All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Jason Andryuk" <jandryuk@gmail.com>
Cc: xen-devel@lists.xenproject.org,
	Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	"Daniel P. Smith" <dpsmith.dev@gmail.com>
Subject: Re: [PATCH] x86/physdev: Call xsm_unmap_domain_irq earlier
Date: Mon, 28 Mar 2022 14:44:30 +0200	[thread overview]
Message-ID: <7ee0889c-c9ae-c11f-7308-25e7d5a14815@suse.com> (raw)
In-Reply-To: <YkGevRlIpAlCDox7@Air-de-Roger>

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@gmail.com>
>> ---
>> 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



  reply	other threads:[~2022-03-28 12:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 14:18 [PATCH] x86/physdev: Call xsm_unmap_domain_irq earlier Jason Andryuk
2022-03-28 11:40 ` Roger Pau Monné
2022-03-28 12:44   ` Jan Beulich [this message]
2022-03-29 12:40     ` Jason Andryuk
2022-03-28 15:36 ` Daniel P. Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ee0889c-c9ae-c11f-7308-25e7d5a14815@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dpsmith.dev@gmail.com \
    --cc=jandryuk@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.