All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Ben Hutchings <ben@decadent.org.uk>
Subject: Re: [PATCH 2/2] PCI: Warn if power_state != PCI_D0 when write MSI message
Date: Sun, 29 Sep 2013 09:32:53 +0800	[thread overview]
Message-ID: <52478345.5090608@huawei.com> (raw)
In-Reply-To: <CAErSpo5XWa3qTfE_p5vDqJOkrrdkcM9_Nr-u_qFYSdAob1sEig@mail.gmail.com>

>> @@ -291,6 +291,8 @@ void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
>>  {
>>         if (entry->dev->current_state != PCI_D0) {
>>                 /* Don't touch the hardware now */
>> +               dev_warn(&entry->dev->dev,
>> +                       "current_state != PCI_D0, ignore writing MSI message!\n");
> 
> Is there a real problem here?  If there is a real problem, a printk
> doesn't help fix it.  If there's no problem, I don't see the point of
> this printk.
> 
> I would expect that if the device is not in D0, we should remember the
> hardware updates that need to be made, and if the device returns to
> D0, we should apply the updates then.  If that's the case this is not
> an error and we shouldn't warn about it.

My colleagues found some msi irqs can not work normally in their driver which works
normally in SLES11 SP1(2.6.32 kernel). I review their code and found that they forget to
call pci_enable_device(), so their device always in PCI_UNKNOWN state despite the really PCI Power
State in PM register is PCI_D0 state. In this case, users call pci_enable_msi() always return success,
but actually, nothing was wrote to the MSI registers.

So I think we should warn here, if someone use pci_enable_msi(), but their devices are not in PCI_D0.

Thanks!
Yijing.

> 
>>         } else if (entry->msi_attrib.is_msix) {
>>                 void __iomem *base;
>>                 base = entry->mask_base +
>> --
>> 1.7.1
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


-- 
Thanks!
Yijing


      parent reply	other threads:[~2013-09-29  1:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12  8:20 [PATCH 2/2] PCI: Warn if power_state != PCI_D0 when write MSI message Yijing Wang
2013-09-27 21:03 ` Bjorn Helgaas
2013-09-28  2:28   ` Ben Hutchings
2013-09-29  1:38     ` Yijing Wang
2013-09-29  1:32   ` Yijing Wang [this message]

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=52478345.5090608@huawei.com \
    --to=wangyijing@huawei.com \
    --cc=ben@decadent.org.uk \
    --cc=bhelgaas@google.com \
    --cc=guohanjun@huawei.com \
    --cc=linux-pci@vger.kernel.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.