Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Michael S. Tsirkin
On Wed, Apr 18, 2018 at 01:38:43PM -0700, Eric Dumazet wrote: > > > On 04/18/2018 10:55 AM, Michael S. Tsirkin wrote: > > > Imagine you want to pass some data to card. > > Natural thing is to just put it in a variable and start DMA. > > However DMA API disallows stack access nowdays, > > so

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Eric Dumazet
On 04/18/2018 10:55 AM, Michael S. Tsirkin wrote: > Imagine you want to pass some data to card. > Natural thing is to just put it in a variable and start DMA. > However DMA API disallows stack access nowdays, > so it's natural to put this within struct device. > > See e.g. > > commit

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Michael S. Tsirkin
On Wed, Apr 18, 2018 at 01:47:21PM -0400, David Miller wrote: > From: Eric Dumazet > Date: Wed, 18 Apr 2018 09:51:25 -0700 > > > I suggest that virtio_net clearly identifies which part needs a specific > > allocation > > and does its itself, instead of abusing the

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Michael S. Tsirkin
On Wed, Apr 18, 2018 at 09:05:54AM -0700, Eric Dumazet wrote: > > > On 04/18/2018 07:34 AM, Mikulas Patocka wrote: > > The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc > > fails (later patches change it to kvzalloc). > > > > The problem with this is that if the vzalloc

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Mikulas Patocka
On Wed, 18 Apr 2018, David Miller wrote: > From: Eric Dumazet > Date: Wed, 18 Apr 2018 09:51:25 -0700 > > > I suggest that virtio_net clearly identifies which part needs a specific > > allocation > > and does its itself, instead of abusing the netdev_priv storage. > >

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Mikulas Patocka
On Wed, 18 Apr 2018, David Miller wrote: > From: Mikulas Patocka > Date: Wed, 18 Apr 2018 12:44:25 -0400 (EDT) > > > The structure net_device is followed by arbitrary driver-specific data > > (accessible with the function netdev_priv). And for virtio-net, these > >

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Mikulas Patocka
On Wed, 18 Apr 2018, Eric Dumazet wrote: > > > On 04/18/2018 09:44 AM, Mikulas Patocka wrote: > > > > > > On Wed, 18 Apr 2018, Eric Dumazet wrote: > > > >> > >> > >> On 04/18/2018 07:34 AM, Mikulas Patocka wrote: > >>> The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread David Miller
From: Eric Dumazet Date: Wed, 18 Apr 2018 09:51:25 -0700 > I suggest that virtio_net clearly identifies which part needs a specific > allocation > and does its itself, instead of abusing the netdev_priv storage. > > Ie use a pointer to a block of memory, allocated by

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread David Miller
From: Mikulas Patocka Date: Wed, 18 Apr 2018 12:44:25 -0400 (EDT) > The structure net_device is followed by arbitrary driver-specific data > (accessible with the function netdev_priv). And for virtio-net, these > driver-specific data must be in DMA memory. And we are

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread David Miller
From: Eric Dumazet Date: Wed, 18 Apr 2018 09:05:54 -0700 > Each virtio_net should probably allocate the exact amount of > DMA-memory it wants, instead of expecting core networking stack to > have a huge chunk of DMA-memory for everything. Yes, if you need DMA'able

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Eric Dumazet
On 04/18/2018 09:44 AM, Mikulas Patocka wrote: > > > On Wed, 18 Apr 2018, Eric Dumazet wrote: > >> >> >> On 04/18/2018 07:34 AM, Mikulas Patocka wrote: >>> The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc >>> fails (later patches change it to kvzalloc). >>> >>> The

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Mikulas Patocka
On Wed, 18 Apr 2018, Eric Dumazet wrote: > > > On 04/18/2018 07:34 AM, Mikulas Patocka wrote: > > The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc > > fails (later patches change it to kvzalloc). > > > > The problem with this is that if the vzalloc function is

Re: [PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Eric Dumazet
On 04/18/2018 07:34 AM, Mikulas Patocka wrote: > The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc > fails (later patches change it to kvzalloc). > > The problem with this is that if the vzalloc function is actually used, > virtio_net doesn't work (because it expects

[PATCH] net: don't use kvzalloc for DMA memory

2018-04-18 Thread Mikulas Patocka
The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc fails (later patches change it to kvzalloc). The problem with this is that if the vzalloc function is actually used, virtio_net doesn't work (because it expects that the extra memory should be accessible with DMA-API and