Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Wei Liu
On Wed, Apr 25, 2018 at 12:35:11PM +0200, Olaf Hering wrote: > Am Wed, 25 Apr 2018 11:31:25 +0100 > schrieb Wei Liu : > > > My bad. Yes, they are converted to int, not unsigned int. > > Hopefully that happens only if the target is int, not if all involved > variables are short. > > Unless there

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Olaf Hering
Am Wed, 25 Apr 2018 11:31:25 +0100 schrieb Wei Liu : > My bad. Yes, they are converted to int, not unsigned int. Hopefully that happens only if the target is int, not if all involved variables are short. Unless there are objections I will prepare a patch to deal with RING_IDX being u16. Olaf

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Wei Liu
On Wed, Apr 25, 2018 at 04:26:06AM -0600, Jan Beulich wrote: > >>> On 25.04.18 at 12:06, wrote: > > On Wed, Apr 25, 2018 at 11:04:26AM +0200, Olaf Hering wrote: > >> Am Wed, 25 Apr 2018 09:59:23 +0100 > >> schrieb Wei Liu : > >> > >> > Do you have the full diff of your changes? > >> > >> Not ri

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Jan Beulich
>>> On 25.04.18 at 12:06, wrote: > On Wed, Apr 25, 2018 at 11:04:26AM +0200, Olaf Hering wrote: >> Am Wed, 25 Apr 2018 09:59:23 +0100 >> schrieb Wei Liu : >> >> > Do you have the full diff of your changes? >> >> Not right now. But without 'val', or val being uint, the same error happens > in f

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Wei Liu
On Wed, Apr 25, 2018 at 11:04:26AM +0200, Olaf Hering wrote: > Am Wed, 25 Apr 2018 09:59:23 +0100 > schrieb Wei Liu : > > > Do you have the full diff of your changes? > > Not right now. But without 'val', or val being uint, the same error happens > in f(): > > #include > void f(void) > { >

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Jan Beulich
>>> On 25.04.18 at 11:04, wrote: > Am Wed, 25 Apr 2018 09:59:23 +0100 > schrieb Wei Liu : > >> Do you have the full diff of your changes? > > Not right now. But without 'val', or val being uint, the same error happens > in f(): > > #include > void f(void) > { > unsigned short req_pro

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Olaf Hering
Am Wed, 25 Apr 2018 09:59:23 +0100 schrieb Wei Liu : > Do you have the full diff of your changes? Not right now. But without 'val', or val being uint, the same error happens in f(): #include void f(void) { unsigned short req_prod = 0, req_cons = 65400; unsigned short val;

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Wei Liu
On Wed, Apr 25, 2018 at 09:39:24AM +0200, Olaf Hering wrote: > Am Wed, 25 Apr 2018 09:28:38 +0200 > schrieb Juergen Gross : > > > Why? (u16)0 - (u16)65400 == 136 > > My helloworld.c shows that ushort gets promoted to uint, unless it is done > like that: > > - if (queue->tx.sring->

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Olaf Hering
Am Wed, 25 Apr 2018 09:28:38 +0200 schrieb Juergen Gross : > Why? (u16)0 - (u16)65400 == 136 My helloworld.c shows that ushort gets promoted to uint, unless it is done like that: - if (queue->tx.sring->req_prod - queue->tx.req_cons > - XEN_NETIF_TX_RING_SIZE) { +

Re: [Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Juergen Gross
On 25/04/18 09:19, Olaf Hering wrote: > With commit 48856286b64e ("xen/netback: shutdown the ring if it contains > garbage.") a new check was added to xen-netback, which triggers for me. > > Since there are bugs in ring buffer handling I tried to trigger them earlier > by changing RING_IDX from

[Xen-devel] bogus wrap check in xen-netback

2018-04-25 Thread Olaf Hering
With commit 48856286b64e ("xen/netback: shutdown the ring if it contains garbage.") a new check was added to xen-netback, which triggers for me. Since there are bugs in ring buffer handling I tried to trigger them earlier by changing RING_IDX from u32 to u16. Now I found another one, and I wonde