From patchwork Fri Oct 20 10:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 155966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp956496vqb; Fri, 20 Oct 2023 03:29:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHonLxPclRRxT9uabtTrrdGZDBMorHjCtroZCSac7lL8IQ7D0zYWI5s6H5cxyWXfbyY6eJR X-Received: by 2002:aca:171a:0:b0:3b2:e30d:9d68 with SMTP id j26-20020aca171a000000b003b2e30d9d68mr1345334oii.32.1697797767695; Fri, 20 Oct 2023 03:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697797767; cv=none; d=google.com; s=arc-20160816; b=g6TqzFVJhdOkULjNLzHH68RefQq5fuKgoRa1Rkkhp7ySd+of+Q56o0NZMt71GEgP/J jDJjiA9LA0SMk1Z3FFaC1lg+yoJZxeikiKXUl62coiTAiVezv1g9y29JZyLwg6kTf0Gx jjv2166s0bREtvEGz8qekmxWmAswzVOELjr8I2WaB0QzqaY9sMS2vIOVcXr0r/lZuYS/ D1h+6Ih/68DELHO/p3lminLnJxCNoZ5Eay3yrKPX8gncJURuAqHpQY+wU4YPiXd6A6an 4v2FZO/z/bNrg8vcFwMhSiyzKC3SRTjECUKlf5AjBhbxb5uH1dvCg6y2tXN9GnMLMCv2 r4jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=ryI+sETQfH56NeQ9taaTVEPrYa8hd8IGX1KE8MVorwE=; fh=FfchO95qmkjXvblag29f40bB1tfNHKjKJM0bKslVfqQ=; b=hr+LD2G9t4EQ/7gvGgV0X/ZqMU19gqtFgarccvkQ5aIvsDREl43zXlUV5e1eLs9wYW UYbAkNPBiRJoV/72ZPDuU2alD9DB/VvsG/3Kk1pQvDt5pqtKz8lxEVmvHyDxZ6Cg0Ej2 vbmwMawjjggByvsfp+ECLy5jFcgh71p7nMBBYr7sdu0kKVlW6PO6hPQOLxGDdd6i+6+H YQokYsNrw4YL7Len5XREFOSqMUkUJesoeaieuD9LEqF2Yg3+UPc6WL0p8c7cznzX5Ev4 BwFlMgHnxq9av1DsJQJKiRtOWpzxX/nARLotVbybelj8+1PMs9vmqUxcPTA+Q0FJnILw r05Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1WV+HfZp; dkim=neutral (no key) header.i=@linutronix.de header.b=L1nmvbQ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id u189-20020a6385c6000000b005b64e8336dfsi1520585pgd.604.2023.10.20.03.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1WV+HfZp; dkim=neutral (no key) header.i=@linutronix.de header.b=L1nmvbQ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 35F2E83C9F92; Fri, 20 Oct 2023 03:29:25 -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 S1376776AbjJTK3D (ORCPT + 25 others); Fri, 20 Oct 2023 06:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376843AbjJTK3A (ORCPT ); Fri, 20 Oct 2023 06:29:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B0CD53; Fri, 20 Oct 2023 03:28:58 -0700 (PDT) Date: Fri, 20 Oct 2023 10:28:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697797736; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ryI+sETQfH56NeQ9taaTVEPrYa8hd8IGX1KE8MVorwE=; b=1WV+HfZpH5662UaeVeD9KsqGvZ13OqZucDjRDqt1/W554Lx16VOTIpPnWYhZeGQhGnzYCy l8hsXEO90NBCmNuLa7fCzCc8RzcX5IIRc7q086BZJQ6Azz4pk4XayMzyj9zJ2eekKGt0Uy LE7frxOixwnBjWRjtrVHbwcyGeFf5RzqnpwfRkSgk7HU2eFMS+Jm/iiniwt2KMvWyYkmPR CGf5InUcTwFyOIhYPsIrBcI3zCzvfJ4wZAKV1gbBeZ3hit46lon6krRruKMzFAc8RIxmka mwn1/nCzeZVb1arqdNiBH6MF45WGQaEoQUbIF9Kr6Cj0dzbyNRXMQ4tMt8RDsQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697797736; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ryI+sETQfH56NeQ9taaTVEPrYa8hd8IGX1KE8MVorwE=; b=L1nmvbQ2ryEmmdgEKbWvTPcH/BYqJR9vexF4CQZVVi6KwClTLPCg2Pa0+NZhqVDZ3ecoJQ uvf5qNkHzkjv4LDw== From: "tip-bot2 for Uros Bizjak" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/percpu] x86/percpu: Correct PER_CPU_VAR() usage to include symbol and its addend Cc: Uros Bizjak , Ingo Molnar , linux-kernel@vger.kernel.org, Brian Gerst , "H. Peter Anvin" , Linus Torvalds , Sean Christopherson , x86@kernel.org MIME-Version: 1.0 Message-ID: <169779773584.3135.2298093434527491915.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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]); Fri, 20 Oct 2023 03:29:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780269991900907731 X-GMAIL-MSGID: 1780269991900907731 The following commit has been merged into the x86/percpu branch of tip: Commit-ID: 39d64ee59ceee0fb61243eab3c4b7b4492f80df2 Gitweb: https://git.kernel.org/tip/39d64ee59ceee0fb61243eab3c4b7b4492f80df2 Author: Uros Bizjak AuthorDate: Tue, 17 Oct 2023 18:27:32 +02:00 Committer: Ingo Molnar CommitterDate: Fri, 20 Oct 2023 12:19:51 +02:00 x86/percpu: Correct PER_CPU_VAR() usage to include symbol and its addend The PER_CPU_VAR() macro should be applied to a symbol and its addend. Inconsistent usage is currently harmless, but needs to be corrected before %rip-relative addressing is introduced to the PER_CPU_VAR() macro. No functional changes intended. Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Cc: linux-kernel@vger.kernel.org Cc: Brian Gerst Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Sean Christopherson --- arch/x86/entry/calling.h | 2 +- arch/x86/entry/entry_32.S | 2 +- arch/x86/entry/entry_64.S | 2 +- arch/x86/kernel/head_64.S | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index f690762..47368ab 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -173,7 +173,7 @@ For 32-bit we have the following conventions - kernel is built with .endm #define THIS_CPU_user_pcid_flush_mask \ - PER_CPU_VAR(cpu_tlbstate) + TLB_STATE_user_pcid_flush_mask + PER_CPU_VAR(cpu_tlbstate + TLB_STATE_user_pcid_flush_mask) .macro SWITCH_TO_USER_CR3_NOSTACK scratch_reg:req scratch_reg2:req ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 6e6af42..d4e094b 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -305,7 +305,7 @@ .macro CHECK_AND_APPLY_ESPFIX #ifdef CONFIG_X86_ESPFIX32 #define GDT_ESPFIX_OFFSET (GDT_ENTRY_ESPFIX_SS * 8) -#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + GDT_ESPFIX_OFFSET +#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page + GDT_ESPFIX_OFFSET) ALTERNATIVE "jmp .Lend_\@", "", X86_BUG_ESPFIX diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index b940e92..6d23665 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -252,7 +252,7 @@ SYM_FUNC_START(__switch_to_asm) #ifdef CONFIG_STACKPROTECTOR movq TASK_stack_canary(%rsi), %rbx - movq %rbx, PER_CPU_VAR(fixed_percpu_data) + FIXED_stack_canary + movq %rbx, PER_CPU_VAR(fixed_percpu_data + FIXED_stack_canary) #endif /* diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index ea69959..bfe5ec2 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -449,7 +449,7 @@ SYM_CODE_START(soft_restart_cpu) UNWIND_HINT_END_OF_STACK /* Find the idle task stack */ - movq PER_CPU_VAR(pcpu_hot) + X86_current_task, %rcx + movq PER_CPU_VAR(pcpu_hot + X86_current_task), %rcx movq TASK_threadsp(%rcx), %rsp jmp .Ljump_to_C_code