[dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchronization

Gavin Hu Gavin.Hu at arm.com
Tue Aug 28 21:30:54 CEST 2018


Assuming reader and writer may execute on different CPU's, this become standard multithreaded programming.
We are concerned about that update the reader pointer too early(weak ordering may reorder it before reading from the slots), that means the slots are released and may immediately overwritten by the writer then you get "too new" data and get lost of the old data.

From: Kokkilagadda, Kiran <Kiran.Kokkilagadda at cavium.com>
Sent: Tuesday, August 28, 2018 6:44 PM
To: Gavin Hu <Gavin.Hu at arm.com>; Ferruh Yigit <ferruh.yigit at intel.com>; Jacob, Jerin <Jerin.JacobKollanukkaran at cavium.com>
Cc: dev at dpdk.org; Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>
Subject: Re: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchronization


In this instance there won't be any problem, as until the value of fifo->write changes, this loop won't get executed. As of now we didn't see any issue with it and for performance reasons, we don't want to keep read barrier.



________________________________
From: Gavin Hu <Gavin.Hu at arm.com<mailto:Gavin.Hu at arm.com>>
Sent: Monday, August 27, 2018 9:10 PM
To: Ferruh Yigit; Kokkilagadda, Kiran; Jacob, Jerin
Cc: dev at dpdk.org<mailto:dev at dpdk.org>; Honnappa Nagarahalli
Subject: RE: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer synchronization

External Email

This fix is not complete, kni_fifo_get requires a read fence also, otherwise it probably gets stale data on a weak ordering platform.

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org<mailto:dev-bounces at dpdk.org>> On Behalf Of Ferruh Yigit
> Sent: Monday, August 27, 2018 10:08 PM
> To: Kiran Kumar <kkokkilagadda at caviumnetworks.com<mailto:kkokkilagadda at caviumnetworks.com>>;
> jerin.jacob at caviumnetworks.com<mailto:jerin.jacob at caviumnetworks.com>
> Cc: dev at dpdk.org<mailto:dev at dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v2] kni: fix kni Rx fifo producer
> synchronization
>
> On 8/16/2018 10:55 AM, Kiran Kumar wrote:
> > With existing code in kni_fifo_put, rx_q values are not being updated
> > before updating fifo_write. While reading rx_q in kni_net_rx_normal,
> > This is causing the sync issue on other core. So adding a write
> > barrier to make sure the values being synced before updating fifo_write.
> >
> > Fixes: 3fc5ca2f6352 ("kni: initial import")
> >
> > Signed-off-by: Kiran Kumar <kkokkilagadda at caviumnetworks.com<mailto:kkokkilagadda at caviumnetworks.com>>
> > Acked-by: Jerin Jacob <jerin.jacob at caviumnetworks.com<mailto:jerin.jacob at caviumnetworks.com>>
>
> Acked-by: Ferruh Yigit <ferruh.yigit at intel.com<mailto:ferruh.yigit at intel.com>>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the dev mailing list