From: Stefan Haberland <sth@linux.ibm.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
Jan Hoeppner <hoeppner@linux.ibm.com>,
linux-s390@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [PATCH 5/7] s390/dasd: add aq_timeouts autoquiesce trigger
Date: Wed, 5 Apr 2023 16:20:15 +0200 [thread overview]
Message-ID: <20230405142017.2446986-6-sth@linux.ibm.com> (raw)
In-Reply-To: <20230405142017.2446986-1-sth@linux.ibm.com>
Add a sysfs attribute aq_timeouts that controls after how many
timeouts a autoquiesce event might be triggered.
The default value is 32768 which is the maximum number of retries
for the DASD device driver DASD_RETRIES_MAX. This means that the
timeout trigger will never happen.
The default value for DASD retries is 255.
Setting the value to below 255 will trigger the timeout autoquiesce
event before an IO error is generated.
Also add the check for the configured amount of timeouts and trigger
an autoquiesce event if exceeded.
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
---
drivers/s390/block/dasd.c | 11 ++++++++
drivers/s390/block/dasd_devmap.c | 47 ++++++++++++++++++++++++++++++++
drivers/s390/block/dasd_eckd.c | 1 +
drivers/s390/block/dasd_int.h | 1 +
4 files changed, 60 insertions(+)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 8186473b9aa7..1bfd0e17a4dc 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1953,6 +1953,16 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
}
}
+/*
+ * check if device should be autoquiesced due to too many timeouts
+ */
+static void __dasd_device_check_autoquiesce_timeout(struct dasd_device *device,
+ struct dasd_ccw_req *cqr)
+{
+ if ((device->default_retries - cqr->retries) >= device->aq_timeouts)
+ dasd_handle_autoquiesce(device, cqr, DASD_EER_TIMEOUTS);
+}
+
/*
* Take a look at the first request on the ccw queue and check
* if it reached its expire time. If so, terminate the IO.
@@ -1987,6 +1997,7 @@ static void __dasd_device_check_expire(struct dasd_device *device)
"remaining\n", cqr, (cqr->expires/HZ),
cqr->retries);
}
+ __dasd_device_check_autoquiesce_timeout(device, cqr);
}
}
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 95c7959c7949..620fab01b710 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -1552,6 +1552,52 @@ static ssize_t dasd_aqr_store(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR(aq_requeue, 0644, dasd_aqr_show, dasd_aqr_store);
+/*
+ * aq_timeouts controls how much retries have to time out until
+ * a device gets autoquiesced
+ */
+static ssize_t
+dasd_aq_timeouts_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct dasd_device *device;
+ int len;
+
+ device = dasd_device_from_cdev(to_ccwdev(dev));
+ if (IS_ERR(device))
+ return -ENODEV;
+ len = sysfs_emit(buf, "%u\n", device->aq_timeouts);
+ dasd_put_device(device);
+ return len;
+}
+
+static ssize_t
+dasd_aq_timeouts_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct dasd_device *device;
+ unsigned int val;
+
+ device = dasd_device_from_cdev(to_ccwdev(dev));
+ if (IS_ERR(device))
+ return -ENODEV;
+
+ if ((kstrtouint(buf, 10, &val) != 0) ||
+ val > DASD_RETRIES_MAX || val == 0) {
+ dasd_put_device(device);
+ return -EINVAL;
+ }
+
+ if (val)
+ device->aq_timeouts = val;
+
+ dasd_put_device(device);
+ return count;
+}
+
+static DEVICE_ATTR(aq_timeouts, 0644, dasd_aq_timeouts_show,
+ dasd_aq_timeouts_store);
+
/*
* expiration time for default requests
*/
@@ -2403,6 +2449,7 @@ static struct attribute * dasd_attrs[] = {
&dev_attr_ping.attr,
&dev_attr_aq_mask.attr,
&dev_attr_aq_requeue.attr,
+ &dev_attr_aq_timeouts.attr,
NULL,
};
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 1a69f97e88fb..ade1369fe5ed 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2109,6 +2109,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
device->default_retries = DASD_RETRIES;
device->path_thrhld = DASD_ECKD_PATH_THRHLD;
device->path_interval = DASD_ECKD_PATH_INTERVAL;
+ device->aq_timeouts = DASD_RETRIES_MAX;
if (private->conf.gneq) {
value = 1;
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index c4633a4aeeb1..33f812f0e515 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -638,6 +638,7 @@ struct dasd_device {
struct kset *paths_info;
struct dasd_copy_relation *copy;
unsigned long aq_mask;
+ unsigned int aq_timeouts;
};
struct dasd_block {
--
2.37.2
next prev parent reply other threads:[~2023-04-05 15:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 14:20 [PATCH 0/7] s390/dasd: add dasd autoquiesce feature Stefan Haberland
2023-04-05 14:20 ` [PATCH 1/7] s390/dasd: remove unused DASD EER defines Stefan Haberland
2023-04-12 1:31 ` Halil Pasic
2023-04-05 14:20 ` [PATCH 2/7] s390/dasd: add autoquiesce feature Stefan Haberland
2023-04-12 1:33 ` Halil Pasic
2023-04-05 14:20 ` [PATCH 3/7] s390/dasd: add aq_mask sysfs attribute Stefan Haberland
2023-04-12 1:33 ` Halil Pasic
2023-04-05 14:20 ` [PATCH 4/7] s390/dasd: add aq_requeue " Stefan Haberland
2023-04-12 1:34 ` Halil Pasic
2023-04-05 14:20 ` Stefan Haberland [this message]
2023-04-12 1:34 ` [PATCH 5/7] s390/dasd: add aq_timeouts autoquiesce trigger Halil Pasic
2023-04-05 14:20 ` [PATCH 6/7] s390/dasd: add autoquiesce event for start IO error Stefan Haberland
2023-04-12 1:35 ` Halil Pasic
2023-04-05 14:20 ` [PATCH 7/7] s390/dasd: fix hanging blockdevice after request requeue Stefan Haberland
2023-04-12 1:35 ` Halil Pasic
2023-04-12 1:53 ` [PATCH 0/7] s390/dasd: add dasd autoquiesce feature Jens Axboe
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=20230405142017.2446986-6-sth@linux.ibm.com \
--to=sth@linux.ibm.com \
--cc=axboe@kernel.dk \
--cc=borntraeger@de.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hoeppner@linux.ibm.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/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