* [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking
@ 2023-06-15 11:38 Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 02/10] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Jim Wylder, Sasha Levin, broonie, gregkh
From: Jim Wylder <jwylder@google.com>
[ Upstream commit 3981514180c987a79ea98f0ae06a7cbf58a9ac0f ]
Currently, when regmap_raw_write() splits the data, it uses the
max_raw_write value defined for the bus. For any bus that includes
the target register address in the max_raw_write value, the chunked
transmission will always exceed the maximum transmission length.
To avoid this problem, subtract the length of the register and the
padding from the maximum transmission.
Signed-off-by: Jim Wylder <jwylder@google.com
Link: https://lore.kernel.org/r/20230517152444.3690870-2-jwylder@google.com
Signed-off-by: Mark Brown <broonie@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/regmap/regmap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index f7811641ed5ae..05410c69a3da6 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2041,6 +2041,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
size_t val_count = val_len / val_bytes;
size_t chunk_count, chunk_bytes;
size_t chunk_regs = val_count;
+ size_t max_data = map->max_raw_write - map->format.reg_bytes -
+ map->format.pad_bytes;
int ret, i;
if (!val_count)
@@ -2048,8 +2050,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
if (map->use_single_write)
chunk_regs = 1;
- else if (map->max_raw_write && val_len > map->max_raw_write)
- chunk_regs = map->max_raw_write / val_bytes;
+ else if (map->max_raw_write && val_len > max_data)
+ chunk_regs = max_data / val_bytes;
chunk_count = val_count / chunk_regs;
chunk_bytes = chunk_regs * val_bytes;
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 02/10] scsi: target: iscsi: Prevent login threads from racing between each other
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 03/10] HID: google: add jewel USB id Sasha Levin
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Maurizio Lombardi, Mike Christie, Martin K . Petersen,
Sasha Levin, d.bogdanov, yang.lee, peilin.ye, linux-scsi,
target-devel
From: Maurizio Lombardi <mlombard@redhat.com>
[ Upstream commit 2a737d3b8c792400118d6cf94958f559de9c5e59 ]
The tpg->np_login_sem is a semaphore that is used to serialize the login
process when multiple login threads run concurrently against the same
target portal group.
The iscsi_target_locate_portal() function finds the tpg, calls
iscsit_access_np() against the np_login_sem semaphore and saves the tpg
pointer in conn->tpg;
If iscsi_target_locate_portal() fails, the caller will check for the
conn->tpg pointer and, if it's not NULL, then it will assume that
iscsi_target_locate_portal() called iscsit_access_np() on the semaphore.
Make sure that conn->tpg gets initialized only if iscsit_access_np() was
successful, otherwise iscsit_deaccess_np() may end up being called against
a semaphore we never took, allowing more than one thread to access the same
tpg.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Link: https://lore.kernel.org/r/20230508162219.1731964-4-mlombard@redhat.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/target/iscsi/iscsi_target_nego.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index c0ed6f8e5c5b9..32a2852352db1 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -1071,6 +1071,7 @@ int iscsi_target_locate_portal(
iscsi_target_set_sock_callbacks(conn);
login->np = np;
+ conn->tpg = NULL;
login_req = (struct iscsi_login_req *) login->req;
payload_length = ntoh24(login_req->dlength);
@@ -1138,7 +1139,6 @@ int iscsi_target_locate_portal(
*/
sessiontype = strncmp(s_buf, DISCOVERY, 9);
if (!sessiontype) {
- conn->tpg = iscsit_global->discovery_tpg;
if (!login->leading_connection)
goto get_target;
@@ -1155,9 +1155,11 @@ int iscsi_target_locate_portal(
* Serialize access across the discovery struct iscsi_portal_group to
* process login attempt.
*/
+ conn->tpg = iscsit_global->discovery_tpg;
if (iscsit_access_np(np, conn->tpg) < 0) {
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE);
+ conn->tpg = NULL;
ret = -1;
goto out;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 03/10] HID: google: add jewel USB id
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 02/10] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 04/10] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sung-Chi Li, Jiri Kosina, Sasha Levin, jikos, benjamin.tissoires,
linux-input
From: Sung-Chi Li <lschyi@chromium.org>
[ Upstream commit ed84c4517a5bc536e8572a01dfa11bc22a280d06 ]
Add 1 additional hammer-like device.
Signed-off-by: Sung-Chi Li <lschyi@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-google-hammer.c | 2 ++
drivers/hid/hid-ids.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index 0403beb3104b9..6a227e07f8943 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -589,6 +589,8 @@ static const struct hid_device_id hammer_devices[] = {
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
+ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
+ USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_JEWEL) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index b153ddc3319e8..5daec769df7ae 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -502,6 +502,7 @@
#define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044
#define USB_DEVICE_ID_GOOGLE_DON 0x5050
#define USB_DEVICE_ID_GOOGLE_EEL 0x5057
+#define USB_DEVICE_ID_GOOGLE_JEWEL 0x5061
#define USB_VENDOR_ID_GOTOP 0x08f2
#define USB_DEVICE_ID_SUPER_Q2 0x007f
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 04/10] HID: wacom: Add error check to wacom_parse_and_register()
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 02/10] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 03/10] HID: google: add jewel USB id Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 05/10] arm64: Add missing Set/Way CMO encodings Sasha Levin
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Denis Arefev, Ping Cheng, Jiri Kosina, Sasha Levin, jason.gerecke,
jikos, benjamin.tissoires, linux-input
From: Denis Arefev <arefev@swemel.ru>
[ Upstream commit 16a9c24f24fbe4564284eb575b18cc20586b9270 ]
Added a variable check and
transition in case of an error
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/wacom_sys.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index d29773a799b4f..33e763e746a0b 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -2425,8 +2425,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
goto fail_quirks;
}
- if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
+ if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
error = hid_hw_open(hdev);
+ if (error) {
+ hid_err(hdev, "hw open failed\n");
+ goto fail_quirks;
+ }
+ }
wacom_set_shared_values(wacom_wac);
devres_close_group(&hdev->dev, wacom);
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 05/10] arm64: Add missing Set/Way CMO encodings
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
` (2 preceding siblings ...)
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 04/10] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 06/10] media: cec: core: don't set last_initiator if tx in progress Sasha Levin
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Marc Zyngier, Cornelia Huck, Steven Price, Oliver Upton,
Sasha Levin, catalin.marinas, will, broonie, james.morse,
kristina.martsenko, robh, jintack.lim, linux-arm-kernel
From: Marc Zyngier <maz@kernel.org>
[ Upstream commit 8d0f019e4c4f2ee2de81efd9bf1c27e9fb3c0460 ]
Add the missing Set/Way CMOs that apply to tagged memory.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20230515204601.1270428-2-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/include/asm/sysreg.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index f79f3720e4cbe..543eb08fa8e5f 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -109,8 +109,14 @@
#define SB_BARRIER_INSN __SYS_BARRIER_INSN(0, 7, 31)
#define SYS_DC_ISW sys_insn(1, 0, 7, 6, 2)
+#define SYS_DC_IGSW sys_insn(1, 0, 7, 6, 4)
+#define SYS_DC_IGDSW sys_insn(1, 0, 7, 6, 6)
#define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2)
+#define SYS_DC_CGSW sys_insn(1, 0, 7, 10, 4)
+#define SYS_DC_CGDSW sys_insn(1, 0, 7, 10, 6)
#define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2)
+#define SYS_DC_CIGSW sys_insn(1, 0, 7, 14, 4)
+#define SYS_DC_CIGDSW sys_insn(1, 0, 7, 14, 6)
/*
* System registers, organised loosely by encoding but grouped together
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 06/10] media: cec: core: don't set last_initiator if tx in progress
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
` (3 preceding siblings ...)
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 05/10] arm64: Add missing Set/Way CMO encodings Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 07/10] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin, linux-media
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[ Upstream commit 73af6c7511038249cad3d5f3b44bf8d78ac0f499 ]
When a message was received the last_initiator is set to 0xff.
This will force the signal free time for the next transmit
to that for a new initiator. However, if a new transmit is
already in progress, then don't set last_initiator, since
that's the initiator of the current transmit. Overwriting
this would cause the signal free time of a following transmit
to be that of the new initiator instead of a next transmit.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/cec/core/cec-adap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
index 67776a0d31e8c..99ede1417d727 100644
--- a/drivers/media/cec/core/cec-adap.c
+++ b/drivers/media/cec/core/cec-adap.c
@@ -1086,7 +1086,8 @@ void cec_received_msg_ts(struct cec_adapter *adap,
mutex_lock(&adap->lock);
dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg);
- adap->last_initiator = 0xff;
+ if (!adap->transmit_in_progress)
+ adap->last_initiator = 0xff;
/* Check if this message was for us (directed or broadcast). */
if (!cec_msg_is_broadcast(msg))
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 07/10] nfcsim.c: Fix error checking for debugfs_create_dir
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
` (4 preceding siblings ...)
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 06/10] media: cec: core: don't set last_initiator if tx in progress Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 08/10] usb: gadget: udc: fix NULL dereference in remove() Sasha Levin
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Osama Muhammad, Simon Horman, David S . Miller, Sasha Levin,
krzysztof.kozlowski, netdev
From: Osama Muhammad <osmtendev@gmail.com>
[ Upstream commit 9b9e46aa07273ceb96866b2e812b46f1ee0b8d2f ]
This patch fixes the error checking in nfcsim.c.
The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that
occur during the creation of DebugFS nodes.
Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nfc/nfcsim.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c
index 85bf8d586c707..0f6befe8be1e2 100644
--- a/drivers/nfc/nfcsim.c
+++ b/drivers/nfc/nfcsim.c
@@ -336,10 +336,6 @@ static struct dentry *nfcsim_debugfs_root;
static void nfcsim_debugfs_init(void)
{
nfcsim_debugfs_root = debugfs_create_dir("nfcsim", NULL);
-
- if (!nfcsim_debugfs_root)
- pr_err("Could not create debugfs entry\n");
-
}
static void nfcsim_debugfs_remove(void)
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 08/10] usb: gadget: udc: fix NULL dereference in remove()
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
` (5 preceding siblings ...)
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 07/10] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 09/10] nvme: double KA polling frequency to avoid KATO with TBKAS on Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 10/10] ext4: enable the lazy init thread when remounting read/write Sasha Levin
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dan Carpenter, Greg Kroah-Hartman, Sasha Levin, linux-usb
From: Dan Carpenter <dan.carpenter@linaro.org>
[ Upstream commit 016da9c65fec9f0e78c4909ed9a0f2d567af6775 ]
The "udc" pointer was never set in the probe() function so it will
lead to a NULL dereference in udc_pci_remove() when we do:
usb_del_gadget_udc(&udc->gadget);
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/ZG+A/dNpFWAlCChk@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/udc/amd5536udc_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c
index c80f9bd51b750..a36913ae31f9e 100644
--- a/drivers/usb/gadget/udc/amd5536udc_pci.c
+++ b/drivers/usb/gadget/udc/amd5536udc_pci.c
@@ -170,6 +170,9 @@ static int udc_pci_probe(
retval = -ENODEV;
goto err_probe;
}
+
+ udc = dev;
+
return 0;
err_probe:
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 09/10] nvme: double KA polling frequency to avoid KATO with TBKAS on
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
` (6 preceding siblings ...)
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 08/10] usb: gadget: udc: fix NULL dereference in remove() Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 10/10] ext4: enable the lazy init thread when remounting read/write Sasha Levin
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Uday Shankar, Costa Sapuntzakis, Randy Jennings, Hannes Reinecke,
Sagi Grimberg, Christoph Hellwig, Keith Busch, Sasha Levin,
linux-nvme
From: Uday Shankar <ushankar@purestorage.com>
[ Upstream commit ea4d453b9ec9ea279c39744cd0ecb47ef48ede35 ]
With TBKAS on, the completion of one command can defer sending a
keep alive for up to twice the delay between successive runs of
nvme_keep_alive_work. The current delay of KATO / 2 thus makes it
possible for one command to defer sending a keep alive for up to
KATO, which can result in the controller detecting a KATO. The following
trace demonstrates the issue, taking KATO = 8 for simplicity:
1. t = 0: run nvme_keep_alive_work, no keep-alive sent
2. t = ε: I/O completion seen, set comp_seen = true
3. t = 4: run nvme_keep_alive_work, see comp_seen == true,
skip sending keep-alive, set comp_seen = false
4. t = 8: run nvme_keep_alive_work, see comp_seen == false,
send a keep-alive command.
Here, there is a delay of 8 - ε between receiving a command completion
and sending the next command. With ε small, the controller is likely to
detect a keep alive timeout.
Fix this by running nvme_keep_alive_work with a delay of KATO / 4
whenever TBKAS is on. Going through the above trace now gives us a
worst-case delay of 4 - ε, which is in line with the recommendation of
sending a command every KATO / 2 in the NVMe specification.
Reported-by: Costa Sapuntzakis <costa@purestorage.com>
Reported-by: Randy Jennings <randyj@purestorage.com>
Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/core.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e5318b38c6624..98a7649a0f061 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1247,9 +1247,25 @@ EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU);
* The host should send Keep Alive commands at half of the Keep Alive Timeout
* accounting for transport roundtrip times [..].
*/
+static unsigned long nvme_keep_alive_work_period(struct nvme_ctrl *ctrl)
+{
+ unsigned long delay = ctrl->kato * HZ / 2;
+
+ /*
+ * When using Traffic Based Keep Alive, we need to run
+ * nvme_keep_alive_work at twice the normal frequency, as one
+ * command completion can postpone sending a keep alive command
+ * by up to twice the delay between runs.
+ */
+ if (ctrl->ctratt & NVME_CTRL_ATTR_TBKAS)
+ delay /= 2;
+ return delay;
+}
+
static void nvme_queue_keep_alive_work(struct nvme_ctrl *ctrl)
{
- queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ / 2);
+ queue_delayed_work(nvme_wq, &ctrl->ka_work,
+ nvme_keep_alive_work_period(ctrl));
}
static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH AUTOSEL 5.15 10/10] ext4: enable the lazy init thread when remounting read/write
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
` (7 preceding siblings ...)
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 09/10] nvme: double KA polling frequency to avoid KATO with TBKAS on Sasha Levin
@ 2023-06-15 11:38 ` Sasha Levin
8 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2023-06-15 11:38 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Theodore Ts'o, Sasha Levin, adilger.kernel, linux-ext4
From: Theodore Ts'o <tytso@mit.edu>
[ Upstream commit eb1f822c76beeaa76ab8b6737ab9dc9f9798408c ]
In commit a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting
r/w until quota is re-enabled") we defer clearing tyhe SB_RDONLY flag
in struct super. However, we didn't defer when we checked sb_rdonly()
to determine the lazy itable init thread should be enabled, with the
next result that the lazy inode table initialization would not be
properly started. This can cause generic/231 to fail in ext4's
nojournal mode.
Fix this by moving when we decide to start or stop the lazy itable
init thread to after we clear the SB_RDONLY flag when we are
remounting the file system read/write.
Fixes a44be64bbecb ("ext4: don't clear SB_RDONLY when remounting r/w until...")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20230527035729.1001605-1-tytso@mit.edu
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/super.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bf8a780cd69b6..ebe2abc064e7b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5962,18 +5962,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
}
}
- /*
- * Reinitialize lazy itable initialization thread based on
- * current settings
- */
- if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE))
- ext4_unregister_li_request(sb);
- else {
- ext4_group_t first_not_zeroed;
- first_not_zeroed = ext4_has_uninit_itable(sb);
- ext4_register_li_request(sb, first_not_zeroed);
- }
-
/*
* Handle creation of system zone data early because it can fail.
* Releasing of existing data is done when we are sure remount will
@@ -6011,6 +5999,18 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
if (enable_rw)
sb->s_flags &= ~SB_RDONLY;
+ /*
+ * Reinitialize lazy itable initialization thread based on
+ * current settings
+ */
+ if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE))
+ ext4_unregister_li_request(sb);
+ else {
+ ext4_group_t first_not_zeroed;
+ first_not_zeroed = ext4_has_uninit_itable(sb);
+ ext4_register_li_request(sb, first_not_zeroed);
+ }
+
if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb))
ext4_stop_mmpd(sbi);
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-06-15 11:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15 11:38 [PATCH AUTOSEL 5.15 01/10] regmap: Account for register length when chunking Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 02/10] scsi: target: iscsi: Prevent login threads from racing between each other Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 03/10] HID: google: add jewel USB id Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 04/10] HID: wacom: Add error check to wacom_parse_and_register() Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 05/10] arm64: Add missing Set/Way CMO encodings Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 06/10] media: cec: core: don't set last_initiator if tx in progress Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 07/10] nfcsim.c: Fix error checking for debugfs_create_dir Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 08/10] usb: gadget: udc: fix NULL dereference in remove() Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 09/10] nvme: double KA polling frequency to avoid KATO with TBKAS on Sasha Levin
2023-06-15 11:38 ` [PATCH AUTOSEL 5.15 10/10] ext4: enable the lazy init thread when remounting read/write Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).