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] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d18alu2h.fsf@yhuang-mobile.sh.intel.com>
Date:   Sat, 05 Aug 2017 08:47:02 +0800
From:   "Huang\, Ying" <ying.huang@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     "Huang\, Ying" <ying.huang@...el.com>,
        Eric Dumazet <eric.dumazet@...il.com>,
        <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...nel.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Borislav Petkov <bp@...e.de>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Juergen Gross" <jgross@...e.com>, Aaron Lu <aaron.lu@...el.com>
Subject: Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

Peter Zijlstra <peterz@...radead.org> writes:

> On Fri, Aug 04, 2017 at 10:05:55AM +0800, Huang, Ying wrote:
>> "Huang, Ying" <ying.huang@...el.com> writes:
>> > Peter Zijlstra <peterz@...radead.org> writes:
>
>> >> +struct __call_single_data {
>> >>  	struct llist_node llist;
>> >>  	smp_call_func_t func;
>> >>  	void *info;
>> >>  	unsigned int flags;
>> >>  };
>> >>  
>> >> +typedef struct __call_single_data call_single_data_t
>> >> +	__aligned(sizeof(struct __call_single_data));
>> >> +
>> >
>> > Another requirement of the alignment is that it should be the power of
>> > 2.  Otherwise, for example, if someone adds a field to struct, so that
>> > the size becomes 40 on x86_64.  The alignment should be 64 instead of
>> > 40.
>> 
>> Thanks Aaron, he reminded me that there is a roundup_pow_of_two().  So
>> the typedef could be,
>> 
>> typedef struct __call_single_data call_single_data_t
>> 	__aligned(roundup_pow_of_two(sizeof(struct __call_single_data));
>> 
>
> Yes, that would take away the requirement to play padding games with the
> struct. Then again, maybe its a good thing to have to be explicit about
> it.
>
> If you see:
>
> struct __call_single_data {
> 	struct llist_node llist;
> 	smp_call_func_t func;
> 	void *info
> 	int flags;
> 	void *extra_field;
>
> 	unsigned long __padding[3]; /* make align work */
> };
>
> that makes it very clear what is going on. In any case, we can delay
> this part because the current structure is a power-of-2 for both ILP32
> and LP64. So only the person growing this will have to deal with it ;-)

Yes.  That looks good.  So you will prepare the final patch?  Or you
hope me to do that?

Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ