From: John Meneghini <jmeneghi@redhat.com>
To: "Kai Mäkisara" <Kai.Makisara@kolumbus.fi>, linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com, loberman@redhat.com
Subject: Re: [PATCH v2 2/4] scsi: scsi_error: Add counters for New Media and Power On/Reset UNIT ATTENTIONs
Date: Wed, 11 Dec 2024 16:57:22 -0500 [thread overview]
Message-ID: <05de7fab-2139-454d-9f5e-2ac36508e88e@redhat.com> (raw)
In-Reply-To: <20241125140301.3912-3-Kai.Makisara@kolumbus.fi>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: John Meneghini <jmeneghi@redhat.com>
On 11/25/24 09:02, Kai Mäkisara wrote:
> The purpose of the counters is to enable all ULDs attached to a
> device to find out that a New Media or/and Power On/Reset Unit
> Attentions has/have been set, even if another ULD catches the
> Unit Attention as response to a SCSI command.
>
> The ULDs can read the counters using the scsi_get_ua_new_media_ctr()
> and scsi_get_ua_por_ctr() macros (argument pointer to the scsi_device
> struct).
>
> Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
> ---
> drivers/scsi/scsi_error.c | 12 ++++++++++++
> include/scsi/scsi_device.h | 9 +++++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 10154d78e336..6ef0711c4ec3 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -547,6 +547,18 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)
>
> scsi_report_sense(sdev, &sshdr);
>
> + if (sshdr.sense_key == UNIT_ATTENTION) {
> + /*
> + * increment the counters for Power on/Reset or New Media so
> + * that all ULDs interested in these can see that those have
> + * happened, even if someone else gets the sense data.
> + */
> + if (sshdr.asc == 0x28)
> + scmd->device->ua_new_media_ctr++;
> + else if (sshdr.asc == 0x29)
> + scmd->device->ua_por_ctr++;
> + }
> +
> if (scsi_sense_is_deferred(&sshdr))
> return NEEDS_RETRY;
>
> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> index 9c540f5468eb..b184a5efc27e 100644
> --- a/include/scsi/scsi_device.h
> +++ b/include/scsi/scsi_device.h
> @@ -247,6 +247,9 @@ struct scsi_device {
> unsigned int queue_stopped; /* request queue is quiesced */
> bool offline_already; /* Device offline message logged */
>
> + unsigned char ua_new_media_ctr; /* Counter for New Media UNIT ATTENTIONs */
> + unsigned char ua_por_ctr; /* Counter for Power On / Reset UAs */
> +
> atomic_t disk_events_disable_depth; /* disable depth for disk events */
>
> DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
> @@ -684,6 +687,12 @@ static inline int scsi_device_busy(struct scsi_device *sdev)
> return sbitmap_weight(&sdev->budget_map);
> }
>
> +/* Macros to access the UNIT ATTENTION counters */
> +#define scsi_get_ua_new_media_ctr(sdev) \
> + ((const unsigned int)(sdev->ua_new_media_ctr))
> +#define scsi_get_ua_por_ctr(sdev) \
> + ((const unsigned int)(sdev->ua_por_ctr))
> +
> #define MODULE_ALIAS_SCSI_DEVICE(type) \
> MODULE_ALIAS("scsi:t-" __stringify(type) "*")
> #define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x"
next prev parent reply other threads:[~2024-12-11 21:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 14:02 [PATCH v2 0/4] scsi: st: scsi_error: More reset patches Kai Mäkisara
2024-11-25 14:02 ` [PATCH v2 1/4] scsi: st: Restore some drive settings after reset Kai Mäkisara
2024-11-25 14:02 ` [PATCH v2 2/4] scsi: scsi_error: Add counters for New Media and Power On/Reset UNIT ATTENTIONs Kai Mäkisara
2024-12-11 21:57 ` John Meneghini [this message]
2024-12-11 22:14 ` Bart Van Assche
2024-12-12 18:33 ` "Kai Mäkisara (Kolumbus)"
2024-11-25 14:03 ` [PATCH v2 3/4] scsi: st: Modify st.c to use the new scsi_error counters Kai Mäkisara
2024-12-11 22:14 ` John Meneghini
2024-11-25 14:03 ` [PATCH v2 4/4] scsi: st: Add sysfs file reset_blocked Kai Mäkisara
2024-12-11 21:57 ` John Meneghini
2024-12-11 21:57 ` [PATCH v2 0/4] scsi: st: scsi_error: More reset patches John Meneghini
2024-12-12 18:27 ` "Kai Mäkisara (Kolumbus)"
2024-12-13 13:09 ` "Kai Mäkisara (Kolumbus)"
2024-12-13 17:32 ` John Meneghini
2024-12-14 13:46 ` "Kai Mäkisara (Kolumbus)"
2024-12-20 22:14 ` John Meneghini
2024-12-21 7:57 ` "Kai Mäkisara (Kolumbus)"
2024-12-13 15:09 ` John Meneghini
2024-12-13 15:28 ` John Meneghini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=05de7fab-2139-454d-9f5e-2ac36508e88e@redhat.com \
--to=jmeneghi@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox