From patchwork Mon Sep 12 13:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 606089 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 4F8C6ECAAD5 for ; Mon, 12 Sep 2022 13:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbiILNpx (ORCPT ); Mon, 12 Sep 2022 09:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiILNpq (ORCPT ); Mon, 12 Sep 2022 09:45:46 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D3A30546 for ; Mon, 12 Sep 2022 06:45:43 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id i19so5051378pgi.1 for ; Mon, 12 Sep 2022 06:45:43 -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=gYEWcvOEwXmBACMfrUKmFRS02NtDZQTsbxIGdhmebJA=; b=KYbF6RpVGwVVgNNIeGWCM4hXZPwo+3if6TmYPboSHxO1Pt5MPckSG4JECupEK1PcR+ TlBHIPPb568R7PTPhfF07vHIags+Kk/f/RNWI5JXQhevZpPEWcOiwzU8+VKay2xesUEo FoTbEViOY/MCUFi41mj+9+gTLRVoDfuqp2H44= 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=gYEWcvOEwXmBACMfrUKmFRS02NtDZQTsbxIGdhmebJA=; b=79jLq5BG7Jx+xzdz2JfGUKqWRarGG93Voxxe0FqG4e83eHwkwJyw69t0FuQLLHOQi0 oJuwU7zIVL5hViTmdyro8shsHE2TOgLMxHWABL4JyEuD1m4Efc1essRE3NtuWmc1e7I/ HdI4ScuqzHm7EnCKRZv5NLjzYjUy+YycqSFQT1N3DYzmB9gF0QpUS1xCkoTSzKfeJlOl KNh0N65OjqX/Q2YGQIkaZbs8Xrsukn3bgZv/Iv79tptGqheRzXRIqil64rL0XrmjjSE6 JrI3FgDH7MhrZaPQ0ZPPGVHEazz9SShTbLafMSlI7Zr6kRHWvklFzmeUWVNAhchfLj/Z gVLQ== X-Gm-Message-State: ACgBeo0v2IZCvMHZDsg3H61CtCTIxM7YEpN41DQ8O2LfX+UuF2iWByUR dsS+V18FqMJSfVN2e4CerWUmflluDaM7yHdgQ9Y4P4g9Iw/RuPBL1tIb8Npzdys/BztqgJ6W1CI 6GElRTHxx50fNJyjIeoLaevvQoJvbVMztFFtSUZ8+gBUzNEvRRkGYVuIK/eGtmguKRzDvQ+Wtv1 bsbMgkmPLz X-Google-Smtp-Source: AA6agR4r6vYbdqVun5DtsFJWEeHpqw85WZa7+zMrXr/Ad99y2RTTF7V3Da0cA6OrR3EiPjn7RVD1Hg== X-Received: by 2002:a65:6454:0:b0:434:a700:f0bf with SMTP id s20-20020a656454000000b00434a700f0bfmr22788452pgv.383.1662990342867; Mon, 12 Sep 2022 06:45:42 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id u7-20020a170903124700b00176e8f85146sm6112900plh.185.2022.09.12.06.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 06:45:42 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, Sreekanth Reddy Subject: [PATCH v2 8/9] mpi3mr: Fix scheduling while atomic type bug Date: Mon, 12 Sep 2022 19:27:41 +0530 Message-Id: <20220912135742.11764-9-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220912135742.11764-1-sreekanth.reddy@broadcom.com> References: <20220912135742.11764-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 5b10504..41dc2bb 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 f841a44..d5da49a 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; }