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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1dbe988f-5703-4ccc-8f53-dea455192983@gmail.com>
Date: Tue, 29 Jul 2025 10:11:49 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Byungchul Park <byungchul@...com>
Cc: Mina Almasry <almasrymina@...gle.com>, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, pabeni@...hat.com, horms@...nel.org, hawk@...nel.org,
 toke@...hat.com, kernel_team@...ynix.com
Subject: Re: [RFC net-next] netmem: replace __netmem_clear_lsb() with
 netmem_to_nmdesc()

On 7/29/25 02:17, Byungchul Park wrote:
> On Mon, Jul 28, 2025 at 07:58:13PM +0100, Pavel Begunkov wrote:
>> On 7/28/25 19:46, Pavel Begunkov wrote:
>>> On 7/28/25 18:44, Mina Almasry wrote:
>>>> On Sun, Jul 27, 2025 at 9:21 PM Byungchul Park <byungchul@...com> wrote:
...>>
>>
>>> info to the compiler to optimise it out without assumptions on
>>> the layouts nor NET_IOV_ASSERT_OFFSET. Currently it's not so bad,
>>> but we should be able to remove this test+cmove.
>>>
>>>       movq    %rdi, %rax    # netmem, tmp105
>>>       andq    $-2, %rax    #, tmp105
>>>       testb    $1, %dil    #, netmem
>>>       cmove    %rdi, %rax    # tmp105,, netmem, <retval>
>>>       jmp    __x86_return_thunk
>>
>> struct netmem_desc *netmem_to_nmdesc(netmem_ref netmem)
>> {
>>         void *p = (void *)((__force unsigned long)netmem & ~NET_IOV);
>>
>>         if (netmem_is_net_iov(netmem))
>>                 return &((struct net_iov *)p)->desc;
>>         return __pp_page_to_nmdesc((struct page *)p);
>> }
> 
> I wanted to remove constraints that can be removed, but Mina want not to
> add additional overhead more.  So I'm thinking to keep the constraint,
> 'netmem_desc is the first member of net_iov'.
> 
> Thoughts?

We don't want extra overhead, the function above doesn't add
any, so just use it. You don't need to explicitly check that
layouts match.

-- 
Pavel Begunkov


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ