5.4.9-stable review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 132/191 spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit ca59d5a51690d5b9340343dc36792a252e9414ae upstream.
When used in Extended SPI mode on LS1021A, the DSPI controller wants to have the least significant 16-bit word written first to the TX FIFO.
In fact, the LS1021A reference manual says:
33.5.2.4.2 Draining the TX FIFO
When Extended SPI Mode (DSPIx_MCR[XSPI]) is enabled, if the frame size of SPI Data to be transmitted is more than 16 bits, then it causes two Data entries to be popped from TX FIFO simultaneously which are transferred to the shift register. The first of the two popped entries forms the 16 least significant bits of the SPI frame to be transmitted.
So given the following TX buffer:
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | 0x5 | 0x6 | 0x7 | 0x8 | 0x9 | 0xa | 0xb | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 32-bit word 1 | 32-bit word 2 | 32-bit word 3 | +-----------------------+-----------------------+-----------------------+
The correct way that a little-endian system should transmit it on the wire when bits_per_word is 32 is:
0x030201000x070605040x0b0a0908
But it is actually transmitted as following, as seen with a scope:
0x010003020x050407060x09080b0a
It appears that this patch has been submitted at least once before:
https://lkml.org/lkml/2018/9/21/286
but in that case Chuanhua Han did not manage to explain the problem clearly enough and the patch did not get merged, leaving XSPI mode broken.
--- drivers/spi/spi-fsl-dspi.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/spi/spi-fsl-dspi.c +4 -11
@@ -583,21 +583,14 @@ static void dspi_tcfq_write(struct fsl_d dspi->tx_cmd |=SPI_PUSHR_CMD_CTCNT ;if (dspi->devtype_data->xspi_mode && dspi->bits_per_word >16 ) { -/* Write two TX FIFO entries first, and then the corresponding -* CMD FIFO entry. +/* Write the CMD FIFO entry first, and then the two +* corresponding TX FIFO entries. */ u32 data =dspi_pop_tx (dspi); -if (dspi->cur_chip->ctar_val &SPI_CTAR_LSBFE ) { -/* LSB */ -tx_fifo_write (dspi, data &0xFFFF ); -tx_fifo_write (dspi, data >>16 ); - }else { -/* MSB */ -tx_fifo_write (dspi, data >>16 ); -tx_fifo_write (dspi, data &0xFFFF ); - }cmd_fifo_write (dspi); +tx_fifo_write (dspi, data &0xFFFF ); +tx_fifo_write (dspi, data >>16 ); }else {/* Write one entry to both TX FIFO and CMD FIFO * simultaneously.
Greg Kroah-Hartman
maintainerPATCH 136/191 arm64: dts: qcom: msm8998-clamshell: Remove retention idle state
In reply to Greg Kroah-HartmanFrom: Jeffrey Hugo <[email protected]>
commit b40dd23f9a8987c8336df0a00e33f52b1f3f19ad upstream.
The retention idle state does not appear to be supported by the firmware present on the msm8998 laptops since the state is advertised as disabled in ACPI, and attempting to enable the state in DT is observed to result in boot hangs. Therefore, remove the state from use to address the observed issues.
--- arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi +37 -0
@@ -23,6 +23,43 @@ }; }; +/* + * The laptop FW does not appear to support the retention state as it is + * not advertised as enabled in ACPI, and enabling it in DT can cause boot + * hangs. + */ +&CPU0 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU1 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU2 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU3 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU4 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + +&CPU5 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + +&CPU6 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + +&CPU7 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + &qusb2phy { status = "okay";
Greg Kroah-Hartman
maintainerPATCH 91/191 gcc-plugins: make it possible to disable CONFIG_GCC_PLUGINS again
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit a5b0dc5a46c221725c43bd9b01570239a4cd78b1 upstream.
I noticed that randconfig builds with gcc no longer produce a lot of ccache hits, unlike with clang, and traced this back to plugins now being enabled unconditionally if they are supported.
I am now working around this by adding
export CCACHE_COMPILERCHECK=/usr/bin/size -A %compiler%
to my top-level Makefile. This changes the heuristic that ccache uses to determine whether the plugins are the same after a 'make clean'.
However, it also seems that being able to just turn off the plugins is generally useful, at least for build testing it adds noticeable overhead but does not find a lot of bugs additional bugs, and may be easier for ccache users than my workaround.
--- scripts/gcc-plugins/Kconfig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
scripts/gcc-plugins/Kconfig +4 -5
@@ -14,8 +14,8 @@ config HAVE_GCC_PLUGINS An arch should select this symbol if it supports building with GCC plugins. -config GCC_PLUGINS - bool +menuconfig GCC_PLUGINS + bool "GCC plugins" depends on HAVE_GCC_PLUGINS depends on PLUGIN_HOSTCC != "" default y
@@ -25,8 +25,7 @@ config GCC_PLUGINS See Documentation/core-api/gcc-plugins.rst for details. -menu "GCC plugins" - depends on GCC_PLUGINS +if GCC_PLUGINS config GCC_PLUGIN_CYC_COMPLEXITY bool "Compute the cyclomatic complexity of a function" if EXPERT
@@ -113,4 +112,4 @@ config GCC_PLUGIN_ARM_SSP_PER_TASK bool depends on GCC_PLUGINS && ARM -endmenu +endif
Greg Kroah-Hartman
maintainerPATCH 89/191 pstore/ram: Write new dumps to start of recycled zones
In reply to Greg Kroah-HartmanFrom: Aleksandr Yashkin <[email protected]>
commit 9e5f1c19800b808a37fb9815a26d382132c26c3d upstream.
The ram_core.c routines treat przs as circular buffers. When writing a new crash dump, the old buffer needs to be cleared so that the new dump doesn't end up in the wrong place (i.e. at the end).
The solution to this problem is to reset the circular buffer state before writing a new Oops dump.
--- fs/pstore/ram.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/pstore/ram.c +11 -0
@@ -407,6 +407,17 @@ static int notrace ramoops_pstore_write( prz = cxt->dprzs[cxt->dump_write_cnt]; +/* +* Since this is a new crash dump, we need to reset the buffer in +* case it still has an old dump present. Without this, the new dump +* will get appended, which would seriously confuse anything trying +* to check dump file contents. Specifically, ramoops_read_kmsg_hdr() +* expects to find a dump header in the beginning of buffer data, so +* we must to reset the buffer values, in order to ensure that the +* header will be written to the beginning of the buffer. +*/ +persistent_ram_zap (prz); +/* Build header and append record contents. */ hlen =ramoops_write_kmsg_hdr (prz, record);if (!hlen)
Greg Kroah-Hartman
maintainerPATCH 133/191 drm/msm: include linux/sched/task.h
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 70082a52f96a45650dfc3d8cdcd2c42bdac9f6f0 upstream.
Without this header file, compile-testing may run into a missing declaration:
drivers/gpu/drm/msm/msm_gpu.c:444:4: error: implicit declaration of function 'put_task_struct' [-Werror,-Wimplicit-function-declaration]
--- drivers/gpu/drm/msm/msm_gpu.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_gpu.c +1 -0
@@ -16,6 +16,7 @@#include <linux/pm_opp.h> #include <linux/devfreq.h> #include <linux/devcoredump.h> +#include <linux/sched/task.h> /* * Power Management:
Greg Kroah-Hartman
maintainerPATCH 82/191 media: cec: check transmit_in_progress, not transmitting
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit ac479b51f3f4aaa852b5d3f00ecfb9290230cf64 upstream.
Currently wait_event_interruptible_timeout is called in cec_thread_func() when adap->transmitting is set. But if the adapter is unconfigured while transmitting, then adap->transmitting is set to NULL. But the hardware is still actually transmitting the message, and that's indicated by adap->transmit_in_progress and we should wait until that is finished or times out before transmitting new messages.
As the original commit says: adap->transmitting is the userspace view, adap->transmit_in_progress reflects the hardware state.
However, if adap->transmitting is NULL and adap->transmit_in_progress is true, then wait_event_interruptible is called (no timeout), which can get stuck indefinitely if the CEC driver is flaky and never marks the transmit-in-progress as 'done'.
So test against transmit_in_progress when deciding whether to use the timeout variant or not, instead of testing against adap->transmitting.
--- drivers/media/cec/cec-adap.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/media/cec/cec-adap.c +12 -8
@@ -463,7 +463,7 @@ int cec_thread_func(void *_adap)bool timeout = false;u8 attempts; -if (adap->transmitting) { +if (adap->transmit_in_progress) {int err;/*
@@ -498,7 +498,7 @@ int cec_thread_func(void *_adap) goto unlock; } -if (adap->transmitting && timeout) { +if (adap->transmit_in_progress && timeout) {/* * If we timeout, then log that. Normally this does * not happen and it is an indication of a faulty CEC
@@ -507,14 +507,18 @@ int cec_thread_func(void *_adap)* so much traffic on the bus that the adapter was * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s). */ -pr_warn ("cec-%s: message %*ph timed out\n" , adap->name, - adap->transmitting->msg.len, - adap->transmitting->msg.msg); +if (adap->transmitting) { +pr_warn ("cec-%s: message %*ph timed out\n" , adap->name, + adap->transmitting->msg.len, + adap->transmitting->msg.msg); +/* Just give up on this. */ +cec_data_cancel (adap->transmitting, +CEC_TX_STATUS_TIMEOUT ); + }else { +pr_warn ("cec-%s: transmit timed out\n" , adap->name); + } adap->transmit_in_progress = false; adap->tx_timeouts++; -/* Just give up on this. */ -cec_data_cancel (adap->transmitting, -CEC_TX_STATUS_TIMEOUT ); goto unlock; }
Greg Kroah-Hartman
maintainerPATCH 90/191 pstore/ram: Fix error-path memory leak in persistent_ram_new() callers
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit 8df955a32a73315055e0cd187cbb1cea5820394b upstream.
For callers that allocated a label for persistent_ram_new(), if the call fails, they must clean up the allocation.
--- fs/pstore/ram.c | 2 ++ 1 file changed, 2 insertions(+)
fs/pstore/ram.c +2 -0
@@ -588,6 +588,7 @@ static int ramoops_init_przs(const chardev_err (dev,"failed to request %s mem region (0x%zx@0x%llx): %d\n" , name, record_size, (unsigned long long )*paddr, err); +kfree (label);while (i >0 ) { i--;
@@ -633,6 +634,7 @@ static int ramoops_init_prz(const char *dev_err (dev,"failed to request %s mem region (0x%zx@0x%llx): %d\n" , name, sz, (unsigned long long )*paddr, err); +kfree (label);return err; }
Greg Kroah-Hartman
maintainerPATCH 88/191 ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less
In reply to Greg Kroah-HartmanFrom: Gang He <[email protected]>
commit b73eba2a867e10b9b4477738677341f3307c07bb upstream.
Because ocfs2_get_dlm_debug() function is called once less here, ocfs2 file system will trigger the system crash, usually after ocfs2 file system is unmounted.
This system crash is caused by a generic memory corruption, these crash backtraces are not always the same, for exapmle,
ocfs2: Unmounting device (253,16) on (node 172167785)
general protection fault: 0000 [#1] SMP PTI
CPU: 3 PID: 14107 Comm: fence_legacy Kdump:
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
RIP: 0010:__kmalloc+0xa5/0x2a0
Code: 00 00 4d 8b 07 65 4d 8b
RSP: 0018:ffffaa1fc094bbe8 EFLAGS: 00010286
RAX: 0000000000000000 RBX: d310a8800d7a3faf RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000dc0 RDI: ffff96e68fc036c0
RBP: d310a8800d7a3faf R08: ffff96e6ffdb10a0 R09: 00000000752e7079
R10: 000000000001c513 R11: 0000000004091041 R12: 0000000000000dc0
R13: 0000000000000039 R14: ffff96e68fc036c0 R15: ffff96e68fc036c0
FS: 00007f699dfba540(0000) GS:ffff96e6ffd80000(0000) knlGS:00000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055f3a9d9b768 CR3: 000000002cd1c000 CR4: 00000000000006e0
Call Trace:
ext4_htree_store_dirent+0x35/0x100 [ext4]
htree_dirblock_to_tree+0xea/0x290 [ext4]
ext4_htree_fill_tree+0x1c1/0x2d0 [ext4]
ext4_readdir+0x67c/0x9d0 [ext4]
iterate_dir+0x8d/0x1a0
__x64_sys_getdents+0xab/0x130
do_syscall_64+0x60/0x1f0
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f699d33a9fbThis regression problem was introduced by commit e581595ea29c ("ocfs: no need to check return value of debugfs_create functions").
--- fs/ocfs2/dlmglue.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/dlmglue.c +1 -0
@@ -3282,6 +3282,7 @@ static void ocfs2_dlm_init_debug(structdebugfs_create_u32 ("locking_filter" ,0600 , osb->osb_debug_root, &dlm_debug->d_filter_secs); +ocfs2_get_dlm_debug (dlm_debug); }static void ocfs2_dlm_shutdown_debug (struct ocfs2_super *osb)
Greg Kroah-Hartman
maintainerPATCH 117/191 tracing: Have the histogram compare functions convert to u64 first
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 106f41f5a302cb1f36c7543fae6a05de12e96fa4 upstream.
The compare functions of the histogram code would be specific for the size of the value being compared (byte, short, int, long long). It would reference the value from the array via the type of the compare, but the value was stored in a 64 bit number. This is fine for little endian machines, but for big endian machines, it would end up comparing zeros or all ones (depending on the sign) for anything but 64 bit numbers.
To fix this, first derference the value as a u64 then convert it to the type being compared.
--- kernel/trace/tracing_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/tracing_map.c +2 -2
@@ -148,8 +148,8 @@ static int tracing_map_cmp_atomic64(void#define DEFINE_TRACING_MAP_CMP_FN (type) \ static int tracing_map_cmp_##type(void *val_a, void *val_b) \ { \ - type a = *(type *)val_a; \ - type b = *(type *)val_b; \ + type a = (type)(*(u64 *)val_a); \ + type b = (type)(*(u64 *)val_b); \ \ return (a > b) ? 1 : ((a < b) ? -1 : 0); \ }
Greg Kroah-Hartman
maintainerPATCH 120/191 io_uring: use current task creds instead of allocating a new one
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 0b8c0ec7eedcd8f9f1a1f238d87f9b512b09e71a upstream.
syzbot reports:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 9217 Comm: io_uring-sq Not tainted 5.4.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:creds_are_invalid kernel/cred.c:792 [inline] RIP: 0010:__validate_creds include/linux/cred.h:187 [inline] RIP: 0010:override_creds+0x9f/0x170 kernel/cred.c:550 Code: ac 25 00 81 fb 64 65 73 43 0f 85 a3 37 00 00 e8 17 ab 25 00 49 8d 7c 24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 96 00 00 00 41 8b 5c 24 10 bf RSP: 0018:ffff88809c45fda0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000043736564 RCX: ffffffff814f3318 RDX: 0000000000000002 RSI: ffffffff814f3329 RDI: 0000000000000010 RBP: ffff88809c45fdb8 R08: ffff8880a3aac240 R09: ffffed1014755849 R10: ffffed1014755848 R11: ffff8880a3aac247 R12: 0000000000000000 R13: ffff888098ab1600 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd51c40664 CR3: 0000000092641000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: io_sq_thread+0x1c7/0xa20 fs/io_uring.c:3274 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Modules linked in: ---[ end trace f2e1a4307fbe2245 ]--- RIP: 0010:creds_are_invalid kernel/cred.c:792 [inline] RIP: 0010:__validate_creds include/linux/cred.h:187 [inline] RIP: 0010:override_creds+0x9f/0x170 kernel/cred.c:550 Code: ac 25 00 81 fb 64 65 73 43 0f 85 a3 37 00 00 e8 17 ab 25 00 49 8d 7c 24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 96 00 00 00 41 8b 5c 24 10 bf RSP: 0018:ffff88809c45fda0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000043736564 RCX: ffffffff814f3318 RDX: 0000000000000002 RSI: ffffffff814f3329 RDI: 0000000000000010 RBP: ffff88809c45fdb8 R08: ffff8880a3aac240 R09: ffffed1014755849 R10: ffffed1014755848 R11: ffff8880a3aac247 R12: 0000000000000000 R13: ffff888098ab1600 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd51c40664 CR3: 0000000092641000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
which is caused by slab fault injection triggering a failure in prepare_creds(). We don't actually need to create a copy of the creds as we're not modifying it, we just need a reference on the current task creds. This avoids the failure case as well, and propagates the const throughout the stack.
--- fs/io_uring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/io_uring.c +2 -2
@@ -239,7 +239,7 @@ struct io_ring_ctx {struct user_struct *user; -struct cred *creds; +const struct cred *creds;struct completion ctx_done;
@@ -3876,7 +3876,7 @@ static int io_uring_create(unsigned entr ctx->account_mem = account_mem; ctx->user = user; - ctx->creds =prepare_creds (); + ctx->creds =get_current_cred ();if (!ctx->creds) { ret = -ENOMEM ; goto err;
Greg Kroah-Hartman
maintainerPATCH 119/191 samples/trace_printk: Wait for IRQ work to finish
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit 01f36a554e3ef32f9fc4b81a4437cf08fd0e4742 upstream.
trace_printk schedules work via irq_work_queue(), but doesn't wait until it was processed. The kprobe_module.tc testcase does:
:;: "Load module again, which means the event1 should be recorded";:
modprobe trace-printk
grep "event1:" trace
so the grep which checks the trace file might run before the irq work was processed. Fix this by adding a irq_work_sync().
--- samples/trace_printk/trace-printk.c | 1 + 1 file changed, 1 insertion(+)
samples/trace_printk/trace-printk.c +1 -0
@@ -36,6 +36,7 @@ static int __init trace_printk_init(void/* Kick off printing in irq context */ irq_work_queue (&irqwork); +irq_work_sync (&irqwork);trace_printk ("This is a %s that will use trace_bprintk()\n" ,"static string" );
Greg Kroah-Hartman
maintainerPATCH 118/191 tracing: Fix endianness bug in histogram trigger
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit fe6e096a5bbf73a142f09c72e7aa2835026eb1a3 upstream.
At least on PA-RISC and s390 synthetic histogram triggers are failing selftests because trace_event_raw_event_synth() always writes a 64 bit values, but the reader expects a field->size sized value. On little endian machines this doesn't hurt, but on big endian this makes the reader always read zero values.
--- kernel/trace/trace_events_hist.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +20 -1
@@ -911,7 +911,26 @@ static notrace void trace_event_raw_evenstrscpy (str_field, str_val,STR_VAR_LEN_MAX ); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else { - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; +struct synth_field *field = event->fields[i]; +u64 val = var_ref_vals[var_ref_idx + i]; + +switch (field->size) { +case 1 : + *(u8 *)&entry->fields[n_u64] = (u8 )val; +break ; + +case 2 : + *(u16 *)&entry->fields[n_u64] = (u16 )val; +break ; + +case 4 : + *(u32 *)&entry->fields[n_u64] = (u32 )val; +break ; + +default : + entry->fields[n_u64] = val; +break ; + } n_u64++; } }
Greg Kroah-Hartman
maintainerPATCH 114/191 rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30
In reply to Greg Kroah-HartmanFrom: Mathieu Desnoyers <[email protected]>
commit 8df34c56321479bfa1ec732c675b686c2b4df412 upstream.
glibc 2.30 introduces gettid() in public headers, which clashes with the internal static definition within rseq selftests.
Rename gettid() to rseq_gettid() to eliminate this symbol name clash.
--- tools/testing/selftests/rseq/param_test.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
tools/testing/selftests/rseq/param_test.c +10 -8
@@ -15,7 +15,7 @@#include <errno.h> #include <stddef.h> -static inline pid_t gettid (void ) +static inline pid_t rseq_gettid (void ) {return syscall (__NR_gettid); }
@@ -373,11 +373,12 @@ void *test_percpu_spinlock_thread(void *rseq_percpu_unlock (&data->lock, cpu);#ifndef BENCHMARK if (i !=0 && !(i % (reps /10 ))) -printf_verbose ("tid %d: count %lld\n" , (int )gettid (), i); +printf_verbose ("tid %d: count %lld\n" , + (int )rseq_gettid (), i);#endif }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq && thread_data->reg &&rseq_unregister_current_thread ())abort ();
@@ -454,11 +455,12 @@ void *test_percpu_inc_thread(void *arg) }while (rseq_unlikely (ret));#ifndef BENCHMARK if (i !=0 && !(i % (reps /10 ))) -printf_verbose ("tid %d: count %lld\n" , (int )gettid (), i); +printf_verbose ("tid %d: count %lld\n" , + (int )rseq_gettid (), i);#endif }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq && thread_data->reg &&rseq_unregister_current_thread ())abort ();
@@ -605,7 +607,7 @@ void *test_percpu_list_thread(void *arg) }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq &&rseq_unregister_current_thread ())abort ();
@@ -796,7 +798,7 @@ void *test_percpu_buffer_thread(void *ar }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq &&rseq_unregister_current_thread ())abort ();
@@ -1011,7 +1013,7 @@ void *test_percpu_memcpy_buffer_thread(v }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq &&rseq_unregister_current_thread ())abort ();
Greg Kroah-Hartman
maintainerPATCH 111/191 gpiolib: fix up emulated open drain outputs
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
commit 256efaea1fdc4e38970489197409a26125ee0aaa upstream.
gpiolib has a corner case with open drain outputs that are emulated. When such outputs are outputting a logic 1, emulation will set the hardware to input mode, which will cause gpiod_get_direction() to report that it is in input mode. This is different from the behaviour with a true open-drain output.
Unify the semantics here.
--- drivers/gpio/gpiolib.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpio/gpiolib.c +8 -0
@@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc chip =gpiod_to_chip (desc); offset =gpio_chip_hwgpio (desc); +/* +* Open drain emulation using input mode may incorrectly report +* input here, fix that up. +*/ +if (test_bit (FLAG_OPEN_DRAIN , &desc->flags) && +test_bit (FLAG_IS_OUT , &desc->flags)) +return 0 ; +if (!chip->get_direction)return -ENOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 106/191 ata: ahci_brcm: Fix AHCI resources management
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit c0cdf2ac4b5bf3e5ef2451ea29fb4104278cdabc upstream.
The AHCI resources management within ahci_brcm.c is a little convoluted, largely because it historically had a dedicated clock that was managed within this file in the downstream tree. Once brough upstream though, the clock was left to be managed by libahci_platform.c which is entirely appropriate.
This patch series ensures that the AHCI resources are fetched and enabled before any register access is done, thus avoiding bus errors on platforms which clock gate the controller by default.
As a result we need to re-arrange the suspend() and resume() functions in order to avoid accessing registers after the clocks have been turned off respectively before the clocks have been turned on. Finally, we can refactor brcm_ahci_get_portmask() in order to fetch the number of ports from hpriv->mmio which is now accessible without jumping through hoops like we used to do.
The commit pointed in the Fixes tag is both old and new enough not to require major headaches for backporting of this patch.
--- drivers/ata/ahci_brcm.c | 105 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 29 deletions(-)
drivers/ata/ahci_brcm.c +76 -29
@@ -213,19 +213,12 @@ static void brcm_sata_phys_disable(strucbrcm_sata_phy_disable (priv, i); } -static u32 brcm_ahci_get_portmask (struct platform_device *pdev, +static u32 brcm_ahci_get_portmask (struct ahci_host_priv *hpriv,struct brcm_ahci_priv *priv) { -void __iomem *ahci; -struct resource *res;u32 impl; - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"ahci" ); - ahci =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (ahci)) -return 0 ; - - impl =readl (ahci +HOST_PORTS_IMPL ); + impl =readl (hpriv->mmio +HOST_PORTS_IMPL );if (fls (impl) >SATA_TOP_MAX_PHYS ) dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n",
@@ -233,9 +226,6 @@ static u32 brcm_ahci_get_portmask(structelse if (!impl)dev_info (priv->dev,"no ports found\n" ); -devm_iounmap (&pdev->dev, ahci); -devm_release_mem_region (&pdev->dev, res->start,resource_size (res)); -return impl; }
@@ -347,11 +337,10 @@ static int brcm_ahci_suspend(struct devistruct ata_host *host =dev_get_drvdata (dev);struct ahci_host_priv *hpriv = host->private_data;struct brcm_ahci_priv *priv = hpriv->plat_data; -int ret; - ret =ahci_platform_suspend (dev);brcm_sata_phys_disable (priv); -return ret; + +return ahci_platform_suspend (dev); }static int brcm_ahci_resume (struct device *dev)
@@ -359,11 +348,44 @@ static int brcm_ahci_resume(struct devicstruct ata_host *host =dev_get_drvdata (dev);struct ahci_host_priv *hpriv = host->private_data;struct brcm_ahci_priv *priv = hpriv->plat_data; +int ret; + +/* Make sure clocks are turned on before re-configuration */ + ret =ahci_platform_enable_clks (hpriv); +if (ret) +return ret;brcm_sata_init (priv);brcm_sata_phys_enable (priv);brcm_sata_alpm_init (hpriv); - return ahci_platform_resume(dev); + +/* Since we had to enable clocks earlier on, we cannot use +* ahci_platform_resume() as-is since a second call to +* ahci_platform_enable_resources() would bump up the resources +* (regulators, clocks, PHYs) count artificially so we copy the part +* after ahci_platform_enable_resources(). +*/ + ret =ahci_platform_enable_phys (hpriv); +if (ret) + goto out_disable_phys; + + ret =ahci_platform_resume_host (dev); +if (ret) + goto out_disable_platform_phys; + +/* We resumed so update PM runtime state */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + +return 0 ; + +out_disable_platform_phys: +ahci_platform_disable_phys (hpriv); +out_disable_phys: +brcm_sata_phys_disable (priv); +ahci_platform_disable_clks (hpriv); + return ret; }#endif
@@ -416,38 +438,63 @@ static int brcm_ahci_probe(struct platfo priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; } + hpriv =ahci_platform_get_resources (pdev,0 ); +if (IS_ERR (hpriv)) { + ret =PTR_ERR (hpriv); + goto out_reset; + } + + ret =ahci_platform_enable_clks (hpriv); +if (ret) + goto out_reset; + +/* Must be first so as to configure endianness including that +* of the standard AHCI register space. +*/ brcm_sata_init (priv); - priv->port_mask =brcm_ahci_get_portmask (pdev, priv); -if (!priv->port_mask) -return -ENODEV ; +/* Initializes priv->port_mask which is used below */ + priv->port_mask =brcm_ahci_get_portmask (hpriv, priv); +if (!priv->port_mask) { + ret = -ENODEV ; + goto out_disable_clks; + } +/* Must be done before ahci_platform_enable_phys() */ brcm_sata_phys_enable (priv); - hpriv =ahci_platform_get_resources (pdev,0 ); -if (IS_ERR (hpriv)) -return PTR_ERR (hpriv); hpriv->plat_data = priv; hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP ;brcm_sata_alpm_init (hpriv); - ret =ahci_platform_enable_resources (hpriv); -if (ret) -return ret; -if (priv->quirks &BRCM_AHCI_QUIRK_NO_NCQ ) hpriv->flags |=AHCI_HFLAG_NO_NCQ ; hpriv->flags |=AHCI_HFLAG_NO_WRITE_TO_RO ; + ret =ahci_platform_enable_phys (hpriv); +if (ret) + goto out_disable_phys; + ret =ahci_platform_init_host (pdev, hpriv, &ahci_brcm_port_info, &ahci_platform_sht);if (ret) -return ret; + goto out_disable_platform_phys;dev_info (dev,"Broadcom AHCI SATA3 registered\n" );return 0 ; + +out_disable_platform_phys: +ahci_platform_disable_phys (hpriv); +out_disable_phys: +brcm_sata_phys_disable (priv); +out_disable_clks: +ahci_platform_disable_clks (hpriv); +out_reset: +if (!IS_ERR_OR_NULL (priv->rcdev)) +reset_control_assert (priv->rcdev); +return ret; }static int brcm_ahci_remove (struct platform_device *pdev)
@@ -457,12 +504,12 @@ static int brcm_ahci_remove(struct platfstruct brcm_ahci_priv *priv = hpriv->plat_data;int ret; +brcm_sata_phys_disable (priv); + ret =ata_platform_remove_one (pdev);if (ret)return ret; -brcm_sata_phys_disable (priv); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 109/191 libata: Fix retrieving of active qcs
In reply to Greg Kroah-HartmanFrom: Sascha Hauer <[email protected]>
commit 8385d756e114f2df8568e508902d5f9850817ffb upstream.
ata_qc_complete_multiple() is called with a mask of the still active tags.
mv_sata doesn't have this information directly and instead calculates the still active tags from the started tags (ap->qc_active) and the finished tags as (ap->qc_active ^ done_mask)
Since 28361c40368 the hw_tag and tag are no longer the same and the equation is no longer valid. In ata_exec_internal_sg() ap->qc_active is initialized as 1ULL << ATA_TAG_INTERNAL, but in hardware tag 0 is started and this will be in done_mask on completion. ap->qc_active ^ done_mask becomes 0x100000000 ^ 0x1 = 0x100000001 and thus tag 0 used as the internal tag will never be reported as completed.
This is fixed by introducing ata_qc_get_active() which returns the active hardware tags and calling it where appropriate.
This is tested on mv_sata, but sata_fsl and sata_nv suffer from the same problem. There is another case in sata_nv that most likely needs fixing as well, but this looks a little different, so I wasn't confident enough to change that.
Add missing export of ata_qc_get_active(), as per Pali.
--- drivers/ata/libata-core.c | 24 ++++++++++++++++++++++++ drivers/ata/sata_fsl.c | 2 +- drivers/ata/sata_mv.c | 2 +- drivers/ata/sata_nv.c | 2 +- include/linux/libata.h | 1 + 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/ata/libata-core.c +24 -0
@@ -5326,6 +5326,30 @@ void ata_qc_complete(struct ata_queued_c }/** +* ata_qc_get_active - get bitmask of active qcs +* @ap: port in question +* +* LOCKING: +* spin_lock_irqsave(host lock) +* +* RETURNS: +* Bitmask of active qcs +*/ +u64 ata_qc_get_active (struct ata_port *ap) +{ +u64 qc_active = ap->qc_active; + +/* ATA_TAG_INTERNAL is sent to hw as tag 0 */ +if (qc_active & (1ULL <<ATA_TAG_INTERNAL )) { + qc_active |= (1 <<0 ); + qc_active &= ~(1ULL <<ATA_TAG_INTERNAL ); + } + +return qc_active; +} +EXPORT_SYMBOL_GPL (ata_qc_get_active); + +/** * ata_qc_complete_multiple - Complete multiple qcs successfully * @ap: port in question * @qc_active: new qc_active mask
drivers/ata/sata_fsl.c +1 -1
@@ -1278,7 +1278,7 @@ static void sata_fsl_host_intr(struct at i,ioread32 (hcr_base +CC ), ioread32(hcr_base + CA)); } -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask);return ; }else if ((ap->qc_active & (1ULL <<ATA_TAG_INTERNAL ))) {
drivers/ata/sata_mv.c +1 -1
@@ -2827,7 +2827,7 @@ static void mv_process_crpb_entries(stru }if (work_done) { -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask);/* Update the software queue position index in hardware */ writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) |
drivers/ata/sata_nv.c +1 -1
@@ -984,7 +984,7 @@ static irqreturn_t nv_adma_interrupt(int check_commands =0 ; check_commands &= ~(1 << pos); } -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask); } }
include/linux/libata.h +1 -0
@@ -1174,6 +1174,7 @@ extern unsigned int ata_do_dev_read_id(s struct ata_taskfile *tf, u16 *id);extern void ata_qc_complete (struct ata_queued_cmd *qc);extern int ata_qc_complete_multiple (struct ata_port *ap,u64 qc_active); +extern u64 ata_qc_get_active (struct ata_port *ap);extern void ata_scsi_simulate (struct ata_device *dev,struct scsi_cmnd *cmd); extern int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
Greg Kroah-Hartman
maintainerPATCH 105/191 ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 84b032dbfdf1c139cd2b864e43959510646975f8 upstream.
This reverts commit 6bb86fefa086faba7b60bb452300b76a47cde1a5 ("libahci_platform: Staticize ahci_platform_<en/dis>able_phys()") we are going to need ahci_platform_{enable,disable}_phys() in a subsequent commit for ahci_brcm.c in order to properly control the PHY initialization order.
Also make sure the function prototypes are declared in include/linux/ahci_platform.h as a result.
--- drivers/ata/libahci_platform.c | 6 ++++-- include/linux/ahci_platform.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +4 -2
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops);* RETURNS: * 0 on success otherwise a negative error code */ -static int ahci_platform_enable_phys (struct ahci_host_priv *hpriv) +int ahci_platform_enable_phys (struct ahci_host_priv *hpriv) {int rc, i;
@@ -74,6 +74,7 @@ disable_phys: }return rc; } +EXPORT_SYMBOL_GPL (ahci_platform_enable_phys);/** * ahci_platform_disable_phys - Disable PHYs
@@ -81,7 +82,7 @@ disable_phys:* * This function disables all PHYs found in hpriv->phys. */ -static void ahci_platform_disable_phys (struct ahci_host_priv *hpriv) +void ahci_platform_disable_phys (struct ahci_host_priv *hpriv) {int i;
@@ -90,6 +91,7 @@ static void ahci_platform_disable_phys(sphy_exit (hpriv->phys[i]); } } +EXPORT_SYMBOL_GPL (ahci_platform_disable_phys);/** * ahci_platform_enable_clks - Enable platform clocks
include/linux/ahci_platform.h +2 -0
@@ -19,6 +19,8 @@ struct ahci_host_priv;struct platform_device ;struct scsi_host_template ; +int ahci_platform_enable_phys (struct ahci_host_priv *hpriv); +void ahci_platform_disable_phys (struct ahci_host_priv *hpriv);int ahci_platform_enable_clks (struct ahci_host_priv *hpriv);void ahci_platform_disable_clks (struct ahci_host_priv *hpriv);int ahci_platform_enable_regulators (struct ahci_host_priv *hpriv);
Quoted 21 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
[ ... ]
Quoted 3 lines
Ming Lei <[email protected]>
block: fix splitting segments on boundary masks
This patch causes a regression. See:
https://lore.kernel.org/linux-block/[email protected]/T/#m4607a04fde9ef2ed80d45efacef01c0b0e8d2bfd
Guenter
Greg Kroah-Hartman
maintainerPATCH 108/191 ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 1a3d78cb6e20779a19388315bd8efefbd8d4a656 upstream.
Set AHCI_HFLAG_DELAY_ENGINE for the BCM7425 AHCI controller thus making it conforming to the 'strict' AHCI implementation which this controller is based on.
This solves long link establishment with specific hard drives (e.g.:
Seagate ST1000VM002-9ZL1 SC12) that would otherwise have to complete the error recovery handling before finally establishing a succesful SATA link at the desired speed.
We re-order the hpriv->flags assignment to also remove the NONCQ quirk since we can set the flag directly.
--- drivers/ata/ahci_brcm.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/ata/ahci_brcm.c +16 -15
@@ -76,8 +76,7 @@ enum brcm_ahci_version { };enum brcm_ahci_quirks { -BRCM_AHCI_QUIRK_NO_NCQ =BIT (0 ), -BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE =BIT (1 ), +BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE =BIT (0 ), };struct brcm_ahci_priv {
@@ -439,18 +438,27 @@ static int brcm_ahci_probe(struct platfoif (!IS_ERR_OR_NULL (priv->rcdev))reset_control_deassert (priv->rcdev); -if ((priv->version ==BRCM_SATA_BCM7425 ) || - (priv->version ==BRCM_SATA_NSP )) { - priv->quirks |=BRCM_AHCI_QUIRK_NO_NCQ ; - priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; - } - hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv)) { ret =PTR_ERR (hpriv); goto out_reset; } + hpriv->plat_data = priv; + hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP |AHCI_HFLAG_NO_WRITE_TO_RO ; + +switch (priv->version) { +case BRCM_SATA_BCM7425 : + hpriv->flags |=AHCI_HFLAG_DELAY_ENGINE ; +/* fall through */ +case BRCM_SATA_NSP : + hpriv->flags |=AHCI_HFLAG_NO_NCQ ; + priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; +break ; +default : +break ; + } + ret =ahci_platform_enable_clks (hpriv);if (ret) goto out_reset;
@@ -470,15 +478,8 @@ static int brcm_ahci_probe(struct platfo/* Must be done before ahci_platform_enable_phys() */ brcm_sata_phys_enable (priv); - hpriv->plat_data = priv; - hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP ; -brcm_sata_alpm_init (hpriv); -if (priv->quirks &BRCM_AHCI_QUIRK_NO_NCQ ) - hpriv->flags |=AHCI_HFLAG_NO_NCQ ; - hpriv->flags |=AHCI_HFLAG_NO_WRITE_TO_RO ; - ret =ahci_platform_enable_phys (hpriv);if (ret) goto out_disable_phys;
Greg Kroah-Hartman
maintainerPATCH 107/191 ata: ahci_brcm: Add missing clock management during recovery
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit bf0e5013bc2dcac205417e1252205dca39dfc005 upstream.
The downstream implementation of ahci_brcm.c did contain clock management recovery, but until recently, did that outside of the libahci_platform helpers and this was unintentionally stripped out while forward porting the patch upstream.
Add the missing clock management during recovery and sleep for 10 milliseconds per the design team recommendations to ensure the SATA PHY controller and AFE have been fully quiesced.
--- drivers/ata/ahci_brcm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/ata/ahci_brcm.c +7 -0
@@ -275,6 +275,13 @@ static unsigned int brcm_ahci_read_id(st/* Perform the SATA PHY reset sequence */ brcm_sata_phy_disable (priv, ap->port_no); +/* Reset the SATA clock */ +ahci_platform_disable_clks (hpriv); +msleep (10 ); + +ahci_platform_enable_clks (hpriv); +msleep (10 ); +/* Bring the PHY back on */ brcm_sata_phy_enable (priv, ap->port_no);
Greg Kroah-Hartman
maintainerPATCH 102/191 compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 673bdf8ce0a387ef585c13b69a2676096c6edfe9 upstream.
These were added to blkdev_ioctl() but not blkdev_compat_ioctl, so add them now.
--- block/compat_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
block/compat_ioctl.c +2 -0
@@ -355,6 +355,8 @@ long compat_blkdev_ioctl(struct file *fi* but we call blkdev_ioctl, which gets the lock for us */ case BLKRRPART : +case BLKREPORTZONE : +case BLKRESETZONE :return blkdev_ioctl (bdev, mode, cmd, (unsigned long )compat_ptr (arg));case BLKBSZSET_32 :
Greg Kroah-Hartman
maintainerPATCH 99/191 Btrfs: fix infinite loop during nocow writeback due to race
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit de7999afedff02c6631feab3ea726a0e8f8c3d40 upstream.
When starting writeback for a range that covers part of a preallocated extent, due to a race with writeback for another range that also covers another part of the same preallocated extent, we can end up in an infinite loop.
Consider the following example where for inode 280 we have two dirty ranges:
range A, from 294912 to 303103, 8192 bytes
range B, from 348160 to 438271, 90112 bytes
and we have the following file extent item layout for our inode:
leaf 38895616 gen 24544 total ptrs 29 free space 13820 owner 5
(...)
item 27 key (280 108 200704) itemoff 14598 itemsize 53
extent data disk bytenr 0 nr 0 type 1 (regular)
extent data offset 0 nr 94208 ram 94208
item 28 key (280 108 294912) itemoff 14545 itemsize 53
extent data disk bytenr 10433052672 nr 81920 type 2 (prealloc)
extent data offset 0 nr 81920 ram 81920Then the following happens:
1) Writeback starts for range B (from 348160 to 438271), execution of run_delalloc_nocow() starts;
2) The first iteration of run_delalloc_nocow()'s whil loop leaves us at the extent item at slot 28, pointing to the prealloc extent item covering the range from 294912 to 376831. This extent covers part of our range;
3) An ordered extent is created against that extent, covering the file range from 348160 to 376831 (28672 bytes);
4) We adjust 'cur_offset' to 376832 and move on to the next iteration of the while loop;
5) The call to btrfs_lookup_file_extent() leaves us at the same leaf, pointing to slot 29, 1 slot after the last item (the extent item we processed in the previous iteration);
6) Because we are a slot beyond the last item, we call btrfs_next_leaf(), which releases the search path before doing a another search for the last key of the leaf (280 108 294912);
7) Right after btrfs_next_leaf() released the path, and before it did another search for the last key of the leaf, writeback for the range A (from 294912 to 303103) completes (it was previously started at some point);
8) Upon completion of the ordered extent for range A, the prealloc extent we previously found got split into two extent items, one covering the range from 294912 to 303103 (8192 bytes), with a type of regular extent (and no longer prealloc) and another covering the range from 303104 to 376831 (73728 bytes), with a type of prealloc and an offset of 8192 bytes. So our leaf now has the following layout:
leaf 38895616 gen 24544 total ptrs 31 free space 13664 owner 5
(...)
item 27 key (280 108 200704) itemoff 14598 itemsize 53
extent data disk bytenr 0 nr 0 type 1
extent data offset 0 nr 8192 ram 94208
item 28 key (280 108 208896) itemoff 14545 itemsize 53
extent data disk bytenr 10433142784 nr 86016 type 1
extent data offset 0 nr 86016 ram 86016
item 29 key (280 108 294912) itemoff 14492 itemsize 53
extent data disk bytenr 10433052672 nr 81920 type 1
extent data offset 0 nr 8192 ram 81920
item 30 key (280 108 303104) itemoff 14439 itemsize 53
extent data disk bytenr 10433052672 nr 81920 type 2
extent data offset 8192 nr 73728 ram 819209) After btrfs_next_leaf() returns, we have our path pointing to that same leaf and at slot 30, since it has a key we didn't have before and it's the first key greater then the key that was previously the last key of the leaf (key (280 108 294912));
10) The extent item at slot 30 covers the range from 303104 to 376831 which is in our target range, so we process it, despite having already created an ordered extent against this extent for the file range from 348160 to 376831. This is because we skip to the next extent item only if its end is less than or equals to the start of our delalloc range, and not less than or equals to the current offset ('cur_offset');
11) As a result we compute 'num_bytes' as:
num_bytes = min(end + 1, extent_end) - cur_offset;
= min(438271 + 1, 376832) - 376832 = 012) We then call create_io_em() for a 0 bytes range starting at offset
376832;
13) Then create_io_em() enters an infinite loop because its calls to
btrfs_drop_extent_cache() do nothing due to the 0 length range
passed to it. So no existing extent maps that cover the offset
376832 get removed, and therefore calls to add_extent_mapping()
return -EEXIST, resulting in an infinite loop. This loop from
create_io_em() is the following:
do {
btrfs_drop_extent_cache(BTRFS_I(inode), em->start,
em->start + em->len - 1, 0);
write_lock(&em_tree->lock);
ret = add_extent_mapping(em_tree, em, 1);
write_unlock(&em_tree->lock);
/*
* The caller has taken lock_extent(), who could race with us
* to add em?
*/
} while (ret == -EEXIST);Also, each call to btrfs_drop_extent_cache() triggers a warning because the start offset passed to it (376832) is smaller then the end offset (376832 - 1) passed to it by -1, due to the 0 length:
[258532.052621] ------------[ cut here ]------------ [258532.052643] WARNING: CPU: 0 PID: 9987 at fs/btrfs/file.c:602 btrfs_drop_extent_cache+0x3f4/0x590 [btrfs] (...) [258532.052672] CPU: 0 PID: 9987 Comm: fsx Tainted: G W 5.4.0-rc7-btrfs-next-64 #1 [258532.052673] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 [258532.052691] RIP: 0010:btrfs_drop_extent_cache+0x3f4/0x590 [btrfs] (...) [258532.052695] RSP: 0018:ffffb4be0153f860 EFLAGS: 00010287 [258532.052700] RAX: ffff975b445ee360 RBX: ffff975b44eb3e08 RCX: 0000000000000000 [258532.052700] RDX: 0000000000038fff RSI: 0000000000039000 RDI: ffff975b445ee308 [258532.052700] RBP: 0000000000038fff R08: 0000000000000000 R09: 0000000000000001 [258532.052701] R10: ffff975b513c5c10 R11: 00000000e3c0cfa9 R12: 0000000000039000 [258532.052703] R13: ffff975b445ee360 R14: 00000000ffffffef R15: ffff975b445ee308 [258532.052705] FS: 00007f86a821de80(0000) GS:ffff975b76a00000(0000) knlGS:0000000000000000 [258532.052707] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [258532.052708] CR2: 00007fdacf0f3ab4 CR3: 00000001f9d26002 CR4: 00000000003606f0 [258532.052712] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [258532.052717] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [258532.052717] Call Trace: [258532.052718] ? preempt_schedule_common+0x32/0x70 [258532.052722] ? ___preempt_schedule+0x16/0x20 [258532.052741] create_io_em+0xff/0x180 [btrfs] [258532.052767] run_delalloc_nocow+0x942/0xb10 [btrfs] [258532.052791] btrfs_run_delalloc_range+0x30b/0x520 [btrfs] [258532.052812] ? find_lock_delalloc_range+0x221/0x250 [btrfs] [258532.052834] writepage_delalloc+0xe4/0x140 [btrfs] [258532.052855] __extent_writepage+0x110/0x4e0 [btrfs] [258532.052876] extent_write_cache_pages+0x21c/0x480 [btrfs] [258532.052906] extent_writepages+0x52/0xb0 [btrfs] [258532.052911] do_writepages+0x23/0x80 [258532.052915] __filemap_fdatawrite_range+0xd2/0x110 [258532.052938] btrfs_fdatawrite_range+0x1b/0x50 [btrfs] [258532.052954] start_ordered_ops+0x57/0xa0 [btrfs] [258532.052973] ? btrfs_sync_file+0x225/0x490 [btrfs] [258532.052988] btrfs_sync_file+0x225/0x490 [btrfs] [258532.052997] __x64_sys_msync+0x199/0x200 [258532.053004] do_syscall_64+0x5c/0x250 [258532.053007] entry_SYSCALL_64_after_hwframe+0x49/0xbe [258532.053010] RIP: 0033:0x7f86a7dfd760 (...) [258532.053014] RSP: 002b:00007ffd99af0368 EFLAGS: 00000246 ORIG_RAX: 000000000000001a [258532.053016] RAX: ffffffffffffffda RBX: 0000000000000ec9 RCX: 00007f86a7dfd760 [258532.053017] RDX: 0000000000000004 RSI: 000000000000836c RDI: 00007f86a8221000 [258532.053019] RBP: 0000000000021ec9 R08: 0000000000000003 R09: 00007f86a812037c [258532.053020] R10: 0000000000000001 R11: 0000000000000246 R12: 00000000000074a3 [258532.053021] R13: 00007f86a8221000 R14: 000000000000836c R15: 0000000000000001 [258532.053032] irq event stamp: 1653450494 [258532.053035] hardirqs last enabled at (1653450493): [<ffffffff9dec69f9>] _raw_spin_unlock_irq+0x29/0x50 [258532.053037] hardirqs last disabled at (1653450494): [<ffffffff9d4048ea>] trace_hardirqs_off_thunk+0x1a/0x20 [258532.053039] softirqs last enabled at (1653449852): [<ffffffff9e200466>] __do_softirq+0x466/0x6bd [258532.053042] softirqs last disabled at (1653449845): [<ffffffff9d4c8a0c>] irq_exit+0xec/0x120 [258532.053043] ---[ end trace 8476fce13d9ce20a ]---
Which results in flooding dmesg/syslog since btrfs_drop_extent_cache() uses WARN_ON() and not WARN_ON_ONCE().
So fix this issue by changing run_delalloc_nocow()'s loop to move to the next extent item when the current extent item ends at at offset less than or equals to the current offset instead of the start offset.
--- fs/btrfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/inode.c +3 -3
@@ -1439,10 +1439,10 @@ next_slot: disk_num_bytes =btrfs_file_extent_disk_num_bytes (leaf, fi);/* -* If extent we got ends before our range starts, skip -* to next extent +* If the extent we got ends before our current offset, +* skip to the next extent. */ -if (extent_end <= start) { +if (extent_end <= cur_offset) { path->slots[0 ]++; goto next_slot; }
Greg Kroah-Hartman
maintainerPATCH 101/191 compat_ioctl: block: handle Persistent Reservations
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit b2c0fcd28772f99236d261509bcd242135677965 upstream.
These were added to blkdev_ioctl() in linux-5.5 but not blkdev_compat_ioctl, so add them now.
Fold in followup patch from Arnd with missing pr.h header include.
--- block/compat_ioctl.c | 9 +++++++++ 1 file changed, 9 insertions(+)
block/compat_ioctl.c +9 -0
@@ -6,6 +6,7 @@#include <linux/compat.h> #include <linux/elevator.h> #include <linux/hdreg.h> +#include <linux/pr.h> #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/types.h>
@@ -401,6 +402,14 @@ long compat_blkdev_ioctl(struct file *ficase BLKTRACETEARDOWN :/* compatible */ ret =blk_trace_ioctl (bdev, cmd,compat_ptr (arg));return ret; +case IOC_PR_REGISTER : +case IOC_PR_RESERVE : +case IOC_PR_RELEASE : +case IOC_PR_PREEMPT : +case IOC_PR_PREEMPT_ABORT : +case IOC_PR_CLEAR : +return blkdev_ioctl (bdev, mode, cmd, + (unsigned long )compat_ptr (arg));default :if (disk->fops->compat_ioctl) ret = disk->fops->compat_ioctl (bdev, mode, cmd, arg);
Greg Kroah-Hartman
maintainerPATCH 97/191 dmaengine: Fix access to uninitialized dma_slave_caps
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 53a256a9b925b47c7e67fc1f16ca41561a7b877c upstream.
dmaengine_desc_set_reuse() allocates a struct dma_slave_caps on the stack, populates it using dma_get_slave_caps() and then accesses one of its members.
However dma_get_slave_caps() may fail and this isn't accounted for, leading to a legitimate warning of gcc-4.9 (but not newer versions):
In file included from drivers/spi/spi-bcm2835.c:19:0:
drivers/spi/spi-bcm2835.c: In function 'dmaengine_desc_set_reuse':
Quoted 1 line
Quoted 1 line
include/linux/dmaengine.h:1370:10: warning: 'caps.descriptor_reuse' is used uninitialized in this function [-Wuninitialized]
if (caps.descriptor_reuse) {Fix it, thereby also silencing the gcc-4.9 warning.
The issue has been present for 4 years but surfaces only now that the first caller of dmaengine_desc_set_reuse() has been added in spi-bcm2835.c. Another user of reusable DMA descriptors has existed for a while in pxa_camera.c, but it sets the DMA_CTRL_REUSE flag directly instead of calling dmaengine_desc_set_reuse(). Nevertheless, tag this commit for stable in case there are out-of-tree users.
--- include/linux/dmaengine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/dmaengine.h +4 -1
@@ -1364,8 +1364,11 @@ static inline int dma_get_slave_caps(strstatic inline int dmaengine_desc_set_reuse (struct dma_async_tx_descriptor *tx) {struct dma_slave_caps caps; +int ret; -dma_get_slave_caps (tx->chan, &caps); + ret =dma_get_slave_caps (tx->chan, &caps); +if (ret) +return ret;if (caps.descriptor_reuse) { tx->flags |=DMA_CTRL_REUSE ;
Greg Kroah-Hartman
maintainerPATCH 94/191 seccomp: Check that seccomp_notif is zeroed out by the user
In reply to Greg Kroah-HartmanFrom: Sargun Dhillon <[email protected]>
commit 2882d53c9c6f3b8311d225062522f03772cf0179 upstream.
This patch is a small change in enforcement of the uapi for SECCOMP_IOCTL_NOTIF_RECV ioctl. Specifically, the datastructure which is passed (seccomp_notif) must be zeroed out. Previously any of its members could be set to nonsense values, and we would ignore it.
This ensures all fields are set to their zero value.
--- kernel/seccomp.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/seccomp.c +7 -0
@@ -1015,6 +1015,13 @@ static long seccomp_notify_recv(struct sstruct seccomp_notif unotif;ssize_t ret; +/* Verify that we're not given garbage to keep struct extensible. */ + ret =check_zeroed_user (buf,sizeof (unotif)); +if (ret <0 ) +return ret; +if (!ret) +return -EINVAL ; +memset (&unotif,0 ,sizeof (unotif)); ret =down_interruptible (&filter->notif->request);
Greg Kroah-Hartman
maintainerPATCH 92/191 locks: print unsigned ino in /proc/locks
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit 98ca480a8f22fdbd768e3dad07024c8d4856576c upstream.
An ino is unsigned, so display it as such in /proc/locks.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_f }if (inode) {/* userspace relies on this representation of dev_t */ -seq_printf (f,"%d %02x:%02x:%ld " , fl_pid, +seq_printf (f,"%d %02x:%02x:%lu " , fl_pid,MAJOR (inode->i_sb->s_dev),MINOR (inode->i_sb->s_dev), inode->i_ino); }else {
Greg Kroah-Hartman
maintainerPATCH 52/191 PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
In reply to Greg Kroah-HartmanFrom: Andy Whitcroft <[email protected]>
[ Upstream commit da6043fe85eb5ec621e34a92540735dcebbea134 ]
When looking for a bit by number we make use of the cached result from the preceding lookup to speed up operation. Firstly we check if the requested pfn is within the cached zone and if not lookup the new zone. We then check if the offset for that pfn falls within the existing cached node. This happens regardless of whether the node is within the zone we are now scanning. With certain memory layouts it is possible for this to false trigger creating a temporary alias for the pfn to a different bit. This leads the hibernation code to free memory which it was never allocated with the expected fallout.
Ensure the zone we are scanning matches the cached zone before considering the cached node.
Deep thanks go to Andrea for many, many, many hours of hacking and testing that went into cornering this bug.
--- kernel/power/snapshot.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/power/snapshot.c +8 -1
@@ -734,8 +734,15 @@ static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn,* We have found the zone. Now walk the radix tree to find the leaf node * for our PFN. */ + +/* +* If the zone we wish to scan is the the current zone and the +* pfn falls into the current node then we do not need to walk +* the tree. +*/ node = bm->cur.node; -if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK ) == bm->cur.node_pfn) +if (zone == bm->cur.zone && + ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK ) == bm->cur.node_pfn) goto node_found; node = zone->rtree;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/191 IB/mlx5: Fix steering rule of drop and count
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit ed9085fed9d95d5921582e3c8474f3736c5d2782 ]
There are two flow rule destinations: QP and packet. While users are setting DROP packet rule, the QP should not be set as a destination.
--- drivers/infiniband/hw/mlx5/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx5/main.c +6 -7
@@ -3548,10 +3548,6 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, }INIT_LIST_HEAD (&handler->list); -if (dst) { -memcpy (&dest_arr[0 ], dst,sizeof (*dst)); - dest_num++; - }for (spec_index =0 ; spec_index < flow_attr->num_of_specs; spec_index++) { err = parse_flow_attr(dev->mdev, spec,
@@ -3564,6 +3560,11 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, ib_flow += ((union ib_flow_spec *)ib_flow)->size; } +if (dst && !(flow_act.action &MLX5_FLOW_CONTEXT_ACTION_DROP )) { +memcpy (&dest_arr[0 ], dst,sizeof (*dst)); + dest_num++; + } +if (!flow_is_multicast_only (flow_attr))set_underlay_qp (dev, spec, underlay_qpn);
@@ -3604,10 +3605,8 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, }if (flow_act.action &MLX5_FLOW_CONTEXT_ACTION_DROP ) { -if (!(flow_act.action &MLX5_FLOW_CONTEXT_ACTION_COUNT )) { +if (!dest_num) rule_dst =NULL ; - dest_num =0 ; - } }else {if (is_egress) flow_act.action |=MLX5_FLOW_CONTEXT_ACTION_ALLOW ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 80/191 media: cec: CEC 2.0-only bcast messages were ignored
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit cec935ce69fc386f13959578deb40963ebbb85c3 upstream.
Some messages are allowed to be a broadcast message in CEC 2.0 only, and should be ignored by CEC 1.4 devices.
Unfortunately, the check was wrong, causing such messages to be marked as invalid under CEC 2.0.
--- drivers/media/cec/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/cec/cec-adap.c +3 -3
@@ -1083,11 +1083,11 @@ void cec_received_msg_ts(struct cec_adap valid_la = false; else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) valid_la = false; - else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) + else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) valid_la = false; else if (cec_msg_is_broadcast(msg) && - adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 && - !(dir_fl & BCAST2_0)) + adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && + !(dir_fl & BCAST1_4)) valid_la = false; }if (valid_la && min_len) {
Greg Kroah-Hartman
maintainerPATCH 79/191 media: pulse8-cec: fix lost cec_transmit_attempt_done() call
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit e5a52a1d15c79bb48a430fb263852263ec1d3f11 upstream.
The periodic PING command could interfere with the result of a CEC transmit, causing a lost cec_transmit_attempt_done() call.
--- drivers/media/usb/pulse8-cec/pulse8-cec.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/media/usb/pulse8-cec/pulse8-cec.c +13 -4
@@ -116,6 +116,7 @@ struct pulse8 {unsigned int vers;struct completion cmd_done;struct work_struct work; +u8 work_result;struct delayed_work ping_eeprom_work;struct cec_msg rx_msg;u8 data[DATA_SIZE ];
@@ -137,8 +138,10 @@ static void pulse8_irq_work_handler(stru {struct pulse8 *pulse8 = container_of(work, struct pulse8, work); +u8 result = pulse8->work_result; -switch (pulse8->data[0 ] &0x3f ) { + pulse8->work_result =0 ; +switch (result &0x3f ) {case MSGCODE_FRAME_DATA :cec_received_msg (pulse8->adap, &pulse8->rx_msg);break ;
@@ -172,12 +175,12 @@ static irqreturn_t pulse8_interrupt(stru pulse8->escape = false; }else if (data ==MSGEND ) {struct cec_msg *msg = &pulse8->rx_msg; +u8 msgcode = pulse8->buf[0 ];if (debug)dev_info (pulse8->dev,"received: %*ph\n" , pulse8->idx, pulse8->buf); - pulse8->data[0 ] = pulse8->buf[0 ]; -switch (pulse8->buf[0 ] &0x3f ) { +switch (msgcode &0x3f ) {case MSGCODE_FRAME_START : msg->len =1 ; msg->msg[0 ] = pulse8->buf[1 ];
@@ -186,14 +189,20 @@ static irqreturn_t pulse8_interrupt(struif (msg->len ==CEC_MAX_MSG_SIZE )break ; msg->msg[msg->len++] = pulse8->buf[1 ]; -if (pulse8->buf[0 ] &MSGCODE_FRAME_EOM ) +if (msgcode &MSGCODE_FRAME_EOM ) { +WARN_ON (pulse8->work_result); + pulse8->work_result = msgcode;schedule_work (&pulse8->work); +break ; + }break ;case MSGCODE_TRANSMIT_SUCCEEDED :case MSGCODE_TRANSMIT_FAILED_LINE :case MSGCODE_TRANSMIT_FAILED_ACK :case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA :case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE : +WARN_ON (pulse8->work_result); + pulse8->work_result = msgcode;schedule_work (&pulse8->work);break ;case MSGCODE_HIGH_ERROR :
Greg Kroah-Hartman
maintainerPATCH 75/191 drm/amdgpu/smu: add metrics table lock for vega20 (v2)
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 1c455101c6d10c99b310d6bcf613244c97854012 upstream.
To protect access to the metrics table.
v2: unlock on error
--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +3 -0
@@ -1691,17 +1691,20 @@ static int vega20_get_metrics_table(strustruct smu_table_context *smu_table= &smu->smu_table;int ret =0 ; +mutex_lock (&smu->metrics_lock);if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +HZ /1000 )) { ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) {pr_info ("Failed to export SMU metrics table!\n" ); +mutex_unlock (&smu->metrics_lock);return ret; } smu_table->metrics_time = jiffies; }memcpy (metrics_table, smu_table->metrics_table,sizeof (SmuMetrics_t)); +mutex_unlock (&smu->metrics_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 73/191 drm/amdgpu/smu: add metrics table lock for arcturus (v2)
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 1da87c9f67c98d552679974dbfc1f0f65b6a0a53 upstream.
To protect access to the metrics table.
v2: unlock on error
--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +3 -0
@@ -910,18 +910,21 @@ static int arcturus_get_metrics_table(ststruct smu_table_context *smu_table= &smu->smu_table;int ret =0 ; +mutex_lock (&smu->metrics_lock);if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +HZ /1000 )) { ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) {pr_info ("Failed to export SMU metrics table!\n" ); +mutex_unlock (&smu->metrics_lock);return ret; } smu_table->metrics_time = jiffies; }memcpy (metrics_table, smu_table->metrics_table,sizeof (SmuMetrics_t)); +mutex_unlock (&smu->metrics_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 67/191 ALSA: usb-audio: fix set_format altsetting sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 0141254b0a74b37aa7eb13d42a56adba84d51c73 upstream.
Make sure to check the return value of usb_altnum_to_altsetting() to avoid dereferencing a NULL pointer when the requested alternate settings is missing.
The format altsetting number may come from a quirk table and there does not seem to be any other validation of it (the corresponding index is checked however).
--- sound/usb/pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/pcm.c +2 -2
@@ -506,9 +506,9 @@ static int set_format(struct snd_usb_subif (WARN_ON (!iface))return -EINVAL ; alts =usb_altnum_to_altsetting (iface, fmt->altsetting); - altsd =get_iface_desc (alts); -if (WARN_ON (altsd->bAlternateSetting != fmt->altsetting)) +if (WARN_ON (!alts))return -EINVAL ; + altsd =get_iface_desc (alts);if (fmt == subs->cur_audiofmt)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 69/191 ALSA: hda - Apply sync-write workaround to old Intel platforms, too
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit c366b3dbbab14b28d044b94eb9ce77c23482ea35 upstream.
Klaus Ethgen reported occasional high CPU usages in his system that seem caused by HD-audio driver. The perf output revealed that it's in the unsolicited event handling in the workqueue, and the problem seems triggered by some communication stall between the controller and the codec at the runtime or system resume.
Actually a similar phenomenon was seen in the past for other Intel platforms, and we already applied the workaround to enforce sync-write for CORB/RIRB verbs for Skylake and newer chipsets (commit 2756d9143aa5 "ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips"). Fortunately, the same workaround is applicable to the old chipset, and the experiment showed the positive effect.
Based on the experiment result, this patch enables the sync-write workaround for all Intel chipsets. The only reason I hesitated to apply this workaround was about the possibly slightly higher CPU usage. But if the lack of sync causes a much severer problem even for quite old chip, we should think this would be necessary for all Intel chips.
--- sound/pci/hda/hda_intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/pci/hda/hda_intel.c +5 -4
@@ -280,12 +280,13 @@ enum {/* quirks for old Intel chipsets */ #define AZX_DCAPS_INTEL_ICH \ - (AZX_DCAPS_OLD_SSYNC | AZX_DCAPS_NO_ALIGN_BUFSIZE) + (AZX_DCAPS_OLD_SSYNC | AZX_DCAPS_NO_ALIGN_BUFSIZE |\ + AZX_DCAPS_SYNC_WRITE)/* quirks for Intel PCH */ #define AZX_DCAPS_INTEL_PCH_BASE \ (AZX_DCAPS_NO_ALIGN_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY |\ - AZX_DCAPS_SNOOP_TYPE(SCH)) + AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)/* PCH up to IVB; no runtime PM; bind with i915 gfx */ #define AZX_DCAPS_INTEL_PCH_NOPM \
@@ -300,13 +301,13 @@ enum { #define AZX_DCAPS_INTEL_HASWELL \ (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\ AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\ - AZX_DCAPS_SNOOP_TYPE(SCH)) + AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)/* Broadwell HDMI can't use position buffer reliably, force to use LPIB */ #define AZX_DCAPS_INTEL_BROADWELL \ (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\ AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\ - AZX_DCAPS_SNOOP_TYPE(SCH)) + AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)#define AZX_DCAPS_INTEL_BAYTRAIL \ (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT)
Greg Kroah-Hartman
maintainerPATCH 61/191 taskstats: fix data-race
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
[ Upstream commit 0b8d616fb5a8ffa307b1d3af37f55c15dae14f28 ]
When assiging and testing taskstats in taskstats_exit() there's a race when setting up and reading sig->stats when a thread-group with more than one thread exits:
write to 0xffff8881157bbe10 of 8 bytes by task 7951 on cpu 0:
taskstats_tgid_alloc kernel/taskstats.c:567 [inline] taskstats_exit+0x6b7/0x717 kernel/taskstats.c:596 do_exit+0x2c2/0x18e0 kernel/exit.c:864 do_group_exit+0xb4/0x1c0 kernel/exit.c:983 get_signal+0x2a2/0x1320 kernel/signal.c:2734 do_signal+0x3b/0xc00 arch/x86/kernel/signal.c:815 exit_to_usermode_loop+0x250/0x2c0 arch/x86/entry/common.c:159 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x2d7/0x2f0 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffff8881157bbe10 of 8 bytes by task 7949 on cpu 1:
taskstats_tgid_alloc kernel/taskstats.c:559 [inline] taskstats_exit+0xb2/0x717 kernel/taskstats.c:596 do_exit+0x2c2/0x18e0 kernel/exit.c:864 do_group_exit+0xb4/0x1c0 kernel/exit.c:983 __do_sys_exit_group kernel/exit.c:994 [inline] __se_sys_exit_group kernel/exit.c:992 [inline] __x64_sys_exit_group+0x2e/0x30 kernel/exit.c:992 do_syscall_64+0xcf/0x2f0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix this by using smp_load_acquire() and smp_store_release().
--- kernel/taskstats.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
kernel/taskstats.c +19 -11
@@ -554,25 +554,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)static struct taskstats *taskstats_tgid_alloc (struct task_struct *tsk) {struct signal_struct *sig = tsk->signal; -struct taskstats *stats; +struct taskstats *stats_new, *stats; -if (sig->stats ||thread_group_empty (tsk)) - goto ret; +/* Pairs with smp_store_release() below. */ + stats =smp_load_acquire (&sig->stats); +if (stats ||thread_group_empty (tsk)) +return stats;/* No problem if kmem_cache_zalloc() fails */ - stats =kmem_cache_zalloc (taskstats_cache,GFP_KERNEL ); + stats_new =kmem_cache_zalloc (taskstats_cache,GFP_KERNEL );spin_lock_irq (&tsk->sighand->siglock); -if (!sig->stats) { - sig->stats = stats; - stats =NULL ; + stats = sig->stats; +if (!stats) { +/* +* Pairs with smp_store_release() above and order the +* kmem_cache_zalloc(). +*/ +smp_store_release (&sig->stats, stats_new); + stats = stats_new; + stats_new =NULL ; }spin_unlock_irq (&tsk->sighand->siglock); -if (stats) -kmem_cache_free (taskstats_cache, stats); -ret: -return sig->stats; +if (stats_new) +kmem_cache_free (taskstats_cache, stats_new); + +return stats; }/* Send pid data out on exit */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/191 ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen
In reply to Greg Kroah-HartmanFrom: Jaroslav Kysela <[email protected]>
[ Upstream commit d2cd795c4ece1a24fda170c35eeb4f17d9826cbb ]
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
--- sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
sound/pci/hda/patch_realtek.c +17 -0
@@ -5547,6 +5547,16 @@ static void alc295_fixup_disable_dac3(struct hda_codec *codec, } } +/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */ +static void alc285_fixup_speaker2_to_dac1 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { +hda_nid_t conn[1 ] = {0x02 }; +snd_hda_override_conn_list (codec,0x17 ,1 , conn); + } +} +/* Hook to update amp GPIO4 for automute */ static void alc280_hp_gpio4_automute_hook (struct hda_codec *codec,struct hda_jack_callback *jack)
@@ -5849,6 +5859,7 @@ enum {ALC225_FIXUP_DISABLE_MIC_VREF ,ALC225_FIXUP_DELL1_MIC_NO_PRESENCE ,ALC295_FIXUP_DISABLE_DAC3 , +ALC285_FIXUP_SPEAKER2_TO_DAC1 ,ALC280_FIXUP_HP_HEADSET_MIC ,ALC221_FIXUP_HP_FRONT_MIC , ALC292_FIXUP_TPT460,
@@ -6652,6 +6663,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc295_fixup_disable_dac3, }, + [ALC285_FIXUP_SPEAKER2_TO_DAC1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + }, [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -7241,6 +7256,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x224c ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x224d ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x225d ,"Thinkpad T480" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x17aa ,0x2293 ,"Thinkpad X1 Carbon 7th" ,ALC285_FIXUP_SPEAKER2_TO_DAC1 ),SND_PCI_QUIRK (0x17aa ,0x30bb ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ),SND_PCI_QUIRK (0x17aa ,0x30e2 ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ), SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
@@ -7425,6 +7441,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"}, {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"}, {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"}, + {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"}, {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"}, {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"}, {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/191 ALSA: hda: Allow HDA to be runtime suspended when dGPU is not bound to a driver
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit bacd861452d2be86a4df341b12e32db7dac8021e ]
Nvidia proprietary driver doesn't support runtime power management, so when a user only wants to use the integrated GPU, it's a common practice to let dGPU not to bind any driver, and let its upstream port to be runtime suspended. At the end of runtime suspension the port uses platform power management to disable power through _OFF method of power resource, which is listed by _PR3.
After commit b516ea586d71 ("PCI: Enable NVIDIA HDA controllers"), when the dGPU comes with an HDA function, the HDA won't be suspended if the dGPU is unbound, so the power resource can't be turned off by its upstream port driver.
Commit 37a3a98ef601 ("ALSA: hda - Enable runtime PM only for discrete GPU") only allows HDA to be runtime suspended once GPU is bound, to keep APU's HDA working.
However, HDA on dGPU isn't that useful if dGPU is not bound to any driver. So let's relax the runtime suspend requirement for dGPU's HDA function, to disable the power source to save lots of power.
--- sound/pci/hda/hda_intel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +7 -1
@@ -1280,11 +1280,17 @@ static void init_vga_switcheroo(struct azx *chip) { struct hda_intel *hda = container_of(chip, struct hda_intel, chip);struct pci_dev *p =get_bound_vga (chip->pci); +struct pci_dev *parent;if (p) {dev_info (chip->card->dev,"Handle vga_switcheroo audio client\n" ); hda->use_vga_switcheroo =1 ; - chip->bus.keep_power =1 ;/* cleared in either gpu_bound op or codec probe */ + +/* cleared in either gpu_bound op or codec probe, or when its +* upstream port has _PR3 (i.e. dGPU). +*/ + parent =pci_upstream_bridge (p); + chip->bus.keep_power = parent ? !pci_pr3_present (parent) :1 ; chip->driver_caps |=AZX_DCAPS_PM_RUNTIME ;pci_dev_put (p); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/191 PM / devfreq: Dont fail devfreq_dev_release if not in list
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]
Right now devfreq_dev_release will print a warning and abort the rest of the cleanup if the devfreq instance is not part of the global devfreq_list. But this is a valid scenario, for example it can happen if the governor can't be found or on any other init error that happens after device_register.
Initialize devfreq->node to an empty list head in devfreq_add_device so that list_del becomes a safe noop inside devfreq_dev_release and we can continue the rest of the cleanup.
--- drivers/devfreq/devfreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/devfreq/devfreq.c +1 -5
@@ -588,11 +588,6 @@ static void devfreq_dev_release(struct device *dev)struct devfreq *devfreq =to_devfreq (dev);mutex_lock (&devfreq_list_lock); -if (IS_ERR (find_device_devfreq (devfreq->dev.parent))) { -mutex_unlock (&devfreq_list_lock); -dev_warn (&devfreq->dev,"releasing devfreq which doesn't exist\n" ); -return ; - }list_del (&devfreq->node);mutex_unlock (&devfreq_list_lock);
@@ -647,6 +642,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->dev.parent = dev; devfreq->dev.class = devfreq_class; devfreq->dev.release = devfreq_dev_release; +INIT_LIST_HEAD (&devfreq->node); devfreq->profile = profile;strncpy (devfreq->governor_name, governor_name,DEVFREQ_NAME_LEN ); devfreq->previous_freq = profile->initial_freq;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/191 RDMA/cma: add missed unregister_pernet_subsys in init failure
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 44a7b6759000ac51b92715579a7bba9e3f9245c2 ]
The driver forgets to call unregister_pernet_subsys() in the error path of cma_init().
Add the missed call to fix it.
--- drivers/infiniband/core/cma.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/cma.c +1 -0
@@ -4736,6 +4736,7 @@ static int __init cma_init(void) err:unregister_netdevice_notifier (&cma_nb);ib_sa_unregister_client (&sa_client); +unregister_pernet_subsys (&cma_pernet_operations); err_wq:destroy_workqueue (cma_wq);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/191 afs: Fix creation calls in the dynamic root to fail with EOPNOTSUPP
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 1da4bd9f9d187f53618890d7b66b9628bbec3c70 ]
Fix the lookup method on the dynamic root directory such that creation calls, such as mkdir, open(O_CREAT), symlink, etc. fail with EOPNOTSUPP rather than failing with some odd error (such as EEXIST).
lookup() itself tries to create automount directories when it is invoked. These are cached locally in RAM and not committed to storage.
--- fs/afs/dynroot.c | 3 +++ 1 file changed, 3 insertions(+)
fs/afs/dynroot.c +3 -0
@@ -136,6 +136,9 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr ASSERTCMP(d_inode(dentry), ==, NULL); +if (flags &LOOKUP_CREATE ) +return ERR_PTR (-EOPNOTSUPP ); +if (dentry->d_name.len >=AFSNAMEMAX ) {_leave (" = -ENAMETOOLONG" );return ERR_PTR (-ENAMETOOLONG );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/191 staging/wlan-ng: add CRC32 dependency in Kconfig
In reply to Greg Kroah-HartmanFrom: Kay Friedrich <[email protected]>
[ Upstream commit 2740bd3351cd5a4351f458aabaa1c9b77de3867b ]
wlan-ng uses the function crc32_le,
but CRC32 wasn't a dependency of wlan-ng
--- drivers/staging/wlan-ng/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/wlan-ng/Kconfig +1 -0
@@ -4,6 +4,7 @@ config PRISM2_USB depends on WLAN && USB && CFG80211 select WIRELESS_EXT select WEXT_PRIV + select CRC32 help This is the wlan-ng prism 2.5/3 USB driver for a wide range of old USB wireless devices.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/191 net: make socket read/write_iter() honor IOCB_NOWAIT
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit ebfcd8955c0b52eb793bcbc9e71140e3d0cdb228 ]
The socket read/write helpers only look at the file O_NONBLOCK. not the iocb IOCB_NOWAIT flag. This breaks users like preadv2/pwritev2 and io_uring that rely on not having the file itself marked nonblocking, but rather the iocb itself.
--- net/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/socket.c +2 -2
@@ -955,7 +955,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) .msg_iocb = iocb};ssize_t res; -if (file->f_flags &O_NONBLOCK ) +if (file->f_flags &O_NONBLOCK || (iocb->ki_flags &IOCB_NOWAIT )) msg.msg_flags =MSG_DONTWAIT ;if (iocb->ki_pos !=0 )
@@ -980,7 +980,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)if (iocb->ki_pos !=0 )return -ESPIPE ; -if (file->f_flags &O_NONBLOCK ) +if (file->f_flags &O_NONBLOCK || (iocb->ki_flags &IOCB_NOWAIT )) msg.msg_flags =MSG_DONTWAIT ;if (sock->type ==SOCK_SEQPACKET )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/191 drm/nouveau: Fix drm-core using atomic code-paths on pre-nv50 hardware
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 64d17f25dcad518461ccf0c260544e1e379c5b35 ]
We do not support atomic modesetting on pre-nv50 hardware, but until now our connector code was setting drm_connector->state on pre-nv50 hardware.
This causes the core to enter atomic modesetting paths in at least:
1. drm_connector_get_encoder(), returning connector->state->best_encoder which is always 0, causing us to always report 0 as encoder_id in the drmModeConnector struct returned by drmModeGetConnector().
2. drm_encoder_get_crtc(), returning NULL because uses_atomic get set, causing us to always report 0 as crtc_id in the drmModeEncoder struct returned by drmModeGetEncoder()
Which in turn confuses userspace, at least plymouth thinks that the pipe has changed because of this and tries to reconfigure it unnecessarily.
More in general we should not set drm_connector->state in the non-atomic code as this violates the drm-core's expectations.
This commit fixes this by using a nouveau_conn_atom struct embedded in the nouveau_connector struct for property handling in the non-atomic case.
--- drivers/gpu/drm/nouveau/nouveau_connector.c | 28 +++++++++++++++------ drivers/gpu/drm/nouveau/nouveau_connector.h | 6 +++++ 2 files changed, 27 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +21 -7
@@ -245,14 +245,22 @@ nouveau_conn_atomic_duplicate_state(struct drm_connector *connector)void nouveau_conn_reset (struct drm_connector *connector) { +struct nouveau_connector *nv_connector =nouveau_connector (connector);struct nouveau_conn_atom *asyc; -if (WARN_ON (!(asyc =kzalloc (sizeof (*asyc),GFP_KERNEL )))) -return ; +if (drm_drv_uses_atomic_modeset (connector->dev)) { +if (WARN_ON (!(asyc =kzalloc (sizeof (*asyc),GFP_KERNEL )))) +return ; + +if (connector->state) +nouveau_conn_atomic_destroy_state (connector, + connector->state); + +__drm_atomic_helper_connector_reset (connector, &asyc->state); + }else { + asyc = &nv_connector->properties_state; + } -if (connector->state) -nouveau_conn_atomic_destroy_state (connector, connector->state); -__drm_atomic_helper_connector_reset (connector, &asyc->state); asyc->dither.mode =DITHERING_MODE_AUTO ; asyc->dither.depth =DITHERING_DEPTH_AUTO ; asyc->scaler.mode =DRM_MODE_SCALE_NONE ;
@@ -276,8 +284,14 @@ void nouveau_conn_attach_properties(struct drm_connector *connector) {struct drm_device *dev = connector->dev; -struct nouveau_conn_atom *armc =nouveau_conn_atom (connector->state);struct nouveau_display *disp =nouveau_display (dev); +struct nouveau_connector *nv_connector =nouveau_connector (connector); +struct nouveau_conn_atom *armc; + +if (drm_drv_uses_atomic_modeset (connector->dev)) + armc =nouveau_conn_atom (connector->state); +else + armc = &nv_connector->properties_state;/* Init DVI-I specific properties. */ if (connector->connector_type ==DRM_MODE_CONNECTOR_DVII )
@@ -749,9 +763,9 @@ static int nouveau_connector_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t value) { - struct nouveau_conn_atom *asyc = nouveau_conn_atom(connector->state); struct nouveau_connector *nv_connector = nouveau_connector(connector);struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; +struct nouveau_conn_atom *asyc = &nv_connector->properties_state;struct drm_encoder *encoder =to_drm_encoder (nv_encoder);int ret;
drivers/gpu/drm/nouveau/nouveau_connector.h +6 -0
@@ -118,6 +118,12 @@ struct nouveau_connector {#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT struct nouveau_backlight *backlight;#endif +/* +* Our connector property code expects a nouveau_conn_atom struct +* even on pre-nv50 where we do not support atomic. This embedded +* version gets used in the non atomic modeset case. +*/ +struct nouveau_conn_atom properties_state; }; static inline struct nouveau_connector *nouveau_connector(
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/191 scsi: qla2xxx: Dont defer relogin unconditonally
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit dabc5ec915f3a2c657ecfb529cd3d4ec303a4412 ]
qla2x00_configure_local_loop sets RELOGIN_NEEDED bit and calls qla24xx_fcport_handle_login to perform the login. This bit triggers a wake up of DPC later after a successful login.
The deferred call is not needed if login succeeds, and it's set in qla24xx_fcport_handle_login in case of errors, hence it should be safe to drop.
--- drivers/scsi/qla2xxx/qla_init.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +0 -1
@@ -5045,7 +5045,6 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)memcpy (&ha->plogi_els_payld.data, (void *)ha->init_cb,sizeof (ha->plogi_els_payld.data)); -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); }else {ql_dbg (ql_dbg_init, vha,0x00d1 ,"PLOGI ELS param read fail.\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/191 nvme/pci: Fix read queue count
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 7e4c6b9a5d22485acf009b3c3510a370f096dd54 ]
If nvme.write_queues equals the number of CPUs, the driver had decreased the number of interrupts available such that there could only be one read queue even if the controller could support more. Remove the interrupt count reduction in this case. The driver wouldn't request more IRQs than it wants queues anyway.
--- drivers/nvme/host/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/nvme/host/pci.c +1 -5
@@ -2060,7 +2060,6 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) .priv = dev, };unsigned int irq_queues, this_p_queues; -unsigned int nr_cpus =num_possible_cpus ();/* * Poll queues don't need interrupts, but we need at least one IO
@@ -2071,10 +2070,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) this_p_queues = nr_io_queues -1 ; irq_queues =1 ; }else { -if (nr_cpus < nr_io_queues - this_p_queues) - irq_queues = nr_cpus +1 ; -else - irq_queues = nr_io_queues - this_p_queues +1 ; + irq_queues = nr_io_queues - this_p_queues +1 ; } dev->io_queues[HCTX_TYPE_POLL ] = this_p_queues;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/191 nvme_fc: add module to ops template to allow module references
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 863fbae929c7a5b64e96b8a3ffb34a29eefb9f8f ]
In nvme-fc: it's possible to have connected active controllers and as no references are taken on the LLDD, the LLDD can be unloaded. The controller would enter a reconnect state and as long as the LLDD resumed within the reconnect timeout, the controller would resume. But if a namespace on the controller is the root device, allowing the driver to unload can be problematic. To reload the driver, it may require new io to the boot device, and as it's no longer connected we get into a catch-22 that eventually fails, and the system locks up.
Fix this issue by taking a module reference for every connected controller (which is what the core layer did to the transport module). Reference is cleared when the controller is removed.
--- drivers/nvme/host/fc.c | 14 ++++++++++++-- drivers/nvme/target/fcloop.c | 1 + drivers/scsi/lpfc/lpfc_nvme.c | 2 ++ drivers/scsi/qla2xxx/qla_nvme.c | 1 + include/linux/nvme-fc-driver.h | 4 ++++ 5 files changed, 20 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +12 -2
@@ -342,7 +342,8 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, !template->ls_req || !template->fcp_io || !template->ls_abort || !template->fcp_abort || !template->max_hw_queues || !template->max_sgl_segments || - !template->max_dif_sgl_segments || !template->dma_boundary) { + !template->max_dif_sgl_segments || !template->dma_boundary || + !template->module) { ret = -EINVAL; goto out_reghost_failed; }
@@ -2015,6 +2016,7 @@ nvme_fc_ctrl_free(struct kref *ref) {struct nvme_fc_ctrl *ctrl = container_of(ref, struct nvme_fc_ctrl, ref); +struct nvme_fc_lport *lport = ctrl->lport;unsigned long flags;if (ctrl->ctrl.tagset) {
@@ -2041,6 +2043,7 @@ nvme_fc_ctrl_free(struct kref *ref)if (ctrl->ctrl.opts)nvmf_free_options (ctrl->ctrl.opts);kfree (ctrl); +module_put (lport->ops->module); } static void
@@ -3056,10 +3059,15 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_fail; } +if (!try_module_get (lport->ops->module)) { + ret = -EUNATCH ; + goto out_free_ctrl; + } + idx =ida_simple_get (&nvme_fc_ctrl_cnt,0 ,0 ,GFP_KERNEL );if (idx <0 ) { ret = -ENOSPC ; - goto out_free_ctrl; + goto out_mod_put; } ctrl->ctrl.opts = opts;
@@ -3212,6 +3220,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, out_free_ida:put_device (ctrl->dev);ida_simple_remove (&nvme_fc_ctrl_cnt, ctrl->cnum); +out_mod_put: +module_put (lport->ops->module); out_free_ctrl:kfree (ctrl); out_fail:
drivers/nvme/target/fcloop.c +1 -0
@@ -850,6 +850,7 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)#define FCLOOP_DMABOUND_4G 0xFFFFFFFFstatic struct nvme_fc_port_template fctemplate = { + .module =THIS_MODULE , .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue,
drivers/scsi/lpfc/lpfc_nvme.c +2 -0
@@ -1976,6 +1976,8 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,/* Declare and initialization an instance of the FC NVME template. */ static struct nvme_fc_port_template lpfc_nvme_template = { + .module =THIS_MODULE , +/* initiator-based functions */ .localport_delete = lpfc_nvme_localport_delete, .remoteport_delete = lpfc_nvme_remoteport_delete,
drivers/scsi/qla2xxx/qla_nvme.c +1 -0
@@ -610,6 +610,7 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) }static struct nvme_fc_port_template qla_nvme_fc_transport = { + .module =THIS_MODULE , .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue,
include/linux/nvme-fc-driver.h +4 -0
@@ -270,6 +270,8 @@ struct nvme_fc_remote_port {* * Host/Initiator Transport Entrypoints/Parameters: * +* @module: The LLDD module using the interface +* * @localport_delete: The LLDD initiates deletion of a localport via * nvme_fc_deregister_localport(). However, the teardown is * asynchronous. This routine is called upon the completion of the
@@ -383,6 +385,8 @@ struct nvme_fc_remote_port {* Value is Mandatory. Allowed to be zero. */ struct nvme_fc_port_template { +struct module *module; +/* initiator-based functions */ void (*localport_delete)(struct nvme_fc_local_port *);void (*remoteport_delete)(struct nvme_fc_remote_port *);
Signature · 1 line
2.20.1
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for quickly testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 5.4 100/191] block: fix splitting segments on boundary masks
In reply to Jens AxboeQuoted 24 lines · Jens Axboe
Quoted 15 lines · Greg Kroah-Hartman
From: Ming Lei <[email protected]>
commit
429120f3df2dba2bf3a4a19f4212a53ecefc7102upstream.We ran into a problem with a mpt3sas based controller, where we would see random (and hard to reproduce) file corruption). The issue seemed specific to this controller, but wasn't specific to the file system. After a lot of debugging, we find out that it's caused by segments spanning a 4G memory boundary. This shouldn't happen, as the default setting for segment boundary masks is 4G.
Turns out there are two issues in
get_max_segment_size():1) The default segment boundary mask is bypassed
Quoted 7 lines
2) The segment start address isn't taken into account when checking segment boundary limit
Fix these two issues by removing the bypass of the segment boundary check even if the mask is set to the default value, and taking into account the actual start address of the request when checking if a segment needs splitting.
Quoted 5 lines
Greg, there's a problem with this one on ARM. Should be resolved shortly, but probably best to defer this one until the next 5.4 stable release.
I'll ping you with both patches once the dust has settled.
Thanks for letting me know, I've now dropped this from the queue.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 24 lines · Guenter Roeck
Quoted 21 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:[ ... ]
Quoted 7 lines
Quoted 3 lines
Ming Lei <[email protected]>
block: fix splitting segments on boundary masksThis patch causes a regression. See:
https://lore.kernel.org/linux-block/[email protected]/T/#m4607a04fde9ef2ed80d45efacef01c0b0e8d2bfd
Thanks for letting me know, Jens also pointed this out and I've now dropped it and will push out a -rc2 in a few minutes with it removed.
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
For v5.4.8-191-gdd269ce619cb:
Build results:
total: 158 pass: 158 fail: 0 Qemu test results: total: 385 pass: 385 fail: 0
Guenter
Jon Hunter
maintainerQuoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
All tests for Tegra are passing ...
Test results for stable-v5.4:
13 builds: 13 pass, 0 fail
22 boots: 22 pass, 0 fail
38 tests: 38 pass, 0 failLinux version: 5.4.9-rc2-gdd269ce619cb
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Quoted 6 lines · Greg Kroah-Hartman
Thanks for letting me know, Jens also pointed this out and I've now dropped it and will push out a -rc2 in a few minutes with it removed.
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.4.9-rc2
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.4.y
git commit: dd269ce619cbf8cc25d38f1872f7c5a29336500e
git describe: v5.4.7-382-gdd269ce619cb
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.4-oe/build/v5.4.7-382-gdd269ce619cb
No regressions (compared to build v5.4.6-434-g6d21990a6f6c)
No fixes (compared to build v5.4.6-434-g6d21990a6f6c)
Ran 20015 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-containers-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-io-tests
* ltp-ipc-tests
* spectre-meltdown-checker-test
* kvm-unit-tests
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-cpuhotplug-tests
* ltp-fcntl-locktests-tests
* ltp-hugetlb-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-sched-tests
* ltp-fs-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* v4l2-compliance
* network-basic-tests
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 25 lines · Jon Hunter
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.9-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.Quoted 5 lines
thanks,
greg k-h
-------------
All tests for Tegra are passing ...
Test results for stable-v5.4:
Quoted 9 lines
13 builds: 13 pass, 0 fail 22 boots: 22 pass, 0 fail 38 tests: 38 pass, 0 failLinux version: 5.4.9-rc2-gdd269ce619cb
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra30-cardhu-a04
Wonderful, thanks for testing and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.9 release. There are 191 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
Quoted 6 lines
For v5.4.8-191-gdd269ce619cb:
Build results:
total: 158 pass: 158 fail: 0 Qemu test results: total: 385 pass: 385 fail: 0
Great, thanks for testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 11 lines · Naresh Kamboju
Quoted 6 lines · Greg Kroah-Hartman
Thanks for letting me know, Jens also pointed this out and I've now dropped it and will push out a -rc2 in a few minutes with it removed.
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Wonderful, thanks for testing these and letting me know.
greg k-h