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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87shjml3tv.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
Date:   Tue, 30 May 2017 12:14:20 -0400
From:   Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel@...oirfairelinux.com,
        f.fainelli@...il.com
Subject: Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code

Hi Andrew,

Andrew Lunn <andrew@...n.ch> writes:

> On Tue, May 30, 2017 at 11:56:30AM -0400, Vivien Didelot wrote:
>> Hi Andrew, David,
>> 
>> David Miller <davem@...emloft.net> writes:
>> 
>> >>> +bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
>> >>> +{
>> >>> +	return !!dst->rcv;
>> >>> +}
>> >>> +
>> >> 
>> >> You need to be careful here. This is in the hot path. Every frame
>> >> received uses this code. And think about a distro kernel, which might
>> >> have DSA enabled by default, yet is unlikely to have any switches. You
>> >> are adding a function call which can be called millions of times per
>> >> second....
>> >
>> > Yeah, we really can't make this change.
>> >
>> > This isn't glibc where we're trying to hide the implementation of "FILE *"
>> > behind accessor functions that caller can't see.  We inline things when
>> > performance dictates, and it does here.
>> 
>> Thanks for the explanation, this wasn't obvious to me at all. So inline
>> is mandatory here. Would a dereference like "!!dst->tag_ops->rcv" have
>> an significant impact on performance?
>
> The additional dereference could cause a cache miss when accessing
> tag_ops, which is expensive. dst will be in cache, so dst->rcv should
> always be cheap.

OK! That was interesting. I'm dropping the first 2 patches.

Thanks,

        Vivien

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ