From patchwork Thu Sep 8 12:53:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 604140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51A49C38145 for ; Thu, 8 Sep 2022 12:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231922AbiIHMmD (ORCPT ); Thu, 8 Sep 2022 08:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbiIHMlu (ORCPT ); Thu, 8 Sep 2022 08:41:50 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E22FE621D for ; Thu, 8 Sep 2022 05:41:32 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id p18so17708454plr.8 for ; Thu, 08 Sep 2022 05:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date; bh=TsOg7GSUtEzME0F1++ilL5Adptcp7HK141I7YuuCFmk=; b=iSF0FrA0VqNo9YwmL3UEOtT5tO9Mv6ra3d74pdiLQOj7ZXFHPj1uAJHJOJ1Wtt3xw6 g4mHfmDVIq7ak82Vgf6sIThKAbTviK5JPKtHw0LOpiukKYxGQAd9616qzd/XjE45cIWA ODe0NkNU/B6YPhH6X6sq7k3rgvAKNOAzjX+ss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=TsOg7GSUtEzME0F1++ilL5Adptcp7HK141I7YuuCFmk=; b=cDRUOnb+BHDJdsDEK23CFfT+AyU8D5TjQLHmmQeETlB4tksKnh7FQXGx+5G2ZwW91o 6uMZNxIyHL9qVf0niW+ukR0txLAbryQJ2Ja2toGLH6w5iZogD0oe3rHUMHpQvarZIzyd 0BJb45ylGccwdcXMycmADM3U3hxCUvz+0zaLGhosDpLIVa+lynTvzXS+5k7aSYWBnNx8 gI4Ev7nIDLGdi33vWQTFnXJAoOrjS8LKIFGzLh0ZZgIC/Pu3yGYo0WpEPS0viWCUVy1l /BkKJzvNiifTGhkQdfXEB5IekgkrXLI26T9nsDekv3X5jy/3T4k3HkyCuJgcW8bS5PYD xi0g== X-Gm-Message-State: ACgBeo2DrTfjFBSuowRwuIhfvl2916PBz+f6qZba/BkeWoLabeB99Edh 1+I/qiBiBgUAn+8iymHYU3J6PQVK/q0ID55Zry4KamD6ozkzhctq2c7aBPSdUwP/za3qx1YVruA AkyRWR25lo0KUyD1CjJaKAQftaucjxBo8Yl+R00FpXkFEwoPgDia6l6XaefbBspLbCzKen9Hlxw bUXHQr4HuF X-Google-Smtp-Source: AA6agR5RdGb3BeCw7M+5KaZmEMZwdmV0y+3v/+vnVB5Yz+TrhiDvzCxF+kWpbKy0jg9xuHTpqZ/m/A== X-Received: by 2002:a17:902:c944:b0:174:f62a:14f0 with SMTP id i4-20020a170902c94400b00174f62a14f0mr8796607pla.168.1662640890855; Thu, 08 Sep 2022 05:41:30 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id c17-20020a63ef51000000b0043395af24f6sm11106807pgk.25.2022.09.08.05.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 05:41:30 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, Sreekanth Reddy Subject: [PATCH 8/9] mpi3mr: Fix scheduling while atomic type bug Date: Thu, 8 Sep 2022 18:23:31 +0530 Message-Id: <20220908125332.21110-9-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220908125332.21110-1-sreekanth.reddy@broadcom.com> References: <20220908125332.21110-1-sreekanth.reddy@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Fix 'scheduling while atomic' type bug, which is observed when pci_irq_vector() is called from interrupt context. Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr.h | 2 ++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index bd8eba2..def4c5e 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -431,12 +431,14 @@ struct op_reply_qinfo { * struct mpi3mr_intr_info - Interrupt cookie information * * @mrioc: Adapter instance reference + * @os_irq: irq number * @msix_index: MSIx index * @op_reply_q: Associated operational reply queue * @name: Dev name for the irq claiming device */ struct mpi3mr_intr_info { struct mpi3mr_ioc *mrioc; + int os_irq; u16 msix_index; struct op_reply_qinfo *op_reply_q; char name[MPI3MR_NAME_LENGTH]; diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index ad78b9b..b5c3bf4 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -627,15 +627,11 @@ static irqreturn_t mpi3mr_isr_primary(int irq, void *privdata) static irqreturn_t mpi3mr_isr(int irq, void *privdata) { struct mpi3mr_intr_info *intr_info = privdata; - struct mpi3mr_ioc *mrioc; - u16 midx; int ret; if (!intr_info) return IRQ_NONE; - mrioc = intr_info->mrioc; - midx = intr_info->msix_index; /* Call primary ISR routine */ ret = mpi3mr_isr_primary(irq, privdata); @@ -650,7 +646,7 @@ static irqreturn_t mpi3mr_isr(int irq, void *privdata) !atomic_read(&intr_info->op_reply_q->pend_ios)) return ret; - disable_irq_nosync(pci_irq_vector(mrioc->pdev, midx)); + disable_irq_nosync(intr_info->os_irq); return IRQ_WAKE_THREAD; } @@ -696,7 +692,7 @@ static irqreturn_t mpi3mr_isr_poll(int irq, void *privdata) (num_op_reply < mrioc->max_host_ios)); intr_info->op_reply_q->enable_irq_poll = false; - enable_irq(pci_irq_vector(mrioc->pdev, midx)); + enable_irq(intr_info->os_irq); return IRQ_HANDLED; } @@ -738,6 +734,7 @@ static inline int mpi3mr_request_irq(struct mpi3mr_ioc *mrioc, u16 index) return retval; } + intr_info->os_irq = pci_irq_vector(pdev, index); return retval; }