Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp452713rdg; Thu, 12 Oct 2023 10:10:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHx+W7Xm9CWDf/ZnlcuZ+XO1Hwnp0viFTvGt2ssOGdgIrW+p4yzdf7y0CbCu1zIdse6HPoh X-Received: by 2002:a05:6358:528f:b0:13f:411:c1a9 with SMTP id g15-20020a056358528f00b0013f0411c1a9mr33484477rwa.17.1697130638296; Thu, 12 Oct 2023 10:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697130638; cv=none; d=google.com; s=arc-20160816; b=LLmmc2amnfECbtI3hNlwanXyPPRLyPq/R8Y9i1DmFhlg/Uz7R2seWtSC3i5VoYd0fW CPLBtxSDnHQ83esCtmOneP+dBnRSyIGgQAL2cme1iDoKn9aOAQidtzJ05tCXFOKXZm6I OKkMJR8g66+6RQUxtTiGQZ3mBSee8yP30+eOb7D3k2kz4EdIFQ01Zjquy/MWdFpoDyGw a154YIxe6a96w3SILIh6zhfUwqsKhnYBPsloZpZl/51yI+NzLJYJLpQvxu3eJtOqrUTy 1ovLZU/Z2Zck3rbGJpzppby/qFc6OzlJl3pqf2RvELO8v9bc/nFWmDky1mvV41xX69y1 2uLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EkHDmoyh6OIiX8/lityBIO7Wg/uX4JOtiNj2ag3Lok4=; fh=3hMqaci1aSMG0AFmuDTcNcT9Fdla45I/j/Dj+Dy/pas=; b=R7KvF9R4nDIOrQtSMXjB6k7p55icik55Eb2fMYwYXGMxwoI4W3ke0zrmUrL1maYwxm emPBdX0BvnrclCQM+ax3gIeXr0MiN34HSMQn8bpGYt3kWgk6+zL+GsDeNNoC/+mqHvL+ z35tC9lvzHMjMFLY8HJ3p+U1JOpa06sADAwVn5vcOIhh0nL4PGR3PUMtrgbcDA8t5oXD HhS+klMJarh/tGmZmQRlbWpuvHglsZKCRRoRZFZ0ZU0gCk4LB6ApSQLEnq3k08FiyL0l bFtZG/fmoe0YKqKIl3JMf/p3MFXEj2SdPF06TLcC+KZ/VWJxrW5Q7AHmp/I065dY1SZi /9aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=FIlldSbU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ch7-20020a056a00288700b006901a8f5dadsi247938pfb.289.2023.10.12.10.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:10:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=FIlldSbU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D7AB2825D12A; Thu, 12 Oct 2023 10:10:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344082AbjJLRKe (ORCPT + 99 others); Thu, 12 Oct 2023 13:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347311AbjJLRKb (ORCPT ); Thu, 12 Oct 2023 13:10:31 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA4A3CC for ; Thu, 12 Oct 2023 10:10:28 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-99c1c66876aso197882466b.2 for ; Thu, 12 Oct 2023 10:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697130627; x=1697735427; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EkHDmoyh6OIiX8/lityBIO7Wg/uX4JOtiNj2ag3Lok4=; b=FIlldSbUyv5zdwSXLu3TSyCJVrRIJTrTBt+0bUloReizcuHtQXPIKWWmzaerfEHDUh qskyLRrNO2HZF2CqkYffCo/hiRv7TFZ/e3H9MRTBY6XKEqUmUroxL5wQ2pqVVkXmJfCQ bBLHAwrJu3ojRdNxetXBKq9w6+RcFxFWxa+6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697130627; x=1697735427; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EkHDmoyh6OIiX8/lityBIO7Wg/uX4JOtiNj2ag3Lok4=; b=R1XOTqEkSwQI9gDTJz1mswOK/DJIWRN4OgQt2rUKhIe4C3+IU7dMSaoA2MXwoNWZY8 EUA4YDD7R6J32lV7dtAKe8gbfrk3kGU7P6JRttpizJN9nXVOOse5uahG1N2rg7GBU08o QjoDvCF6pnCKSse5r9D4Cr3cP+JYWM2cU0fTZbEaBmiGpGnq1XX28OTV+pY7KMBdEKUB 8rbdBF2syE+jsnMQHkIxCa6VRMaqX7K+mYageOJN4lSC/gxYaEGs61kEsZ7ndVPGVMWK 5UK9OU6g1s1RsLfnVZxKFPHzllQmqo1tJWYZH1ngeX0chUuCpcBbtwVgfcUqrs7yFnuq mTEQ== X-Gm-Message-State: AOJu0YwK2iiT4kw08RWYuyBQG7FbGoteWrh31Mv2rRRAb/sLmWFM2Qe5 Srj7aQ4bONdm6obJirXtF1QlEsRkj2UmPeRzZwrBM6Gs X-Received: by 2002:a17:906:74db:b0:9b2:78bf:d8d4 with SMTP id z27-20020a17090674db00b009b278bfd8d4mr23333476ejl.5.1697130626989; Thu, 12 Oct 2023 10:10:26 -0700 (PDT) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com. [209.85.218.46]) by smtp.gmail.com with ESMTPSA id a24-20020a170906685800b009828e26e519sm11239581ejs.122.2023.10.12.10.10.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 10:10:26 -0700 (PDT) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-9ad8a822508so201976566b.0 for ; Thu, 12 Oct 2023 10:10:26 -0700 (PDT) X-Received: by 2002:a17:906:73d4:b0:9b8:df8e:cbdd with SMTP id n20-20020a17090673d400b009b8df8ecbddmr20214962ejl.38.1697130625765; Thu, 12 Oct 2023 10:10:25 -0700 (PDT) MIME-Version: 1.0 References: <20231010164234.140750-1-ubizjak@gmail.com> <0617BB2F-D08F-410F-A6EE-4135BB03863C@vmware.com> In-Reply-To: From: Linus Torvalds Date: Thu, 12 Oct 2023 10:10:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() To: Uros Bizjak Cc: Nadav Amit , "the arch/x86 maintainers" , Linux Kernel Mailing List , Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:10:37 -0700 (PDT) On Thu, 12 Oct 2023 at 09:55, Uros Bizjak wrote: > > An example: Oh, I'm convinced. The fix seems to be a simple one-liner, ie just - asm(__pcpu_op2_##size(op, __percpu_arg(P[var]), "%[val]") \ + asm(__pcpu_op2_##size(op, __percpu_arg(a[var]), "%[val]") \ and it turns out that we have other places where I think we could use that '%a', For example, we have things like this: asm ("lea sme_cmdline_arg(%%rip), %0" : "=r" (cmdline_arg) : "p" (sme_cmdline_arg)); and I think the only reason we do that ridiculous asm is that the code in question really does want that (%rip) encoding. It sounds like this could just do asm ("lea %a1, %0" : "=r" (cmdline_arg) : "p" (sme_cmdline_arg)); instead. Once again, I claim ignorance of the operand modifiers as the reason for these kinds of things. But coming back to the stable op thing, I do wonder if there is some way we could avoid the unnecessary reload. I don't hate Nadav's patch, so that part is fine, but I'd like to understand what it is that makes gcc think it needs to reload. We have other cases (like the ALTERNATIVE() uses) where we *have* to use inline asm, so it would be good to know... Is it just that "p" (in the constraint, not "P" in the modifier) ends up always being seen as a memory access, even when we only use the address? That part has never really been something we've been entirely clear on. We *are* passing in just the address, so the hope in *that* place is that it's only an address dependency, not a memory one. (Of course, we use 'p' constraints in other places, and may expect/assume that those have memory dependency. Again - this has never been entirely clear) Linus