Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3065917imm; Thu, 17 May 2018 02:48:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr+EiOujyijXhvBy20sne31XQkxtzgv/OcWvBhbrJhQwyJJ6l/2PawqB9TEMYi2DjlZSXq6 X-Received: by 2002:a63:6fcd:: with SMTP id k196-v6mr3549702pgc.376.1526550492438; Thu, 17 May 2018 02:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526550492; cv=none; d=google.com; s=arc-20160816; b=L1j9tFN3y5dirbqZ0SWGWYTrveCBtoCS4hM/bOfI/bKmCjIrGt0aqOfGKPAQO8xJAh 5162vBeXuOkjoG/GGjtCwwx+iODCt6qHu2esdQCXCqyEKbFh0iZgSU8KBs0utsb/U4OP T1Y7Vf+xoVnATAzQnFw8qLhkYxbdrAnQtERxZCe1UgWS0KGyw/Xwey271Mq/59EWPfqR uUsoNyKg+Da/iAJZkY9YJLoEnSaNF6Dhr7ZFqn68cN3KdP2om5lCwou6wLJ0TDNJ1Kuc cAyUI81vIWJghbLq+lkDsaBpGEfg+W5FBWjPtS8xCqPnMkYPp0io0jLKlymxxHp7jpFE Lpow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/fsnNnI3R7oXYCK9ju6gD/hdJ0r9lzrP+H/Z7xlWYXQ=; b=EvWxo/lmDPWD88rlZ0WhWRfghwpvgm7fEYIhJJslTvDSJEXFxS9RNN6AKTV1t5KA8N 5gzrYwkH5XTL733iGCMbs3tnJtXJMffds7JHMow6bIq0loz7WnXX7rdZ7JlW/gC0kQkO 1d4UP9csyR8echxVtQz0Po/3rAkjFOEh5pekCuMN2+ATxwZHpMZghtmgURU11uUDU91W KgMK/ZuTnC3sfIK3h8RBmdAsmk1pa6ClF5ip1au2XmggPNFX0vEZvjDGD8FpjmTJUIzy dJN9neL/TfeTk10lS9gBCGKesa+3Ef1c0tUKIdeW5TemOYZfJzCqfeYrA9FQAaURFKVc 08zQ== 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 z86-v6si4920717pfa.120.2018.05.17.02.47.58; Thu, 17 May 2018 02:48:12 -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 S1751815AbeEQJrS (ORCPT + 99 others); Thu, 17 May 2018 05:47:18 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:50104 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751280AbeEQJrQ (ORCPT ); Thu, 17 May 2018 05:47:16 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="40038169" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 17 May 2018 17:47:13 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id AF1764B3ED6D; Thu, 17 May 2018 17:47:09 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 17 May 2018 17:47:09 +0800 From: Dou Liyang To: , , CC: , , , , , , Dou Liyang Subject: [RFC PATCH 1/1] acpi/processor: Remove the check of duplicate processors Date: Thu, 17 May 2018 17:46:58 +0800 Message-ID: <20180517094658.18707-2-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180517094658.18707-1-douly.fnst@cn.fujitsu.com> References: <20180517094658.18707-1-douly.fnst@cn.fujitsu.com> 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: AF1764B3ED6D.ACC05 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 Now, Linux checks the duplicate processor ids at boot time based on the ACPI namespace, and using it at hotplug time. But, In fact, it doesn't work, becasue of the wrong walk in all APIC namespace entries, and even if it would be right, it may miss an hotpluggable CPU(we can hotplug one of the duplicate processor, the others can be ignored). So, Remove the check code. Signed-off-by: Dou Liyang --- drivers/acpi/acpi_processor.c | 126 ------------------------------------------ include/linux/acpi.h | 3 - 2 files changed, 129 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 449d86d39965..8358708e0bbb 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -281,13 +281,6 @@ static int acpi_processor_get_info(struct acpi_device *device) pr->acpi_id = value; } - if (acpi_duplicate_processor_id(pr->acpi_id)) { - dev_err(&device->dev, - "Failed to get unique processor _UID (0x%x)\n", - pr->acpi_id); - return -ENODEV; - } - pr->phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id); if (invalid_phys_cpuid(pr->phys_id)) @@ -579,127 +572,8 @@ static struct acpi_scan_handler processor_container_handler = { .attach = acpi_processor_container_attach, }; -/* The number of the unique processor IDs */ -static int nr_unique_ids __initdata; - -/* The number of the duplicate processor IDs */ -static int nr_duplicate_ids; - -/* Used to store the unique processor IDs */ -static int unique_processor_ids[] __initdata = { - [0 ... NR_CPUS - 1] = -1, -}; - -/* Used to store the duplicate processor IDs */ -static int duplicate_processor_ids[] = { - [0 ... NR_CPUS - 1] = -1, -}; - -static void __init processor_validated_ids_update(int proc_id) -{ - int i; - - if (nr_unique_ids == NR_CPUS||nr_duplicate_ids == NR_CPUS) - return; - - /* - * Firstly, compare the proc_id with duplicate IDs, if the proc_id is - * already in the IDs, do nothing. - */ - for (i = 0; i < nr_duplicate_ids; i++) { - if (duplicate_processor_ids[i] == proc_id) - return; - } - - /* - * Secondly, compare the proc_id with unique IDs, if the proc_id is in - * the IDs, put it in the duplicate IDs. - */ - for (i = 0; i < nr_unique_ids; i++) { - if (unique_processor_ids[i] == proc_id) { - duplicate_processor_ids[nr_duplicate_ids] = proc_id; - nr_duplicate_ids++; - return; - } - } - - /* - * Lastly, the proc_id is a unique ID, put it in the unique IDs. - */ - unique_processor_ids[nr_unique_ids] = proc_id; - nr_unique_ids++; -} - -static acpi_status __init acpi_processor_ids_walk(acpi_handle handle, - u32 lvl, - void *context, - void **rv) -{ - acpi_status status; - acpi_object_type acpi_type; - unsigned long long uid; - union acpi_object object = { 0 }; - struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; - - status = acpi_get_type(handle, &acpi_type); - if (ACPI_FAILURE(status)) - return false; - - switch (acpi_type) { - case ACPI_TYPE_PROCESSOR: - status = acpi_evaluate_object(handle, NULL, NULL, &buffer); - if (ACPI_FAILURE(status)) - goto err; - uid = object.processor.proc_id; - break; - - case ACPI_TYPE_DEVICE: - status = acpi_evaluate_integer(handle, "_UID", NULL, &uid); - if (ACPI_FAILURE(status)) - goto err; - break; - default: - goto err; - } - - processor_validated_ids_update(uid); - return true; - -err: - acpi_handle_info(handle, "Invalid processor object\n"); - return false; - -} - -static void __init acpi_processor_check_duplicates(void) -{ - /* check the correctness for all processors in ACPI namespace */ - acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - acpi_processor_ids_walk, - NULL, NULL, NULL); - acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk, - NULL, NULL); -} - -bool acpi_duplicate_processor_id(int proc_id) -{ - int i; - - /* - * compare the proc_id with duplicate IDs, if the proc_id is already - * in the duplicate IDs, return true, otherwise, return false. - */ - for (i = 0; i < nr_duplicate_ids; i++) { - if (duplicate_processor_ids[i] == proc_id) - return true; - } - return false; -} - void __init acpi_processor_init(void) { - acpi_processor_check_duplicates(); acpi_scan_add_handler_with_hotplug(&processor_handler, "processor"); acpi_scan_add_handler(&processor_container_handler); } diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 15bfb15c2fa5..068dcfe6768b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -285,9 +285,6 @@ static inline bool invalid_phys_cpuid(phys_cpuid_t phys_id) return phys_id == PHYS_CPUID_INVALID; } -/* Validate the processor object's proc_id */ -bool acpi_duplicate_processor_id(int proc_id); - #ifdef CONFIG_ACPI_HOTPLUG_CPU /* Arch dependent functions for cpu hotplug support */ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, -- 2.14.3