Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2341547imm; Thu, 23 Aug 2018 19:53:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZizuzYA2oxmtkx5HujxF0Ipx3zWG4Z6SsfvlqqxH8rpP+av286YuzlAb0CJ8TzQKh/VLFt X-Received: by 2002:a62:c805:: with SMTP id z5-v6mr15015613pff.44.1535079234565; Thu, 23 Aug 2018 19:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535079234; cv=none; d=google.com; s=arc-20160816; b=Mhns99esJiGoOLGVANpMDIHUYajCy9qa7sWBcCvyhvZ09ddlxYmeJnhZicqANvf1A1 rT5DHC3dJe15PYMIrDTQPPZmxujvyftsx2sHczJegdrAvvV58QVhOPjDoOmHRtTstq2H 3RW5kM8OvMW2U5hQlVn1UHzgXqNaTSXj4Jpb2Uv6U9xNOtEjOAW5ZoXSEQrMe0Qs/F9o jCBuG2mRVXaObS2GxzS+RZcj3JleodeuQfi2MwgK3nvrGND20113BJKbzDqsX7X8UjnI tLiOzr3y1JWKMM0/TkyV5FB2xV2Scr2SOJNKW2Q7jZULiZPILz/ZyeFghK2qtxR4Xapi S8Gg== 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=ZYLj145rfdQ/4lbnk87zEnXayvbrtkjJ0zYN0McB8yQ=; b=MPHeEVX1YkwsMbBh6XmqjAwEyfYPezI7NVjE66rNFvQs+ZOTZ4NcXfnebh64bUMeiQ LMRP47xXLQSXIbJewcZJJSuYDIzVvISYAoI3F5Vkgg0h1/d7nd4KEbXa+yMQwSdO8OFq UhGdGquHwRi8HxqVOp8c8Zo3TJL63psaTAk2380Qy4cRAMYflfGpZ2coBNgdIju/daQV 7esjP0Rj02tDEvO4u1WESW3ondptgcdUPRojwVSCSp7hsE1TVwfURz72VPLXbkVRH6Bc yiWype0ljv/bgrjI/sgWhCLleip995E66QApcbcfEEDSfcWo6uaDga/oCloenA1mkhJS AH8g== 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 bh12-v6si5167632plb.425.2018.08.23.19.53.26; Thu, 23 Aug 2018 19:53:54 -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 S1726644AbeHXGYO (ORCPT + 99 others); Fri, 24 Aug 2018 02:24:14 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:37339 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726140AbeHXGYO (ORCPT ); Fri, 24 Aug 2018 02:24:14 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="43888538" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 24 Aug 2018 10:51:39 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id A7B224B6AE02; Fri, 24 Aug 2018 10:51:36 +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.408.0; Fri, 24 Aug 2018 10:51:36 +0800 From: Dou Liyang To: , , CC: , , , , , Dou Liyang Subject: [PATCH v3] acpi/processor: Fix the return value of acpi_processor_ids_walk() Date: Fri, 24 Aug 2018 10:51:26 +0800 Message-ID: <20180824025126.19231-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: A7B224B6AE02.AB934 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 ACPI driver should make sure all the processor IDs in their ACPI Namespace are unique. the driver performs a depth-first walk of the namespace tree and calls the acpi_processor_ids_walk() to check the duplicate IDs. But, the acpi_processor_ids_walk() mistakes the return value. If a processor is checked, it returns true which causes the walk break immediately, and other processors will never be checked. Repace the value with AE_OK which is the standard acpi_status value. And don't abort the namespace walk even on error. Fixes 8c8cb30f49b8 ("acpi/processor: Implement DEVICE operator for processor enumeration") Signed-off-by: Dou Liyang --- Changelog: v2 --> v3: - Fix a compiler error reported by LKP v1 --> v2: - Fix the check against duplicate IDs suggested by Rafael. Now,the duplicate IDs only be found in Ivb42 machine, and we have added this check at linux-4.9. But, we introduced a bug in linux-4.12 by commit 8c8cb30f49b8. For resolving the bug, firstly, I removed the check[1]. because Linux will compare the coming ID with present processors when it hot-added a physical CPU and will avoid using duplicate IDs. But, seems we should consider all the possible processors. So, with this patch, All the processors with the same IDs will never be hot-plugged. [1] https://lkml.org/lkml/2018/5/28/213 --- drivers/acpi/acpi_processor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 449d86d39965..fc447410ae4d 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -643,7 +643,7 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle, status = acpi_get_type(handle, &acpi_type); if (ACPI_FAILURE(status)) - return false; + return status; switch (acpi_type) { case ACPI_TYPE_PROCESSOR: @@ -663,11 +663,12 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle, } processor_validated_ids_update(uid); - return true; + return AE_OK; err: + /* Exit on error, but don't abort the namespace walk */ acpi_handle_info(handle, "Invalid processor object\n"); - return false; + return AE_OK; } -- 2.14.3