Re: [PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
On Fri, Jan 17, 2014 at 03:01:10PM -0700, Keith Busch wrote: > >dev->entry[0].vector is initialized in nvme_dev_map(), and it's used > >for free_irq() above the area of your patch, so I don't think this is > >actually a bug, though it might be somewhat confusing. > > It is confusing, but there's a reason. :) > > We send a single command using legacy irq to discover how many msix > vectors we want. The legacy entry needs to be set some time before calling > request_irq in nvme_configure_admin_queue, but also within nvme_dev_start > (for power-management). I don't think there's a place to set it that > won't look odd when looking at nvme_setup_io_queues. I settled on > 'nvme_dev_map' was because 'nvme_dev_unmap' invalidates the entries, > so this seemed to provide some amount of symmetry. I am sending v3 of the patch which concerns Bjorn's comment. I am also sending two follow-up patches an attempt to make nvme_dev_start() more readable and fix couple of (what I suspect are) issues. Thanks! -- Regards, Alexander Gordeev agord...@redhat.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
On Fri, Jan 17, 2014 at 03:01:10PM -0700, Keith Busch wrote: dev-entry[0].vector is initialized in nvme_dev_map(), and it's used for free_irq() above the area of your patch, so I don't think this is actually a bug, though it might be somewhat confusing. It is confusing, but there's a reason. :) We send a single command using legacy irq to discover how many msix vectors we want. The legacy entry needs to be set some time before calling request_irq in nvme_configure_admin_queue, but also within nvme_dev_start (for power-management). I don't think there's a place to set it that won't look odd when looking at nvme_setup_io_queues. I settled on 'nvme_dev_map' was because 'nvme_dev_unmap' invalidates the entries, so this seemed to provide some amount of symmetry. I am sending v3 of the patch which concerns Bjorn's comment. I am also sending two follow-up patches an attempt to make nvme_dev_start() more readable and fix couple of (what I suspect are) issues. Thanks! -- Regards, Alexander Gordeev agord...@redhat.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
On Fri, 17 Jan 2014, Bjorn Helgaas wrote: On Fri, Jan 17, 2014 at 9:02 AM, Alexander Gordeev wrote: In case MSI-X and MSI initialization failed the function irq_set_affinity_hint() is called with uninitialized value in dev->entry[0].vector. This update fixes the issue. dev->entry[0].vector is initialized in nvme_dev_map(), and it's used for free_irq() above the area of your patch, so I don't think this is actually a bug, though it might be somewhat confusing. It is confusing, but there's a reason. :) We send a single command using legacy irq to discover how many msix vectors we want. The legacy entry needs to be set some time before calling request_irq in nvme_configure_admin_queue, but also within nvme_dev_start (for power-management). I don't think there's a place to set it that won't look odd when looking at nvme_setup_io_queues. I settled on 'nvme_dev_map' was because 'nvme_dev_unmap' invalidates the entries, so this seemed to provide some amount of symmetry. Signed-off-by: Alexander Gordeev --- drivers/block/nvme-core.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 26d03fa..e292450 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1790,15 +1790,15 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) vecs = 32; for (;;) { result = pci_enable_msi_block(pdev, vecs); - if (result == 0) { - for (i = 0; i < vecs; i++) - dev->entry[i].vector = i + pdev->irq; - break; + if (result > 0) { + vecs = result; + continue; } else if (result < 0) { vecs = 1; - break; } - vecs = result; + for (i = 0; i < vecs; i++) + dev->entry[i].vector = i + pdev->irq; + break; } } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
On Fri, Jan 17, 2014 at 9:02 AM, Alexander Gordeev wrote: > In case MSI-X and MSI initialization failed the function > irq_set_affinity_hint() is called with uninitialized value > in dev->entry[0].vector. This update fixes the issue. dev->entry[0].vector is initialized in nvme_dev_map(), and it's used for free_irq() above the area of your patch, so I don't think this is actually a bug, though it might be somewhat confusing. > Signed-off-by: Alexander Gordeev > --- > drivers/block/nvme-core.c | 12 ++-- > 1 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c > index 26d03fa..e292450 100644 > --- a/drivers/block/nvme-core.c > +++ b/drivers/block/nvme-core.c > @@ -1790,15 +1790,15 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) > vecs = 32; > for (;;) { > result = pci_enable_msi_block(pdev, vecs); > - if (result == 0) { > - for (i = 0; i < vecs; i++) > - dev->entry[i].vector = i + pdev->irq; > - break; > + if (result > 0) { > + vecs = result; > + continue; > } else if (result < 0) { > vecs = 1; > - break; > } > - vecs = result; > + for (i = 0; i < vecs; i++) > + dev->entry[i].vector = i + pdev->irq; > + break; > } > } > > -- > 1.7.7.6 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-pci" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
In case MSI-X and MSI initialization failed the function irq_set_affinity_hint() is called with uninitialized value in dev->entry[0].vector. This update fixes the issue. Signed-off-by: Alexander Gordeev --- drivers/block/nvme-core.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 26d03fa..e292450 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1790,15 +1790,15 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) vecs = 32; for (;;) { result = pci_enable_msi_block(pdev, vecs); - if (result == 0) { - for (i = 0; i < vecs; i++) - dev->entry[i].vector = i + pdev->irq; - break; + if (result > 0) { + vecs = result; + continue; } else if (result < 0) { vecs = 1; - break; } - vecs = result; + for (i = 0; i < vecs; i++) + dev->entry[i].vector = i + pdev->irq; + break; } } -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
In case MSI-X and MSI initialization failed the function irq_set_affinity_hint() is called with uninitialized value in dev-entry[0].vector. This update fixes the issue. Signed-off-by: Alexander Gordeev agord...@redhat.com --- drivers/block/nvme-core.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 26d03fa..e292450 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1790,15 +1790,15 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) vecs = 32; for (;;) { result = pci_enable_msi_block(pdev, vecs); - if (result == 0) { - for (i = 0; i vecs; i++) - dev-entry[i].vector = i + pdev-irq; - break; + if (result 0) { + vecs = result; + continue; } else if (result 0) { vecs = 1; - break; } - vecs = result; + for (i = 0; i vecs; i++) + dev-entry[i].vector = i + pdev-irq; + break; } } -- 1.7.7.6 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
On Fri, Jan 17, 2014 at 9:02 AM, Alexander Gordeev agord...@redhat.com wrote: In case MSI-X and MSI initialization failed the function irq_set_affinity_hint() is called with uninitialized value in dev-entry[0].vector. This update fixes the issue. dev-entry[0].vector is initialized in nvme_dev_map(), and it's used for free_irq() above the area of your patch, so I don't think this is actually a bug, though it might be somewhat confusing. Signed-off-by: Alexander Gordeev agord...@redhat.com --- drivers/block/nvme-core.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 26d03fa..e292450 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1790,15 +1790,15 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) vecs = 32; for (;;) { result = pci_enable_msi_block(pdev, vecs); - if (result == 0) { - for (i = 0; i vecs; i++) - dev-entry[i].vector = i + pdev-irq; - break; + if (result 0) { + vecs = result; + continue; } else if (result 0) { vecs = 1; - break; } - vecs = result; + for (i = 0; i vecs; i++) + dev-entry[i].vector = i + pdev-irq; + break; } } -- 1.7.7.6 -- To unsubscribe from this list: send the line unsubscribe linux-pci in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 5/9] nvme: Fix invalid call to irq_set_affinity_hint()
On Fri, 17 Jan 2014, Bjorn Helgaas wrote: On Fri, Jan 17, 2014 at 9:02 AM, Alexander Gordeev agord...@redhat.com wrote: In case MSI-X and MSI initialization failed the function irq_set_affinity_hint() is called with uninitialized value in dev-entry[0].vector. This update fixes the issue. dev-entry[0].vector is initialized in nvme_dev_map(), and it's used for free_irq() above the area of your patch, so I don't think this is actually a bug, though it might be somewhat confusing. It is confusing, but there's a reason. :) We send a single command using legacy irq to discover how many msix vectors we want. The legacy entry needs to be set some time before calling request_irq in nvme_configure_admin_queue, but also within nvme_dev_start (for power-management). I don't think there's a place to set it that won't look odd when looking at nvme_setup_io_queues. I settled on 'nvme_dev_map' was because 'nvme_dev_unmap' invalidates the entries, so this seemed to provide some amount of symmetry. Signed-off-by: Alexander Gordeev agord...@redhat.com --- drivers/block/nvme-core.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 26d03fa..e292450 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1790,15 +1790,15 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) vecs = 32; for (;;) { result = pci_enable_msi_block(pdev, vecs); - if (result == 0) { - for (i = 0; i vecs; i++) - dev-entry[i].vector = i + pdev-irq; - break; + if (result 0) { + vecs = result; + continue; } else if (result 0) { vecs = 1; - break; } - vecs = result; + for (i = 0; i vecs; i++) + dev-entry[i].vector = i + pdev-irq; + break; } } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/