Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2982266rdb; Mon, 4 Dec 2023 13:03:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEN+VaDP3aG5aeX/opPvkxV3VNuVT9Jg0kTW13vQA3qn1L70G94yGuoFTV+frZLuDcxOcDf X-Received: by 2002:a17:902:a585:b0:1d0:6ffd:ced1 with SMTP id az5-20020a170902a58500b001d06ffdced1mr2279806plb.138.1701723832999; Mon, 04 Dec 2023 13:03:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701723832; cv=none; d=google.com; s=arc-20160816; b=bVfWw3k9Xwd3/6s3+6tF3F1JxnotCUYr3nWUDaPeX7nTfCRSYcjVP+l7Pl5HrHra24 o7mO2IV9fWtdvi/VnKibGM5oszTcUj8hVFzvOQjEvaCqDPM58S2CmSMX05O/0Xl2UZpR hP3QtwNLwRr+Cmn9qutI9nwEHh1HdOJoEW0QbtaFzPOFAWHzMxjBbaHqMtbjvNEb+h85 bXGvizVbxMYCs9HIKNQ4Xzby8hoqgqGhNvrqyHL1e3bcAI1aGCPn8QJWjBsBIzd+uC72 avC4wuKhJ6mwJ3oYyIgVl9d539EFL++XJ81QhbAhF36XxLtleK94RFhIIU0RqPiXwjyq w1nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Jl45wvWcP4iiFsyKLXsZFij0FbjKyVAo4CJ25+GOTjE=; fh=Lg0n8Kt1FzrWrrpdAJIEZ+A+M/gVozJpG8E4qEdoiqc=; b=I/CO3abUfbD3RagsFRuMKgm8JNONP1PUsoaoferYRrGIyum/j7m2YYXjcbObhJkECb xQHvNkhA9/KvNC3p44xt4JR3iGA2RIk0iQ3bvroLI5Dbmj61L0H7vnQOFa7Ylf/wTOv+ kB8hD1UCIkbCDhvoKbqWFyaqsllDl2E2w41giIiRAuPHs/5mcKIGlfHwbHCf5R5EYpDq awQndHoiiU+0jI04qxm8feAtTSYEimCfpVPX7SsfacdZg5x7OwsulLf1oIV53iLQbZKg CN7MBYTMBrMbP/KTJgmQRDcQ57FVbF+hMqAAmp2MUxg70sRn8/gTALHJw/Ieu93D9ZIR yvBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HDNqsAqB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id s5-20020a170902ea0500b001cfee3a6708si8415903plg.150.2023.12.04.13.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 13:03:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HDNqsAqB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5AD398034A51; Mon, 4 Dec 2023 13:03:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233774AbjLDVD0 (ORCPT + 99 others); Mon, 4 Dec 2023 16:03:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233724AbjLDVDZ (ORCPT ); Mon, 4 Dec 2023 16:03:25 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01411AA for ; Mon, 4 Dec 2023 13:03:31 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40c0fc1cf3dso3452905e9.0 for ; Mon, 04 Dec 2023 13:03:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701723810; x=1702328610; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jl45wvWcP4iiFsyKLXsZFij0FbjKyVAo4CJ25+GOTjE=; b=HDNqsAqB6mhHvIgxXgqCYN+9FvVqq2ZuzrBqitqc9epLJOTjh0S68vyB2+2cZ0AVzb C22JrtlpShdVXMe9JZZMMZyD1+zBTmEory0LAcOm0chnNV1ToHzLHIah5xmkG2ESNvBp O+17H4KyhTQI8eu/o9ukGXO4lZ4y1hGrkrfbAErMvwhnqVpL+jutrhBqzdk2mc2jr/4y +QVtmrHMxOAp073mpXU+eJ9C2GPs2BHSDsO2o2LrDsHuySCgo8WGLqNhh4S23Ec5iPgl eV8QLS63yKhri6JBkjBTFl1C17qi9LExhJ2ukxdidY19mvUOgIXDO1aUqCsuBc3A/8+z xfRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701723810; x=1702328610; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jl45wvWcP4iiFsyKLXsZFij0FbjKyVAo4CJ25+GOTjE=; b=SpVB9sm7r3o1JzxxPzoLYxeDQIAI3IzyUV6/SFWBmyMv3ca+zWYkAmegS6vdq3JCp8 YmaWnpKKenbBCAUmFwz/+UMJliE9xf8G5mTnh1QzoC/uYYVTkApxmT5ca3xN8regKgde w9oQmlrBXhm624oV4gfynZ6ASg/AUdD0dFxOFhiFT/2mAd2AaISlSgIhj3ljlrt6bOPX F8lTeRp9ocyIstbLW3mQemq/7KwRE+j3rBj7exUaAk9K3DYzFkM5qK1Fq6BKpkI2NsMG QKTPize1DarhIyeF03EX+xyB1vf10rdSi42Wu8Kf1aSdmhbmac6pi7v9aLoCaJD6n67U soDw== X-Gm-Message-State: AOJu0Yzbq2tglB3yAfn89j8LJhdpmA070lkzsPxt9oOCWx9DvYq/k6/Z P4SFp+mMz/eVGIYp3yzQ94D/UbyNoi8Q3TkR X-Received: by 2002:a05:600c:474e:b0:40b:47cb:5f90 with SMTP id w14-20020a05600c474e00b0040b47cb5f90mr2768696wmo.27.1701723810051; Mon, 04 Dec 2023 13:03:30 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id b18-20020a05600c4e1200b0040c08567bbfsm7414815wmq.17.2023.12.04.13.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 13:03:29 -0800 (PST) From: Uros Bizjak To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH -tip v3 2/3] x86/traps: Use current_top_of_stack() helper in traps.c Date: Mon, 4 Dec 2023 22:02:30 +0100 Message-ID: <20231204210320.114429-2-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231204210320.114429-1-ubizjak@gmail.com> References: <20231204210320.114429-1-ubizjak@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Mon, 04 Dec 2023 13:03:48 -0800 (PST) Use current_top_of_stack() helper in sync_regs() and vc_switch_off_ist() instead of reading top_of_stack percpu variable explicitly. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Signed-off-by: Uros Bizjak --- arch/x86/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index c876f1d36a81..78b1d1a6ed2c 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -772,7 +772,7 @@ DEFINE_IDTENTRY_RAW(exc_int3) */ asmlinkage __visible noinstr struct pt_regs *sync_regs(struct pt_regs *eregs) { - struct pt_regs *regs = (struct pt_regs *)this_cpu_read(pcpu_hot.top_of_stack) - 1; + struct pt_regs *regs = (struct pt_regs *)current_top_of_stack() - 1; if (regs != eregs) *regs = *eregs; return regs; @@ -790,7 +790,7 @@ asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *r * trust it and switch to the current kernel stack */ if (ip_within_syscall_gap(regs)) { - sp = this_cpu_read(pcpu_hot.top_of_stack); + sp = current_top_of_stack(); goto sync; } -- 2.42.0