lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20160721164126.GA91555@ast-mbp.thefacebook.com> Date: Thu, 21 Jul 2016 09:41:28 -0700 From: Alexei Starovoitov <alexei.starovoitov@...il.com> To: Saeed Mahameed <saeedm@....mellanox.co.il> Cc: Saeed Mahameed <saeedm@...lanox.com>, "David S. Miller" <davem@...emloft.net>, Linux Netdev List <netdev@...r.kernel.org>, Or Gerlitz <ogerlitz@...lanox.com>, Hadar Hen-Zion <hadarh@...lanox.com> Subject: Re: [PATCH net-next 2/2] net/mlx5e: Query minimum required header copy during xmit On Thu, Jul 21, 2016 at 11:22:32AM +0300, Saeed Mahameed wrote: > On Thu, Jul 21, 2016 at 8:15 AM, Alexei Starovoitov > <alexei.starovoitov@...il.com> wrote: > > On Thu, Jul 21, 2016 at 01:20:02AM +0300, Saeed Mahameed wrote: > >> From: Hadar Hen Zion <hadarh@...lanox.com> > >> > >> Add support for query the minimum inline mode from the Firmware. > >> It is required for correct TX steering according to L3/L4 packet > >> headers. > >> > >> Each send queue (SQ) has inline mode that defines the minimal required > >> headers that needs to be copied into the SQ WQE. > >> The driver asks the Firmware for the wqe_inline_mode device capability > >> value. In case the device capability defined as "vport context" the > >> driver must check the reported min inline mode from the vport context > >> before creating its SQs. > >> > >> Signed-off-by: Hadar Hen Zion <hadarh@...lanox.com> > >> Signed-off-by: Saeed Mahameed <saeedm@...lanox.com> > > ... > >> + int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out); > >> + u32 *out; > >> + > >> + out = mlx5_vzalloc(outlen); > >> + if (!out) > >> + return; > > > > Just discovered this... > > outlen is a small constant here, yet you want to try to vmalloc it? > > What is the point? > > There are 67 places in mlx5 where failed kmalloc is retried with > > vmalloc... was that path ever tested? > > The point is that there are a lot of places in the code that want to > allocate huge commands and mlx5_vzalloc is a nice black box that > provides the method to allocate such huge chunks of memory. > > Now sometimes people tend to reuse same pieces of code for code consistency. > > I don't see any harm from doing that. There are several *_kvzalloc() helpers in the kernel. Their main purpose is to allocate large chunks of contigous memory. mlx5 driver just calls mlx5_vzalloc everywhere even when the size is known and it's small. There is a lot of harm in such 'consistency': . if we're under memory pressure and small size kmalloc fails, it will hurt the system if vmalloc somehow finds a free page for this small alloc . the memory returned by vmalloc is virtually contiguous, whereas the driver takes it and puts in all sort of hardware things. I'm not sure why I didn't blow up yet In general you should never call vmalloc with anything smaller than page size.
Powered by blists - more mailing lists