Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1020370ybe; Wed, 4 Sep 2019 11:14:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMKJBEmb6amPISqmpL0fisQCfvDTj9Uj6aKp0UPzWJFUlBiHxvhqiJDjf/UYOaCtVRNxzq X-Received: by 2002:a17:90a:b781:: with SMTP id m1mr6018853pjr.141.1567620895496; Wed, 04 Sep 2019 11:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620895; cv=none; d=google.com; s=arc-20160816; b=Yq6Y3wrJdxQD5QMtAOKTxvFpjGFZ0Q6uOVdQS88R6U13s0WK9B4zXzzajEwIyM2Drt NNWPVnnzEncNMTQSHsSzNTdEE7+PgYZHBwN0B+whw6C4e03crn6a/qwFvaVlRlfVt1i0 aMbw6e4MdZfFmbGpDzn7j9vQk7/Txv3Ob2G1qFeiIfMArStCPzz6hBMcpyONiaZdUNWp MjAyAJIKkweEDHCGpiDq1EDU6W/BkpMM25xbP/lMo+S/rPwBk9Ty4Vcc8KVT6sBEWFZe iTnfAeIxC4LhwCz+xCDP1Ks5uIL4LktM05qw7O7FNP2zcFhtSybbbWZxlF8eGgScEBUA lSjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N8GiM7UvhFFSdmei0PyDcM7i9qN8vgwyU/qgxfx9kTc=; b=Ru93vNElfUFiBfdhmck3RLdgQQtmNVOuYp1sb1IHx7jadsubAJ5cvbonl3oM8iUQ0P Uc7KfkG/I3bxduHs7CRzYwgmU48lHyBmAplu9n2Y/Qdo/6jBBBd/41AAzUmDA6KAMIU1 n2uMP7d2Qa26NPpTt8ulczXiTRSSDQZb1uqgAQyuxE3T1xm8yKJNrm3cQ1lgyBuFJydZ eO4AWsFt1KTl0YLJkC05M5PJKcXfP/d6I/0lnd58zV6sqQN9ApyM43MbMkwqNU1lCLGj FPlecXh+mdzLhF4v1uZ0dL8G0ki1TB1jPBwcrWfUy0+gJxjn7GTnPxRK/t2xNNPbygR/ +B/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JX42eqny; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c189si21502144pfa.110.2019.09.04.11.14.40; Wed, 04 Sep 2019 11:14:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JX42eqny; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390448AbfIDSMH (ORCPT + 99 others); Wed, 4 Sep 2019 14:12:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:56348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390442AbfIDSME (ORCPT ); Wed, 4 Sep 2019 14:12:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03F7D206BA; Wed, 4 Sep 2019 18:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620723; bh=pfHA4ghX1sdzBre+QSIFvxbGOXnT+CmSpcZh5msUerA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JX42eqny7++XwhZ/KMIafdmlmEOEZ7cMOF10H+rphqjUtOujAKXrHrm8RN19TUoLI Tj31jt6vHIPIqNZG8abqGYuOdfPrugNwTmiAhlbtVTv9wUhbQngamb5RIzDnfF2cMb 3LT/5Dc2AK3QAgzuE59+kbTZCCkd1AMQ10XAyZ5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Bandan Das Subject: [PATCH 5.2 072/143] x86/apic: Do not initialize LDR and DFR for bigsmp Date: Wed, 4 Sep 2019 19:53:35 +0200 Message-Id: <20190904175316.874622073@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bandan Das commit bae3a8d3308ee69a7dbdf145911b18dfda8ade0d upstream. Legacy apic init uses bigsmp for smp systems with 8 and more CPUs. The bigsmp APIC implementation uses physical destination mode, but it nevertheless initializes LDR and DFR. The LDR even ends up incorrectly with multiple bit being set. This does not cause a functional problem because LDR and DFR are ignored when physical destination mode is active, but it triggered a problem on a 32-bit KVM guest which jumps into a kdump kernel. The multiple bits set unearthed a bug in the KVM APIC implementation. The code which creates the logical destination map for VCPUs ignores the disabled state of the APIC and ends up overwriting an existing valid entry and as a result, APIC calibration hangs in the guest during kdump initialization. Remove the bogus LDR/DFR initialization. This is not intended to work around the KVM APIC bug. The LDR/DFR ininitalization is wrong on its own. The issue goes back into the pre git history. The fixes tag is the commit in the bitkeeper import which introduced bigsmp support in 2003. git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Fixes: db7b9e9f26b8 ("[PATCH] Clustered APIC setup for >8 CPU systems") Suggested-by: Thomas Gleixner Signed-off-by: Bandan Das Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20190826101513.5080-2-bsd@redhat.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/apic/bigsmp_32.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c @@ -38,32 +38,12 @@ static int bigsmp_early_logical_apicid(i return early_per_cpu(x86_cpu_to_apicid, cpu); } -static inline unsigned long calculate_ldr(int cpu) -{ - unsigned long val, id; - - val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; - id = per_cpu(x86_bios_cpu_apicid, cpu); - val |= SET_APIC_LOGICAL_ID(id); - - return val; -} - /* - * Set up the logical destination ID. - * - * Intel recommends to set DFR, LDR and TPR before enabling - * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel - * document number 292116). So here it goes... + * bigsmp enables physical destination mode + * and doesn't use LDR and DFR */ static void bigsmp_init_apic_ldr(void) { - unsigned long val; - int cpu = smp_processor_id(); - - apic_write(APIC_DFR, APIC_DFR_FLAT); - val = calculate_ldr(cpu); - apic_write(APIC_LDR, val); } static void bigsmp_setup_apic_routing(void)