Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp443165rdg; Thu, 12 Oct 2023 09:57:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLGNUrieyxOQMzCKcMnkOwY1VNECu0ANHCPc2LDS6CIoUguN8vFIV+/n3L7IifoXJHCy4q X-Received: by 2002:a05:6a21:6d87:b0:16c:b95c:6d35 with SMTP id wl7-20020a056a216d8700b0016cb95c6d35mr20809398pzb.50.1697129823015; Thu, 12 Oct 2023 09:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697129822; cv=none; d=google.com; s=arc-20160816; b=IIsdW00RM1q/f4zS/59S8gZEa3YvJMC/kzSCxcRYFOjzCn9+np5O6K/IFsft6+ZqAR oSZm6tBg9YdlfK5nIiHxn8psBIUuNei9Zb3UbfuZ4D2kllMu8FG90T2phFcTA+XfZ9xf NmLY62xMPocWat5Sr9GHq5UObvgHWcGzT4eAEo/SxFw+A+H7jMQXj1d8lBQnQIS4eIAT 5pi4MOeT790CHfqRXB7t12bq6fUGwf93HJ5jKwsvDYoTdqczpnuCAfw87g01GatRBiv4 25nGM+Rxjft/LpOZEC8JMSmbDMb57daJ9MpMo7uCjKP+QO1rok4UcFX+4HLcvWP8x761 bcrQ== 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=jmrTXUYBrl82zPk6xTsWXlr1/jpE50Bjd2FIS9se3Js=; fh=3hMqaci1aSMG0AFmuDTcNcT9Fdla45I/j/Dj+Dy/pas=; b=MYaJKiJBZm2/RsxFmac7Z0PWzSvl79Wbpg02hz8Ea82thrcAX60bLHfkYwiDQvOhzW 5b46ksodhd8zDsEQvW4qrTOOfUGWEMeKyRGNpYcyMb4xwHjq8O5BJ6gaQrCoB3V/Y+gQ RPDxNH0RqV1by/ysXQfxwWoOkdFy4DFlqTsXfTYeqLBKzxPzDpF9d6PayRlPo6/isexb m1U/HmMpRTSp6E1JscNpRH2fVgnbliuygG7OrNQdcLCeHPwpJWh40hZOFtjFXja9f1OX wmKNZjGj5SBoP36bPO7joWO1RWTaug4GrcMQwplO/KRH2Jt5jmwiLLx7yodGvoSFt2cU hXJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="gaF/Jl0W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id hk9-20020a17090b224900b0026b043c8bbesi2999553pjb.136.2023.10.12.09.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 09:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="gaF/Jl0W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 3BD0080FE2AE; Thu, 12 Oct 2023 09:57:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379519AbjJLQ4u (ORCPT + 99 others); Thu, 12 Oct 2023 12:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378915AbjJLQ4t (ORCPT ); Thu, 12 Oct 2023 12:56:49 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F085C0 for ; Thu, 12 Oct 2023 09:56:47 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9b2cee55056so209143066b.3 for ; Thu, 12 Oct 2023 09:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697129805; x=1697734605; 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=jmrTXUYBrl82zPk6xTsWXlr1/jpE50Bjd2FIS9se3Js=; b=gaF/Jl0WfZpYm4GGXPdKkPEzLHd6jnnZBRz/tZd1n+KqNo17OQSpGqZOX3gKGAARha ksTqqrCCufAjEifAab1Vc4PhGnZrS+Azw4W1J5jUWthVOFuf5ltZPPpHS2AyzwEe/FB+ bwlvwFtIfGbdm4NNzIHxSKgk8j4W2rzVV3Uzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697129805; x=1697734605; 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=jmrTXUYBrl82zPk6xTsWXlr1/jpE50Bjd2FIS9se3Js=; b=fMrLpAp0krDkLLCCl4b8gdvf3SM4aP0fKe4MKh6a7XpuZf4vQUHkXf47ltcdIZimbq RsMzy2AXrxMF764epJoQwYhCJbstNgsCOtUDFLVi1IEE707NxrfFji89fe2GSBQOo7lj LNhgmJkNG5797eickPP1hwibfMAkI24kqfnlljgtWnWJQYqbAQjdDiSab20TTzPsC0wD t6vuLXV4K6WgbV6nhKNZC7Z86MITD8Ssxd5W6fnMjjwkR93LOiFfVa77oEgHdTQE9fku JfH3GrKr8ywN1hYnswtXiNXMLqvPXcHXiFPUr5XFr70iptYRqcOQVvoeSYT8uVpcwDwt TRwg== X-Gm-Message-State: AOJu0YzfBHVT+Yx076FIovWGDvdoCSJQh2Nrm3hRf2nF/fdfzE2v8QC0 Ft7ouAYcuDQX2AlqbgytyD6D74wZlbXWNTtm/K/hyKYS X-Received: by 2002:a17:906:220c:b0:9b8:a556:87a5 with SMTP id s12-20020a170906220c00b009b8a55687a5mr20866248ejs.22.1697129805544; Thu, 12 Oct 2023 09:56:45 -0700 (PDT) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com. [209.85.218.43]) by smtp.gmail.com with ESMTPSA id gq7-20020a170906e24700b009adc5802d08sm11310289ejb.190.2023.10.12.09.56.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 09:56:44 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-9b6559cbd74so210922266b.1 for ; Thu, 12 Oct 2023 09:56:44 -0700 (PDT) X-Received: by 2002:a17:906:518e:b0:9ad:8a29:f26a with SMTP id y14-20020a170906518e00b009ad8a29f26amr22916310ejk.63.1697129804061; Thu, 12 Oct 2023 09:56:44 -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 09:56:27 -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=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Thu, 12 Oct 2023 09:57:00 -0700 (PDT) On Thu, 12 Oct 2023 at 09:33, Uros Bizjak wrote: > > For some reason existing percpu_stable_op asm uses %P operand > modifier. This will drop all syntax-specific prefixes and issue the > bare constant. It will also remove the (%rip) suffix. What we want > here is a generic %a modifier (See 6.47.2.8 Generic Operand Modifiers > [1]) that will substitute a memory reference, with the actual operand > treated as the address. In combination with "p" constraint will DTRT > and will emit symbol with the (%rip) suffix when available, also when > -fpie is in effect. Well, I have to admit that I think the main reason we used "p" as a constraint was simply that we knew about it, and I don't think I've ever even realized "a" existed. In fact, we historically didn't use a lot of operand modifiers, and the only common ones (at least for x86) tend to be the "register size" modifiers (b/w/q) I just did git grep 'asm.*[^%]%[a-z][0-9]' arch/x86 and while that will only catch one-liner inline asm cases, all it finds is indeed just the size ones. A slightly smarter grep finds a couple of uses of '%c' for bare constants. So I think the "we used P for percpu_stable_op" is really mostly a "we are not actually very familiar with the operand modifiers". We use the constraints fairly wildly, but the operand modifiers are a relative rarity. I suspect - but it's much too long ago - that some gcc person just told us that "solve this using 'P'" and we never went any further. So changing it to use 'a' sounds like the right thing to do, and we can only plead ignorance, not wilful stupidity. Linus