From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 003.mia.mailroute.net (003.mia.mailroute.net [199.89.3.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59DEE301482 for ; Thu, 30 Oct 2025 19:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.3.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761853163; cv=none; b=L/oEYDP2uIHRjxQ8kP/wbj52x2UqYECp3XaXLFWfZhokGj0RxQPKsmxqxscOwiN4Iny3EriaHscJTo+DhpKWGj4c4Zlic/LSoU9K6YR/l8pCJ2jocnhzg1ZU2AvNzSXDItgi4ugWNKKtMT30rfmysGmJ5KgAzkPlyhT9+eg+10A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761853163; c=relaxed/simple; bh=X47noe8U1fxkssokE+erCToQ+3UeRkzHfC311sJCyN8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pgD3TJXZfW6Yk7V1BQ1WZPdlwRNVWlAupa9kBEoXPAs/22rBdWSsqAZqx/rn/C9nopiVOHngvXslmtfPxob+KXVpPNPVwMmyyQlyNF3MxMEER1IE1QSs9lNCFihUfR3ZSsr3QpEPFPP2Hg/q+MxtMT8TBW4PDSv7GZgc914hJ/s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=t+e1Dwo/; arc=none smtp.client-ip=199.89.3.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="t+e1Dwo/" Received: from localhost (localhost [127.0.0.1]) by 003.mia.mailroute.net (Postfix) with ESMTP id 4cyDvY1zYlzlv76k; Thu, 30 Oct 2025 19:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1761853159; x=1764445160; bh=+0gVV gZVxjEpEiLkVu0mHRIFO/+W1VBNbDfQgA0Dr2k=; b=t+e1Dwo/bhRRyA00lKaMG p3ipSluAj9EMzmOpjt5Ail8FJ4E9eLB5JqJHt8BKkRMe1bzXFKN2vzsZZ4uJI9DY 7wsdjJtAi5FTPv+L5PGpJ9f43stqG/bdKFw/6/LlnyuLclLXHVP+H0VTw4Zd+oOF vpgPx0fBPEQyC4of/7fjsUGqpLHYx+5LR8rofxbqTh91JVLDM1hs5Tdr/G26QPdC LCaITN10ptr8TbJ0BujX0j3qNWXRf2+AqKRHobbpRQgU3AGyTOhghhezVQngyvcG hMnXmDF7YBcs3TOil2vM9jqL7RdV8++UfF3oaUzMx42kkK3iEJmUNvofnESrTIss Q== X-Virus-Scanned: by MailRoute Received: from 003.mia.mailroute.net ([127.0.0.1]) by localhost (003.mia [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id h9rMQ0CStDww; Thu, 30 Oct 2025 19:39:19 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.180.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 003.mia.mailroute.net (Postfix) with ESMTPSA id 4cyDvL4L5ZzlpTG1; Thu, 30 Oct 2025 19:39:09 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Peter Wang , "James E.J. Bottomley" , Matthias Brugger , AngeloGioacchino Del Regno , Avri Altman , Bean Huo , "Bao D. Nguyen" , Adrian Hunter Subject: [PATCH v7 13/28] ufs: core: Only call ufshcd_should_inform_monitor() for SCSI commands Date: Thu, 30 Oct 2025 12:36:12 -0700 Message-ID: <20251030193720.871635-14-bvanassche@acm.org> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog In-Reply-To: <20251030193720.871635-1-bvanassche@acm.org> References: <20251030193720.871635-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable ufshcd_should_inform_monitor() only returns 'true' for SCSI commands. Instead of checking inside ufshcd_should_inform_monitor() whether its second argument represents a SCSI command, only call this function for SCSI commands. This patch prepares for removing the lrbp->cmd member. Reviewed-by: Peter Wang Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index f478d5b5230d..dbdb8c30ca09 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2293,12 +2293,13 @@ static inline int ufshcd_monitor_opcode2dir(u8 op= code) return -EINVAL; } =20 +/* Must only be called for SCSI commands. */ static inline bool ufshcd_should_inform_monitor(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) { const struct ufs_hba_monitor *m =3D &hba->monitor; =20 - return (m->enabled && lrbp && lrbp->cmd && + return (m->enabled && (!m->chunk_size || m->chunk_size =3D=3D lrbp->cmd->sdb.length) && ktime_before(hba->monitor.enabled_ts, lrbp->issue_time_stamp)); } @@ -2368,9 +2369,9 @@ static inline void ufshcd_send_command(struct ufs_h= ba *hba, if (lrbp->cmd) { ufshcd_add_command_trace(hba, lrbp->cmd, UFS_CMD_SEND); ufshcd_clk_scaling_start_busy(hba); + if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) + ufshcd_start_monitor(hba, lrbp); } - if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) - ufshcd_start_monitor(hba, lrbp); =20 if (hba->mcq_enabled) { int utrd_size =3D sizeof(struct utp_transfer_req_desc);