All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Jan Beulich <JBeulich@suse.com>, Roger Pau Monne <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Kevin Tian <kevin.tian@intel.com>,
	hfp@posteo.de, xen-devel@lists.xenproject.org
Subject: Re: [PATCH XEN] x86/pt: add a MSI unmask flag to XEN_DOMCTL_bind_pt_irq
Date: Thu, 24 Aug 2017 18:19:57 +0800	[thread overview]
Message-ID: <20170824101953.GA37087@op-computing> (raw)
In-Reply-To: <599EC3DC02000078001731D6@prv-mh.provo.novell.com>

On Thu, Aug 24, 2017 at 04:17:32AM -0600, Jan Beulich wrote:
>>>> On 24.08.17 at 12:12, <roger.pau@citrix.com> wrote:
>> On Thu, Aug 24, 2017 at 04:07:40AM -0600, Jan Beulich wrote:
>>> >>> On 24.08.17 at 11:47, <roger.pau@citrix.com> wrote:
>>> > @@ -438,6 +439,22 @@ int pt_irq_create_bind(
>>> >              pi_update_irte(vcpu ? &vcpu->arch.hvm_vmx.pi_desc : NULL,
>>> >                             info, pirq_dpci->gmsi.gvec);
>>> >  
>>> > +        if ( pt_irq_bind->u.msi.gflags & VMSI_UNMASKED )
>>> > +        {
>>> > +            struct irq_desc *desc = irq_to_desc(info->arch.irq);
>>> > +            unsigned long flags;
>>> > +
>>> > +            if ( !desc )
>>> > +            {
>>> > +                pt_irq_destroy_bind(d, pt_irq_bind);
>>> > +                return -EINVAL;
>>> > +            }
>>> > +
>>> > +            spin_lock_irqsave(&desc->lock, flags);
>>> > +            guest_mask_msi_irq(desc, false);
>>> > +            spin_unlock_irqrestore(&desc->lock, flags);
>>> > +        }
>>> > +
>>> >          break;
>>> >      }
>>> 
>>> I think you would better use pirq_spin_lock_irq_desc() here. And
>>> wouldn't the addition better be moved up a little (perhaps right
>>> after the dropping of the domain's event lock)?
>> 
>> Shouldn't the unmask happen after the posted interrupt is setup? Or it
>> doesn't really matter?
>> 
>> I though it was safer to unmask once the bind process was finished.
>
>Yeah, I'm not entirely certain either, hence I've put it as a question.
>Kevin, Chao?
>

Hi, Jan and Roger.

pi_update_irte() right above the piece of code is to set IRTE properly
according to the request. Unmasking the msi without updating IRTE, I
think may leads to inject an interrupt whose vector or destination is
out of date.

Thanks
Chao

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-08-24 11:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  9:47 [PATCH] x86/pt: fix binding of MSIX entries already unmasked Roger Pau Monne
2017-08-24  9:47 ` [PATCH XEN] x86/pt: add a MSI unmask flag to XEN_DOMCTL_bind_pt_irq Roger Pau Monne
2017-08-24 10:07   ` Jan Beulich
2017-08-24 10:12     ` Roger Pau Monne
2017-08-24 10:17       ` Jan Beulich
2017-08-24 10:19         ` Chao Gao [this message]
2017-08-24  9:47 ` [Qemu-devel] [PATCH QEMU] xen/pt: allow QEMU to request MSI unmasking at bind time Roger Pau Monne
2017-08-24  9:47   ` Roger Pau Monne
2017-08-24  9:54   ` [Qemu-devel] " Jan Beulich
2017-08-24  9:54     ` Jan Beulich
2017-08-24 10:06     ` [Qemu-devel] " Roger Pau Monne
2017-08-24 10:06       ` Roger Pau Monne
2017-08-24 10:13       ` [Qemu-devel] " Jan Beulich
2017-08-24 10:13         ` Jan Beulich
2017-08-24 10:42         ` [Qemu-devel] " Roger Pau Monne
2017-08-24 10:42           ` Roger Pau Monne

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=20170824101953.GA37087@op-computing \
    --to=chao.gao@intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=hfp@posteo.de \
    --cc=kevin.tian@intel.com \
    --cc=roger.pau@citrix.com \
    --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.