From patchwork Sat Nov 7 21:20:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7576341 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 343729F1AF for ; Sat, 7 Nov 2015 21:21:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1891A20460 for ; Sat, 7 Nov 2015 21:21:03 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97D5E2041E for ; Sat, 7 Nov 2015 21:21:01 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 775E61A1F45; Sat, 7 Nov 2015 13:21:01 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A27451A1F45 for ; Sat, 7 Nov 2015 13:20:59 -0800 (PST) Received: by wmww144 with SMTP id w144so51450695wmw.1 for ; Sat, 07 Nov 2015 13:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tgs1TIlF2Pddh/bb9NvRoAFoEr+xWfkdfIHJrqEVvnY=; b=vz4EtFz/9kvJYAzyDexePR1fZdVvJBZvsFiHGuuMtzktLSZ8FNoe/uZn0YoiCppxvJ DqE2rha5+Td8i9w9oPSFuCkQHZvKStCLUMAtIh3YBfn9cOd/waT6w8dL6Ml91GBQMk0e ixcoeb5xioeKR9NH8dP9E0ORwFkd7A9u56/thRfSCAfG7cRUym6skWFHxAIPhASK2izS ZcZ/ETMlDLyhqIdMDKnAdC75fThDlkx6MsHLwYeqYYUdm2tIDCOg61HZxF5t1QorZ1bh 9ymxrCGWjeJJIjo+FjsmAGNpiDWL3afvL7Pw0B7anhqkqduwadyOh//3Ekd4A01MtEme bjfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=tgs1TIlF2Pddh/bb9NvRoAFoEr+xWfkdfIHJrqEVvnY=; b=iC12f2BI0gyY6XpCmHQZbgIYnNbsbN8xn5SOR1yLfqgHMXo+xnCsq1I8WWQ9/Y6TmR uQA9dEJFlG3rCSPPEeCg1yZjtrfTNCC4V1Dzl8Hn66YZ+hTWHTWOisU9d+sI9Xl6AMzn MD2DJ+A3tVrDNnHXKSp0ATC0CeUCHZjNBOadLVwxCknTLtgwkKr7+dn+zGG1E3PZzMjL +lm8oWBnixld1QEpnSZwz5NKAp1h1FqXUGH6I/cI2E1rP6vLIpfIKkQ69tUdebO6vwZW uUfdfNh8UlQcuHZqpd2Ry2eGRXu4aUPL+jJoQHmrU0dD77dXB3YusREGEE7TFoLxILgQ ooqA== X-Gm-Message-State: ALoCoQkqtQL4VMS4kTRUOIoEo4Hmq+XlsNSQsOTq7yI+j4u40Y/j9Fw4NGYjQzXVhd6T6qAFjBRy MIME-Version: 1.0 X-Received: by 10.28.11.13 with SMTP id 13mr16864625wml.4.1446931257839; Sat, 07 Nov 2015 13:20:57 -0800 (PST) Received: by 10.27.88.130 with HTTP; Sat, 7 Nov 2015 13:20:57 -0800 (PST) In-Reply-To: References: <1445986707-15395-1-git-send-email-vishal.l.verma@intel.com> <1445986707-15395-3-git-send-email-vishal.l.verma@intel.com> Date: Sat, 7 Nov 2015 13:20:57 -0800 Message-ID: Subject: Re: [PATCH v3 2/2] acpi: nfit: Add support for hot-add From: Dan Williams To: Vishal Verma Cc: Toshi Kani , "linux-nvdimm@lists.01.org" , "Rafael J. Wysocki" , Linux ACPI , Elliott Robert X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Nov 7, 2015 at 10:57 AM, Dan Williams wrote: > Rafael, awaiting your ack... > > Vishal, one thing I'll fix up on applying... > > On Tue, Oct 27, 2015 at 3:58 PM, Vishal Verma wrote: >> Add a .notify callback to the acpi_nfit_driver that gets called on a >> hotplug event. From this, evaluate the _FIT ACPI method which returns >> the updated NFIT with handles for the hot-plugged NVDIMM. >> >> Iterate over the new NFIT, and add any new tables found, and >> register/enable the corresponding regions. >> >> In the nfit test framework, after normal initialization, update the NFIT >> with a new hot-plugged NVDIMM, and directly call into the driver to >> update its view of the available regions. >> >> Cc: Dan Williams >> Cc: Rafael J. Wysocki >> Cc: Toshi Kani >> Cc: Elliott, Robert >> Cc: Jeff Moyer >> Cc: >> Cc: >> Signed-off-by: Vishal Verma > [..] > >> +static int acpi_nfit_add(struct acpi_device *adev) >> +{ >> + struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; >> + struct acpi_nfit_desc *acpi_desc; >> + struct device *dev = &adev->dev; >> + struct acpi_table_header *tbl; >> + acpi_status status = AE_OK; >> + acpi_size sz; >> + int rc = 0; >> + >> + device_lock(dev); > > The device is already locked by the time we reach this point. The > unit tests don't trip this path which might be why this wasn't seen > earlier. The lockup call trace if you're interested: dracut:/# [ 376.030455] INFO: task systemd-udevd:278 blocked for more than 120 seconds. [ 376.032561] Tainted: G O 4.3.0-rc6+ #1747 [ 376.034376] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 376.036704] systemd-udevd D 0000000000000000 0 278 262 0x00000004 [ 376.039758] ffff880352a0ba60 0000000000000092 ffff880352a0ba88 ffff880361e57b98 [ 376.043779] ffff88035f150000 ffff880352ea5dc0 ffff880352a0c000 0000000000000246 [ 376.047800] ffff880359a43148 ffff880352ea5dc0 00000000ffffffff ffff880352a0ba78 [ 376.051821] Call Trace: [ 376.052882] [] schedule+0x33/0x80 [ 376.054527] [] schedule_preempt_disabled+0xe/0x10 [ 376.056493] [] mutex_lock_nested+0x14f/0x3a0 [ 376.058361] [] ? acpi_nfit_add+0x4e/0x150 [nfit] [ 376.060310] [] acpi_nfit_add+0x4e/0x150 [nfit] [ 376.062283] [] ? devices_kset_move_last+0x60/0x90 [ 376.064250] [] acpi_device_probe+0x4f/0xf5 [ 376.066076] [] driver_probe_device+0x224/0x480 [ 376.067983] [] __driver_attach+0x88/0x90 [ 376.069769] [] ? driver_probe_device+0x480/0x480 [ 376.071716] [] bus_for_each_dev+0x73/0xc0 [ 376.073522] [] driver_attach+0x1e/0x20 [ 376.075267] [] bus_add_driver+0x1ee/0x280 [ 376.077072] [] ? 0xffffffffa0038000 [ 376.078757] [] driver_register+0x60/0xe0 [ 376.080543] [] acpi_bus_register_driver+0x40/0x42 [ 376.082511] [] nfit_init+0xce/0x1000 [nfit] ...fixed by the following incremental change: Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 869f279fde95..a2e99ccf0480 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -1732,22 +1732,19 @@ static int acpi_nfit_add(struct acpi_device *adev) struct acpi_table_header *tbl; acpi_status status = AE_OK; acpi_size sz; - int rc = 0; - device_lock(dev); status = acpi_get_table_with_size("NFIT", 0, &tbl, &sz); if (ACPI_FAILURE(status)) { /* This is ok, we could have an nvdimm hotplugged later */ dev_dbg(dev, "failed to find NFIT at startup\n"); - goto out_unlock; + return 0; } acpi_desc = acpi_nfit_desc_init(adev); if (IS_ERR(acpi_desc)) { dev_err(dev, "%s: error initializing acpi_desc: %ld\n", __func__, PTR_ERR(acpi_desc)); - rc = PTR_ERR(acpi_desc); - goto out_unlock; + return PTR_ERR(acpi_desc); } acpi_desc->nfit = (struct acpi_table_nfit *) tbl; @@ -1762,12 +1759,9 @@ static int acpi_nfit_add(struct acpi_device *adev) rc = acpi_nfit_init(acpi_desc, sz); if (rc) { nvdimm_bus_unregister(acpi_desc->nvdimm_bus); - goto out_unlock; + return rc; } - - out_unlock: - device_unlock(dev); - return rc; + return 0; } _______________________________________________ Linux-nvdimm mailing list