Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4973713ybi; Tue, 30 Jul 2019 11:25:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIQNoVvyg+Y9dIuOkID3EfrcvRMDM08kkC9E7AP1oQx1SNAbppI5vNdo0VVMAQVaClb7y1 X-Received: by 2002:a17:902:124:: with SMTP id 33mr119124952plb.145.1564511123738; Tue, 30 Jul 2019 11:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564511123; cv=none; d=google.com; s=arc-20160816; b=QAq6wQxv8JLY3xGPDPDqqadDnqByRmBMYQhRyDmwKixZKmwBmRMMR0iyzsBOqLp/s6 AOOp+evGCAWquxfksOHvtuBI+FMAE/0T0BsL/wWHSUulO70sseBqCg5FVn7SwDOEmgBZ 5e8SUQnyoOdzKhg4oO0B/srPyBd65onzMIwxfs69Cd+3wMSW4qaeEE1GFAxBYfzlmhRE vMoFOniu86nIxXSbIUZVLL+bLM8k+WYKEigb5n3glpocIPwWpl1RWR6aV/GBwgI7hSkF Vshwvx5sAHdqwMTtgCN0w8w7PV4H/rPEzZH265qx8/b5lJPC5UMuCFZn5HCj8xWtugHK hjbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ELs8WXXvt2Nkvxci62TT76ZUPbF4S3pMgT3/gsD16Yg=; b=T/r8HJMaOopbL4vXX+r1GqjTSnpZkP6p6C8cUUj4ppX49p6i2AtiMLqOP89Sy3nPLM Dojw242oYs+9Hizz9SkeLimqSYb9IexuTJWeTGL2PjDpWm3os+uv6mxXaKzWGQtj8fKm aCDUHgimZHzm+BT3hgmzLt8wnFjONe35ff4bkIq+n3PKLogL8f8k9X+B1cm5J+QVWq85 JJ2UH4RI16Aw4NCFDeOp1EKE4ccmYkXWtkagciLPYZM8pYClmO3Fofdl5K5bNuhytkec rbsl+8lRI2gGrGIJbEFQ6kNEwB8c8SilL585ojS1n570GC5rMmYjkc9zSQmvT/2pGxwn UqBA== ARC-Authentication-Results: i=1; mx.google.com; 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 k11si26834590pll.377.2019.07.30.11.25.08; Tue, 30 Jul 2019 11:25:23 -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; 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 S1728750AbfG3SYd (ORCPT + 99 others); Tue, 30 Jul 2019 14:24:33 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33285 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbfG3SYc (ORCPT ); Tue, 30 Jul 2019 14:24:32 -0400 Received: by mail-qk1-f195.google.com with SMTP id r6so47332803qkc.0 for ; Tue, 30 Jul 2019 11:24:32 -0700 (PDT) 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; bh=ELs8WXXvt2Nkvxci62TT76ZUPbF4S3pMgT3/gsD16Yg=; b=bDEzt8bmtnk66qMuKWwlviDej60p3bMheuXWAzxg4rt8nq3rq281U2XnF3vi4Yzfsn jdizUMUFpUjEWVef6LoIpFfW2xYYTrm8VaoNFHKM7v//1LSh9ARpZb4DFFeIbtkB4dok LqHpl+oPPaU4mAwNEQb1A2j6oZrUgpTTqCA3WwkH6UveIe3tRQiFchxrPhshJgRQZcli J7RGDLRzzdCeRCFWquDRIKwhAVkNPhiKRlYhbyKycii/ISTQcK0w+kLLBzWSEP0hO1cT eE2J+9dmP6NIAp7L8dh9kVHVbYaPdZqXtxYkQBPG3erxjAydnExIBj/3QRUBKRIHb0Nh /r4g== X-Gm-Message-State: APjAAAUpGHN4qZ9iEHldnGkfWv9mlN3oDr/RDFapqvptWRuCCB1dKJG8 d4H+6qDslh9DlgQHqEOOwVw/Fg6pmGqH4Wu8FqQ= X-Received: by 2002:a37:ad12:: with SMTP id f18mr32660393qkm.3.1564511071739; Tue, 30 Jul 2019 11:24:31 -0700 (PDT) MIME-Version: 1.0 References: <20190729202542.205309-1-ndesaulniers@google.com> <20190729203246.GA117371@archlinux-threadripper> <20190729215200.GN31406@gate.crashing.org> <20190730134856.GO31406@gate.crashing.org> <20190730161637.GP31406@gate.crashing.org> In-Reply-To: <20190730161637.GP31406@gate.crashing.org> From: Arnd Bergmann Date: Tue, 30 Jul 2019 20:24:14 +0200 Message-ID: Subject: Re: [PATCH] powerpc: workaround clang codegen bug in dcbz To: Segher Boessenkool Cc: Nathan Chancellor , Nick Desaulniers , Michael Ellerman , christophe leroy , kbuild test robot , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , Linux Kernel Mailing List , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30, 2019 at 6:16 PM Segher Boessenkool wrote: > > On Tue, Jul 30, 2019 at 04:30:29PM +0200, Arnd Bergmann wrote: > > On Tue, Jul 30, 2019 at 3:49 PM Segher Boessenkool > > wrote: > > > > > > On Tue, Jul 30, 2019 at 09:34:28AM +0200, Arnd Bergmann wrote: > > > > Upon a second look, I think the issue is that the "Z" is an input argument > > > > when it should be an output. clang decides that it can make a copy of the > > > > input and pass that into the inline asm. This is not the most efficient > > > > way, but it seems entirely correct according to the constraints. > > > > > > Most dcb* (and all icb*) do not change the memory pointed to. The > > > memory is an input here, logically as well, and that is obvious. > > > > Ah, right. I had only thought of dcbz here, but you are right that using > > an output makes little sense for the others. > > > > readl() is another example where powerpc currently uses "Z" for an > > input, which illustrates this even better. > > in_le32 and friends? Yeah, huh. If LLVM copies that to the stack as > well, its (not byte reversing) read will be atomic just fine, so things > will still work correctly. byteorder is fine, the problem I was thinking of is when moving the load/store instructions around the barriers that synchronize with DMA, or turning them into different-size accesses. Changing two consecutive 16-bit mmio reads into an unaligned 32-bit read will rarely have the intended effect ;-) Arnd