Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2184435iof; Tue, 7 Jun 2022 22:30:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCUyH6ub46jpQlV+1eQBKE+qlR43QFf9ePyh/RugbbpcSvEBb57Pfbt32PuEnn7fzqSl3C X-Received: by 2002:a17:903:1108:b0:156:73a7:7c1 with SMTP id n8-20020a170903110800b0015673a707c1mr32001072plh.101.1654666211912; Tue, 07 Jun 2022 22:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666211; cv=none; d=google.com; s=arc-20160816; b=pMuiKQP0VrA7MXlPjOHGsG1veQeJe05btk0iod+2/0vBF273iCte4LNwVa5j4aL3o9 nhj+hZHebysdKHF/MVacw4cwN+7dhS/03Ff29c3HJF5X3xEbBRgGwvu6Te6BovNd8XDr CzAGtiu/xWe9PzXzQCcOCjnpzRtTGZC+yyEKwCD6jBX7mB55DR9mi9VUAgozp/67igxw crTDzqvqBuRC9bu9yCJ6zYliotUpy9DZYir/FX5MiHakTPmiq5mrg3CujY47DYh1uFLY xxxjBxIFfFcOlZAsq3ZTo0JfItOJ5GAz4JlqFVYTfyO9w1AjRqdfln6CirSa4HLZFeij YS/Q== 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=ZvGYveDaKpl84Wh3lwP68AxZKQond+nIiK/0Mn3PuPw=; b=EOQh7gP/dE8LoWcxShpIQnC5Ppp1dJAs3/bJE3kTWlUD6skDksKmcGAg5Gh4bFgXY6 3X8s2Kklbhq5Fx7vfVHlPci2DzL4JDoOiYtoovMfnHWmI37VNYgUL1c5Gn/pkMI957Vq qPguZBrUJuq/uhADkt48GyOu3RAczyzMul24xjN1P79vXMcL2KUQq8eI9/c8/6alOuux Asn8Zay9R3bqPU9wgZQoNuuc4DpO7NsbcGfDc6YGR0cM/+K6MbbiFBvJCfD5aKJ7hBv4 0uQL2TBFTGkHL9wXLl+/rVlklorlcrgY8hywyM7TgE2CZGFVSRrE1ssJ05K8moUPKgBr rX7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l7QvaqvL; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id f8-20020a636a08000000b003fcb1baee3bsi1216262pgc.269.2022.06.07.22.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:30:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l7QvaqvL; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 03967279C18; Tue, 7 Jun 2022 21:57:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359474AbiFGUjC (ORCPT + 99 others); Tue, 7 Jun 2022 16:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357608AbiFGTmJ (ORCPT ); Tue, 7 Jun 2022 15:42:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B00B71B5872; Tue, 7 Jun 2022 11:15:29 -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 dfw.source.kernel.org (Postfix) with ESMTPS id C7D7D608CD; Tue, 7 Jun 2022 18:15:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D210DC385A2; Tue, 7 Jun 2022 18:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654625728; bh=6c21A1kbnXmKe8tly4EAnWS1CNBZxBOYlSwgTiYeW1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l7QvaqvLc5Ll97Eej0ModQi5kxTR2VytK8P18OqaTfmK5nR4tJwfGilOAARhCzi99 7UJwDR7U/vOlmDoIKIDi0ikD/Jw16vpmYFuHd/9macuZF3XIBNt/VeGLQH0zdZ1K8B iREIk5jOdvhE/R0DBnXuJapOAHgmsU08AhOAcEbM= 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.17 081/772] scsi: lpfc: Fix call trace observed during I/O with CMF enabled Date: Tue, 7 Jun 2022 18:54:33 +0200 Message-Id: <20220607164951.428465700@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@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 6cc94fae01b8..d9a8e3a59d94 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -3936,7 +3936,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); @@ -3980,7 +3980,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