From patchwork Sat Apr 7 16:38:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10327923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A74B600CB for ; Sat, 7 Apr 2018 16:48:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0EC12933F for ; Sat, 7 Apr 2018 16:48:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D560A29405; Sat, 7 Apr 2018 16:48:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 812D52933F for ; Sat, 7 Apr 2018 16:48:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 11433226516DA; Sat, 7 Apr 2018 09:48:54 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=dan.j.williams@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 31A4E226516D8 for ; Sat, 7 Apr 2018 09:48:52 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Apr 2018 09:48:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,419,1517904000"; d="scan'208";a="30288173" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga007.fm.intel.com with ESMTP; 07 Apr 2018 09:48:52 -0700 Subject: [ndctl PATCH] ndctl, test: fix pmem-errors.sh vs new ARS rework From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 07 Apr 2018 09:38:56 -0700 Message-ID: <152311913670.5287.392327526734931887.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 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-Virus-Scanned: ClamAV using ClamSMTP Due to locking constraints the nfit_test implementation is not able to internally trigger ARS, so just run and wait for ARS manually in this test. For example, here is what happens if nfit_test call acpi_nfit_ars_rescan() from within the ioctl path. WARNING: possible circular locking dependency detected 4.16.0-rc4+ #1686 Tainted: G OE ------------------------------------------------------ kworker/u80:0/6 is trying to acquire lock: (&nvdimm_bus->reconfig_mutex){+.+.}, at: [<0000000048851014>] nvdimm_badblocks_populate+0x41/0x150 [libnvdimm] but task is already holding lock: (&acpi_desc->init_mutex){+.+.}, at: [<00000000016af3e5>] acpi_nfit_scrub+0x3b/0x2d0 [nfit] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&acpi_desc->init_mutex){+.+.}: acpi_nfit_ars_rescan+0x28/0x160 [nfit] nfit_test_ctl+0x976/0x1040 [nfit_test] __nd_ioctl+0x5d8/0x650 [libnvdimm] nd_ioctl+0xa4/0xb0 [libnvdimm] do_vfs_ioctl+0xa5/0x6d0 SyS_ioctl+0x74/0x80 do_syscall_64+0x79/0x230 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (&nvdimm_bus->reconfig_mutex){+.+.}: __mutex_lock+0x7f/0xa00 nvdimm_badblocks_populate+0x41/0x150 [libnvdimm] nd_region_notify+0x95/0xb0 [libnvdimm] nd_device_notify+0x40/0x50 [libnvdimm] ars_complete.isra.19+0x5d/0xb0 [nfit] ars_complete_all+0x42/0x60 [nfit] acpi_nfit_scrub+0x84/0x2d0 [nfit] process_one_work+0x212/0x660 worker_thread+0x3a/0x390 kthread+0x11e/0x140 ret_from_fork+0x3a/0x50 Signed-off-by: Dan Williams --- test/pmem-errors.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh index 7c0487d1ac49..e0ab9e866b92 100755 --- a/test/pmem-errors.sh +++ b/test/pmem-errors.sh @@ -59,6 +59,7 @@ err_sector="$(((size/512) / 2))" err_count=8 if ! read sector len < /sys/block/$blockdev/badblocks; then $NDCTL inject-error --block="$err_sector" --count=$err_count $dev + $NDCTL start-scrub; $NDCTL wait-scrub fi read sector len < /sys/block/$blockdev/badblocks [ $((sector * 2)) -ne $((size /512)) ] && echo "fail: $LINENO" && false