Received: by 10.192.165.156 with SMTP id m28csp1387504imm; Wed, 11 Apr 2018 18:44:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx48C2gCul5DT2CDvL0bfYwHw1vE1CAwZ749Rgmbsz9fNOzNuuyXYx706VS4TK0UJWHkBnFqN X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr7407137plb.36.1523497485008; Wed, 11 Apr 2018 18:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523497484; cv=none; d=google.com; s=arc-20160816; b=jO6bC110fHdmt2keSG0VAAXZ6z59ZNIXwDdo7Y+4sp0zfkMeHK2hLD64MaI2oRx+nk yRRwocuLA8ULxOgnQkEjJ34+9yGw9JHTe5yXYhvFVFvC1+iwu37NMJT8jofgnbWJjj1c nWd6pbV+4Y1pbOOBjkAEzbRY6kY/a5Emo8aaYVDq9Y6YXE0QIWtcsmwVfo3LckwDd8ID BrNm4Xx8XNxBFKU0NxuXFQ7UFXrzcTiVyX9H0qmB+/oiFMhwKpi6q7mKBfnC/K1/pOf2 doqiNlWQucfaPAXS86RlxnaIgiASiieV+UeUBOt6TI/5vPI6iOQ2AWlw4DmzylVFyfH1 vjQQ== 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 :message-id:date:subject:cc:to:from:arc-authentication-results; bh=xC6clprfO+CBWmnPqtUXB2dGcLIwhQFsRUeWEPByTpg=; b=jcgnzLdSKmbzDEzYrSxxhgX2cDgzNSKy3RVjdh/M727+om8x6IMopsK/qTYBJHD2zk 99ykEzMZl213e/FJtXHPKno64xX91Soc879jbfqUWBIU1Twmfrt0QTXL2Mh8xD+ihpoW ztkJiC7Zjevggqunhgf0TyC6wUjWY5n8VwE5oQ5DOzmNz6p10rJet0f/qkNMOfBgYVjJ W1V156YtJt0TqFoiJadusM2ViO7Txtliz2Thmjr1yonXnhQkVwIcProjJR76GYdUqhXe k60ZrxHEZWg0H5Imd88WSwA078zZWDku9+PTueYSl7FLTkn+f3+XMPM3TJd8sBNMJPWH pNXg== ARC-Authentication-Results: i=1; mx.google.com; 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 g185si1550493pgc.155.2018.04.11.18.44.07; Wed, 11 Apr 2018 18:44:44 -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; 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 S1752622AbeDLBlI (ORCPT + 99 others); Wed, 11 Apr 2018 21:41:08 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:14445 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751870AbeDLBlH (ORCPT ); Wed, 11 Apr 2018 21:41:07 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="38797416" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 Apr 2018 09:41:03 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 864464724003; Thu, 12 Apr 2018 09:41:02 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 12 Apr 2018 09:41:01 +0800 From: Dou Liyang To: , CC: , , , , , Dou Liyang Subject: [PATCH] x86/acpi: Prevent X2APIC id 0xffffffff from being accounted Date: Thu, 12 Apr 2018 09:40:52 +0800 Message-ID: <20180412014052.25186-1-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 864464724003.A6C74 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RongQing reported that there are some X2APIC id 0xffffffff in his machine's ACPI MADT table, which made the number of possible CPU inaccuracy. The reason is that the ACPI X2APIC parser has no sanity check for apicid 0xffffffff, which is an invalid id in all APIC types. See "IntelĀ® 64 Architecture x2APIC Specification", Chapter 2.4.1. Add a sanity check to acpi_parse_x2apic() which ignores the invalid id. Reported-by: Li RongQing Signed-off-by: Dou Liyang --- arch/x86/kernel/acpi/boot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index dde444f932c1..3b20607d581b 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -215,6 +215,10 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) apic_id = processor->local_apic_id; enabled = processor->lapic_flags & ACPI_MADT_ENABLED; + /* Ignore invalid ID */ + if (apic_id == 0xffffffff) + return 0; + /* * We need to register disabled CPU as well to permit * counting disabled CPUs. This allows us to size -- 2.14.3