Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp830551pxa; Wed, 12 Aug 2020 14:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWMtAgIRuIlbZWbU9QAtG1EnF1NFhPzERoi7PwXdqZ2bhnvg2rBoCFwP/tN2PYW5g40TY7 X-Received: by 2002:a05:6402:2042:: with SMTP id bc2mr1875896edb.109.1597267961095; Wed, 12 Aug 2020 14:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597267961; cv=none; d=google.com; s=arc-20160816; b=fSHfvXJ9zzG/txWzQT6IW4MyzMx8RyTeq0YIufDOrjjoTBFp8PAfc6SO/XLJZ764Xw 2GNr2/2+/Px22lmXIuqSB+ZexnRxi17FwG3oce7tKk/fBV0T2NbCzqT6xxdH6ZtNemSc a4jOUDQhObTOntA8I7stGHSs9UJndZqHgx7jVhPC4QzCtaDSLp9HdfwPoxbGV0Kc78uI 2QP3zE6TEm77GkCL33wXGzSJuDWP9UiZK5QEdvx/9NFBg5foSQ+si5lQvLH3CGLzZQxA nE0/G+Sww269fbtg3bvxVHRHbOPBcErEd9MQP4drWnG38uwv9Q2HiD8O2j+dj3KBxylL WJMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=wZUfbWD2oBKIbcbRhn2MlHBlsAt09/GiRlxjIAJiqj0=; b=A2zirU/8ZVfzfSH4KHF5kFJroXiM1covmv43zgc02rxptiIlo42iMGBi4gDHPacC8S Be2E/2W89CqoC6wBrV3nXbF6PMhDQ5ofoVEVMOlH4ktFhISXtPx4qu6s+EtVGcC/UOO6 PX/jY+WB8Ag9HRzynuJYYsAtxTrpxEm4tl8tEh9fNLcqDVQ3QewTo3XV0nF7GeG5KmIr nEyHvY1sS2tSfztHnD0S5H8LRlByN5OTrxTTdyezhsbl3T48BtMB3UmlsQdiRmzz7ecW +MD8NVE33aNy3YkByW5FOND7EqFgos3jB95B7J7efpwBzbWev7psXt28F3roYmUeoggn 1fgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=PYFxoLIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yj16si2047420ejb.59.2020.08.12.14.32.18; Wed, 12 Aug 2020 14:32:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=PYFxoLIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726596AbgHLVbr (ORCPT + 99 others); Wed, 12 Aug 2020 17:31:47 -0400 Received: from ale.deltatee.com ([204.191.154.188]:38670 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbgHLVbr (ORCPT ); Wed, 12 Aug 2020 17:31:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wZUfbWD2oBKIbcbRhn2MlHBlsAt09/GiRlxjIAJiqj0=; b=PYFxoLIaaTeOjTA6L1Grk2PoP/ oohcnDZvDLUWM3SgcIGGzS4nkSYAtfAnxIS6aFMahUYZF47lYeFrz+VfJ7GuY6p/l2y5lIRLd63xQ oVKpTYqHf6uB5PJJnJB8KGqv7PtbkXi3pwCZcIjLMBafrFmICRXavdYfSDTZFcJ/Fmk9dHli/pJgb rl+Mya1p0IC6PZ7hVkZX6RjYy5XM8lb9/+U89MjMZPrOcFRUbnoSzSZRcO5G4kwbIKYscZ9lCWA7C 94R53Wby5ZDUGd5WMlZws5yT/VJ+J7EnRhOD2B7FD4YpLeqoWoiNRJwhBIWZcJlF/odoaxs7NDWif gfcmEjvg==; Received: from s01060023bee90a7d.cg.shawcable.net ([24.64.145.4] helo=[192.168.0.10]) by ale.deltatee.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k5yLW-0004Gg-PO; Wed, 12 Aug 2020 15:31:43 -0600 To: Keith Busch Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Christoph Hellwig , Sagi Grimberg , Keith Busch , Jens Axboe References: <20200812210119.7155-1-logang@deltatee.com> <20200812211959.GA1238450@dhcp-10-100-145-180.wdl.wdc.com> From: Logan Gunthorpe Message-ID: Date: Wed, 12 Aug 2020 15:31:41 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200812211959.GA1238450@dhcp-10-100-145-180.wdl.wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 24.64.145.4 X-SA-Exim-Rcpt-To: axboe@kernel.dk, keith.busch@wdc.com, sagi@grimberg.me, hch@lst.de, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, kbusch@kernel.org X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [RESEND PATCH] nvme: Use spin_lock_irqsave() when taking the ctrl->lock X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-08-12 3:19 p.m., Keith Busch wrote: > On Wed, Aug 12, 2020 at 03:01:19PM -0600, Logan Gunthorpe wrote: >> @@ -2971,15 +2971,16 @@ int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi, >> static struct nvme_cel *nvme_find_cel(struct nvme_ctrl *ctrl, u8 csi) >> { >> struct nvme_cel *cel, *ret = NULL; >> + unsigned long flags; >> >> - spin_lock(&ctrl->lock); >> + spin_lock_irqsave(&ctrl->lock, flags); >> list_for_each_entry(cel, &ctrl->cels, entry) { >> if (cel->csi == csi) { >> ret = cel; >> break; >> } >> } >> - spin_unlock(&ctrl->lock); >> + spin_unlock_irqrestore(&ctrl->lock, flags); >> >> return ret; >> } >> @@ -2988,6 +2989,7 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, >> struct nvme_effects_log **log) >> { >> struct nvme_cel *cel = nvme_find_cel(ctrl, csi); >> + unsigned long flags; >> int ret; >> >> if (cel) >> @@ -3006,9 +3008,9 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, >> >> cel->csi = csi; >> >> - spin_lock(&ctrl->lock); >> + spin_lock_irqsave(&ctrl->lock, flags); >> list_add_tail(&cel->entry, &ctrl->cels); >> - spin_unlock(&ctrl->lock); >> + spin_unlock_irqrestore(&ctrl->lock, flags); >> out: >> *log = &cel->log; >> return 0; >> > > Neither of these are ever called from an interrupt disabled context, > correct? If so, you can just use spin_lock_irq() without saving the > current irq state. Yes, I believe that is correct. I'll send a v2 shortly. Thanks, Logan