From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752690AbcEJWcT (ORCPT ); Tue, 10 May 2016 18:32:19 -0400 Received: from terminus.zytor.com ([198.137.202.10]:59812 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751568AbcEJWcB (ORCPT ); Tue, 10 May 2016 18:32:01 -0400 Subject: Re: [PATCH -v2] x86/hweight: Get rid of the special calling convention To: Borislav Petkov References: <5998407c-3497-22c1-45dc-a86afcb73c94@zytor.com> <20160504194101.GE23257@pd.tnic> <20160504202213.GF23257@pd.tnic> <572B446D.1030000@redhat.com> <20160505140446.GE534@pd.tnic> <20160510165318.GD28520@pd.tnic> <20160510172313.GA3192@twins.programming.kicks-ass.net> <8FE6169B-4F2E-4B7D-A271-14FEC245F663@zytor.com> <20160510191041.GI28520@pd.tnic> Cc: Peter Zijlstra , x86-ml , Denys Vlasenko , Brian Gerst , LKML , Dmitry Vyukov , Andi Kleen , zengzhaoxiu@163.com, Thomas Gleixner , Ingo Molnar , Andrew Morton , Kees Cook , Zhaoxiu Zeng , Andy Lutomirski From: "H. Peter Anvin" Message-ID: Date: Tue, 10 May 2016 15:30:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20160510191041.GI28520@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/10/16 12:10, Borislav Petkov wrote: > On Tue, May 10, 2016 at 12:03:48PM -0700, H. Peter Anvin wrote: >> Also, to be fair... if the problem is with these being in C then we >> could just do it in assembly easily enough. > > I thought about converting the __sw_hweight* variants to asm but > __sw_hweight32, for example, is 55 bytes here and that's a lot. > > Or do you have a better idea? > > peterz's sounds ok to me: we call a thunk which then calls __sw_hweight* > after having saved regs properly - problem solved. > I didn't mean inline assembly. -hpa