fs/9p: only translate RWX permissions for plain 9P2000
Subsystems (11)
Sasha Levin
maintainerPATCH 1/16 fs/9p: only translate RWX permissions for plain 9P2000
From: Joakim Sindholt <[email protected]>
[ Upstream commit cd25e15e57e68a6b18dc9323047fe9c68b99290b ]
Garbage in plain 9P2000's perm bits is allowed through, which causes it to be able to set (among others) the suid bit. This was presumably not the intent since the unix extended bits are handled explicitly and conditionally on .u.
--- fs/9p/vfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_inode.c +1 -1
@@ -83,7 +83,7 @@ static int p9mode2perm(struct v9fs_session_info *v9ses,int res;int mode = stat->mode; - res = mode &S_IALLUGO ; + res = mode &0777 ;/* S_IRWXUGO */ if (v9fs_proto_dotu (v9ses)) {if ((mode &P9_DMSETUID ) ==P9_DMSETUID ) res |=S_ISUID ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/16 fs/9p: translate O_TRUNC into OTRUNC
From: Joakim Sindholt <[email protected]>
[ Upstream commit 87de39e70503e04ddb58965520b15eb9efa7eef3 ]
This one hits both 9P2000 and .u as it appears v9fs has never translated the O_TRUNC flag.
--- fs/9p/vfs_inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/9p/vfs_inode.c +3 -0
@@ -178,6 +178,9 @@ int v9fs_uflags2omode(int uflags, int extended)break ; } +if (uflags &O_TRUNC ) + ret |=P9_OTRUNC ; +if (extended) {if (uflags &O_EXCL ) ret |=P9_OEXCL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/16 fs/9p: fix the cache always being enabled on files with qid flags
In reply to Sasha LevinFrom: Joakim Sindholt <[email protected]>
[ Upstream commit 4e5d208cc9bd5fbc95d536fa223b4b14c37b8ca8 ]
I'm not sure why this check was ever here. After updating to 6.6 I suddenly found caching had been turned on by default and neither cache=none nor the new directio would turn it off. After walking through the new code very manually I realized that it's because the caching has to be, in effect, turned off explicitly by setting P9L_DIRECT and whenever a file has a flag, in my case QTAPPEND, it doesn't get set.
Setting aside QTDIR which seems to ignore the new fid->mode entirely, the rest of these either should be subject to the same cache rules as every other QTFILE or perhaps very explicitly not cached in the case of QTAUTH.
--- fs/9p/fid.h | 3 --- 1 file changed, 3 deletions(-)
fs/9p/fid.h +0 -3
@@ -49,9 +49,6 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)static inline void v9fs_fid_add_modes (struct p9_fid *fid,unsigned int s_flags,unsigned int s_cache,unsigned int f_flags) { -if (fid->qid.type !=P9_QTFILE ) -return ; -if ((!s_cache) || ((fid->qid.version ==0 ) && !(s_flags &V9FS_IGNORE_QV )) || (s_flags &V9FS_DIRECT_IO ) || (f_flags &O_DIRECT )) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/16 9p: explicitly deny setlease attempts
In reply to Sasha LevinFrom: Jeff Layton <[email protected]>
[ Upstream commit 7a84602297d36617dbdadeba55a2567031e5165b ]
9p is a remote network protocol, and it doesn't support asynchronous notifications from the server. Ensure that we don't hand out any leases since we can't guarantee they'll be broken when a file's contents change.
--- fs/9p/vfs_file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/9p/vfs_file.c +2 -0
@@ -591,6 +591,7 @@ const struct file_operations v9fs_file_operations = { .splice_read = v9fs_file_splice_read, .splice_write = iter_file_splice_write, .fsync = v9fs_file_fsync, + .setlease = simple_nosetlease, };const struct file_operations v9fs_file_operations_dotl = {
@@ -605,4 +606,5 @@ const struct file_operations v9fs_file_operations_dotl = { .splice_read = v9fs_file_splice_read, .splice_write = iter_file_splice_write, .fsync = v9fs_file_fsync_dotl, + .setlease = simple_nosetlease, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/16 powerpc/crypto/chacha-p10: Fix failure on non Power10
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit 69630926011c1f7170a465b7b5c228deb66e9372 ]
The chacha-p10-crypto module provides optimised chacha routines for Power10. It also selects CRYPTO_ARCH_HAVE_LIB_CHACHA which says it provides chacha_crypt_arch() to generic code.
Notably the module needs to provide chacha_crypt_arch() regardless of whether it is loaded on Power10 or an older CPU.
The implementation of chacha_crypt_arch() already has a fallback to chacha_crypt_generic(), however the module as a whole fails to load on pre-Power10, because of the use of module_cpu_feature_match().
This breaks for example loading wireguard:
jostaberry-1:~ # modprobe -v wireguard
insmod /lib/modules/6.8.0-lp155.8.g7e0e887-default/kernel/arch/powerpc/crypto/chacha-p10-crypto.ko.zst
modprobe: ERROR: could not insert 'wireguard': No such device
Fix it by removing module_cpu_feature_match(), and instead check the CPU feature manually. If the CPU feature is not found, the module still loads successfully, but doesn't register the Power10 specific algorithms. That allows chacha_crypt_generic() to remain available for use, fixing the problem.
[root@fedora ~]# modprobe -v wireguard
insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/net/ipv4/udp_tunnel.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/net/ipv6/ip6_udp_tunnel.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/lib/crypto/libchacha.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/arch/powerpc/crypto/chacha-p10-crypto.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/lib/crypto/libchacha20poly1305.ko insmod /lib/modules/6.8.0-00001-g786a790c4d79/kernel/drivers/net/wireguard/wireguard.ko
[ 18.910452][ T721] wireguard: allowedips self-tests: pass [ 18.914999][ T721] wireguard: nonce counter self-tests: pass [ 19.029066][ T721] wireguard: ratelimiter self-tests: pass [ 19.029257][ T721] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information. [ 19.029361][ T721] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <[email protected]>. All Rights Reserved.
--- arch/powerpc/crypto/chacha-p10-glue.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/crypto/chacha-p10-glue.c +7 -1
@@ -197,6 +197,9 @@ static struct skcipher_alg algs[] = {static int __init chacha_p10_init (void ) { +if (!cpu_has_feature (CPU_FTR_ARCH_31 )) +return 0 ; +static_branch_enable (&have_p10);return crypto_register_skciphers (algs,ARRAY_SIZE (algs));
@@ -204,10 +207,13 @@ static int __init chacha_p10_init(void) static void __exit chacha_p10_exit(void) { +if (!static_branch_likely (&have_p10)) +return ; +crypto_unregister_skciphers (algs,ARRAY_SIZE (algs)); } -module_cpu_feature_match (PPC_MODULE_FEATURE_P10 , chacha_p10_init); +module_init (chacha_p10_init);module_exit (chacha_p10_exit);MODULE_DESCRIPTION ("ChaCha and XChaCha stream ciphers (P10 accelerated)" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/16 gpio: wcove: Use -ENOTSUPP consistently
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 0c3b532ad3fbf82884a2e7e83e37c7dcdd4d1d99 ]
The GPIO library expects the drivers to return -ENOTSUPP in some cases and not using analogue POSIX code. Make the driver to follow this.
--- drivers/gpio/gpio-wcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-wcove.c +1 -1
@@ -104,7 +104,7 @@ static inline int to_reg(int gpio, enum ctrl_register type)unsigned int reg = type ==CTRL_IN ?GPIO_IN_CTRL_BASE :GPIO_OUT_CTRL_BASE ;if (gpio >=WCOVE_GPIO_NUM ) -return -EOPNOTSUPP ; +return -ENOTSUPP ;return reg + gpio; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/16 gpio: crystalcove: Use -ENOTSUPP consistently
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit ace0ebe5c98d66889f19e0f30e2518d0c58d0e04 ]
The GPIO library expects the drivers to return -ENOTSUPP in some cases and not using analogue POSIX code. Make the driver to follow this.
--- drivers/gpio/gpio-crystalcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-crystalcove.c +1 -1
@@ -92,7 +92,7 @@ static inline int to_reg(int gpio, enum ctrl_register reg_type)case 0x5e :return GPIOPANELCTL ;default : -return -EOPNOTSUPP ; +return -ENOTSUPP ; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/16 clk: Don't hold prepare_lock when calling kref_put()
In reply to Sasha LevinFrom: Stephen Boyd <[email protected]>
[ Upstream commit 6f63af7511e7058f3fa4ad5b8102210741c9f947 ]
We don't need to hold the prepare_lock when dropping a ref on a struct clk_core. The release function is only freeing memory and any code with a pointer reference has already unlinked anything pointing to the clk_core. This reduces the holding area of the prepare_lock a bit.
Note that we also don't call free_clk() with the prepare_lock held. There isn't any reason to do that.
--- drivers/clk/clk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/clk/clk.c +5 -7
@@ -4410,7 +4410,8 @@ void clk_unregister(struct clk *clk)if (ops == &clk_nodrv_ops) {pr_err ("%s: unregistered clock: %s\n" , __func__, clk->core->name); - goto unlock; +clk_prepare_unlock (); +return ; }/* * Assign empty clock ops for consumers that might still hold
@@ -4444,11 +4445,10 @@ void clk_unregister(struct clk *clk)if (clk->core->protect_count)pr_warn ("%s: unregistering protected clock: %s\n" , __func__, clk->core->name); +clk_prepare_unlock ();kref_put (&clk->core->ref, __clk_release);free_clk (clk); -unlock: -clk_prepare_unlock (); }EXPORT_SYMBOL_GPL (clk_unregister);
@@ -4607,13 +4607,11 @@ void __clk_put(struct clk *clk)if (clk->min_rate >0 || clk->max_rate <ULONG_MAX )clk_set_rate_range_nolock (clk,0 ,ULONG_MAX ); - owner = clk->core->owner; -kref_put (&clk->core->ref, __clk_release); -clk_prepare_unlock (); + owner = clk->core->owner; +kref_put (&clk->core->ref, __clk_release);module_put (owner); -free_clk (clk); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/16 fs/9p: drop inodes immediately on non-.L too
In reply to Sasha LevinFrom: Joakim Sindholt <[email protected]>
[ Upstream commit 7fd524b9bd1be210fe79035800f4bd78a41b349f ]
--- fs/9p/vfs_super.c | 1 + 1 file changed, 1 insertion(+)
fs/9p/vfs_super.c +1 -0
@@ -320,6 +320,7 @@ static const struct super_operations v9fs_super_ops = { .alloc_inode = v9fs_alloc_inode, .free_inode = v9fs_free_inode, .statfs = simple_statfs, + .drop_inode = v9fs_drop_inode, .evict_inode = v9fs_evict_inode, .show_options = v9fs_show_options, .umount_begin = v9fs_umount_begin,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/16 gpio: lpc32xx: fix module autoloading
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 11baa36d317321f5d54059f07d243c5a1dbbfbb2 ]
Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpio/gpio-lpc32xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-lpc32xx.c +1 -0
@@ -529,6 +529,7 @@ static const struct of_device_id lpc32xx_gpio_of_match[] = { { .compatible = "nxp,lpc3220-gpio", }, { }, }; +MODULE_DEVICE_TABLE (of, lpc32xx_gpio_of_match);static struct platform_driver lpc32xx_gpio_driver = { .driver = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/16 drm/nouveau/dp: Don't probe eDP ports twice harder
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
[ Upstream commit bf52d7f9b2067f02efe7e32697479097aba4a055 ]
I didn't pay close enough attention the last time I tried to fix this problem - while we currently do correctly take care to make sure we don't probe a connected eDP port more then once, we don't do the same thing for eDP ports we found to be disconnected.
So, fix this and make sure we only ever probe eDP ports once and then leave them at that connector state forever (since without HPD, it's not going to change on its own anyway). This should get rid of the last few GSP errors getting spit out during runtime suspend and resume on some machines, as we tried to reprobe eDP ports in response to ACPI hotplug probe events.
--- drivers/gpu/drm/nouveau/nouveau_dp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dp.c +8 -5
@@ -108,12 +108,15 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector,u8 *dpcd = nv_encoder->dp.dpcd;int ret =NOUVEAU_DP_NONE , hpd; -/* If we've already read the DPCD on an eDP device, we don't need to -* reread it as it won't change +/* eDP ports don't support hotplugging - so there's no point in probing eDP ports unless we +* haven't probed them once before. */ -if (connector->connector_type == DRM_MODE_CONNECTOR_eDP && - dpcd[DP_DPCD_REV ] !=0 ) -return NOUVEAU_DP_SST ; +if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { +if (connector->status == connector_status_connected) +return NOUVEAU_DP_SST ; +else if (connector->status == connector_status_disconnected) +return NOUVEAU_DP_NONE ; + }mutex_lock (&nv_encoder->dp.hpd_irq_lock);if (mstm) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/16 platform/x86: ISST: Add Granite Rapids-D to HPM CPU list
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit d8c2d38c4d1dee8fe8e015b9ebf65bdd8e4da99b ]
Add Granite Rapids-D to hpm_cpu_ids, so that MSR 0x54 can be used.
--- drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/intel/speed_select_if/isst_if_common.c +1 -0
@@ -719,6 +719,7 @@ static struct miscdevice isst_if_char_driver = { };static const struct x86_cpu_id hpm_cpu_ids[] = { +X86_MATCH_INTEL_FAM6_MODEL (GRANITERAPIDS_D ,NULL ),X86_MATCH_INTEL_FAM6_MODEL (GRANITERAPIDS_X ,NULL ),X86_MATCH_INTEL_FAM6_MODEL (ATOM_CRESTMONT_X ,NULL ), {}
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/16 platform/x86/amd/pmc: Extend Framework 13 quirk to more BIOSes
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit f609e7b1b49e4d15cf107d2069673ee63860c398 ]
BIOS 03.05 still hasn't fixed the spurious IRQ1 issue. As it's still being worked on there is still a possibility that it won't need to apply to future BIOS releases.
Add a quirk for BIOS 03.05 as well.
--- drivers/platform/x86/amd/pmc/pmc-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/amd/pmc/pmc-quirks.c +9 -0
@@ -208,6 +208,15 @@ static const struct dmi_system_id fwbug_list[] = { DMI_MATCH(DMI_BIOS_VERSION, "03.03"), } }, + { + .ident = "Framework Laptop 13 (Phoenix)", + .driver_data = &quirk_spurious_8042, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Framework"), + DMI_MATCH(DMI_PRODUCT_NAME, "Laptop 13 (AMD Ryzen 7040Series)"), + DMI_MATCH(DMI_BIOS_VERSION, "03.05"), + } + }, {} };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/16 drm/radeon: silence UBSAN warning (v3)
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 781d41fed19caf900c8405064676813dc9921d32 ]
Convert a variable sized array from [1] to [].
v2: fix up a few more.
v3: integrate comments from Kees.
--- drivers/gpu/drm/radeon/pptable.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/pptable.h +5 -5
@@ -424,7 +424,7 @@ typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{ typedef struct _ATOM_PPLIB_STATE_V2 { //number of valid dpm levels in this state; Driver uses it to calculate the whole - //size of the state: sizeof(ATOM_PPLIB_STATE_V2) + (ucNumDPMLevels - 1) * sizeof(UCHAR) + //size of the state: struct_size(ATOM_PPLIB_STATE_V2, clockInfoIndex, ucNumDPMLevels) UCHAR ucNumDPMLevels; //a index to the array of nonClockInfos
@@ -432,14 +432,14 @@ typedef struct _ATOM_PPLIB_STATE_V2/** * Driver will read the first ucNumDPMLevels in this array */ -UCHAR clockInfoIndex[1 ]; + UCHAR clockInfoIndex[] __counted_by(ucNumDPMLevels); }ATOM_PPLIB_STATE_V2 ;typedef struct _StateArray {//how many states we have UCHAR ucNumEntries; -ATOM_PPLIB_STATE_V2 states[1 ]; + ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries); }StateArray ;
@@ -450,7 +450,7 @@ typedef struct _ClockInfoArray{//sizeof(ATOM_PPLIB_CLOCK_INFO) UCHAR ucEntrySize; -UCHAR clockInfo[1 ]; + UCHAR clockInfo[] __counted_by(ucNumEntries); }ClockInfoArray; typedef struct _NonClockInfoArray{
@@ -460,7 +460,7 @@ typedef struct _NonClockInfoArray{//sizeof(ATOM_PPLIB_NONCLOCK_INFO) UCHAR ucEntrySize; -ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[1 ]; + ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[] __counted_by(ucNumEntries); }NonClockInfoArray; typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/16 net:usb:qmi_wwan: support Rolling modules
In reply to Sasha LevinFrom: Vanillan Wang <[email protected]>
[ Upstream commit d362046021ea122309da8c8e0b6850c792ca97b5 ]
Update the qmi_wwan driver support for the Rolling LTE modules.
- VID:PID 33f8:0104, RW101-GL for laptop debug M.2 cards(with RMNET interface for /Linux/Chrome OS)0x0104: RMNET, diag, at, pipe
Here are the outputs of usb-devices:
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=33f8 ProdID=0104 Rev=05.04 S: Manufacturer=Rolling Wireless S.a.r.l. S: Product=Rolling Module S: SerialNumber=ba2eb033 C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1431,6 +1431,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2692, 0x9025, 4)}, /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */ {QMI_QUIRK_SET_DTR(0x1546, 0x1312, 4)}, /* u-blox LARA-R6 01B */ {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */ + {QMI_QUIRK_SET_DTR(0x33f8, 0x0104, 4)}, /* Rolling RW101 RMNET *//* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/16 blk-iocost: do not WARN if iocg was already offlined
In reply to Sasha LevinFrom: Li Nan <[email protected]>
[ Upstream commit 01bc4fda9ea0a6b52f12326486f07a4910666cf6 ]
In iocg_pay_debt(), warn is triggered if 'active_list' is empty, which is intended to confirm iocg is active when it has debt. However, warn can be triggered during a blkcg or disk removal, if iocg_waitq_timer_fn() is run at that time:
WARNING: CPU: 0 PID: 2344971 at block/blk-iocost.c:1402 iocg_pay_debt+0x14c/0x190 Call trace: iocg_pay_debt+0x14c/0x190 iocg_kick_waitq+0x438/0x4c0 iocg_waitq_timer_fn+0xd8/0x130 __run_hrtimer+0x144/0x45c __hrtimer_run_queues+0x16c/0x244 hrtimer_interrupt+0x2cc/0x7b0
The warn in this situation is meaningless. Since this iocg is being removed, the state of the 'active_list' is irrelevant, and 'waitq_timer' is canceled after removing 'active_list' in ioc_pd_free(), which ensures iocg is freed after iocg_waitq_timer_fn() returns.
Therefore, add the check if iocg was already offlined to avoid warn when removing a blkcg or disk.
--- block/blk-iocost.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
block/blk-iocost.c +5 -2
@@ -1438,8 +1438,11 @@ static void iocg_pay_debt(struct ioc_gq *iocg, u64 abs_vpay,lockdep_assert_held (&iocg->ioc->lock);lockdep_assert_held (&iocg->waitq.lock); -/* make sure that nobody messed with @iocg */ -WARN_ON_ONCE (list_empty (&iocg->active_list)); +/* +* make sure that nobody messed with @iocg. Check iocg->pd.online +* to avoid warn when removing blkcg or disk. +*/ +WARN_ON_ONCE (list_empty (&iocg->active_list) && iocg->pd.online);WARN_ON_ONCE (iocg->inuse >1 ); iocg->abs_vdebt -=min (abs_vpay, iocg->abs_vdebt);
Signature · 1 line
2.43.0