From patchwork Wed Aug 9 20:36:09 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: 133556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp30833vqi; Wed, 9 Aug 2023 14:59:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlVIYW7B+m5xOEXKBvX5iM8REtw0UZvISfbQPAuhOX1ciOxpkcZ2VdnTQi++qoD9tXLZMd X-Received: by 2002:a05:6a20:8f29:b0:126:42ce:bd44 with SMTP id b41-20020a056a208f2900b0012642cebd44mr229666pzk.17.1691618391524; Wed, 09 Aug 2023 14:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691618391; cv=none; d=google.com; s=arc-20160816; b=FPNng4zxteQDrYQzObihGw9Mxvr0FJKc+D0EnorOhdJNlHNuzSohUkE4ZHxylDRgxr hpqCroeiymmba+TnmrQ4z6OC4i86hd8+arRlg/aazq29t8GiF9JDIz8mPOAnFMbUa5tg 2aBZFLpeIgr+h+sUQ00+ybBxOPWdNJH/6iZ/AdVo7CsQSqF5RIGykPWL3+cPGPm78mZG MVPcZ+x3w79/SC4Q1EfA4Cic713EmTZOtEjNxrURGLAazirixxoWTVdgZ0Aei49m0JZ+ qeDJrb1JEXmgwDRj19I2rCKIKUTkC1tDz5kZJS1E/IRXhRnMgv6NoIfrCDOsWtyRy6da Mf9g== 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=vZC+MMNaenBhj07GBnw7x7mIB9D3DZZseP5+hGYx4qs=; fh=jBwjuriIPWA1lnCf5oMMiNAPpgGE0iGPmBzZMsd85oQ=; b=Zz+N9fswmszBxIB40wKq7F0tBDfICsZaqHqp7b1hvCRHBLmMLxAz3I0/J9AWKjPScB duz1IPBbkF2F7snIoj9ABoF/nY2kaCQ5q8O0eSJT/sz91cYMF8cvhdt1IaLPfw+pBDpC YwjnnvjVtUJT4o/0tRO6WVqBkaVQxqV5oGFnfqBgeCTag6wr3YCEZLlmoV/bctGCUR3j vNFtFbe8TVvQOo9vm3MM79jPgOD/V8GfHjTPqHiHOYkX8pTiV3QWtss4WK393tC+Rv8W 5YBnssh4YepxMonBmzepiO02U8HhVkeLdJ0Cl+PR6JrLhUjGQq3Z8yklsqowxuivSRYh AHLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OXUnqFYf; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=OJTTjtQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e24-20020a633718000000b0055adb191739si155440pga.62.2023.08.09.14.59.37; Wed, 09 Aug 2023 14:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OXUnqFYf; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=OJTTjtQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234621AbjHIUgq (ORCPT + 99 others); Wed, 9 Aug 2023 16:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234566AbjHIUgR (ORCPT ); Wed, 9 Aug 2023 16:36:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D22882125; Wed, 9 Aug 2023 13:36:11 -0700 (PDT) Date: Wed, 09 Aug 2023 20:36:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691613370; 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=vZC+MMNaenBhj07GBnw7x7mIB9D3DZZseP5+hGYx4qs=; b=OXUnqFYfNZqjfT0H+Ruj+UvzDc8q/z2rg8a5zvhdijlFEki5ZP2k3zfmXz0uEuFySIS9dR AxKVNDO7msEIithSCIrJdLHLUojY4UKX8EH48RqEKK0AsmjkhyactD6icRyhQBfqosIjka jNr4okqx1Kk9sdBpLzV0Fzr5fXsQsSCBiJKSHdhVA+nIoKmMN660qlJrebxzF5u+M1GmIo SVbQ7zti9BEnuYsyr75Xz4mLCsZvMxH/9x/aQH9ufLphja0LFhj3hDU5721q9aVxft5AmX QBa1NweRJdl3Iezx7ZEwDvD2FwF3wazOG8uUMBVpyP6Kp3DDFkt9pVMS69kiEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691613370; 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=vZC+MMNaenBhj07GBnw7x7mIB9D3DZZseP5+hGYx4qs=; b=OJTTjtQ3mSgbhJ0YYWcZJ2eFJVeoclMLCouDb38IkVgxj1cpZLr1UveBTvh1d2WWMFZ5l5 6q+7VrWG024OhwCg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/apic] x86/apic/noop: Tidy up the code Cc: Thomas Gleixner , Dave Hansen , "Peter Zijlstra (Intel)" , Michael Kelley , Sohil Mehta , Juergen Gross , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169161336997.27769.6634475409776925662.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773790446254698885 X-GMAIL-MSGID: 1773790446254698885 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 3600ceb0df845beb7a204ab599aaff1213129314 Gitweb: https://git.kernel.org/tip/3600ceb0df845beb7a204ab599aaff1213129314 Author: Thomas Gleixner AuthorDate: Tue, 08 Aug 2023 15:04:14 -07:00 Committer: Dave Hansen CommitterDate: Wed, 09 Aug 2023 11:58:33 -07:00 x86/apic/noop: Tidy up the code First of all apic_noop can't be probed because it's not registered. So there is no point for implementing a probe callback. The machine is rightfully to die when that is invoked. Remove the gunk and tidy up the other space consuming dummy callbacks. This gunk should simply die. Nothing should ever invoke APIC callbacks once this is installed, But that's a differrent story for another round of cleanups. The comment on top of this file which was intentionally left in place tells exactly why this is needed: voodoo programming. In fact the kernel of today should just outright refuse to boot on a system with no (functional) local APIC. That would spare tons of #ifdeffery and other nonsense. Signed-off-by: Thomas Gleixner Signed-off-by: Dave Hansen Acked-by: Peter Zijlstra (Intel) Tested-by: Michael Kelley Tested-by: Sohil Mehta Tested-by: Juergen Gross # Xen PV (dom0 and unpriv. guest) --- arch/x86/kernel/apic/apic_noop.c | 38 ++++++------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c index 28b693b..e33bea0 100644 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c @@ -8,6 +8,10 @@ * Though in case if apic is disabled (for some reason) we try * to not uglify the caller's code and allow to call (some) apic routines * like self-ipi, etc... + * + * FIXME: Remove this gunk. The above argument which was intentionally left + * in place is silly to begin with because none of the callbacks except for + * APIC::read/write() have a WARN_ON_ONCE() in them. Sigh... */ #include #include @@ -21,35 +25,10 @@ static void noop_send_IPI_allbutself(int vector) { } static void noop_send_IPI_all(int vector) { } static void noop_send_IPI_self(int vector) { } static void noop_apic_icr_write(u32 low, u32 id) { } - -static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) -{ - return -1; -} - -static u64 noop_apic_icr_read(void) -{ - return 0; -} - -static int noop_phys_pkg_id(int cpuid_apic, int index_msb) -{ - return 0; -} - -static unsigned int noop_get_apic_id(unsigned long x) -{ - return 0; -} - -static int noop_probe(void) -{ - /* - * NOOP apic should not ever be - * enabled via probe routine - */ - return 0; -} +static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) { return -1; } +static u64 noop_apic_icr_read(void) { return 0; } +static int noop_phys_pkg_id(int cpuid_apic, int index_msb) { return 0; } +static unsigned int noop_get_apic_id(unsigned long x) { return 0; } static u32 noop_apic_read(u32 reg) { @@ -64,7 +43,6 @@ static void noop_apic_write(u32 reg, u32 val) struct apic apic_noop __ro_after_init = { .name = "noop", - .probe = noop_probe, .delivery_mode = APIC_DELIVERY_MODE_FIXED, .dest_mode_logical = true,