x86/paravirt: Fix some warning messages
Subsystems (2)
Sasha Levin
maintainerPATCH 1/8 x86/paravirt: Fix some warning messages
From: Dan Carpenter <[email protected]>
[ Upstream commit 571d0563c8881595f4ab027aef9ed1c55e3e7b7c ]
The first argument to WARN_ONCE() is a condition.
--- arch/x86/kernel/paravirt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/paravirt.c +2 -2
@@ -90,7 +90,7 @@ unsigned paravirt_patch_call(void *insnbuf,if (len <5 ) {#ifdef CONFIG_RETPOLINE -WARN_ONCE ("Failing to patch indirect CALL in %ps\n" , (void *)addr); +WARN_ONCE (1 ,"Failing to patch indirect CALL in %ps\n" , (void *)addr);#endif return len;/* call too long for patch site */ }
@@ -110,7 +110,7 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,if (len <5 ) {#ifdef CONFIG_RETPOLINE -WARN_ONCE ("Failing to patch indirect JMP in %ps\n" , (void *)addr); +WARN_ONCE (1 ,"Failing to patch indirect JMP in %ps\n" , (void *)addr);#endif return len;/* call too long for patch site */ }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 2/8 libertas: call into generic suspend code before turning off power
From: Daniel Mack <[email protected]>
[ Upstream commit 4f666675cdff0b986195413215eb062b7da6586f ]
When powering down a SDIO connected card during suspend, make sure to call into the generic lbs_suspend() function before pulling the plug. This will make sure the card is successfully deregistered from the system to avoid communication to the card starving out.
--- drivers/net/wireless/marvell/libertas/if_sdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/marvell/libertas/if_sdio.c +4 -0
@@ -1317,6 +1317,10 @@ static int if_sdio_suspend(struct device *dev)if (priv->wol_criteria ==EHS_REMOVE_WAKEUP ) {dev_info (dev,"Suspend without wake params -- powering down card\n" );if (priv->fw_ready) { + ret =lbs_suspend (priv); +if (ret) +return ret; + priv->power_up_on_resume = true;if_sdio_power_off (card); }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 3/8 iommu/rockchip: Free irqs in shutdown handler
In reply to Sasha LevinFrom: Heiko Stuebner <[email protected]>
[ Upstream commit 74bc2abca7603c956d1e331e8b9bee7b874c1eec ]
In the iommu's shutdown handler we disable runtime-pm which could result in the irq-handler running unclocked and since commit
3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
we warn about that fact.
This can cause warnings on shutdown on some Rockchip machines, so free the irqs in the shutdown handler before we disable runtime-pm.
--- drivers/iommu/rockchip-iommu.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iommu/rockchip-iommu.c +6 -0
@@ -1242,6 +1242,12 @@ static int rk_iommu_probe(struct platform_device *pdev)static void rk_iommu_shutdown (struct platform_device *pdev) { +struct rk_iommu *iommu =platform_get_drvdata (pdev); +int i =0 , irq; + +while ((irq =platform_get_irq (pdev, i++)) != -ENXIO ) +devm_free_irq (iommu->dev, irq, iommu); +pm_runtime_force_suspend (&pdev->dev); }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 4/8 powerpc/numa: Skip onlining a offline node in kdump path
In reply to Sasha LevinFrom: Srikar Dronamraju <[email protected]>
[ Upstream commit ac1788cc7da4ce54edcfd2e499afdb0a23d5c41d ]
With commit 2ea626306810 ("powerpc/topology: Get topology for shared processors at boot"), kdump kernel on shared LPAR may crash.
The necessary conditions are
- Shared LPAR with at least 2 nodes having memory and CPUs.
- Memory requirement for kdump kernel must be met by the first N-1 nodes where there are at least N nodes with memory and CPUs.
Example numactl of such a machine.
$ numactl -H
available: 5 nodes (0,2,5-7)
node 0 cpus:
node 0 size: 0 MB
node 0 free: 0 MB
node 2 cpus:
node 2 size: 255 MB
node 2 free: 189 MB
node 5 cpus: 24 25 26 27 28 29 30 31
node 5 size: 4095 MB
node 5 free: 4024 MB
node 6 cpus: 0 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23
node 6 size: 6353 MB
node 6 free: 5998 MB
node 7 cpus: 8 9 10 11 12 13 14 15 32 33 34 35 36 37 38 39
node 7 size: 7640 MB
node 7 free: 7164 MB
node distances:
node 0 2 5 6 7
0: 10 40 40 40 40
2: 40 10 40 40 40
5: 40 40 10 40 40
6: 40 40 40 10 20
7: 40 40 40 20 10Steps to reproduce.
1. Load / start kdump service.
2. Trigger a kdump (for example : echo c > /proc/sysrq-trigger)
When booting a kdump kernel with 2048M:
kexec: Starting switchover sequence.
I'm in purgatory
Using 1TB segments
hash-mmu: Initializing hash mmu with SLB
Linux version 4.19.0-rc5-master+ (srikar@linux-xxu6) (gcc version 4.8.5 (SUSE Linux)) #1 SMP Thu Sep 27 19:45:00 IST 2018 Found initrd at 0xc000000009e70000:0xc00000000ae554b4
Using pSeries machine description
-----------------------------------------------------
ppc64_pft_size = 0x1e
phys_mem_size = 0x88000000
dcache_bsize = 0x80
icache_bsize = 0x80
cpu_features = 0x000000ff8f5d91a7
possible = 0x0000fbffcf5fb1a7
always = 0x0000006f8b5c91a1
cpu_user_features = 0xdc0065c2 0xef000000
mmu_features = 0x7c006001
firmware_features = 0x00000007c45bfc57
htab_hash_mask = 0x7fffff
physical_start = 0x8000000
-----------------------------------------------------
numa: NODE_DATA [mem 0x87d5e300-0x87d67fff]
numa: NODE_DATA(0) on node 6
numa: NODE_DATA [mem 0x87d54600-0x87d5e2ff]
Top of RAM: 0x88000000, Total RAM: 0x88000000
Memory hole size: 0MB
Zone ranges:
DMA [mem 0x0000000000000000-0x0000000087ffffff]
DMA32 empty
Normal empty
Movable zone start for each node
Early memory node ranges
node 6: [mem 0x0000000000000000-0x0000000087ffffff] Could not find start_pfn for node 0
Initmem setup node 0 [mem 0x0000000000000000-0x0000000000000000] On node 0 totalpages: 0
Initmem setup node 6 [mem 0x0000000000000000-0x0000000087ffffff] On node 6 totalpages: 34816
Unable to handle kernel paging request for data at address 0x00000060 Faulting instruction address: 0xc000000008703a54 Oops: Kernel access of bad area, sig: 11 [#1] LE SMP NR_CPUS=2048 NUMA pSeries Modules linked in: CPU: 11 PID: 1 Comm: swapper/11 Not tainted 4.19.0-rc5-master+ #1 NIP: c000000008703a54 LR: c000000008703a38 CTR: 0000000000000000 REGS: c00000000b673440 TRAP: 0380 Not tainted (4.19.0-rc5-master+) MSR: 8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 24022022 XER: 20000002 CFAR: c0000000086fc238 IRQMASK: 0 GPR00: c000000008703a38 c00000000b6736c0 c000000009281900 0000000000000000 GPR04: 0000000000000000 0000000000000000 fffffffffffff001 c00000000b660080 GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000220 GPR12: 0000000000002200 c000000009e51400 0000000000000000 0000000000000008 GPR16: 0000000000000000 c000000008c152e8 c000000008c152a8 0000000000000000 GPR20: c000000009422fd8 c000000009412fd8 c000000009426040 0000000000000008 GPR24: 0000000000000000 0000000000000000 c000000009168bc8 c000000009168c78 GPR28: c00000000b126410 0000000000000000 c00000000916a0b8 c00000000b126400 NIP [c000000008703a54] bus_add_device+0x84/0x1e0 LR [c000000008703a38] bus_add_device+0x68/0x1e0 Call Trace: [c00000000b6736c0] [c000000008703a38] bus_add_device+0x68/0x1e0 (unreliable) [c00000000b673740] [c000000008700194] device_add+0x454/0x7c0 [c00000000b673800] [c00000000872e660] __register_one_node+0xb0/0x240 [c00000000b673860] [c00000000839a6bc] __try_online_node+0x12c/0x180 [c00000000b673900] [c00000000839b978] try_online_node+0x58/0x90 [c00000000b673930] [c0000000080846d8] find_and_online_cpu_nid+0x158/0x190 [c00000000b673a10] [c0000000080848a0] numa_update_cpu_topology+0x190/0x580 [c00000000b673c00] [c000000008d3f2e4] smp_cpus_done+0x94/0x108 [c00000000b673c70] [c000000008d5c00c] smp_init+0x174/0x19c [c00000000b673d00] [c000000008d346b8] kernel_init_freeable+0x1e0/0x450 [c00000000b673dc0] [c0000000080102e8] kernel_init+0x28/0x160 [c00000000b673e30] [c00000000800b65c] ret_from_kernel_thread+0x5c/0x80 Instruction dump: 60000000 60000000 e89e0020 7fe3fb78 4bff87d5 60000000 7c7d1b79 4082008c e8bf0050 e93e0098 3b9f0010 2fa50000 <e8690060> 38630018 419e0114 7f84e378 ---[ end trace 593577668c2daa65 ]---
However a regular kernel with 4096M (2048 gets reserved for crash kernel) boots properly.
Unlike regular kernels, which mark all available nodes as online, kdump kernel only marks just enough nodes as online and marks the rest as offline at boot. However kdump kernel boots with all available CPUs. With Commit 2ea626306810 ("powerpc/topology: Get topology for shared processors at boot"), all CPUs are onlined on their respective nodes at boot time. try_online_node() tries to online the offline nodes but fails as all needed subsystems are not yet initialized.
As part of fix, detect and skip early onlining of a offline node.
--- arch/powerpc/mm/numa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/mm/numa.c +3 -2
@@ -1215,9 +1215,10 @@ int find_and_online_cpu_nid(int cpu)* Need to ensure that NODE_DATA is initialized for a node from * available memory (see memblock_alloc_try_nid). If unable to * init the node, then default to nearest node that has memory -* installed. +* installed. Skip onlining a node if the subsystems are not +* yet initialized. */ -if (try_online_node (new_nid)) +if (!topology_inited ||try_online_node (new_nid)) new_nid = first_online_node;#else /*
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 5/8 powerpc/numa: Use associativity if VPHN hcall is successful
In reply to Sasha LevinFrom: Srikar Dronamraju <[email protected]>
[ Upstream commit 2483ef056f6e42f61cd266452e2841165dfe1b5c ]
Currently associativity is used to lookup node-id even if the preceding VPHN hcall failed. However this can cause CPU to be made part of the wrong node, (most likely to be node 0). This is because VPHN is not enabled on KVM guests.
With 2ea6263 ("powerpc/topology: Get topology for shared processors at boot"), associativity is used to set to the wrong node. Hence KVM guest topology is broken.
For example : A 4 node KVM guest before would have reported.
[root@localhost ~]# numactl -H
available: 4 nodes (0-3)
node 0 cpus: 0 1 2 3
node 0 size: 1746 MB
node 0 free: 1604 MB
node 1 cpus: 4 5 6 7
node 1 size: 2044 MB
node 1 free: 1765 MB
node 2 cpus: 8 9 10 11
node 2 size: 2044 MB
node 2 free: 1837 MB
node 3 cpus: 12 13 14 15
node 3 size: 2044 MB
node 3 free: 1903 MB
node distances:
node 0 1 2 3
0: 10 40 40 40
1: 40 10 40 40
2: 40 40 10 40
3: 40 40 40 10Would now report:
[root@localhost ~]# numactl -H
available: 4 nodes (0-3)
node 0 cpus: 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 node 0 size: 1746 MB
node 0 free: 1244 MB
node 1 cpus:
node 1 size: 2044 MB
node 1 free: 2032 MB
node 2 cpus: 1
node 2 size: 2044 MB
node 2 free: 2028 MB
node 3 cpus:
node 3 size: 2044 MB
node 3 free: 2032 MB
node distances:
node 0 1 2 3
0: 10 40 40 40
1: 40 10 40 40
2: 40 40 10 40
3: 40 40 40 10Fix this by skipping associativity lookup if the VPHN hcall failed.
--- arch/powerpc/mm/numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/mm/numa.c +3 -1
@@ -1204,7 +1204,9 @@ int find_and_online_cpu_nid(int cpu)int new_nid;/* Use associativity from first thread for all siblings */ -vphn_get_associativity (cpu, associativity); +if (vphn_get_associativity (cpu, associativity)) +return cpu_to_node (cpu); + new_nid =associativity_to_nid (associativity);if (new_nid <0 || !node_possible (new_nid)) new_nid = first_online_node;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 6/8 perf report: Don't try to map ip to invalid map
In reply to Sasha LevinFrom: Milian Wolff <[email protected]>
[ Upstream commit ff4ce2885af8f9e8e99864d78dbeb4673f089c76 ]
Fixes a crash when the report encounters an address that could not be associated with an mmaped region:
#0 0x00005555557bdc4a in callchain_srcline (ip=<error reading variable: Cannot access memory at address 0x38>, sym=0x0, map=0x0) at util/machine.c:2329 #1 unwind_entry (entry=entry@entry=0x7fffffff9180, arg=arg@entry=0x7ffff5642498) at util/machine.c:2329 #2 0x00005555558370af in entry (arg=0x7ffff5642498, cb=0x5555557bdb50 <unwind_entry>, thread=<optimized out>, ip=18446744073709551615) at util/unwind-libunwind-local.c:586 #3 get_entries (ui=ui@entry=0x7fffffff9620, cb=0x5555557bdb50 <unwind_entry>, arg=0x7ffff5642498, max_stack=<optimized out>) at util/unwind-libunwind-local.c:703 #4 0x0000555555837192 in _unwind__get_entries (cb=<optimized out>, arg=<optimized out>, thread=<optimized out>, data=<optimized out>, max_stack=<optimized out>) at util/unwind-libunwind-local.c:725 #5 0x00005555557c310f in thread__resolve_callchain_unwind (max_stack=127, sample=0x7fffffff9830, evsel=0x555555c7b3b0, cursor=0x7ffff5642498, thread=0x555555c7f6f0) at util/machine.c:2351 #6 thread__resolve_callchain (thread=0x555555c7f6f0, cursor=0x7ffff5642498, evsel=0x555555c7b3b0, sample=0x7fffffff9830, parent=0x7fffffff97b8, root_al=0x7fffffff9750, max_stack=127) at util/machine.c:2378 #7 0x00005555557ba4ee in sample__resolve_callchain (sample=<optimized out>, cursor=<optimized out>, parent=parent@entry=0x7fffffff97b8, evsel=<optimized out>, al=al@entry=0x7fffffff9750,
max_stack=<optimized out>) at util/callchain.c:1085
--- tools/perf/util/machine.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/machine.c +3 -2
@@ -2272,7 +2272,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) {struct callchain_cursor *cursor = arg;const char *srcline =NULL ; -u64 addr; +u64 addr = entry->ip;if (symbol_conf.hide_unresolved && entry->sym ==NULL )return 0 ;
@@ -2284,7 +2284,8 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)* Convert entry->ip from a virtual address to an offset in * its corresponding binary. */ - addr =map__map_ip (entry->map, entry->ip); +if (entry->map) + addr =map__map_ip (entry->map, entry->ip); srcline =callchain_srcline (entry->map, entry->sym, addr); return callchain_cursor_append(cursor, entry->ip,
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 7/8 tls: Fix improper revert in zerocopy_from_iter
In reply to Sasha LevinFrom: Doron Roberts-Kedes <[email protected]>
[ Upstream commit 2da19ed3e4a87db16c0f69039da9f17a9596c350 ]
The current code is problematic because the iov_iter is reverted and never advanced in the non-error case. This patch skips the revert in the non-error case. This patch also fixes the amount by which the iov_iter is reverted. Currently, iov_iter is reverted by size, which can be greater than the amount by which the iter was actually advanced. Instead, only revert by the amount that the iter was advanced.
--- net/tls/tls_sw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/tls/tls_sw.c +5 -7
@@ -286,7 +286,7 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from, int length, int *pages_used, unsigned int *size_used, struct scatterlist *to, int to_max_pages, - bool charge, bool revert) + bool charge) { struct page *pages[MAX_SKB_FRAGS];
@@ -335,10 +335,10 @@ static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from, } out: +if (rc) +iov_iter_revert (from, size - *size_used); *size_used = size; *pages_used = num_elem; -if (revert) -iov_iter_revert (from, size);return rc; }
@@ -440,7 +440,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) &ctx->sg_plaintext_size, ctx->sg_plaintext_data,ARRAY_SIZE (ctx->sg_plaintext_data), - true, false); + true);if (ret) goto fallback_to_reg_send;
@@ -453,8 +453,6 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) copied -= try_to_copy; fallback_to_reg_send: -iov_iter_revert (&msg->msg_iter, - ctx->sg_plaintext_size - orig_size); trim_sg(sk, ctx->sg_plaintext_data, &ctx->sg_plaintext_num_elem, &ctx->sg_plaintext_size,
@@ -828,7 +826,7 @@ int tls_sw_recvmsg(struct sock *sk, err =zerocopy_from_iter (sk, &msg->msg_iter, to_copy, &pages, &chunk, &sgin[1 ], -MAX_SKB_FRAGS , false, true); +MAX_SKB_FRAGS , false);if (err <0 ) goto fallback_to_reg_recv;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 8/8 HID: i2c-hid: Remove RESEND_REPORT_DESCR quirk and its handling
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit afbb1169ed5b58cfca017e368b53e019cf285853 ]
Commit 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system resume") removes the need for the RESEND_REPORT_DESCR quirk for Raydium devices, but kept it for the SIS device id 10FB touchscreens, as the author of that commit could not determine if the quirk is still necessary there.
I've tested suspend/resume on a Toshiba Click Mini L9W-B which is the device for which this quirk was added in the first place and with the "Don't reset device upon system resume" fix the quirk is no longer necessary, so this commit removes it.
Note even better I also had some other devices with SIS touchscreens which suspend/resume issues, where the RESEND_REPORT_DESCR quirk did not help.
I've also tested these devices with the "Don't reset device upon system resume" fix and I'm happy to report that that fix also fixes touchscreen resume on the following devices:
Asus T100HA
Asus T200TA
Peaq C1010
--- drivers/hid/hid-ids.h | 1 - drivers/hid/i2c-hid/i2c-hid.c | 18 +++--------------- 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/hid/hid-ids.h +0 -1
@@ -974,7 +974,6 @@#define USB_DEVICE_ID_SIS817_TOUCH 0x0817#define USB_DEVICE_ID_SIS_TS 0x1013#define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 -#define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb#define USB_VENDOR_ID_SKYCABLE 0x1223#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
drivers/hid/i2c-hid/i2c-hid.c +3 -15
@@ -47,8 +47,7 @@/* quirks to control the device */ #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) -#define I2C_HID_QUIRK_RESEND_REPORT_DESCR BIT(2) -#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(3) +#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)/* flags */ #define I2C_HID_STARTED 0
@@ -172,8 +171,6 @@ static const struct i2c_hid_quirks { {I2C_VENDOR_ID_HANTICK ,I2C_PRODUCT_ID_HANTICK_5288 ,I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | I2C_HID_QUIRK_NO_RUNTIME_PM }, - { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH, - I2C_HID_QUIRK_RESEND_REPORT_DESCR }, { 0, 0 } };
@@ -1241,22 +1238,13 @@ static int i2c_hid_resume(struct device *dev)/* Instead of resetting device, simply powers the device on. This * solves "incomplete reports" on Raydium devices 2386:3118 and -* 2386:4B33 +* 2386:4B33 and fixes various SIS touchscreens no longer sending +* data after a suspend/resume. */ ret =i2c_hid_set_power (client,I2C_HID_PWR_ON );if (ret)return ret; -/* Some devices need to re-send report descr cmd -* after resume, after this it will be back normal. -* otherwise it issues too many incomplete reports. -*/ -if (ihid->quirks &I2C_HID_QUIRK_RESEND_REPORT_DESCR ) { - ret =i2c_hid_command (client, &hid_report_descr_cmd,NULL ,0 ); -if (ret) -return ret; - } -if (hid->driver && hid->driver->reset_resume) { ret = hid->driver->reset_resume (hid);return ret;
Signature · 1 line
2.17.1