* [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
@ 2022-02-14 10:07 Josef Johansson
2022-08-05 10:03 ` Josef Johansson
2022-08-26 15:51 ` Bjorn Helgaas
0 siblings, 2 replies; 6+ messages in thread
From: Josef Johansson @ 2022-02-14 10:07 UTC (permalink / raw)
To: Thomas Gleixner, Bjorn Helgaas, linux-pci, Jason Gunthorpe; +Cc: xen-devel
From: Josef Johansson <josef@oderland.se>
PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies
the logic of checking msi_attrib.can_mask, without any reason.
This commits restores that logic.
Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()")
Signed-off-by: Josef Johansson <josef@oderland.se>
---
v2: Changing subject line to fit earlier commits.
Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code,
which ironically was what my last MSI patch resulted into.
I don't see any reason why this logic was change, and it did not break anything
correcting the logic.
CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask).
---
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index c19c7ca58186..146e7b9a01cc 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
!desc.pci.msi_attrib.is_virtual;
- if (!desc.pci.msi_attrib.can_mask) {
+ if (desc.pci.msi_attrib.can_mask) {
addr = pci_msix_desc_addr(&desc);
desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
2022-02-14 10:07 [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc() Josef Johansson
@ 2022-08-05 10:03 ` Josef Johansson
2022-08-05 12:10 ` Jason Gunthorpe
2022-08-26 15:51 ` Bjorn Helgaas
1 sibling, 1 reply; 6+ messages in thread
From: Josef Johansson @ 2022-08-05 10:03 UTC (permalink / raw)
To: Thomas Gleixner, Bjorn Helgaas, linux-pci, Jason Gunthorpe; +Cc: xen-devel
On 2/14/22 11:07, Josef Johansson wrote:
> From: Josef Johansson <josef@oderland.se>
>
> PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
>
> Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies
> the logic of checking msi_attrib.can_mask, without any reason.
>
> This commits restores that logic.
>
> Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()")
> Signed-off-by: Josef Johansson <josef@oderland.se>
>
> ---
> v2: Changing subject line to fit earlier commits.
>
> Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code,
> which ironically was what my last MSI patch resulted into.
>
> I don't see any reason why this logic was change, and it did not break anything
> correcting the logic.
>
> CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask).
> ---
>
> diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> index c19c7ca58186..146e7b9a01cc 100644
> --- a/drivers/pci/msi/msi.c
> +++ b/drivers/pci/msi/msi.c
> @@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
> desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
> !desc.pci.msi_attrib.is_virtual;
>
> - if (!desc.pci.msi_attrib.can_mask) {
> + if (desc.pci.msi_attrib.can_mask) {
> addr = pci_msix_desc_addr(&desc);
> desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> }
>
> --
> 2.31.1
>
Hi,
I'm sending a ping such that this patch will not get forgotten in the
oblivion.
Regards
Josef
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
2022-08-05 10:03 ` Josef Johansson
@ 2022-08-05 12:10 ` Jason Gunthorpe
2022-08-05 15:53 ` Bjorn Helgaas
0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2022-08-05 12:10 UTC (permalink / raw)
To: Josef Johansson, Bjorn Helgaas; +Cc: Thomas Gleixner, linux-pci, xen-devel
On Fri, Aug 05, 2022 at 12:03:15PM +0200, Josef Johansson wrote:
> On 2/14/22 11:07, Josef Johansson wrote:
> > From: Josef Johansson <josef@oderland.se>
> >
> > PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
> > Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies
> > the logic of checking msi_attrib.can_mask, without any reason.
> > This commits restores that logic.
> >
> > Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()")
> > Signed-off-by: Josef Johansson <josef@oderland.se>
> >
> > ---
> > v2: Changing subject line to fit earlier commits.
> >
> > Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code,
> > which ironically was what my last MSI patch resulted into.
> >
> > I don't see any reason why this logic was change, and it did not break anything
> > correcting the logic.
> >
> > CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask).
> > ---
> >
> > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> > index c19c7ca58186..146e7b9a01cc 100644
> > --- a/drivers/pci/msi/msi.c
> > +++ b/drivers/pci/msi/msi.c
> > @@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
> > desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
> > !desc.pci.msi_attrib.is_virtual;
> > - if (!desc.pci.msi_attrib.can_mask) {
> > + if (desc.pci.msi_attrib.can_mask) {
> > addr = pci_msix_desc_addr(&desc);
> > desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> > }
> >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Bjorn, please take it?
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
2022-08-05 12:10 ` Jason Gunthorpe
@ 2022-08-05 15:53 ` Bjorn Helgaas
2022-08-26 13:08 ` Jason Gunthorpe
0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2022-08-05 15:53 UTC (permalink / raw)
To: Jason Gunthorpe, Thomas Gleixner
Cc: Josef Johansson, Bjorn Helgaas, linux-pci, xen-devel
On Fri, Aug 05, 2022 at 09:10:41AM -0300, Jason Gunthorpe wrote:
> On Fri, Aug 05, 2022 at 12:03:15PM +0200, Josef Johansson wrote:
> > On 2/14/22 11:07, Josef Johansson wrote:
> > > From: Josef Johansson <josef@oderland.se>
> > >
> > > PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
> > > Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies
> > > the logic of checking msi_attrib.can_mask, without any reason.
> > > This commits restores that logic.
> > >
> > > Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()")
> > > Signed-off-by: Josef Johansson <josef@oderland.se>
> > >
> > > ---
> > > v2: Changing subject line to fit earlier commits.
> > >
> > > Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code,
> > > which ironically was what my last MSI patch resulted into.
> > >
> > > I don't see any reason why this logic was change, and it did not break anything
> > > correcting the logic.
> > >
> > > CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask).
> > > ---
> > >
> > > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> > > index c19c7ca58186..146e7b9a01cc 100644
> > > --- a/drivers/pci/msi/msi.c
> > > +++ b/drivers/pci/msi/msi.c
> > > @@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
> > > desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
> > > !desc.pci.msi_attrib.is_virtual;
> > > - if (!desc.pci.msi_attrib.can_mask) {
> > > + if (desc.pci.msi_attrib.can_mask) {
> > > addr = pci_msix_desc_addr(&desc);
> > > desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> > > }
> > >
>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
>
> Bjorn, please take it?
Thanks for the ping. Since 71020a3c0dff4 is by Thomas, and he merged
that along with a whole series of MSI work, I think I probably
expected him to take care of this.
This looks like a simple typo, so I think the commit log should be
reworded along that line, e.g., something like:
71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") inadvertently
reversed the sense of "msi_attrib.can_mask" in one use:
- if (entry->pci.msi_attrib.can_mask) {
- addr = pci_msix_desc_addr(entry);
- entry->pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
+ if (!desc.pci.msi_attrib.can_mask) {
+ addr = pci_msix_desc_addr(&desc);
+ desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
Restore the original test.
Thomas, do you want to take this? I'm happy to merge it, but would
like your reviewed-by or ack first.
Bjorn
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
2022-08-05 15:53 ` Bjorn Helgaas
@ 2022-08-26 13:08 ` Jason Gunthorpe
0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2022-08-26 13:08 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Thomas Gleixner, Josef Johansson, Bjorn Helgaas, linux-pci, xen-devel
On Fri, Aug 05, 2022 at 10:53:36AM -0500, Bjorn Helgaas wrote:
> On Fri, Aug 05, 2022 at 09:10:41AM -0300, Jason Gunthorpe wrote:
> > On Fri, Aug 05, 2022 at 12:03:15PM +0200, Josef Johansson wrote:
> > > On 2/14/22 11:07, Josef Johansson wrote:
> > > > From: Josef Johansson <josef@oderland.se>
> > > >
> > > > PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
> > > > Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies
> > > > the logic of checking msi_attrib.can_mask, without any reason.
> > > > This commits restores that logic.
> > > >
> > > > Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()")
> > > > Signed-off-by: Josef Johansson <josef@oderland.se>
> > > >
> > > > ---
> > > > v2: Changing subject line to fit earlier commits.
> > > >
> > > > Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code,
> > > > which ironically was what my last MSI patch resulted into.
> > > >
> > > > I don't see any reason why this logic was change, and it did not break anything
> > > > correcting the logic.
> > > >
> > > > CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask).
> > > > ---
> > > >
> > > > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> > > > index c19c7ca58186..146e7b9a01cc 100644
> > > > --- a/drivers/pci/msi/msi.c
> > > > +++ b/drivers/pci/msi/msi.c
> > > > @@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
> > > > desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
> > > > !desc.pci.msi_attrib.is_virtual;
> > > > - if (!desc.pci.msi_attrib.can_mask) {
> > > > + if (desc.pci.msi_attrib.can_mask) {
> > > > addr = pci_msix_desc_addr(&desc);
> > > > desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> > > > }
> > > >
> >
> > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> >
> > Bjorn, please take it?
>
> Thanks for the ping. Since 71020a3c0dff4 is by Thomas, and he merged
> that along with a whole series of MSI work, I think I probably
> expected him to take care of this.
>
> This looks like a simple typo, so I think the commit log should be
> reworded along that line, e.g., something like:
>
> 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") inadvertently
> reversed the sense of "msi_attrib.can_mask" in one use:
>
> - if (entry->pci.msi_attrib.can_mask) {
> - addr = pci_msix_desc_addr(entry);
> - entry->pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> + if (!desc.pci.msi_attrib.can_mask) {
> + addr = pci_msix_desc_addr(&desc);
> + desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
>
> Restore the original test.
>
> Thomas, do you want to take this? I'm happy to merge it, but would
> like your reviewed-by or ack first.
At this point I think you should take it Bjorn..
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
2022-02-14 10:07 [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc() Josef Johansson
2022-08-05 10:03 ` Josef Johansson
@ 2022-08-26 15:51 ` Bjorn Helgaas
1 sibling, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2022-08-26 15:51 UTC (permalink / raw)
To: Josef Johansson
Cc: Thomas Gleixner, Bjorn Helgaas, linux-pci, Jason Gunthorpe, xen-devel
On Mon, Feb 14, 2022 at 11:07:47AM +0100, Josef Johansson wrote:
> From: Josef Johansson <josef@oderland.se>
>
> PCI/MSI: Correct use of can_mask in msi_add_msi_desc()
>
> Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies
> the logic of checking msi_attrib.can_mask, without any reason.
>
> This commits restores that logic.
>
> Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()")
> Signed-off-by: Josef Johansson <josef@oderland.se>
Applied to pci/misc for v6.1 with commit log below, thanks!
PCI/MSI: Correct 'can_mask' test in msi_add_msi_desc()
71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") inadvertently reversed
the sense of "msi_attrib.can_mask" in one use:
- if (entry->pci.msi_attrib.can_mask) {
- addr = pci_msix_desc_addr(entry);
- entry->pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
+ if (!desc.pci.msi_attrib.can_mask) {
+ addr = pci_msix_desc_addr(&desc);
+ desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
Restore the original test.
> ---
> v2: Changing subject line to fit earlier commits.
>
> Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code,
> which ironically was what my last MSI patch resulted into.
>
> I don't see any reason why this logic was change, and it did not break anything
> correcting the logic.
>
> CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask).
> ---
>
> diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> index c19c7ca58186..146e7b9a01cc 100644
> --- a/drivers/pci/msi/msi.c
> +++ b/drivers/pci/msi/msi.c
> @@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
> desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
> !desc.pci.msi_attrib.is_virtual;
>
> - if (!desc.pci.msi_attrib.can_mask) {
> + if (desc.pci.msi_attrib.can_mask) {
> addr = pci_msix_desc_addr(&desc);
> desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
> }
>
> --
> 2.31.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-08-26 15:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 10:07 [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc() Josef Johansson
2022-08-05 10:03 ` Josef Johansson
2022-08-05 12:10 ` Jason Gunthorpe
2022-08-05 15:53 ` Bjorn Helgaas
2022-08-26 13:08 ` Jason Gunthorpe
2022-08-26 15:51 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).