Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp604401yba; Fri, 3 May 2019 07:34:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPqQIo2QbXFayNkZ6zo1rsnZ4sWszZ+d3R2xEHZijjnqT7i2FBNTm1RiKmrIxjCXD/+dej X-Received: by 2002:a63:494f:: with SMTP id y15mr10707579pgk.56.1556894081089; Fri, 03 May 2019 07:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556894081; cv=none; d=google.com; s=arc-20160816; b=VUrxwC1ecANJ1qMtOcNLKzKJVjSGxOjPe5i1f6Ev9QpT98ZoDpmXA7TZSPOVVmbAik SzSw4FkjueAX8HmVNeAH4dvkYq86hVvk0UcwvguG2h/9aOHTVp6+tZx4S5im0ZLsN4ZR t2dRBuU0Pek2BsSwi2kpSb9y4woKXPSZiu+u+mGRVh3L3W7Td3DeyoWp7gmAQiH95559 NaFYZYl+dxgz7j9gAugeKnWcS62zPPbEZSUyzq92x4LRsvritiBSewI+XJNyr1+07ZFz g0MweNSKbhegsIz+A0Ayq27zr/Zp7FtcdjUuh4y9gXwXTvtuv8DkpYNN+oemg0fs2cnJ SSxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:to:references:cc:subject:from:dkim-signature; bh=4FP3jlxhOw7MO/z0jPsJssg5WmxNf+WleLB2wfm43OM=; b=P9QLV1hLCyQzDdBaxdendQjphY0xxzuH4lnbqKoUXIJnmb9z7mC1uWG2xdMLuRFDD9 28A0qvOq2vP4OFfylJ8ddh6uCiIJs+RL3hw8KhRPZrI71z3Bv4k5jXC0wTyvYtnVu1Jh Sg5Hk8/INbrKjMfpdG1HfGdKuiLffcF8qw/KhKUwaCGwEjuncRdYX+vm9KtbfgqJ2W/F NIVETdRAr/A+jHlqTzJSDiwg+zKA5bzb4ul1wpu3O7UbCPSuQS5i9ZtbKwS07jqYNNPs PhjxjT3xFbA4cAaRArK1OGfhSFcljHOClcq8bCHFlYTOcPqFFp1AzJzmtK+uqFeiAfkP L4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=oyEBpwZn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si2473818plr.216.2019.05.03.07.34.25; Fri, 03 May 2019 07:34:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=oyEBpwZn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728018AbfECOOf (ORCPT + 99 others); Fri, 3 May 2019 10:14:35 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:65112 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbfECOOf (ORCPT ); Fri, 3 May 2019 10:14:35 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44wYzX0GDHz9v0Qq; Fri, 3 May 2019 16:14:32 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=oyEBpwZn; dkim-adsp=pass; dkim-atps=neutral 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 gFTAIGcYYqpx; Fri, 3 May 2019 16:14:31 +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 44wYzW6LSSz9v0Qp; Fri, 3 May 2019 16:14:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556892871; bh=4FP3jlxhOw7MO/z0jPsJssg5WmxNf+WleLB2wfm43OM=; h=From:Subject:Cc:References:To:Date:In-Reply-To:From; b=oyEBpwZnmvO22aGAGTnwP0mfPeRC10r3u63RuhVW9bnRhTaz0xqD2Inl4FWx8TmOP 7BQbpHUSunw6z1z95HIxTfz7pg4s0t+63gGf2IL7LGmXZB/KLl+FGpWiNznF3UsCt5 ZA5EUE7ZnUvwPH6QhsRrlvKP2UTpfIng8B1LKWnk= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 59C1A8B91F; Fri, 3 May 2019 16:14:33 +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 bUUrU_B9bv25; Fri, 3 May 2019 16:14:33 +0200 (CEST) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.6]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 36AA58B906; Fri, 3 May 2019 16:14:33 +0200 (CEST) From: Christophe Leroy Subject: Re: [PATCH] powerpc/32: Remove memory clobber asm constraint on dcbX() functions Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20180109065759.4E54B6C73D@localhost.localdomain> To: Segher Boessenkool Message-ID: <392ac8d7-c848-9661-706b-0fbb5b9e54bc@c-s.fr> Date: Fri, 3 May 2019 16:14:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20180109065759.4E54B6C73D@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Segher, A while ago I proposed the following patch, and didn't get any comment back on it. Do you have any opinion on it ? Is it good and worth it ? Thanks Christophe Le 09/01/2018 à 07:57, Christophe Leroy a écrit : > Instead of just telling GCC that dcbz(), dcbi(), dcbf() and dcbst() > clobber memory, tell it what it clobbers: > * dcbz(), dcbi() and dcbf() clobbers one cacheline as output > * dcbf() and dcbst() clobbers one cacheline as input > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/cache.h | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/include/asm/cache.h > b/arch/powerpc/include/asm/cache.h > index c1d257aa4c2d..fc8fe18acf8c 100644 > --- a/arch/powerpc/include/asm/cache.h > +++ b/arch/powerpc/include/asm/cache.h > @@ -82,22 +82,31 @@ extern void _set_L3CR(unsigned long); > static inline void dcbz(void *addr) > { > - __asm__ __volatile__ ("dcbz 0, %0" : : "r"(addr) : "memory"); > + __asm__ __volatile__ ("dcbz 0, %1" : > + "=m"(*(char (*)[L1_CACHE_BYTES])addr) : > + "r"(addr) :); > } > static inline void dcbi(void *addr) > { > - __asm__ __volatile__ ("dcbi 0, %0" : : "r"(addr) : "memory"); > + __asm__ __volatile__ ("dcbi 0, %1" : > + "=m"(*(char (*)[L1_CACHE_BYTES])addr) : > + "r"(addr) :); > } > static inline void dcbf(void *addr) > { > - __asm__ __volatile__ ("dcbf 0, %0" : : "r"(addr) : "memory"); > + __asm__ __volatile__ ("dcbf 0, %1" : > + "=m"(*(char (*)[L1_CACHE_BYTES])addr) : > + "r"(addr), "m"(*(char (*)[L1_CACHE_BYTES])addr) : > + ); > } > static inline void dcbst(void *addr) > { > - __asm__ __volatile__ ("dcbst 0, %0" : : "r"(addr) : "memory"); > + __asm__ __volatile__ ("dcbst 0, %0" : : > + "r"(addr), "m"(*(char (*)[L1_CACHE_BYTES])addr) : > + ); > } > #endif /* !__ASSEMBLY__ */ > #endif /* __KERNEL__ */ >