Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp155941ybt; Fri, 12 Jun 2020 23:49:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC9Gi71t7W9r52MufNEbwqxLIWh3KPqXeRguxJgAX2MEcxTljGZ43gLvkV3cQdo4JKBvt8 X-Received: by 2002:a50:e14e:: with SMTP id i14mr14352931edl.279.1592030980383; Fri, 12 Jun 2020 23:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592030980; cv=none; d=google.com; s=arc-20160816; b=zY3c9ZznI44HKg3v7ZEasfpjOugqkRAbdxGv1DMDyQl8vOc59gWD+YOyjwgBiYJ3Ls 9ggExsnCVUE8pREmXAoIiAjLR0oX6I3H7OAJKzvZfC+cglAJD7Iuw7vV5ZBhzcQpFWiK 6lSnK4ROiX5kYA4Hq4ze3Tfrd7xhkFVomBZaK7Fc+Ey8hOrxnUjNlpaUZCxQzVAk9LNw bMQWSXUsJtTbDczud5b6guWB161PDGyl60zA9+iq03wmeo8cZLkryni4unvA5BCzIyt4 KkynlIgqsTGmao2hGqrjRVYSnTyqoEVvcxHWPgHeZTFM4yLi61HyjOyWRv6OzBLGS8dL YVvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IkmKQYwu305i9JKV9zxcRcfb0+u3dSVIQfo/Z7oUPjY=; b=0fS+e5RVZfKWhQFmzGLG9k7GgLmJwRNajmHL9jImfOfJSWr7lm0x0fy7tFljtilvLg 5x9dVXX1kXp7+HiLj1n5nYSY50T9OSYqLOQnfxVbRLDF4ccchx0BjInJBKYSjXDUmwuC ebhVsNx4tn1FlILpuQelML4hKejBnRorAVGJvzhRltiSBKWtuB+09sPgVlgn1BhTxTjw W+l1BCm2XcflSAl9So2J8mFF4PNILS/TFtfmzrqIoc/JfBHjakS1VOIQOUIFuh402FqP 7R/FrZn/ChhjOSjnV9ymAYHZUQFxpFuNjNSXuXYUh4+rLA+MVodl5E3O1toFQ4EF9Ob4 Ndqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si5360293eji.227.2020.06.12.23.49.01; Fri, 12 Jun 2020 23:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726290AbgFMGqr (ORCPT + 99 others); Sat, 13 Jun 2020 02:46:47 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:21274 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgFMGqr (ORCPT ); Sat, 13 Jun 2020 02:46:47 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 49kSmy5MQRz9twtx; Sat, 13 Jun 2020 08:46:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id sNXi3cRrh7Ub; Sat, 13 Jun 2020 08:46:42 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 49kSmy3vdrz9twtw; Sat, 13 Jun 2020 08:46:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AF5FF8B771; Sat, 13 Jun 2020 08:46:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id o_sKFmexd0LZ; Sat, 13 Jun 2020 08:46:43 +0200 (CEST) Received: from pc16570vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E6A0B8B76A; Sat, 13 Jun 2020 08:46:42 +0200 (CEST) Subject: Re: [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' To: Nick Desaulniers , Segher Boessenkool Cc: Michael Ellerman , Christophe Leroy , Benjamin Herrenschmidt , LKML , linuxppc-dev , Nicholas Piggin , Paul Mackerras , clang-built-linux References: <49YBKY13Szz9sT4@ozlabs.org> <20200611224355.71174-1-ndesaulniers@google.com> <20200611235256.GL31009@gate.crashing.org> From: Christophe Leroy Message-ID: <1d1f9aee-ff13-d18b-9454-1580067d7c71@csgroup.eu> Date: Sat, 13 Jun 2020 06:46:33 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/12/2020 09:33 PM, Nick Desaulniers wrote: > > IIUC the bug report correctly, it looks like LLVM is failing for the > __put_user_asm2_goto case for -m32. A simple reproducer: > https://godbolt.org/z/jBBF9b > > void foo(long long in, long long* out) { > asm volatile( > "stw%X1 %0, %1\n\t" > "stw%X1 %L0, %L1" > ::"r"(in), "m"(*out)); > } > prints (in GCC): > foo: > stw 3, 0(5) > stw 4, 4(5) > blr > (first time looking at ppc assembler, seems constants and registers > are not as easy to distinguish, > https://developer.ibm.com/technologies/linux/articles/l-ppc/ say "Get > used to it." LOL, ok). When I do ppc-linux-objdump -d vmlinux, registers and constants are easily distinguished, see below. c0002284 : c0002284: 3c 40 c0 3c lis r2,-16324 c0002288: 60 42 45 00 ori r2,r2,17664 c000228c: 3c 82 40 00 addis r4,r2,16384 c0002290: 38 84 04 30 addi r4,r4,1072 c0002294: 7c 93 43 a6 mtsprg 3,r4 c0002298: 3c 20 c0 3e lis r1,-16322 c000229c: 38 21 e0 00 addi r1,r1,-8192 c00022a0: 38 00 00 00 li r0,0 c00022a4: 94 01 1f f0 stwu r0,8176(r1) c00022a8: 48 35 e7 41 bl c03609e8 c00022ac: 38 60 00 00 li r3,0 c00022b0: 7f e4 fb 78 mr r4,r31 c00022b4: 48 35 e7 8d bl c0360a40 c00022b8: 48 35 eb e1 bl c0360e98 c00022bc: 3c c0 c0 3c lis r6,-16324 c00022c0: 3c c6 40 00 addis r6,r6,16384 c00022c4: 7c df c3 a6 mtspr 799,r6 c00022c8: 3c 80 c0 00 lis r4,-16384 c00022cc: 60 84 22 e4 ori r4,r4,8932 c00022d0: 3c 84 40 00 addis r4,r4,16384 c00022d4: 38 60 10 02 li r3,4098 c00022d8: 7c 9a 03 a6 mtsrr0 r4 c00022dc: 7c 7b 03 a6 mtsrr1 r3 c00022e0: 4c 00 00 64 rfi c00022e4: 7c 00 02 e4 tlbia c00022e8: 7c 00 04 ac hwsync c00022ec: 3c c6 c0 00 addis r6,r6,-16384 c00022f0: 3c a0 c0 3c lis r5,-16324 c00022f4: 60 a5 40 00 ori r5,r5,16384 c00022f8: 90 a0 00 f0 stw r5,240(0) c00022fc: 3c a5 40 00 addis r5,r5,16384 c0002300: 90 c5 00 00 stw r6,0(r5) c0002304: 38 80 10 32 li r4,4146 c0002308: 3c 60 c0 35 lis r3,-16331 c000230c: 60 63 d6 a8 ori r3,r3,54952 c0002310: 7c 7a 03 a6 mtsrr0 r3 c0002314: 7c 9b 03 a6 mtsrr1 r4 c0002318: 4c 00 00 64 rfi For GCC, I think you call tell you want register names with -mregnames Christophe