From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincenzo Frascino Subject: Re: [PATCH] vsyscall: use __iter_div_u64_rem() Date: Thu, 11 Jul 2019 14:08:25 +0100 Message-ID: <049c3a69-e2da-4169-da4a-8e46cbcd323c@arm.com> References: <20190710130206.1670830-1-arnd@arndb.de> <33511b0e-6d7b-c156-c415-7a609b049567@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Arnd Bergmann Cc: Andy Lutomirski , Thomas Gleixner , linux-arch , Linux ARM , linux-mips@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , Catalin Marinas , Will Deacon , Russell King , Ralf Baechle , Paul Burton , Daniel Lezcano , Mark Salyzyn , Peter Collingbourne , Shuah Khan , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , Huw Davies Linux List-Id: linux-arch.vger.kernel.org Hi Arnd, On 11/07/2019 13:28, Arnd Bergmann wrote: > On Thu, Jul 11, 2019 at 2:14 PM Vincenzo Frascino > wrote: >> >> >> Could you please tell me which version of the compiler did you use? >> >> My building command is: >> >> # make mrproper && make CC=clang HOSTCC=clang i386_defconfig && make ARCH=i386 >> CC=clang HOSTCC=clang -j56 >> > > See below for the patch I am using locally to work around this. > That patch is probably wrong, so I have not submitted it yet, but it > gives you a clean build ;-) > > Arnd > Thank you, I will give it a go :-) > 8<--- > Subject: [PATCH] x86: percpu: fix clang 32-bit build > > clang does not like an inline assembly with a "=q" contraint for > a 64-bit output: > > arch/x86/events/perf_event.h:824:21: error: invalid output size for > constraint '=q' > u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask); > ^ > include/linux/percpu-defs.h:447:2: note: expanded from macro '__this_cpu_read' > raw_cpu_read(pcp); \ > ^ > include/linux/percpu-defs.h:421:28: note: expanded from macro 'raw_cpu_read' > #define raw_cpu_read(pcp) > __pcpu_size_call_return(raw_cpu_read_, pcp) > ^ > include/linux/percpu-defs.h:322:23: note: expanded from macro > '__pcpu_size_call_return' > case 1: pscr_ret__ = stem##1(variable); break; \ > ^ > :357:1: note: expanded from here > raw_cpu_read_1 > ^ > arch/x86/include/asm/percpu.h:394:30: note: expanded from macro 'raw_cpu_read_1' > #define raw_cpu_read_1(pcp) percpu_from_op(, "mov", pcp) > ^ > arch/x86/include/asm/percpu.h:189:15: note: expanded from macro 'percpu_from_op' > : "=q" (pfo_ret__) \ > ^ > > According to the commit that introduced the "q" constraint, this was > needed to fix miscompilation, but it gives no further detail. > > Using the normal "=r" constraint seems to work so far. > > Fixes: 3c598766a2ba ("x86: fix percpu_{to,from}_op()") > Cc: Jan Beulich > Signed-off-by: Arnd Bergmann > > diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h > index 2278797c769d..e791fbf4018f 100644 > --- a/arch/x86/include/asm/percpu.h > +++ b/arch/x86/include/asm/percpu.h > @@ -99,7 +99,7 @@ do { \ > case 1: \ > asm qual (op "b %1,"__percpu_arg(0) \ > : "+m" (var) \ > - : "qi" ((pto_T__)(val))); \ > + : "ri" ((pto_T__)(val))); \ > break; \ > case 2: \ > asm qual (op "w %1,"__percpu_arg(0) \ > @@ -144,7 +144,7 @@ do { > \ > else \ > asm qual ("addb %1, "__percpu_arg(0) \ > : "+m" (var) \ > - : "qi" ((pao_T__)(val))); \ > + : "ri" ((pao_T__)(val))); \ > break; \ > case 2: \ > if (pao_ID__ == 1) \ > @@ -186,7 +186,7 @@ do { > \ > switch (sizeof(var)) { \ > case 1: \ > asm qual (op "b "__percpu_arg(1)",%0" \ > - : "=q" (pfo_ret__) \ > + : "=r" (pfo_ret__) \ > : "m" (var)); \ > break; \ > case 2: \ > @@ -215,7 +215,7 @@ do { > \ > switch (sizeof(var)) { \ > case 1: \ > asm(op "b "__percpu_arg(P1)",%0" \ > - : "=q" (pfo_ret__) \ > + : "=r" (pfo_ret__) \ > : "p" (&(var))); \ > break; \ > case 2: \ > -- Regards, Vincenzo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.110.172]:45926 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728655AbfGKNI3 (ORCPT ); Thu, 11 Jul 2019 09:08:29 -0400 Subject: Re: [PATCH] vsyscall: use __iter_div_u64_rem() References: <20190710130206.1670830-1-arnd@arndb.de> <33511b0e-6d7b-c156-c415-7a609b049567@arm.com> From: Vincenzo Frascino Message-ID: <049c3a69-e2da-4169-da4a-8e46cbcd323c@arm.com> Date: Thu, 11 Jul 2019 14:08:25 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Arnd Bergmann Cc: Andy Lutomirski , Thomas Gleixner , linux-arch , Linux ARM , linux-mips@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , Catalin Marinas , Will Deacon , Russell King , Ralf Baechle , Paul Burton , Daniel Lezcano , Mark Salyzyn , Peter Collingbourne , Shuah Khan , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , Huw Davies , Linux Kernel Mailing List , clang-built-linux Message-ID: <20190711130825.AO8BkMOfDJuAaiofBCZylGrd3UJE5c2l6idgwXrSyUI@z> Hi Arnd, On 11/07/2019 13:28, Arnd Bergmann wrote: > On Thu, Jul 11, 2019 at 2:14 PM Vincenzo Frascino > wrote: >> >> >> Could you please tell me which version of the compiler did you use? >> >> My building command is: >> >> # make mrproper && make CC=clang HOSTCC=clang i386_defconfig && make ARCH=i386 >> CC=clang HOSTCC=clang -j56 >> > > See below for the patch I am using locally to work around this. > That patch is probably wrong, so I have not submitted it yet, but it > gives you a clean build ;-) > > Arnd > Thank you, I will give it a go :-) > 8<--- > Subject: [PATCH] x86: percpu: fix clang 32-bit build > > clang does not like an inline assembly with a "=q" contraint for > a 64-bit output: > > arch/x86/events/perf_event.h:824:21: error: invalid output size for > constraint '=q' > u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask); > ^ > include/linux/percpu-defs.h:447:2: note: expanded from macro '__this_cpu_read' > raw_cpu_read(pcp); \ > ^ > include/linux/percpu-defs.h:421:28: note: expanded from macro 'raw_cpu_read' > #define raw_cpu_read(pcp) > __pcpu_size_call_return(raw_cpu_read_, pcp) > ^ > include/linux/percpu-defs.h:322:23: note: expanded from macro > '__pcpu_size_call_return' > case 1: pscr_ret__ = stem##1(variable); break; \ > ^ > :357:1: note: expanded from here > raw_cpu_read_1 > ^ > arch/x86/include/asm/percpu.h:394:30: note: expanded from macro 'raw_cpu_read_1' > #define raw_cpu_read_1(pcp) percpu_from_op(, "mov", pcp) > ^ > arch/x86/include/asm/percpu.h:189:15: note: expanded from macro 'percpu_from_op' > : "=q" (pfo_ret__) \ > ^ > > According to the commit that introduced the "q" constraint, this was > needed to fix miscompilation, but it gives no further detail. > > Using the normal "=r" constraint seems to work so far. > > Fixes: 3c598766a2ba ("x86: fix percpu_{to,from}_op()") > Cc: Jan Beulich > Signed-off-by: Arnd Bergmann > > diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h > index 2278797c769d..e791fbf4018f 100644 > --- a/arch/x86/include/asm/percpu.h > +++ b/arch/x86/include/asm/percpu.h > @@ -99,7 +99,7 @@ do { \ > case 1: \ > asm qual (op "b %1,"__percpu_arg(0) \ > : "+m" (var) \ > - : "qi" ((pto_T__)(val))); \ > + : "ri" ((pto_T__)(val))); \ > break; \ > case 2: \ > asm qual (op "w %1,"__percpu_arg(0) \ > @@ -144,7 +144,7 @@ do { > \ > else \ > asm qual ("addb %1, "__percpu_arg(0) \ > : "+m" (var) \ > - : "qi" ((pao_T__)(val))); \ > + : "ri" ((pao_T__)(val))); \ > break; \ > case 2: \ > if (pao_ID__ == 1) \ > @@ -186,7 +186,7 @@ do { > \ > switch (sizeof(var)) { \ > case 1: \ > asm qual (op "b "__percpu_arg(1)",%0" \ > - : "=q" (pfo_ret__) \ > + : "=r" (pfo_ret__) \ > : "m" (var)); \ > break; \ > case 2: \ > @@ -215,7 +215,7 @@ do { > \ > switch (sizeof(var)) { \ > case 1: \ > asm(op "b "__percpu_arg(P1)",%0" \ > - : "=q" (pfo_ret__) \ > + : "=r" (pfo_ret__) \ > : "p" (&(var))); \ > break; \ > case 2: \ > -- Regards, Vincenzo