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: <CAJ8uoz0GgzzfrgS0189=zwY-zzogZq+=v-NCY7O+RuWrwe1n6w@mail.gmail.com> Date: Tue, 4 Apr 2023 13:14:20 +0200 From: Magnus Karlsson <magnus.karlsson@...il.com> To: Kal Cutter Conley <kal.conley@...tris.com> Cc: Björn Töpel <bjorn@...nel.org>, Magnus Karlsson <magnus.karlsson@...el.com>, Maciej Fijalkowski <maciej.fijalkowski@...el.com>, Jonathan Lemon <jonathan.lemon@...il.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Jonathan Corbet <corbet@....net>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>, John Fastabend <john.fastabend@...il.com>, netdev@...r.kernel.org, bpf@...r.kernel.org, linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH bpf-next v2 08/10] xsk: Support UMEM chunk_size > PAGE_SIZE On Tue, 4 Apr 2023 at 12:29, Kal Cutter Conley <kal.conley@...tris.com> wrote: > > > > > Is not the max 64K as you test against XDP_UMEM_MAX_CHUNK_SIZE in > > > > xdp_umem_reg()? > > > > > > The absolute max is 64K. In the case of HPAGE_SIZE < 64K, then it > > > would be HPAGE_SIZE. > > > > Is there such a case when HPAGE_SIZE would be less than 64K? If not, > > then just write 64K. > > Yes. While most platforms have HPAGE_SIZE defined to a compile-time > constant >= 64K (very often 2M) there are platforms (at least ia64 and > powerpc) where the hugepage size is configured at boot. Specifically, > in the case of Itanium (ia64), the hugepage size may be configured at > boot to any valid page size > PAGE_SIZE (e.g. 8K). See: > https://elixir.bootlin.com/linux/latest/source/arch/ia64/mm/hugetlbpage.c#L159 So for all practical purposes it is max 64K. Let us just write that then. > > > > > > > static int xdp_umem_pin_pages(struct xdp_umem *umem, unsigned long address) > > > > > { > > > > > +#ifdef CONFIG_HUGETLB_PAGE > > > > > > > > Let us try to get rid of most of these #ifdefs sprinkled around the > > > > code. How about hiding this inside xdp_umem_is_hugetlb() and get rid > > > > of these #ifdefs below? Since I believe it is quite uncommon not to > > > > have this config enabled, we could simplify things by always using the > > > > page_size in the pool, for example. And dito for the one in struct > > > > xdp_umem. What do you think? > > > > > > I used #ifdef for `page_size` in the pool for maximum performance when > > > huge pages are disabled. We could also not worry about optimizing this > > > uncommon case though since the performance impact is very small. > > > However, I don't find the #ifdefs excessive either. > > > > Keep them to a minimum please since there are few of them in the > > current code outside of some header files. And let us assume that > > CONFIG_HUGETLB_PAGE is the common case. > > > > Would you be OK if I just remove the ones from xsk_buff_pool? I think > the code in xdp_umem.c is quite readable and the #ifdefs are really > only used in xdp_umem_pin_pages. Please make an effort to remove the ones in xdp_umem.c too. The more ifdefs you add, the harder it will be to read.
Powered by blists - more mailing lists