Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5804815imm; Tue, 12 Jun 2018 13:42:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJGVijudKfks0FpZL/FYARIvsN2aHPWkw/Oqx85A9DjYmVwPxarLCi33HDlvxnrf99tF+D1 X-Received: by 2002:a63:a05d:: with SMTP id u29-v6mr1625635pgn.80.1528836173505; Tue, 12 Jun 2018 13:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528836173; cv=none; d=google.com; s=arc-20160816; b=DwkQ/46wdMBoqeLefO8rSZAH1sNQwzxz4LU1ARO/ggp6nmtufhWGg2Vb3ZTWhJBVWG QcNmXQ6BP9kOtv0zS4soLD55yh1setHtKYpOjNWw+cczGi0NfB9R068xKWZPZThrLozj ECrYlzb/8PLx6QYkWGSGPb6HyQPX8YYd4bo9TH6gEJqJivDmBYmjnVvkX0XVp05cSruY j2h/ivJorI9MfITQllxZKU9WEaZxIq67+y3I8duEgsl5lHPpuMfcR4woG6ZQcPloFekP 36MZOR0PUk/q/T1Ub1JECZi6iWLNjqLsEa4uBZCX8b2FJXH4Wzn7GK1jwpyJSnyvq1xF HXOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=MN2Mkrop9rn4sGIjmy5kPrbZmlWwdDZjAPMMFqsDt7A=; b=eXaRxXTEzRIh2zHUKpNxVamrk3mJJFH2zWTja6/LpTfR1aOID1Vwdo2Llgq3/ZO1og Zn44fFpUpiMp7Bb6tpBnOT22WAmwDdP0QfCt7vHTNGA+oEBFaBDt+ss3kksPAPJr3dyQ Cyn00qXYSA4k0UnqmuD+nTOKDGZLYJduyYmJgDiafvp2M//+67/HD5Dg5AJZk3BuZYeA +5r7D+BjCPh6D7HlCqTGjlgjAiBZ264GP/KEZyOfCv0bl+bKvWSelGRxAiFCZ+y/LLpo xBVDxmNfIdcrhc55tFJZfqQaPYzlkiNGPkAm9fgyWIKR1Xinosk5I0zvFrda2en/f/8T PKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=DsoYIbb+; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si987747pln.414.2018.06.12.13.42.39; Tue, 12 Jun 2018 13:42:53 -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; dkim=pass header.i=@broadcom.com header.s=google header.b=DsoYIbb+; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934647AbeFLUmB (ORCPT + 99 others); Tue, 12 Jun 2018 16:42:01 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36099 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933625AbeFLUmA (ORCPT ); Tue, 12 Jun 2018 16:42:00 -0400 Received: by mail-pg0-f65.google.com with SMTP id m5-v6so133638pgd.3 for ; Tue, 12 Jun 2018 13:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=MN2Mkrop9rn4sGIjmy5kPrbZmlWwdDZjAPMMFqsDt7A=; b=DsoYIbb+BC27uVzGP+QnthGXJbTZ0l4UtLq4+YPGe9E4MxtS685p2b7QbdzepgIIoq nqXhQM7h5M3CDZWzJR7mpyYP7LSWOgs0VZ8R/vySjUDuCd9KpSMmMNl/1eaDKMJaFutz r94+ruPrt0yPhHy/rKmk/Qog47XO4Jy7ZJkDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=MN2Mkrop9rn4sGIjmy5kPrbZmlWwdDZjAPMMFqsDt7A=; b=jCR3DIWU/Q1b9mL7QP4lhq/UPWqXtZ8TsK79nWYrCy97e7UYkLb4c6KTyra//l81Y4 BNcRkiwn87evH7JYPB0Ng5GUvfSAf8IqMwcesSkCctOk1PZpGDxsuNBfSsib4M8wsFRy POtQdCHYg2CBMHjGBoLD3hQgZNd/+5OdZrsMvTkdy2VdHH0+XwOvDdXnSvlqWxH2yary pohwqRpXXs5ak3FNc6Esaoy5WwEQehGvG3e8oJRaXQYpOdLPFClIaPvKcgWCu0Oeu6EW cdHsk/Ue2vZ//+nmtm5Cbx1DiltE4ShFkmWmfQ5qa1HYv3eUSakA+5+8wu7NdIRgOb75 i1Cw== X-Gm-Message-State: APt69E39mCgRDfszODUUv9o3iWFI8E4Wo3iqh4Fp+zCf7sezLFUvLctH LQEcOA3c+Ms7rUlhhFh4yzv4tQ== X-Received: by 2002:a63:6f8a:: with SMTP id k132-v6mr1615383pgc.153.1528836119871; Tue, 12 Jun 2018 13:41:59 -0700 (PDT) Received: from [10.69.55.99] ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id c27-v6sm1745146pfl.63.2018.06.12.13.41.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 13:41:59 -0700 (PDT) Subject: Re: [PATCH 5/5] nvmet: fcloop: use irqsave spinlocks To: Johannes Thumshirn , Keith Busch Cc: Sagi Grimberg , Christoph Hellwig , Linux NVMe Mailinglist , Linux Kernel Mailinglist , Hannes Reinecke References: <20180515074043.22843-1-jthumshirn@suse.de> <20180515074043.22843-6-jthumshirn@suse.de> From: James Smart Message-ID: <03515e30-e614-3c1d-314e-ef0be6248d92@broadcom.com> Date: Tue, 12 Jun 2018 13:41:55 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180515074043.22843-6-jthumshirn@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/15/2018 12:40 AM, Johannes Thumshirn wrote: > Lockdep complains about inconsistent hardirq states when using > nvme-fcloop. So use the irqsave variant of spin_locks for the > nvmefc_fcp_req's reqlock. > > Here's the lockdep report: > [ 11.138417] ================================ > [ 11.139085] WARNING: inconsistent lock state > [ 11.139207] nvmet: creating controller 2 for subsystem blktests-subsystem-1 for NQN nqn.2014-08.org.nvmexpress:uuid:046394e7-bff7-4403-9502-1816800efaa0. > [ 11.139727] 4.17.0-rc5+ #883 Not tainted > [ 11.139732] -------------------------------- > [ 11.144441] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. > [ 11.145341] swapper/8/0 [HC1[1]:SC0[0]:HE0:SE1] takes: > [ 11.146108] (ptrval) (&(&tfcp_req->reqlock)->rlock){?.+.}, at: fcloop_fcp_op+0x20/0x1d0 [nvme_fcloop] > [ 11.148633] {HARDIRQ-ON-W} state was registered at: > [ 11.149380] _raw_spin_lock+0x34/0x70 > [ 11.149940] fcloop_fcp_recv_work+0x17/0x90 [nvme_fcloop] > [ 11.150746] process_one_work+0x1d8/0x5c0 > [ 11.151346] worker_thread+0x45/0x3e0 > [ 11.151886] kthread+0x101/0x140 > [ 11.152370] ret_from_fork+0x3a/0x50 > [ 11.152903] irq event stamp: 36666 > [ 11.153402] hardirqs last enabled at (36663): [] default_idle+0x13/0x180 > [ 11.154601] hardirqs last disabled at (36664): [] interrupt_entry+0xc4/0xe0 > [ 11.155817] softirqs last enabled at (36666): [] irq_enter+0x59/0x60 > [ 11.156952] softirqs last disabled at (36665): [] irq_enter+0x3e/0x60 > [ 11.158092] > [ 11.158092] other info that might help us debug this: > [ 11.159436] Possible unsafe locking scenario: > [ 11.159436] > [ 11.160299] CPU0 > [ 11.160663] ---- > [ 11.161026] lock(&(&tfcp_req->reqlock)->rlock); > [ 11.161709] > [ 11.162091] lock(&(&tfcp_req->reqlock)->rlock); > [ 11.163148] > [ 11.163148] *** DEADLOCK *** > [ 11.163148] > [ 11.164007] no locks held by swapper/8/0. > [ 11.164596] > [ 11.164596] stack backtrace: > [ 11.165238] CPU: 8 PID: 0 Comm: swapper/8 Not tainted 4.17.0-rc5+ #883 > [ 11.166180] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 > [ 11.167673] Call Trace: > [ 11.168037] > [ 11.168349] dump_stack+0x78/0xb3 > [ 11.168864] print_usage_bug+0x1ed/0x1fe > [ 11.169440] ? check_usage_backwards+0x110/0x110 > [ 11.170111] mark_lock+0x263/0x2a0 > [ 11.170995] __lock_acquire+0x675/0x1870 > [ 11.171865] ? __lock_acquire+0x48d/0x1870 > [ 11.172460] lock_acquire+0xd4/0x220 > [ 11.172981] ? fcloop_fcp_op+0x20/0x1d0 [nvme_fcloop] > [ 11.173709] _raw_spin_lock+0x34/0x70 > [ 11.174243] ? fcloop_fcp_op+0x20/0x1d0 [nvme_fcloop] > [ 11.174978] fcloop_fcp_op+0x20/0x1d0 [nvme_fcloop] > [ 11.175673] nvmet_fc_transfer_fcp_data+0x9b/0x130 [nvmet_fc] > [ 11.176507] nvmet_req_complete+0x10/0x110 [nvmet] > [ 11.177210] nvmet_bio_done+0x23/0x40 [nvmet] > [ 11.177837] blk_update_request+0xab/0x3b0 > [ 11.178434] blk_mq_end_request+0x13/0x60 > [ 11.179033] flush_smp_call_function_queue+0x58/0x150 > [ 11.179755] smp_call_function_single_interrupt+0x49/0x260 > [ 11.180531] call_function_single_interrupt+0xf/0x20 > [ 11.181236] > [ 11.181542] RIP: 0010:native_safe_halt+0x2/0x10 > [ 11.182186] RSP: 0018:ffffa481006cbec0 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff04 > [ 11.183265] RAX: ffff9f54f8b86200 RBX: ffff9f54f8b86200 RCX: 0000000000000000 > [ 11.184264] RDX: ffff9f54f8b86200 RSI: 0000000000000001 RDI: ffff9f54f8b86200 > [ 11.185270] RBP: 0000000000000008 R08: 0000000000000000 R09: 0000000000000000 > [ 11.186271] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 > [ 11.187280] R13: 0000000000000000 R14: ffff9f54f8b86200 R15: ffff9f54f8b86200 > [ 11.188280] default_idle+0x18/0x180 > [ 11.188806] do_idle+0x176/0x260 > [ 11.189273] cpu_startup_entry+0x5a/0x60 > [ 11.189832] start_secondary+0x18f/0x1b0 > > Signed-off-by: Johannes Thumshirn > Cc: James Smart > --- > drivers/nvme/target/fcloop.c | 52 ++++++++++++++++++++++++-------------------- > 1 file changed, 29 insertions(+), 23 deletions(-) > Looks ok. I assume it is as the bio_done call can be in an interrupt handler. Reviewed-by:   James Smart