Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2099294iof; Tue, 7 Jun 2022 19:42:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKfxHn1Ssyu1XEJz9lwGtHlMYHlFj3V5pFKNBNRk6pr2OCn3xukCMtWyPRAobvpTT/KI91 X-Received: by 2002:a17:90a:86c8:b0:1e6:7147:8b4d with SMTP id y8-20020a17090a86c800b001e671478b4dmr35121952pjv.45.1654656177478; Tue, 07 Jun 2022 19:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656177; cv=none; d=google.com; s=arc-20160816; b=KuC7qvfkcgmOG1I7VdmlUZDJixoEZRx0p70l/KOwNptzB4xIRkAs/L8FMsnpflOLzL djb4LpVCQQsZTHaOd+6f1LFTcBRT1onnhP3H5YUlgjtLLbPbwEI8WG7ufv2KNF2gD4gX z652uRLh5fImUg6LGkWqJ8aABEIjM9cWf5piwnI8oyI5S/i8BdRAjLxtSnsf+q0Nxtq0 eD6dV7EJ9zqD92eogVw3w9+qZ0VFeeRkN1wW7eWTTl4HPYkALJ9kXxEE41ZLxGU00wRy cXOIxEPjk+lU2bSeb8ngRncNsOLYJTgQI5Hsi4dbXZxMj8ntxwyNYrgBhmu/MUI8NHr7 MG1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qOwH3dyr5YpIhe7fnnCYp5ZXXYjol+BbRPgg/36E+5w=; b=PNwEwoxIv5Yo19UkC/fKVO+nBr/IlvsIxzlPQInqAstf8Zf3O4rf/r58mTUeIHIpMz hA5kcXMsl38UIs6PksRWTonWkY+ssSZGmOtFI+Q9KgbncgzGcK23Qr8tnVs1MYMc7UPC ln+vYwm8N/pAMqV+s/mIX0Rw5htuaPjaQQ6tFM070xokHMxbHIKIOIi1pWFdCNTGiQmr 2AYK72Jm9FN73bakINeVFtdZhxE0I8hnaj7qHQehtycNnSYSvwW/oSgsFzMD35xxZMLo Qm/xlGVQyRs6SKHsyxaMIH6ZnMa+Od0o3EWHOkx9E5cIrT1Pwhy1TzBhwlBBDwZu9InL HeNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lwza+0FI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d13-20020a63d70d000000b003f27cfcc9dfsi12396956pgg.828.2022.06.07.19.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:42:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lwza+0FI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C09041588E; Tue, 7 Jun 2022 19:34:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382953AbiFGWJU (ORCPT + 99 others); Tue, 7 Jun 2022 18:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379569AbiFGVGG (ORCPT ); Tue, 7 Jun 2022 17:06:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCA41F0FE8; Tue, 7 Jun 2022 11:49:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1983B8220B; Tue, 7 Jun 2022 18:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2141AC385A5; Tue, 7 Jun 2022 18:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627785; bh=NQr4DnHVulh4RbREC1iNFCv8RKjtbaKcjTm0ZM5tSvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwza+0FIK/iHzE/JosxV+v1GpzIbRPfH+mdLT0pEPckaMC4pYyP3svFBgs3gxQTzF nssUpM+fPEMzsaNb6dJV4uu2ePVZme6P64m+gli00cNiWgWi7RVXVvrP+RpxKHRIvq GJ4Y5Vnrm0xi6tBjHUIWjCqvn/6DdHXgluyrViAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 092/879] scsi: lpfc: Fix call trace observed during I/O with CMF enabled Date: Tue, 7 Jun 2022 18:53:30 +0200 Message-Id: <20220607165005.362959230@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit d6d45f67a11136cb88a70a29ab22ea6db8ae6bd5 ] The following was seen with CMF enabled: BUG: using smp_processor_id() in preemptible code: systemd-udevd/31711 kernel: caller is lpfc_update_cmf_cmd+0x214/0x420 [lpfc] kernel: CPU: 12 PID: 31711 Comm: systemd-udevd kernel: Call Trace: kernel: kernel: dump_stack_lvl+0x44/0x57 kernel: check_preemption_disabled+0xbf/0xe0 kernel: lpfc_update_cmf_cmd+0x214/0x420 [lpfc] kernel: lpfc_nvme_fcp_io_submit+0x23b4/0x4df0 [lpfc] this_cpu_ptr() calls smp_processor_id() in a preemptible context. Fix by using per_cpu_ptr() with raw_smp_processor_id() instead. Link: https://lore.kernel.org/r/20220412222008.126521-16-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c4fa7d68fe03..f617a2ef6b0f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -3835,7 +3835,7 @@ lpfc_update_cmf_cmpl(struct lpfc_hba *phba, else time = div_u64(time + 500, 1000); /* round it */ - cgs = this_cpu_ptr(phba->cmf_stat); + cgs = per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); atomic64_add(size, &cgs->rcv_bytes); atomic64_add(time, &cgs->rx_latency); atomic_inc(&cgs->rx_io_cnt); @@ -3879,7 +3879,7 @@ lpfc_update_cmf_cmd(struct lpfc_hba *phba, uint32_t size) atomic_set(&phba->rx_max_read_cnt, size); } - cgs = this_cpu_ptr(phba->cmf_stat); + cgs = per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); atomic64_add(size, &cgs->total_bytes); return 0; } -- 2.35.1