From patchwork Sat Oct 6 15:27:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 1558461 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8625A40D7F for ; Sat, 6 Oct 2012 15:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755392Ab2JFPgr (ORCPT ); Sat, 6 Oct 2012 11:36:47 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:55513 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755013Ab2JFPgn (ORCPT ); Sat, 6 Oct 2012 11:36:43 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so2756563pad.19 for ; Sat, 06 Oct 2012 08:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=eI0vB9QWeZsNNYpRRze+3BQjkOU8IOvNfoEUWzMoZX0=; b=NUMGiW9LIY7wNt2RjudrQCp2hbNgjW7o4QEUjsXwRN5Ko5EaPO/Mq5IDDfGAEcyGVq et8dp5T8ojlPeGTK9+JBvEk8v3VjSu/T4T7iJtFzEZ0OY/fZB4kfVUvuIjGuyfLbLUdv NPumv3h/V13RuJkWsfF9fzAazFhUyVGNCHYcRFnCQCS62Hce2Tbgj3rinc4K/LbGabx0 oTHuY56KM0rnlD9niEvUASTDlP5rV80s0My+OxAvSPCR7urmC+zpokmn+/xPCC1/Xlzy NdDGWaqQGE1ioFYKw9ZmFrLbj7mAKD+K1J3ZDn3W+jvDxfvrtrypx8VCbN/fNrOG4GDU NVvg== Received: by 10.68.232.194 with SMTP id tq2mr39234303pbc.111.1349537803381; Sat, 06 Oct 2012 08:36:43 -0700 (PDT) Received: from localhost.localdomain ([221.221.24.247]) by mx.google.com with ESMTPS id vz8sm7785292pbc.63.2012.10.06.08.36.31 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 06 Oct 2012 08:36:43 -0700 (PDT) From: Jiang Liu To: Yinghai Lu , Yasuaki Ishimatsu , Kenji Kaneshige , Wen Congyang , Tang Chen , Taku Izumi Cc: Hanjun Guo , Yijing Wang , Gong Chen , Jiang Liu , Tony Luck , Huang Ying , Bob Moore , Len Brown , "Srivatsa S . Bhat" , Bjorn Helgaas , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Subject: [RFC PATCH v3 28/28] ACPI/processor: serialize call to acpi_map/unmap_lsapic Date: Sat, 6 Oct 2012 23:27:36 +0800 Message-Id: <1349537256-21670-29-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349537256-21670-1-git-send-email-jiang.liu@huawei.com> References: <1349537256-21670-1-git-send-email-jiang.liu@huawei.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a mutex to serialize call to acpi_map/unmap_lsapic. Signed-off-by: Jiang Liu --- drivers/acpi/processor_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 2346b81..9fc20b4 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -108,6 +108,7 @@ static struct acpi_driver acpi_processor_driver = { .drv.pm = &acpi_processor_pm, }; +static DEFINE_MUTEX(acpi_processor_mutex); static DEFINE_PER_CPU(void *, processor_device_array); DEFINE_PER_CPU(struct acpi_processor *, processors); @@ -668,7 +669,9 @@ static void acpi_processor_reset(struct acpi_device *device, struct acpi_process acpi_processor_unlink(device, pr); put_online_cpus(); arch_unregister_cpu(pr->id); + mutex_lock(&acpi_processor_mutex); acpi_unmap_lsapic(pr->id); + mutex_unlock(&acpi_processor_mutex); pr->id = -1; } @@ -702,7 +705,9 @@ static int acpi_processor_pre_configure(struct acpi_device *device, if (pr->id == -1) { if (pr->apic_id == -1) goto out; + mutex_lock(&acpi_processor_mutex); result = acpi_map_lsapic(device->handle, pr->apic_id, &pr->id); + mutex_unlock(&acpi_processor_mutex); if (result) goto out; BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); @@ -722,7 +727,9 @@ static int acpi_processor_pre_configure(struct acpi_device *device, return 0; out_unmap: + mutex_lock(&acpi_processor_mutex); acpi_unmap_lsapic(pr->id); + mutex_unlock(&acpi_processor_mutex); pr->id = -1; out: