Re: [PATCH] ptr_ring: add barriers

2017-12-11 Thread George Cherian
Hi David, On 12/11/2017 09:23 PM, David Miller wrote: From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or

Re: [PATCH] ptr_ring: add barriers

2017-12-11 Thread George Cherian
Hi David, On 12/11/2017 09:23 PM, David Miller wrote: From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger

Re: [PATCH] ptr_ring: add barriers

2017-12-11 Thread David Miller
From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 > Users of ptr_ring expect that it's safe to give the > data structure a pointer and have it be available > to consumers, but that actually requires an smb_wmb > or a stronger barrier. > > In absence of such

Re: [PATCH] ptr_ring: add barriers

2017-12-11 Thread David Miller
From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 > Users of ptr_ring expect that it's safe to give the > data structure a pointer and have it be available > to consumers, but that actually requires an smb_wmb > or a stronger barrier. > > In absence of such barriers and on

Re: [PATCH] ptr_ring: add barriers

2017-12-08 Thread David Miller
From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 > Users of ptr_ring expect that it's safe to give the > data structure a pointer and have it be available > to consumers, but that actually requires an smb_wmb > or a stronger barrier. > > In absence of such

Re: [PATCH] ptr_ring: add barriers

2017-12-08 Thread David Miller
From: "Michael S. Tsirkin" Date: Tue, 5 Dec 2017 21:29:37 +0200 > Users of ptr_ring expect that it's safe to give the > data structure a pointer and have it be available > to consumers, but that actually requires an smb_wmb > or a stronger barrier. > > In absence of such barriers and on

Re: [PATCH] ptr_ring: Add barriers to fix NULL-pointer exception

2017-12-06 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 02:08:54PM +, Cherian, George wrote: > > @@ -275,6 +281,13 @@ static inline void *__ptr_ring_consume(struct ptr_ring > *r) > > if (ptr) > > __ptr_ring_discard_one(r); > > > > + /* > > + * This barrier is necessary in order to prevent race condition with > > + * with

Re: [PATCH] ptr_ring: Add barriers to fix NULL-pointer exception

2017-12-06 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 02:08:54PM +, Cherian, George wrote: > > @@ -275,6 +281,13 @@ static inline void *__ptr_ring_consume(struct ptr_ring > *r) > > if (ptr) > > __ptr_ring_discard_one(r); > > > > + /* > > + * This barrier is necessary in order to prevent race condition with > > + * with

Re: [PATCH] ptr_ring: Add barriers to fix NULL-pointer exception

2017-12-06 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 09:57:41AM +, George Cherian wrote: > While running a multiple VM testscase with each VM running iperf > traffic between others the following kernel NULL pointer exception > was seen. > > Race appears when the tun driver instance of one VM calls skb_array_produce >

Re: [PATCH] ptr_ring: Add barriers to fix NULL-pointer exception

2017-12-06 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 09:57:41AM +, George Cherian wrote: > While running a multiple VM testscase with each VM running iperf > traffic between others the following kernel NULL pointer exception > was seen. > > Race appears when the tun driver instance of one VM calls skb_array_produce >

Re: [PATCH] ptr_ring: add barriers

2017-12-06 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 02:51:41PM +0530, George Cherian wrote: > Hi Michael, > > > On 12/06/2017 12:59 AM, Michael S. Tsirkin wrote: > > Users of ptr_ring expect that it's safe to give the > > data structure a pointer and have it be available > > to consumers, but that actually requires an

Re: [PATCH] ptr_ring: add barriers

2017-12-06 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 02:51:41PM +0530, George Cherian wrote: > Hi Michael, > > > On 12/06/2017 12:59 AM, Michael S. Tsirkin wrote: > > Users of ptr_ring expect that it's safe to give the > > data structure a pointer and have it be available > > to consumers, but that actually requires an

[PATCH] ptr_ring: Add barriers to fix NULL-pointer exception

2017-12-06 Thread George Cherian
While running a multiple VM testscase with each VM running iperf traffic between others the following kernel NULL pointer exception was seen. Race appears when the tun driver instance of one VM calls skb_array_produce (from tun_net_xmit) and the the destined VM's skb_array_consume (from

[PATCH] ptr_ring: Add barriers to fix NULL-pointer exception

2017-12-06 Thread George Cherian
While running a multiple VM testscase with each VM running iperf traffic between others the following kernel NULL pointer exception was seen. Race appears when the tun driver instance of one VM calls skb_array_produce (from tun_net_xmit) and the the destined VM's skb_array_consume (from

Re: [PATCH] ptr_ring: add barriers

2017-12-06 Thread George Cherian
Hi Michael, On 12/06/2017 12:59 AM, Michael S. Tsirkin wrote: Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger barrier. This is not the exact situation we are seeing. Let me

Re: [PATCH] ptr_ring: add barriers

2017-12-06 Thread George Cherian
Hi Michael, On 12/06/2017 12:59 AM, Michael S. Tsirkin wrote: Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger barrier. This is not the exact situation we are seeing. Let me

Re: [PATCH] ptr_ring: add barriers

2017-12-05 Thread Jason Wang
On 2017年12月06日 10:53, Michael S. Tsirkin wrote: On Wed, Dec 06, 2017 at 10:31:39AM +0800, Jason Wang wrote: On 2017年12月06日 03:29, Michael S. Tsirkin wrote: Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually

Re: [PATCH] ptr_ring: add barriers

2017-12-05 Thread Jason Wang
On 2017年12月06日 10:53, Michael S. Tsirkin wrote: On Wed, Dec 06, 2017 at 10:31:39AM +0800, Jason Wang wrote: On 2017年12月06日 03:29, Michael S. Tsirkin wrote: Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually

Re: [PATCH] ptr_ring: add barriers

2017-12-05 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 10:31:39AM +0800, Jason Wang wrote: > > > On 2017年12月06日 03:29, Michael S. Tsirkin wrote: > > Users of ptr_ring expect that it's safe to give the > > data structure a pointer and have it be available > > to consumers, but that actually requires an smb_wmb > > or a

Re: [PATCH] ptr_ring: add barriers

2017-12-05 Thread Michael S. Tsirkin
On Wed, Dec 06, 2017 at 10:31:39AM +0800, Jason Wang wrote: > > > On 2017年12月06日 03:29, Michael S. Tsirkin wrote: > > Users of ptr_ring expect that it's safe to give the > > data structure a pointer and have it be available > > to consumers, but that actually requires an smb_wmb > > or a

Re: [PATCH] ptr_ring: add barriers

2017-12-05 Thread Jason Wang
On 2017年12月06日 03:29, Michael S. Tsirkin wrote: Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger barrier. In absence of such barriers and on architectures that reorder

Re: [PATCH] ptr_ring: add barriers

2017-12-05 Thread Jason Wang
On 2017年12月06日 03:29, Michael S. Tsirkin wrote: Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger barrier. In absence of such barriers and on architectures that reorder

[PATCH] ptr_ring: add barriers

2017-12-05 Thread Michael S. Tsirkin
Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger barrier. In absence of such barriers and on architectures that reorder writes, consumer might read an un=initialized value from

[PATCH] ptr_ring: add barriers

2017-12-05 Thread Michael S. Tsirkin
Users of ptr_ring expect that it's safe to give the data structure a pointer and have it be available to consumers, but that actually requires an smb_wmb or a stronger barrier. In absence of such barriers and on architectures that reorder writes, consumer might read an un=initialized value from