Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2756044rdg; Mon, 16 Oct 2023 14:00:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgCDNZbDRpltVMZLuw/YDXZVlsEtQ2Vcte6/la9gJXL6jHw23lgXoBRT/mxdbt/yN70kE4 X-Received: by 2002:a05:6a00:2d8d:b0:6b5:26ef:3261 with SMTP id fb13-20020a056a002d8d00b006b526ef3261mr296777pfb.16.1697490050041; Mon, 16 Oct 2023 14:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697490050; cv=none; d=google.com; s=arc-20160816; b=hS4eDjS6Mg/iUcJZckNa0iar8dX6FGPeD9BEc0tfsblC/cZSNrone1FNScVqPA5egx oROfFxvFDuU95OK0zywLgPDHiMsxNBVr/yibgeAAZ5vKo+cxUVf1C1oyrBbONyuco70r Il4Z/rtWxTWYqTNo0a6b9rgz7FuRzFPXEU4nCByurpejIpPTFl7ms560c7XXRCjyoKTM 84OUe/IG8IjRsqIbZSH9leuYcg0VpKCQiysbLRl8LlDspwDOTIFAmWza1zgBOx0Gr6ro FMrtQ9R+74QMZlRyVM5TuKAMCeAkke3xBY8uAdq/Yu8czskm7kXIxXCUM0Gd0x0z+8J3 +75w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zoMScRfK8cWUdYKqO6aPdGhvxLOi2B22QQaZqfT/07A=; fh=2W7QWOT4LLEZc93hpAJV9qeXTsNW2Zd+/+ufcs7IIZU=; b=MpoB2KU8YMERCrBgfqecNw3ai1LwECg8n5SJKfi88H9a/v9GMxPWnkGcJGYoUvc7Eb c+L2c7wb0rbuG935t0oSRdSDPzrarR7kcgpmYQQpsGav8DuGi82PpIsUR6nh9nnx7vh/ FjQ09WyOyVb+brAUsM4Sl/77WU29BQ6j+YbcvDTbOY5Vr9OXjM4gfN2J5rcGCqf3tx9H dhjcWHk92pYBcgwVlLfpJnIGUoXQlQ2j8LX/pD8oa6Z2LKwmOmxCI5lVhDECBGt9jPb9 KO17Go76hBuKf32ligzOCEuoxNLS2y6Kxak8LhcU1StBTe7U4f+VKYalYTW1vPNW1+Wn Gtrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=IcaGIYIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id 19-20020a631753000000b005a9b2800a06si132125pgx.787.2023.10.16.14.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 14:00:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=IcaGIYIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id DED2C807C657; Mon, 16 Oct 2023 14:00:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbjJPVAI (ORCPT + 99 others); Mon, 16 Oct 2023 17:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjJPVAH (ORCPT ); Mon, 16 Oct 2023 17:00:07 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B25F1B0 for ; Mon, 16 Oct 2023 14:00:04 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9c53e8b7cf4so126369166b.1 for ; Mon, 16 Oct 2023 14:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697490003; x=1698094803; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zoMScRfK8cWUdYKqO6aPdGhvxLOi2B22QQaZqfT/07A=; b=IcaGIYIefiuGySjjUruDRr9FBID8JBRT2VKYN0Y9Dzh72VOuyVHja5tx0Gi0cTcTer JxKD9W/QsbOse7xhVOiOQGiB9VQv0PCE1hTEX9WhsgKvnCiNgRqN/C8XQLkYGABGsW1f XspgLaa40PEJy6uwf18d6f4IuCdRKXlMJtUHY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697490003; x=1698094803; h=content-transfer-encoding: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=zoMScRfK8cWUdYKqO6aPdGhvxLOi2B22QQaZqfT/07A=; b=W9mbhDoZ7T1dfvkBnhUwom49Kx/TKZE4JTOX9d8a2IBohKy7yhJOn+JBm5UHt/4mKO 9gLEvh3NWN24TJy5L6nCnSQZCa91FNgi6kuusGcMDqKp5sajea590REXFEjnxQTUfB++ lDzJiyKe4rIWumXR8xhZhfMQ3X8w4TGHLrxAvKXRGARpyNY0rq/v3DYirgOP0uC/N9PV 25y34Ng/PF7Xu5FCZnWW38lmBjx4jMA1s8JyjujwmPzEiGl0n3zJzQhuPR6lOUJm5z04 6tJ4asCp76jOGOtmsk7UORzSdXS4K6g5z3v/VLowuoBkHTMI7W04ODK1kBABtcSqjWIS RQ2A== X-Gm-Message-State: AOJu0Yyqpd3ZQLJ1X4dyFCk9ggAKIIeUhzCvSREaatUEGKWsbWH4gzE6 4iID4pjZxGkBckYR0t0ePiR79b3tWdD/1uQSvWpDBmyr X-Received: by 2002:a17:907:a08:b0:9a2:ecd:d963 with SMTP id bb8-20020a1709070a0800b009a20ecdd963mr141972ejc.44.1697490002985; Mon, 16 Oct 2023 14:00:02 -0700 (PDT) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com. [209.85.208.49]) by smtp.gmail.com with ESMTPSA id mm12-20020a170906cc4c00b0098951bb4dc3sm4672301ejb.184.2023.10.16.14.00.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 14:00:01 -0700 (PDT) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-53e3b8f906fso6315497a12.2 for ; Mon, 16 Oct 2023 14:00:01 -0700 (PDT) X-Received: by 2002:a17:907:706:b0:9b2:b95e:3825 with SMTP id xb6-20020a170907070600b009b2b95e3825mr155914ejb.39.1697490001479; Mon, 16 Oct 2023 14:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20231010164234.140750-1-ubizjak@gmail.com> <0617BB2F-D08F-410F-A6EE-4135BB03863C@vmware.com> <7D77A452-E61E-4B8B-B49C-949E1C8E257C@vmware.com> In-Reply-To: <7D77A452-E61E-4B8B-B49C-949E1C8E257C@vmware.com> From: Linus Torvalds Date: Mon, 16 Oct 2023 13:59:44 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() To: Nadav Amit Cc: Uros Bizjak , "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" Content-Transfer-Encoding: quoted-printable 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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 14:00:18 -0700 (PDT) On Mon, 16 Oct 2023 at 13:35, Nadav Amit wrote: > > I don=E2=80=99t think it means that it the aliasing does not work; I thin= k it all means that > it actually works *too well*. Hmm. The *only* case I can think of is __switch_to() itself when doing that raw_cpu_write(pcpu_hot.current_task, next_p); and arguably that part should never have been done in C at all, but here we= are. I do think that from a sanity standpoint, it would be good to split "__switch_to()" into two: a "before stack switch" and "after stack switch", and change 'current' from within the asm section (ie do that part in __switch_to_asm"). Or maybe we should just keep the single "__switch_to()" function, but make it clear that it happens *after* current has been changed (and maybe rename it to 'funish_switch_to()" or something like that to make it clearer). Because the situation with __switch_to() right now is outright confusing, where it has 'prevp' and 'nextp', but then implicitly uses 'current' in two different ways. Ugh. Linus