Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp851380ybl; Fri, 9 Aug 2019 15:04:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+Cetu/G+w9AdoDBtsq2HiRF/C7pHGLP6azi4hhONlWDGuWb5+2TYr9V1pSJ9g4TeUD2/2 X-Received: by 2002:a63:204b:: with SMTP id r11mr19315258pgm.121.1565388281003; Fri, 09 Aug 2019 15:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565388280; cv=none; d=google.com; s=arc-20160816; b=Qww1/jVtBNNe3NIw77IQD5yVNC/VFq+2TE2oIIN/T/LuhHiFxpVzwyGcHRQbmEciOc 7U4DgUxCpKAm34h8ahNnLgObq7JHyd7Xy+j2cVUgYKm2Xqd7PkdPNvj2xMnUVPPGh6Wz 0WyfWWWUup8DONF+nLXd7+VdcPwMtbeCjpUkqUx/AwqejmsMvlvB7sFjoxiN/ppHqind aNzNt8OtrO3A5FtZf8u5zXnaeb+EgLEpVRubrH6fei+vL51fthrwM9CNHhGG+X/LnR9X ohvwVTG5/dLuqFBxnh89/BShlt7VWhM4er0uW3++E3rLsJyG95mIUtC/ZXQc15qXnvOU hvLg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=4YE5LFpbQmY5CUf9HiiZAitomsRy44hXFJVcN3+uc3g=; b=yUxs93uUmTX+WNOzbRlzUj8scqaFN9OkeCnAKWxCsRq2R1S588Q17EiWonQHlR2Nu3 AESHH6uJN2Y/D0RCqSIf9LxlRfx0ZnEYfkklrZcJ1MBYP/2yh7IkNQfYPg1YYkumqv8M h34wPGVkgmIya7WXRIkYqz/g5d/OGPU937V/EJiMR8dZqPGPTdVfgoI1ehPX1L4zNImu w0KL2mjAOQENfZqpYQmuj80kQiYTFT1jN71w4uqR/6mq24OxMXVhhllf3Xa0DfH6+DTK YlDBCz9f69BzsDzxKMJGOi+JvfJWGqnaMpEBgrnwRb2/5GiX3N6MoXbEozU0zrGdtS1J ZaDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=F2iKZ4lO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si57957433pgk.158.2019.08.09.15.04.24; Fri, 09 Aug 2019 15:04:40 -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=@google.com header.s=20161025 header.b=F2iKZ4lO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbfHIWDn (ORCPT + 99 others); Fri, 9 Aug 2019 18:03:43 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40255 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbfHIWDn (ORCPT ); Fri, 9 Aug 2019 18:03:43 -0400 Received: by mail-pg1-f193.google.com with SMTP id w10so46489723pgj.7 for ; Fri, 09 Aug 2019 15:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=4YE5LFpbQmY5CUf9HiiZAitomsRy44hXFJVcN3+uc3g=; b=F2iKZ4lOk3Ih5R8vAeqlbdrBc0o0/2oPVqnxRiWVqXjqSSkS0hpJwY8/YpKGOaysmn S7RZmGdJWCcjYz5bky70ydz7Ay2uw/D5UfOz58OF/e09ambmcuAy/7caWD6Gu/8MZQDD kVqtz0SfTVti/fNY1P+4wOxv9CyVCfKZW/JhCEIdShv7eyoDF0003q3Qz5cDaNO/oV+8 ocxCDTmnNj6lX9aKWMtmKBid2xr8N7AmyTYIAQSf2rpqUIxrXM6haG3j8DFCDjmQTg9z YMtbBY7z9XoMpxQTQAeQanKoqciXuUF8/jLaNvyJvHQlxiHfytWc3UIpLanxf2sUkmtH mUHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=4YE5LFpbQmY5CUf9HiiZAitomsRy44hXFJVcN3+uc3g=; b=WSDK/oRgphPETQ0YXKMW4TODcwqnWQDzUYybTvignEcY0eMIqYTn0aP+D3PfaR4rHB hKTrsMKhNGjFZIEPtC/yWyvm5CylOjcqhcGfKeGtKb/v33C9OZVVS7gc9mWrRmgRRWIi BBDTh9BiCj9oVoFOLe9yEHIZQO09TUvvgrNX6dz5F9acQeDK4FwVlqPED5kkvc35fUoH Wdk9BlLdXpdYk+GywmQ6olGp7foLRLQIQWJDuV7nq+egaWNlNiL80/lAHz/RdGYQZUpd gPoDuEkMa0i14BfaYK6duASxrrVrMGgULDFIDljUNQ8dUh9OgsC98gqB53wG653Y0jf9 3H4Q== X-Gm-Message-State: APjAAAWVuw/O+xh8XwXXQLyZDyBJEsHP19De710ZPJK+G4AZ2NvM1IGl aM5iNOm+stym2HfSorR6dQK0pk2Ix/YNKNSw8oiq1DvnVyl1bg== X-Received: by 2002:a63:61cd:: with SMTP id v196mr19675034pgb.263.1565388221708; Fri, 09 Aug 2019 15:03:41 -0700 (PDT) MIME-Version: 1.0 References: <87h873zs88.fsf@concordia.ellerman.id.au> <20190809182106.62130-1-ndesaulniers@google.com> <20190809220301.Horde.AR6y4Bx4WGIq58V9K0En9g4@messagerie.si.c-s.fr> In-Reply-To: From: Nick Desaulniers Date: Fri, 9 Aug 2019 15:03:30 -0700 Message-ID: Subject: Re: [PATCH] powerpc: fix inline asm constraints for dcbz To: Arnd Bergmann Cc: Christophe Leroy , clang-built-linux , Linux Kernel Mailing List , linuxppc-dev , Paul Mackerras , Benjamin Herrenschmidt , kbuild test robot , Nathan Chancellor , Segher Boessenkool , Michael Ellerman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 9, 2019 at 1:13 PM Arnd Bergmann wrote: > > On Fri, Aug 9, 2019 at 10:02 PM Christophe Leroy > wrote: > > > > Arnd Bergmann a =C3=A9crit : > > > On Fri, Aug 9, 2019 at 8:21 PM 'Nick Desaulniers' via Clang Built > > > Linux wrote: > > > > > >> static inline void dcbz(void *addr) > > >> { > > >> - __asm__ __volatile__ ("dcbz %y0" : : "Z"(*(u8 *)addr) : "mem= ory"); > > >> + __asm__ __volatile__ ("dcbz %y0" : "=3DZ"(*(u8 *)addr) :: "m= emory"); > > >> } > > >> > > >> static inline void dcbi(void *addr) > > >> { > > >> - __asm__ __volatile__ ("dcbi %y0" : : "Z"(*(u8 *)addr) : "mem= ory"); > > >> + __asm__ __volatile__ ("dcbi %y0" : "=3DZ"(*(u8 *)addr) :: "m= emory"); > > >> } > > > > > > I think the result of the discussion was that an output argument only= kind-of > > > makes sense for dcbz, but for the others it's really an input, and cl= ang is > > > wrong in the way it handles the "Z" constraint by making a copy, whic= h it > > > doesn't do for "m". > > > > > > I'm not sure whether it's correct to use "m" instead of "Z" here, whi= ch > > > would be a better workaround if that works. More importantly though, > > > clang really needs to be fixed to handle "Z" correctly. > > > > As the benefit is null, I think the best is probably to reverse my > > original commit until at least CLang is fixed, as initialy suggested > > by mpe > > Yes, makes sense. > > There is one other use of the "Z" constraint, so on top of the revert, I > think it might be helpful if Nick could check if the patch below makes > any difference with clang and, if it does, whether the current version > is broken. > > Arnd > > diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.= h > index 23e5d5d16c7e..28b467779328 100644 > --- a/arch/powerpc/include/asm/io.h > +++ b/arch/powerpc/include/asm/io.h > @@ -106,7 +106,7 @@ static inline u##size name(const volatile u##size > __iomem *addr) \ > { \ > u##size ret; \ > __asm__ __volatile__("sync;"#insn" %0,%y1;twi 0,%0,0;isync" \ > - : "=3Dr" (ret) : "Z" (*addr) : "memory"); = \ > + : "=3Dr" (ret) : "m" (*addr) : "memory"); = \ > return ret; \ > } > > @@ -114,7 +114,7 @@ static inline u##size name(const volatile u##size > __iomem *addr) \ > static inline void name(volatile u##size __iomem *addr, u##size val) \ > { \ > __asm__ __volatile__("sync;"#insn" %1,%y0" \ > - : "=3DZ" (*addr) : "r" (val) : "memory"); = \ > + : "=3Dm" (*addr) : "r" (val) : "memory"); = \ > mmiowb_set_pending(); \ > } Does not work: https://travis-ci.com/ClangBuiltLinux/continuous-integration/builds/1226548= 99 https://github.com/ClangBuiltLinux/continuous-integration/pull/197/files#di= ff-40bd16e3188587e4d648c30e0c2d6d37 --=20 Thanks, ~Nick Desaulniers