All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: use lighter smp barriers in nvme_irq
@ 2021-02-14 16:24 Heiner Kallweit
  2021-02-16 23:59 ` Chaitanya Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Heiner Kallweit @ 2021-02-14 16:24 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg; +Cc: linux-nvme

Based on the description we should be fine using the less heavy-weight
smp barriers here. On x86 this would be compiler barriers only.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/nvme/host/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 7b6632c00..59fee4a60 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1066,10 +1066,10 @@ static irqreturn_t nvme_irq(int irq, void *data)
 	 * The rmb/wmb pair ensures we see all updates from a previous run of
 	 * the irq handler, even if that was on another CPU.
 	 */
-	rmb();
+	smp_rmb();
 	if (nvme_process_cq(nvmeq))
 		ret = IRQ_HANDLED;
-	wmb();
+	smp_wmb();
 
 	return ret;
 }
-- 
2.30.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] nvme: use lighter smp barriers in nvme_irq
  2021-02-14 16:24 [PATCH] nvme: use lighter smp barriers in nvme_irq Heiner Kallweit
@ 2021-02-16 23:59 ` Chaitanya Kulkarni
  2021-02-17  7:26   ` Heiner Kallweit
  0 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-16 23:59 UTC (permalink / raw)
  To: Heiner Kallweit, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg
  Cc: linux-nvme

On 2/14/21 08:30, Heiner Kallweit wrote:
> Based on the description we should be fine using the less heavy-weight
> smp barriers here. On x86 this would be compiler barriers only.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Can you share performance numbers ?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nvme: use lighter smp barriers in nvme_irq
  2021-02-16 23:59 ` Chaitanya Kulkarni
@ 2021-02-17  7:26   ` Heiner Kallweit
  2021-02-18  1:41     ` Chaitanya Kulkarni
  2021-02-18  3:28     ` Keith Busch
  0 siblings, 2 replies; 7+ messages in thread
From: Heiner Kallweit @ 2021-02-17  7:26 UTC (permalink / raw)
  To: Chaitanya Kulkarni, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg
  Cc: linux-nvme

On 17.02.2021 00:59, Chaitanya Kulkarni wrote:
> On 2/14/21 08:30, Heiner Kallweit wrote:
>> Based on the description we should be fine using the less heavy-weight
>> smp barriers here. On x86 this would be compiler barriers only.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> Can you share performance numbers ?
> 

I stumbled across this code piece by chance and don't have hw to test it.
Having said that the change is based on code inspection only.
Unfortunately the barrier comment is very generic and doesn't mention
a problematic scenario. Also the commit message of 3a7afd8ee42a doesn't
mention a potential race. Most likely the barrier can be removed
completely. Helpful would be if someone could explain the potential race
in detail, means which reordering / variable accesses could be racy.
Then we would have a basis to talk about READ_ONCE/WRITE_ONCE vs.
smp barrier vs. dma barrier vs. full barrier.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nvme: use lighter smp barriers in nvme_irq
  2021-02-17  7:26   ` Heiner Kallweit
@ 2021-02-18  1:41     ` Chaitanya Kulkarni
  2021-02-18  3:28     ` Keith Busch
  1 sibling, 0 replies; 7+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-18  1:41 UTC (permalink / raw)
  To: Heiner Kallweit, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg
  Cc: linux-nvme

On 2/16/21 23:26, Heiner Kallweit wrote:
> On 17.02.2021 00:59, Chaitanya Kulkarni wrote:
>> On 2/14/21 08:30, Heiner Kallweit wrote:
>>> Based on the description we should be fine using the less heavy-weight
>>> smp barriers here. On x86 this would be compiler barriers only.
>>>
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> Can you share performance numbers ?
>>
> I stumbled across this code piece by chance and don't have hw to test it.
> Having said that the change is based on code inspection only.
> Unfortunately the barrier comment is very generic and doesn't mention
> a problematic scenario. Also the commit message of 3a7afd8ee42a doesn't
> mention a potential race. Most likely the barrier can be removed
> completely. Helpful would be if someone could explain the potential race
> in detail, means which reordering / variable accesses could be racy.
> Then we would have a basis to talk about READ_ONCE/WRITE_ONCE vs.
> smp barrier vs. dma barrier vs. full barrier.
>

For these question you need to add commit Author to original email, as
far as
I know any performance improvement needs to be backed by data, unless there
is an exception, in this case I'm not if it is.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nvme: use lighter smp barriers in nvme_irq
  2021-02-17  7:26   ` Heiner Kallweit
  2021-02-18  1:41     ` Chaitanya Kulkarni
@ 2021-02-18  3:28     ` Keith Busch
  2021-02-18  4:06       ` Chaitanya Kulkarni
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Busch @ 2021-02-18  3:28 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Jens Axboe, linux-nvme, Christoph Hellwig, Chaitanya Kulkarni,
	Sagi Grimberg

On Wed, Feb 17, 2021 at 08:26:30AM +0100, Heiner Kallweit wrote:
> On 17.02.2021 00:59, Chaitanya Kulkarni wrote:
> > On 2/14/21 08:30, Heiner Kallweit wrote:
> >> Based on the description we should be fine using the less heavy-weight
> >> smp barriers here. On x86 this would be compiler barriers only.
> >>
> >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> > Can you share performance numbers ?
> > 
> 
> I stumbled across this code piece by chance and don't have hw to test it.
> Having said that the change is based on code inspection only.
> Unfortunately the barrier comment is very generic and doesn't mention
> a problematic scenario. Also the commit message of 3a7afd8ee42a doesn't
> mention a potential race. Most likely the barrier can be removed
> completely. Helpful would be if someone could explain the potential race
> in detail, means which reordering / variable accesses could be racy.
> Then we would have a basis to talk about READ_ONCE/WRITE_ONCE vs.
> smp barrier vs. dma barrier vs. full barrier.

The variables the driver was protecting no longer exist, so I also agree
the barriers should not be necessary.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nvme: use lighter smp barriers in nvme_irq
  2021-02-18  3:28     ` Keith Busch
@ 2021-02-18  4:06       ` Chaitanya Kulkarni
  2021-02-18 21:57         ` Keith Busch
  0 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-18  4:06 UTC (permalink / raw)
  To: Keith Busch, Heiner Kallweit
  Cc: Jens Axboe, Christoph Hellwig, linux-nvme, Sagi Grimberg

Keith,

On 2/17/21 19:28, Keith Busch wrote:
> On Wed, Feb 17, 2021 at 08:26:30AM +0100, Heiner Kallweit wrote:
>> On 17.02.2021 00:59, Chaitanya Kulkarni wrote:
>>> On 2/14/21 08:30, Heiner Kallweit wrote:
>>>> Based on the description we should be fine using the less heavy-weight
>>>> smp barriers here. On x86 this would be compiler barriers only.
>>>>
>>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>> Can you share performance numbers ?
>>>
>> I stumbled across this code piece by chance and don't have hw to test it.
>> Having said that the change is based on code inspection only.
>> Unfortunately the barrier comment is very generic and doesn't mention
>> a problematic scenario. Also the commit message of 3a7afd8ee42a doesn't
>> mention a potential race. Most likely the barrier can be removed
>> completely. Helpful would be if someone could explain the potential race
>> in detail, means which reordering / variable accesses could be racy.
>> Then we would have a basis to talk about READ_ONCE/WRITE_ONCE vs.
>> smp barrier vs. dma barrier vs. full barrier.
> The variables the driver was protecting no longer exist, so I also agree
> the barriers should not be necessary.
>

Are you saying something like following is needed ?

From a3a73bd3943b479f82ff00582baf2c37c1afd8e8 Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Date: Wed, 17 Feb 2021 20:01:37 -0800
Subject: [PATCH] nvme-pci: remove the barriers

The variable which was protected by the barriers is removed in
The commit f6c4d97b0d82 (" nvme/pci: Remove last_cq_head").

Remove the barriers which was protecting the variable.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/host/pci.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0045c5edf629..3729775f6a8a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1062,14 +1062,8 @@ static irqreturn_t nvme_irq(int irq, void *data)
     struct nvme_queue *nvmeq = data;
     irqreturn_t ret = IRQ_NONE;
 
-    /*
-     * The rmb/wmb pair ensures we see all updates from a previous run of
-     * the irq handler, even if that was on another CPU.
-     */
-    rmb();
     if (nvme_process_cq(nvmeq))
         ret = IRQ_HANDLED;
-    wmb();
 
     return ret;
 }
-- 
2.22.1

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] nvme: use lighter smp barriers in nvme_irq
  2021-02-18  4:06       ` Chaitanya Kulkarni
@ 2021-02-18 21:57         ` Keith Busch
  0 siblings, 0 replies; 7+ messages in thread
From: Keith Busch @ 2021-02-18 21:57 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: Jens Axboe, Sagi Grimberg, Christoph Hellwig, linux-nvme,
	Heiner Kallweit

On Thu, Feb 18, 2021 at 04:06:35AM +0000, Chaitanya Kulkarni wrote:
> On 2/17/21 19:28, Keith Busch wrote:
> > The variables the driver was protecting no longer exist, so I also agree
> > the barriers should not be necessary.
> >
> 
> Are you saying something like following is needed ?

Right, I'm just saying the barriers don't appear to be necessary, so
they can go away as you've indicated below.
 
> From a3a73bd3943b479f82ff00582baf2c37c1afd8e8 Mon Sep 17 00:00:00 2001
> From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> Date: Wed, 17 Feb 2021 20:01:37 -0800
> Subject: [PATCH] nvme-pci: remove the barriers
> 
> The variable which was protected by the barriers is removed in
> The commit f6c4d97b0d82 (" nvme/pci: Remove last_cq_head").
> 
> Remove the barriers which was protecting the variable.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/nvme/host/pci.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 0045c5edf629..3729775f6a8a 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1062,14 +1062,8 @@ static irqreturn_t nvme_irq(int irq, void *data)
>      struct nvme_queue *nvmeq = data;
>      irqreturn_t ret = IRQ_NONE;
>  
> -    /*
> -     * The rmb/wmb pair ensures we see all updates from a previous run of
> -     * the irq handler, even if that was on another CPU.
> -     */
> -    rmb();
>      if (nvme_process_cq(nvmeq))
>          ret = IRQ_HANDLED;
> -    wmb();
>  
>      return ret;
>  }
> -- 
> 2.22.1

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-18 21:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 16:24 [PATCH] nvme: use lighter smp barriers in nvme_irq Heiner Kallweit
2021-02-16 23:59 ` Chaitanya Kulkarni
2021-02-17  7:26   ` Heiner Kallweit
2021-02-18  1:41     ` Chaitanya Kulkarni
2021-02-18  3:28     ` Keith Busch
2021-02-18  4:06       ` Chaitanya Kulkarni
2021-02-18 21:57         ` Keith Busch

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.