[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/physdev: Call xsm_unmap_domain_irq earlier


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 28 Mar 2022 14:44:30 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7sSlK5e1tsI7wIMyKgdHvyi34xsx8CI64b5FpxtshK4=; b=BOVyAnueg4iDIGvxtuONurFoZRrZMprune3pwFcTuVyEWydW7KnAmi5FLsRqVpJjEpnozvOvz87FiRZu/jVGpbTcg5iQWOnVMOV9gLIL27GRsEqT4x90z8U3dfUHMLHPJPhRV+BQDJ190updiRW6lIHWK3SanxDPboXyEnHU/6Ml+ZnkHq5NYUaghPKB8Wsz2ZjNF03YJ3E3ZlMTfMjfQWFSG3Qoa+b0zfT3xQNgbdQjA2/XUgiIezHcirQNvbpzI3GIiMXSPLtppQdrzy3r2E8muu0vPAargGKJV2l42Nr2ESE2Yj9LD6zTjg7xt6uY7UGaNOb/jmEsx7/tMww3SA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PYmEGj+7Gpu1n+q8BqGU8F1735Qwz0gA52ySPyxZTR6MdyfsSnOhVQivVHvvVmjrLOTpmUhO/XU7kGKBiWLgUCJFJfE/H49D9RymXAAo2n2O0VHjPZNBUgv7AaS0uzirmT9jHtRy2RjqubBiQitcexsFaOBcXi43fbZXWzu+dKgylkeXoIoNdqAjKX9SxJrkP4HII90PK64gRTzaTrvWv3h/ioenPwIYVFjdYGsHJ2NtpUlzXHpZUKA7T5QSvVcpDpE5WoazTKCr91G10kICt1NJIfno1Zgm8vYuOh+d5Z6L5N3eqWxuBpIiHRBY/9iBrKlev2LC8vWMWaI61BrH2Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Daniel P. Smith" <dpsmith.dev@xxxxxxxxx>
  • Delivery-date: Mon, 28 Mar 2022 12:44:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.03.2022 13:40, Roger Pau Monné wrote:
> On Fri, Mar 25, 2022 at 10:18:26AM -0400, Jason Andryuk wrote:
>> Pull the XSM check up out of unmap_domain_pirq into physdev_map_pirq.
>>
>> xsm_unmap_domain_irq was seen denying unmap_domain_pirq when called from
>> complete_domain_destroy as an RCU callback.  The source context was an
>> unexpected, random domain.  Since this is a xen-internal operation,
>> going through the XSM hook is inapproriate.
>>
>> Move the XSM hook up into physdev_unmap_pirq, which is the
>> guest-accessible path.  This requires moving some of the sanity check
>> upwards as well since the hook needs the additional data to make its
>> decision.  Since complete_domain_destroy still calls unmap_domain_pirq,
>> replace the moved runtime checking with assert.  Only valid pirqs should
>> make their way into unmap_domain_pirq from complete_domain_destroy.
>>
>> This is mostly code movement, but one style change is to pull `irq =
>> info->arch.irq` out of the if condition.

And why is this better? You now have an extra conditional expression
there.

>> Label done is now unused and removed.
>>
>> Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
>> ---
>> unmap_domain_pirq is also called in vioapic_hwdom_map_gsi and
>> vpci_msi_disable.  vioapic_hwdom_map_gsi is a cleanup path after going
>> through map_domain_pirq, and I don't think the vpci code is directly
>> guest-accessible.  So I think those are okay, but I not familiar with
>> that code.  Hence, I am highlighting it.
> 
> Hm, for vpci_msi_disable it's not technically correct to drop the XSM
> check. This is a guests accessible path, however the value of PIRQ is
> not settable by the guest, so it's kind of OK just for that reason.

Kind of - perhaps. But better to avoid if possible. Hence I would prefer
the ->is_dying alternative you suggest at the end.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.