From patchwork Tue Dec 20 05:34:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 34905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2788640wrn; Mon, 19 Dec 2022 21:45:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4pCuiYwYBV5rOUhkOINnxDthtSyEhZOAAHVbDSmiI9M23ZLmIiNFpNyV2efqAU3KL+osJr X-Received: by 2002:a17:90b:23cf:b0:219:d98d:19d with SMTP id md15-20020a17090b23cf00b00219d98d019dmr48505058pjb.32.1671515121386; Mon, 19 Dec 2022 21:45:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671515121; cv=none; d=google.com; s=arc-20160816; b=wkIVIfetQPjFO9d9OJ/NmtXIcrBMqkgCrt8VTjMAukIpljy7gPwccDc6hYm6nG+7Ue bgrgsaOOq+q7JLv/0XiipyOBaSkC1Q7sU8bzUTgD0UkC/C3i/806QltDlGD70SFP8Y1E T8a9eJUAJKpXSzImvBtEJVeJvj4tD0Ygr7PX4QvLZ20ANNkDRgbsrRR80cmCvzYyOf02 pYs4wybh7crmumD6LogywTmdMQ5aeoeE+PvcZQFEMPzJsMeH1yRXRDG4KdwjPJcfvqAe uv7uiVDdnZJNLcpJmULpSsV5aP00P1P5QH3GfRWuQKw0X3DsxuTjd8WoZreJ2HMU0Ogr DrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=KBR2HoyzcWG2X3wTGI85w2emZlqY9KWE0Xp/R0+BIqA=; b=OQXHuAm1YcoofYcRK+ZIfMajuX4b9Z9TtV+q9QsOUQBz0wL0yITWD6QsPQo9pAo9LK wsU7XHcI6LMNM8iw4EBTGoyhaKBtl4j4Xz1aILNPXlnpa4xf3TL/SPVgMJ1B1z3FfcND +6FT94bG7+cobWlNqMw3q0ecJKiE3SM7btB+m32xd4g6yu21iKHjPWaq+sGtz22W0qO9 1LAq1YStjCsZFpBiLK7GEC7d61SoJ43aLFSg3db5/NSKQ7sKr5oIlq1MSU6UX4Yvzs/f 5UqoO6HmMmVGLKuNc3hK42PwuFAdvwbt6E1fQiQU96VHgqhmxl5IkgdwIG+yLwk17jkf BF9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ibNhADfU; 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=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a17090a7b8600b001faf26eed66si11569007pjc.150.2022.12.19.21.45.08; Mon, 19 Dec 2022 21:45:21 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=ibNhADfU; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbiLTFgK (ORCPT + 99 others); Tue, 20 Dec 2022 00:36:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiLTFgG (ORCPT ); Tue, 20 Dec 2022 00:36:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682E1633D for ; Mon, 19 Dec 2022 21:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671514515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=KBR2HoyzcWG2X3wTGI85w2emZlqY9KWE0Xp/R0+BIqA=; b=ibNhADfUDOGkRsHJfO/xqOclaNOk5qTJ3XUBoVCWI01ID6ULYWTy8qfRHao/YFOJX/OTLc HhPIAXjH/x9+63Ejc4u7hS5LMaEsI7nYsf8kJKjtwtQIJ8naQaI/XcJjaOwduQFZfz7Fty iyFJsTJ/PKHDYcf9+WUxRwyCXL2PYGo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-387-x2XfTH3VMIGI2u9l5pJ6Ew-1; Tue, 20 Dec 2022 00:35:10 -0500 X-MC-Unique: x2XfTH3VMIGI2u9l5pJ6Ew-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F92280D0E4; Tue, 20 Dec 2022 05:35:10 +0000 (UTC) Received: from localhost (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D82D40C2004; Tue, 20 Dec 2022 05:35:01 +0000 (UTC) Date: Tue, 20 Dec 2022 13:34:58 +0800 From: Baoquan He To: linux-kernel@vger.kernel.org, Thomas Gleixner Cc: x86@kernel.org, kexec@lists.infradead.org Subject: [PATCH] Revert "x86/apic/x2apic: Implement IPI shorthands support" Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,UPPERCASE_75_100 autolearn=no 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752710639868502315?= X-GMAIL-MSGID: =?utf-8?q?1752710639868502315?= This reverts commit 43931d350f30c6cd8c2f498d54ef7d65750abc92. On kvm guest with 4 cpus deployed, when adding 'nr_cpus=2' to normal kernel's cmdline, and triggering crash to jump to kdump kernel, kdump kernel will stably hang. Reverting commit 43931d350f30 ("x86/apic/x2apic: Implement IPI shorthands support") can fix it. The problem will disappear if removing 'nr_cpus=2' from normal kerne's cmdline. Tried on several bare metal systems, this issue can't be stably reproduced. On several systems, kdump kernel can always succeed. On some systems, kdump kernel randomly failed, not sure if it's the same issue as the one on kvm guest. On some systems, there's another random hang with tick_periodic() call trace, I will report it in another mail. Signed-off-by: Baoquan He Tested-by: Baoquan He --- This is reproduced stably on kvm guest with Fedora. Attached the kernel config for reference just in case. arch/x86/kernel/apic/local.h | 1 - arch/x86/kernel/apic/x2apic_cluster.c | 4 ++-- arch/x86/kernel/apic/x2apic_phys.c | 13 ++----------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/apic/local.h b/arch/x86/kernel/apic/local.h index a997d849509a..59b91f7708d8 100644 --- a/arch/x86/kernel/apic/local.h +++ b/arch/x86/kernel/apic/local.h @@ -24,7 +24,6 @@ unsigned int x2apic_get_apic_id(unsigned long id); u32 x2apic_set_apic_id(unsigned int id); int x2apic_phys_pkg_id(int initial_apicid, int index_msb); void x2apic_send_IPI_self(int vector); -void __x2apic_send_IPI_shorthand(int vector, u32 which); /* IPI */ diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index e696e22d0531..d95b49fac01a 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -90,12 +90,12 @@ x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) static void x2apic_send_IPI_allbutself(int vector) { - __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLBUT); + __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT); } static void x2apic_send_IPI_all(int vector) { - __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLINC); + __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC); } static u32 x2apic_calc_apicid(unsigned int cpu) diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 6bde05a86b4e..18c5201d1cb1 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -83,12 +83,12 @@ static void static void x2apic_send_IPI_allbutself(int vector) { - __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLBUT); + __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT); } static void x2apic_send_IPI_all(int vector) { - __x2apic_send_IPI_shorthand(vector, APIC_DEST_ALLINC); + __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC); } static void init_x2apic_ldr(void) @@ -123,15 +123,6 @@ void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest) native_x2apic_icr_write(cfg, apicid); } -void __x2apic_send_IPI_shorthand(int vector, u32 which) -{ - unsigned long cfg = __prepare_ICR(which, vector, 0); - - /* x2apic MSRs are special and need a special fence: */ - weak_wrmsr_fence(); - native_x2apic_icr_write(cfg, 0); -} - unsigned int x2apic_get_apic_id(unsigned long id) { return id;