All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joby Poriyath <joby.poriyath@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: andrew.cooper3@citrix.com,
	xen-devel <xen-devel@lists.xenproject.org>,
	Sander Eikelenboom <linux@eikelenboom.it>
Subject: Re: [PATCH v7] interrupts: allow guest to set/clear MSI-X mask bit
Date: Wed, 4 Sep 2013 13:01:06 +0100	[thread overview]
Message-ID: <20130904120105.GA14816@citrix.com> (raw)
In-Reply-To: <52270D1902000078000F03EB@nat28.tlf.novell.com>

On Wed, Sep 04, 2013 at 09:36:09AM +0100, Jan Beulich wrote:
> >>> On 30.08.13 at 18:12, Joby Poriyath <joby.poriyath@citrix.com> wrote:
> > +static struct msi_desc *virt_to_msi_desc(struct pci_dev *dev, void *virt)
> > +{
> > +    struct msi_desc *desc;
> > +
> > +    list_for_each_entry( desc, &dev->msi_list, list )
> > +        if ( desc->msi_attrib.type == PCI_CAP_ID_MSIX  &&
> > +             desc->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 
> > +                == virt )
> 
> To match the function's name I'd prefer this to hit on the full 16-byte
> range rather than just the control word.
> 

Sorry Jan, I didn't quite understand this. virt points to the control word 
in this function. So how can we do a match on (low | high) address and data words?

> >  static int msixtbl_write(struct vcpu *v, unsigned long address,
> > -                        unsigned long len, unsigned long val)
> > +                         unsigned long len, unsigned long val)
> >  {
> >      unsigned long offset;
> >      struct msixtbl_entry *entry;
> > +    struct msi_desc *m_desc;
> 
> Please name this msi_desc, consistent with other variables of this
> type in this file. And afaict this could (once again) be const.

I'll add the const and also rename m_desc to msi_desc.

> 
> > +    m_desc = virt_to_msi_desc(entry->pdev, virt);
> > +    if ( !m_desc || m_desc->irq < 0 )
> > +        goto out;
> > +    
> > +    desc = irq_to_desc(m_desc->irq);
> > +    if ( !desc )
> > +        goto out;
> > +
> >      spin_lock_irqsave(&desc->lock, flags);
> > +
> > +    if ( !desc->msi_desc )
> > +        goto unlock;
> 
> I'd again strongly recommend adding an ASSERT() here, checking
> desc->msi_desc against (as it's currently named) m_desc.

ASSERT makes sense. I'll add it.

> 
> But overall this looks much better than the earlier, no reverted
> variant.
> 
> Jan
> 

Thanks,
Joby

  reply	other threads:[~2013-09-04 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30 16:12 [PATCH v7] interrupts: allow guest to set/clear MSI-X mask bit Joby Poriyath
2013-09-04  8:36 ` Jan Beulich
2013-09-04 12:01   ` Joby Poriyath [this message]
2013-09-04 12:10     ` Jan Beulich

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=20130904120105.GA14816@citrix.com \
    --to=joby.poriyath@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=linux@eikelenboom.it \
    --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.