Re: kworker/0:3+pm hogging CPU

2020-07-20 Thread Alan Stern
On Mon, Jul 20, 2020 at 08:16:05PM +0200, Michal Hocko wrote: > On Mon 20-07-20 13:48:12, Alan Stern wrote: > > On Mon, Jul 20, 2020 at 07:45:30PM +0200, Michal Hocko wrote: > > > On Mon 20-07-20 13:38:07, Alan Stern wrote: > > > > On Mon, Jul 20, 2020 at 06:33:

Re: kworker/0:3+pm hogging CPU

2020-07-20 Thread Alan Stern
On Mon, Jul 20, 2020 at 07:45:30PM +0200, Michal Hocko wrote: > On Mon 20-07-20 13:38:07, Alan Stern wrote: > > On Mon, Jul 20, 2020 at 06:33:55PM +0200, Michal Hocko wrote: > > > On Mon 20-07-20 11:12:55, Alan Stern wrote: > > > [...] > > > >

Re: kworker/0:3+pm hogging CPU

2020-07-20 Thread Alan Stern
On Mon, Jul 20, 2020 at 06:33:55PM +0200, Michal Hocko wrote: > On Mon 20-07-20 11:12:55, Alan Stern wrote: > [...] > > sudo echo 'module usbcore =p' >/debug/dynamic_debug/control > > > > Then wait long enough for some interesting messages to appear in the > >

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-20 Thread Alan Stern
say "unlock semantics"? It's not as bad as all that; people do talk about acquiring and releasing locks, and presumably you don't have any trouble understanding those terms. In fact this usage is quite common -- and I believe it's where the names "acquire semantics" and "release semantics" came from originally. Alan Stern

Re: kworker/0:3+pm hogging CPU

2020-07-20 Thread Alan Stern
On Mon, Jul 20, 2020 at 04:32:13PM +0200, Michal Hocko wrote: > On Mon 20-07-20 09:58:57, Alan Stern wrote: > [...] > > Can you provide the contents of /sys/kernel/debug/usb/devices and also a > > attached. It looks like you've got just two devices, only one of which is

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-20 Thread Alan Stern
On Mon, Jul 20, 2020 at 11:33:20AM +1000, Dave Chinner wrote: > On Sat, Jul 18, 2020 at 10:08:11AM -0400, Alan Stern wrote: > > > This is one of the reasons that the LKMM documetnation is so damn > > > difficult to read and understand: just understanding the vocabulary &

Re: kworker/0:3+pm hogging CPU

2020-07-20 Thread Alan Stern
81 > [<0>] process_one_work+0x1bd/0x2c6 > [<0>] worker_thread+0x19c/0x240 > [<0>] kthread+0x11b/0x123 > [<0>] ret_from_fork+0x22/0x30 > > Is this something known or something I can give more information about? > From a very quick look into the code it sounds as if the system wanted > to suspend an USB device/controller but that keeps failing again and > again. Yes, that's what it looks like to me too. Or maybe the suspend succeeds but then the device/controller immediately gets woken up again. Can you provide the contents of /sys/kernel/debug/usb/devices and also a usbmon trace showing a few rounds of this recurring activity? Perhaps a section of the dmesg log with dynamic debugging enabled for the usbcore module, as well. Alan Stern

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-18 Thread Alan Stern
ikely), there is a distinct risk that people will supply different mutexes or done variables for the invocations. IMO a better approach would be to have a macro which, given a variable name v, generates an actual init_once_v() function. Then code wanting to use v would call init_once_v() first, with no danger of inconsistent usage. You can fill in the details... Alan Stern

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-18 Thread Alan Stern
s file), and the actual recipe itself should await the development of a general and robust API. Alan Stern

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-18 Thread Alan Stern
think it needs improvement and can give some specific details about where it falls short, I would like to hear them. Alan Stern

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-17 Thread Alan Stern
pendency (checking whether the pointer is non-NULL). Control dependencies do not always ensure ordering -- certainly not for reads, and depending on the compiler, possibly not for some writes -- and therefore a load-acquire is necessary. Perhaps this is more wordy than you want, but it does get the important ideas across. Alan Stern

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-17 Thread Alan Stern
> Why do we have cmpxchg_release() anyway? Under what circumstances is > cmpxchg() useful _without_ having release semantics? To answer just the last question: cmpxchg() is useful for lock acquisition, in which case it needs to have acquire semantics rather than release semantics. Alan Stern

Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode

2020-07-17 Thread Alan Stern
On Fri, Jul 17, 2020 at 12:22:49PM -0400, Mathieu Desnoyers wrote: > - On Jul 17, 2020, at 12:11 PM, Alan Stern st...@rowland.harvard.edu > wrote: > > >> > I agree with Nick: A memory barrier is needed somewhere between the > >> > assignment at 6 and the ret

Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode

2020-07-17 Thread Alan Stern
as to ensure that it executes after the IPI-induced memory barrier on CPU1. If it happened before then we could still end up with r1 = 0. That's why the pairing matters. I hope this helps your head get properly wrapped. :-) Alan Stern

Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode

2020-07-17 Thread Alan Stern
On Fri, Jul 17, 2020 at 09:39:25AM -0400, Mathieu Desnoyers wrote: > - On Jul 16, 2020, at 5:24 PM, Alan Stern st...@rowland.harvard.edu wrote: > > > On Thu, Jul 16, 2020 at 02:58:41PM -0400, Mathieu Desnoyers wrote: > >> - On Jul 16, 2020, at 12:03

Re: [PATCH] tools/memory-model: document the "one-time init" pattern

2020-07-17 Thread Alan Stern
ase above to: ... since we still need a load-acquire of the data on which the other task performed a store-release. Alan Stern

Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode

2020-07-16 Thread Alan Stern
s say that a writes to X and 9 reads from X. Then we have an instance of the Store Buffer pattern: CPU0CPU1 a. Write X 6. Write rq->curr for user thread c. smp_mb() 7. switch_to memory barrier d. Read rq->curr9. Read X In this pattern, the memory barriers make it impossible for both reads to miss their corresponding writes. Since d does fail to read 6 (it sees the earlier value stored by 4), 9 must read a. The other guarantee you need is that g on CPU0 will observe anything written by CPU1 in 1. This is easier to see, using the fact that 3 is a memory barrier and d reads from 4. Alan Stern

Re: [PATCH -next v2] usb: usbtest: reduce stack usage in test_queue

2020-07-16 Thread Alan Stern
uct usbtest_dev *dev, struct > usbtest_param_32 *param, > if (param->sglen > MAX_SGLEN) > return -EINVAL; > > + urbs = kcalloc(MAX_SGLEN, sizeof(*urbs), GFP_KERNEL); Since you know at runtime how many URBs will be needed, why not use that information? Change MAX_SGLEN to param->sglen. Aside from that, Acked-by: Alan Stern Alan Stern

Re: INFO: rcu detected stall in dummy_timer (3)

2020-07-14 Thread Alan Stern
itting. (Incidentally, the calls to usb_unlink_urb() in that routine are useless and look very strange. The URB is already unlinked, since mceusb_dev_recv() is the completion handler.) Alan Stern

[PATCH v3 bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-13 Thread Alan Maguire
it in-kernel when/if we encounter a program using the bpf_trace_printk() helper. With this approach, trace_printk() is not used directly and no warning message appears. This work was started by Steven (see Link) and finished by Alan; added Steven's Signed-off-by with his permission. Link: https

[PATCH v3 bpf-next 0/2] bpf: fix use of trace_printk() in BPF

2020-07-13 Thread Alan Maguire
will not prevent tracing output from being logged (Steven, patch 1) - use "tp/raw_syscalls/sys_enter" and a usleep(1) to trigger events in the selftest ensuring test runs faster (Andrii, patch 2) [1] https://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Alan Maguire (2): bpf: use

[PATCH v3 bpf-next 2/2] selftests/bpf: add selftests verifying bpf_trace_printk() behaviour

2020-07-13 Thread Alan Maguire
Simple selftests that verifies bpf_trace_printk() returns a sensible value and tracing messages appear. Signed-off-by: Alan Maguire Acked-by: Andrii Nakryiko --- .../selftests/bpf/prog_tests/trace_printk.c| 75 ++ tools/testing/selftests/bpf/progs/trace_printk.c

[PATCH v2 bpf-next 0/2] bpf: fix use of trace_printk() in BPF

2020-07-10 Thread Alan Maguire
, patch 1) - use "tp/raw_syscalls/sys_enter" and a usleep(1) to trigger events in the selftest ensuring test runs faster (Andrii, patch 2) [1] https://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Alan Maguire (2): bpf: use dedicated bpf_trace_printk event instead of tr

[PATCH v2 bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-10 Thread Alan Maguire
it in-kernel when/if we encounter a program using the bpf_trace_printk() helper. With this approach, trace_printk() is not used directly and no warning message appears. This work was started by Steven (see Link) and finished by Alan; added Steven's Signed-off-by with his permission. Link: https

[PATCH v2 bpf-next 2/2] selftests/bpf: add selftests verifying bpf_trace_printk() behaviour

2020-07-10 Thread Alan Maguire
Simple selftests that verifies bpf_trace_printk() returns a sensible value and tracing messages appear. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/trace_printk.c| 74 ++ tools/testing/selftests/bpf/progs/trace_printk.c | 21 ++ 2 files changed

Re: [PATCH bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-09 Thread Alan Maguire
On Tue, 7 Jul 2020, Andrii Nakryiko wrote: > On Fri, Jul 3, 2020 at 7:47 AM Alan Maguire wrote: > > > > The bpf helper bpf_trace_printk() uses trace_printk() under the hood. > > This leads to an alarming warning message originating from trace > > buffer allocation

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-07-06 Thread Alan Stern
On Tue, Jun 30, 2020 at 20:49:58PM -0400, Alan Stern wrote: > On Tue, Jun 30, 2020 at 04:31:58PM -0700, Bart Van Assche wrote: > > On 2020-06-30 12:38, Alan Stern wrote: > > > Assume that BLK_MQ_REQ_PREEMPT is set in flags. Then where exactly > > > does blk

[PATCH bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-03 Thread Alan Maguire
it in-kernel when/if we encounter a program using the bpf_trace_printk() helper. With this approach, trace_printk() is not used directly and no warning message appears. This work was started by Steven (see Link) and finished by Alan; added Steven's Signed-off-by with his permission. Link: https

[PATCH bpf-next 0/2] bpf: fix use of trace_printk() in BPF

2020-07-03 Thread Alan Maguire
://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Alan Maguire (2): bpf: use dedicated bpf_trace_printk event instead of trace_printk() selftests/bpf: add selftests verifying bpf_trace_printk() behaviour kernel/trace/Makefile | 2 + kernel/trace

[PATCH bpf-next 2/2] selftests/bpf: add selftests verifying bpf_trace_printk() behaviour

2020-07-03 Thread Alan Maguire
Simple selftest that verifies bpf_trace_printk() returns a sensible value and tracing messages appear. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/trace_printk.c| 71 ++ tools/testing/selftests/bpf/progs/trace_printk.c | 21 +++ 2 files changed

Re: [PATCH] usb: host: ohci-platform: Disable ohci for rk3288

2020-07-02 Thread Alan Stern
7 +96,7 @@ static int ohci_platform_probe(struct platform_device *dev) > struct ohci_hcd *ohci; > int err, irq, clk = 0; > > - if (usb_disabled()) > + if (usb_disabled() || of_machine_is_compatible("rockchip,rk3288")) > return -ENODEV; > > /* > -- > 2.25.1 Acked-by: Alan Stern

Re: [RFC PATCH 0/6] Support raw event and DT for perf on RISC-V

2020-06-30 Thread Alan Kao
Tue, Jun 30, 2020 at 06:02:43PM -0700, Atish Patra wrote: > On Tue, Jun 30, 2020 at 5:52 PM Alan Kao wrote: > > > > On Mon, Jun 29, 2020 at 11:19:09AM +0800, Zong Li wrote: > > > This patch set adds raw event support on RISC-V. In addition, we > > > introduce

Re: [RFC PATCH 0/6] Support raw event and DT for perf on RISC-V

2020-06-30 Thread Alan Kao
On Mon, Jun 29, 2020 at 11:19:09AM +0800, Zong Li wrote: > This patch set adds raw event support on RISC-V. In addition, we > introduce the DT mechanism to make our perf more generic and common. > > Currently, we set the hardware events by writing the mhpmeventN CSRs, it > would raise an illegal

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-30 Thread Alan Stern
On Tue, Jun 30, 2020 at 04:31:58PM -0700, Bart Van Assche wrote: > On 2020-06-30 12:38, Alan Stern wrote: > > Assume that BLK_MQ_REQ_PREEMPT is set in flags. Then where exactly > > does blk_queue_enter(q, flags) call blk_pm_request_resume(q)? > > Please take a loo

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-30 Thread Alan Stern
On Tue, Jun 30, 2020 at 12:23:12PM -0700, Bart Van Assche wrote: > On 2020-06-30 11:02, Alan Stern wrote: > > Right now there doesn't seem to be any mechanism for resuming the queue > > if an REQ_PREEMPT request is added while the queue is suspended. > > I do not agree wit

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-30 Thread Alan Stern
On Tue, Jun 30, 2020 at 08:59:00AM -0700, Bart Van Assche wrote: > On 2020-06-29 09:15, Alan Stern wrote: > > Aha. Looking at this more closely, it's apparent that the code in > > blk-core.c contains a logic bug: It assumes that if the BLK_MQ_REQ_PREEMPT > > flag is set

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-30 Thread Alan Stern
gs 0x0 phys_seg 1 prio class 0 No way to tell from the log what caused this error. > [ 372.560690] scsi_runtime_suspend > [ 372.563968] scsi_runtime_suspend > [ 372.567237] scsi_runtime_suspend > > thanks Alan for taking the time and trying to fix this! you're close. > what is missing? At this point I don't know. Alan Stern

Re: linux-next: build failure after merge of the thunderbolt tree

2020-06-30 Thread Alan Maguire
un 2020 15:51:50 +1000 > Subject: [PATCH] thunderbolt: merge fix for kunix_resource changes > > Signed-off-by: Stephen Rothwell Thanks Stephen, resolution looks good to me! If you need it Reviewed-by: Alan Maguire Once the kunit and thunderbolt trees are merged there may be some additional t

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-29 Thread Alan Stern
On Mon, Jun 29, 2020 at 09:56:49AM -0700, Bart Van Assche wrote: > On 2020-06-29 09:15, Alan Stern wrote: > > Aha. Looking at this more closely, it's apparent that the code in > > blk-core.c contains a logic bug: It assumes that if the BLK_MQ_REQ_PREEMPT > > flag is set

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-29 Thread Alan Stern
On Mon, Jun 29, 2020 at 11:42:59AM +0200, Martin Kepplinger wrote: > > > On 26.06.20 17:44, Alan Stern wrote: > > Martin's best approach would be to add some debugging code to find out why > > blk_queue_enter() isn't calling bkl_pm_request_resume(), or why that c

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-28 Thread Alan Stern
On Sat, Jun 27, 2020 at 07:37:54PM -0700, Bart Van Assche wrote: > On 2020-06-26 08:44, Alan Stern wrote: > > On Fri, Jun 26, 2020 at 08:07:51AM -0700, Bart Van Assche wrote: > >> As far as I know runtime power management support in the sd driver is > >> working

Re: KASAN: use-after-free Read in line6_submit_audio_in_all_urbs

2020-06-26 Thread Alan Stern
sound/usb/line6/pcm.c:533 > toneport_init+0xdd/0x6b0 sound/usb/line6/toneport.c:419 > line6_probe+0xaa0/0x1330 sound/usb/line6/driver.c:809 It look like the cancel_delayed_work() in line6_disconnect() needs to be cancel_delayed_work_sync(). Unfortunately we can't test this until syzbot is able to reproduce the bug. Alan Stern

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-26 Thread Alan Stern
> Bart. Martin's best approach would be to add some debugging code to find out why blk_queue_enter() isn't calling bkl_pm_request_resume(), or why that call doesn't lead to pm_request_resume(). Alan Stern

Re: [PATCH v3 bpf-next 4/8] printk: add type-printing %pT format specifier which uses BTF

2020-06-26 Thread Alan Maguire
On Fri, 26 Jun 2020, Petr Mladek wrote: > On Tue 2020-06-23 13:07:07, Alan Maguire wrote: > > printk supports multiple pointer object type specifiers (printing > > netdev features etc). Extend this support using BTF to cover > > arbitrary types. "%pT&q

Re: [PATCH] scsi: sd: add runtime pm to open / release

2020-06-25 Thread Alan Stern
struct gendisk *disk, fmode_t > >> mode) > >> > >>SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); > >> > >> + scsi_autopm_put_device(sdev); > >> + > >>if (atomic_dec_return(>openers) == 0 &

Re: RFC: KTAP documentation - expected messages

2020-06-24 Thread Alan Maguire
er place to trace). If it seems like it could be useful I could have a go at porting the kprobe stuff to KUnit, as it helps expand the vocabulary for what can be tested in kernel context; for example we can also override return values for kernel functions to simulate errors. Alan

[PATCH v3 bpf-next 8/8] bpf/selftests: add tests for %pT format specifier

2020-06-23 Thread Alan Maguire
tests verify we get 0 return value from bpf_trace_print() using %pT format specifier with various modifiers/pointer values. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/trace_printk_btf.c| 45 + .../selftests/bpf/progs/netif_receive_skb.c| 47

[PATCH v3 bpf-next 5/8] printk: initialize vmlinux BTF outside of printk in late_initcall()

2020-06-23 Thread Alan Maguire
vmlinux BTF initialization can take time so it's best to do that outside of printk context; otherwise the first printk() using %pT will trigger BTF initialization. Signed-off-by: Alan Maguire --- lib/vsprintf.c | 12 1 file changed, 12 insertions(+) diff --git a/lib/vsprintf.c b

[PATCH v3 bpf-next 2/8] bpf: move to generic BTF show support, apply it to seq files/strings

2020-06-23 Thread Alan Maguire
te pointer values. BTF_SHOW_UNSAFE - do not copy data to safe buffer before display. BTF_SHOW_ZERO - show zeroed values (by default they are not shown). Signed-off-by: Alan Maguire --- include/linux/btf.h | 36 ++ kernel/bpf/btf.c| 966 ++-

[PATCH v3 bpf-next 4/8] printk: add type-printing %pT format specifier which uses BTF

2020-06-23 Thread Alan Maguire
es where overflow is likely, the compact/no type names display modes may be used. Signed-off-by: Alan Maguire i --- Documentation/core-api/printk-formats.rst | 17 ++ include/linux/btf.h | 3 +- include/linux/printk.h| 16 + lib/vsprintf.c

[PATCH v3 bpf-next 6/8] printk: extend test_printf to test %pT BTF-based format specifier

2020-06-23 Thread Alan Maguire
. These changes add up to approximately 20,000 new tests covering all enum, struct, union and typedefs in vmlinux BTF. Individual tests are also added for int, char, struct, enum and typedefs which verify output is as expected. Signed-off-by: Alan Maguire --- include/linux/btf.h | 3 + kernel/bpf

[PATCH v3 bpf-next 7/8] bpf: add support for %pT format specifier for bpf_trace_printk() helper

2020-06-23 Thread Alan Maguire
Allow %pT[cNx0] format specifier for BTF-based display of data associated with pointer. The unsafe data modifier 'u' - where the source data is traversed without copying it to a safe buffer via probe_kernel_read() - is not supported. Signed-off-by: Alan Maguire --- include/uapi/linux/bpf.h

[PATCH v3 bpf-next 0/8] bpf, printk: add BTF-based type printing

2020-06-23 Thread Alan Maguire
ko - the version in the bpf-next tree will induce a panic when running the fwnode_pointer() tests due to a kobject issue; applying the patch in https://lkml.org/lkml/2020/4/17/389 ...resolved this issue for me. Alan Maguire (8): bpf: provide function to get vmlinux BTF information bpf: move t

[PATCH v3 bpf-next 3/8] checkpatch: add new BTF pointer format specifier

2020-06-23 Thread Alan Maguire
checkpatch complains about unknown format specifiers, so add the BTF format specifier we will implement in a subsequent patch to avoid errors. Signed-off-by: Alan Maguire --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b

[PATCH v3 bpf-next 1/8] bpf: provide function to get vmlinux BTF information

2020-06-23 Thread Alan Maguire
It will be used later for BTF printk() support Signed-off-by: Alan Maguire --- include/linux/bpf.h | 2 ++ kernel/bpf/verifier.c | 18 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 07052d4..a2ecebd 100644

Re: [PATCH 1/2] usb: gadget: introduce flag for large request

2020-06-16 Thread Alan Stern
of > hardware is ready to support these operations. This isn't needed. All UDC drivers must be able to support requests that are larger than the maxpacket size. Alan Stern

Re: common KUnit Kconfig and file naming (was: Re: [PATCH] lib: kunit_test_overflow: add KUnit test of check_*_overflow functions)

2020-06-16 Thread Alan Maguire
o "struct kunit_suite"? So for the ext4 tests the "subsystem" would be "ext4" and the name "inode" would specify the test area within that subsystem. For the KUnit selftests, the subsystem would be "test"/"selftest". Logging could utilize the subsystem definition to allow test writers to use less redundant test names too. For example the suite name logged could be constructed from the subsystem + area values associated with the kunit_suite, and individual test names could be shown as the suite area + test_name. Thanks! Alan

Re: [PATCH v2] usb: replace hardcode maximum usb string length by definition

2020-06-15 Thread Alan Stern
n ch9.h instead of in usb.h. > Thanks for Alan's suggestion. Acked-by: Alan Stern

Re: [PATCH] usb: core: fix reference count leak in usb_port_resume

2020-06-14 Thread Alan Stern
wrong; you need to do test_and_clear_bit(port1, hub->child_usage_bits) before calling pm_runtime_put_sync(). Otherwise the child_usage_bits value will get out of sync with the port's runtime status. Alan Stern

Re: [PATCH] usb: replace hardcoded maximum usb string length by definition

2020-06-12 Thread Alan Stern
> +#define MAX_USB_STRING_LEN 126 This definition belongs in include/uapi/linux/usb/ch9.h (near the definition of struct usb_string_descriptor) because it is part of the USB standard rather than specific to the Linux USB stack. Alan Stern

Re: [PATCH 1/2] xhci: Suspend ports to U3 directly from U1 or U2

2020-06-10 Thread Alan Stern
y, let's > do the same for USB_PORT_FEAT_SUSPEND and bus suspend case. > > This is particularly useful for USB2 devices, which may take a very long > time to switch USB2 LPM on and off. Have these two patches been tested with a variety of USB-2.0 and USB-2.1 devices? Alan Stern

Re: [PATCH v2] usb/gadget/function: introduce Built-in CDROM support

2020-06-10 Thread Alan Stern
Don't clean the file path to empty. > + */ > + if (curlun->cdrom == 1 && count == 1) > + return count; > + > + /* > + * WORKAROUND: Should be closed the fsg lun for virtual cd-rom, > + * when switch to other usb functions. That is not a grammatical English sentence. > + * Use the special keyword "off", because the init can > + * not parse the char '\n' in rc file and write into the sysfs. > + */ > + if (count == 3 && > + buf[0] == 'o' && buf[1] == 'f' && buf[2] == 'f' && > + fsg_lun_is_open(curlun)) > + ((char *) buf)[0] = 0; This seems like another bug fix that has no connection with BICR. Alan Stern > + > /* Remove a trailing newline */ > if (count > 0 && buf[count-1] == '\n') > ((char *) buf)[count-1] = 0;/* Ugh! */ > -- > 2.18.0

Re: [PATCH] USB: ohci-sm501: Add missed iounmap() in remove

2020-06-10 Thread Alan Stern
; > mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); > -- > 2.26.2 Acked-by: Alan Stern

Re: [PATCH v5 0/4] introduction of migration_version attribute for VFIO live migration

2020-06-05 Thread Dr. David Alan Gilbert
* Alex Williamson (alex.william...@redhat.com) wrote: > On Fri, 5 Jun 2020 11:22:24 +0100 > "Dr. David Alan Gilbert" wrote: > > > * Alex Williamson (alex.william...@redhat.com) wrote: > > > On Wed, 3 Jun 2020 01:24:43 -0400 > > > Yan Zhao wrote: >

Re: [PATCH v5 0/4] introduction of migration_version attribute for VFIO live migration

2020-06-05 Thread Dr. David Alan Gilbert
> > > > On Tue, Jun 02, 2020 at 04:55:27PM -0600, Alex Williamson wrote: > > > > > On Wed, 29 Apr 2020 20:39:50 -0400 > > > > > Yan Zhao wrote: > > > > > > > > > > > On Wed, Apr 29, 2020 at 05:48:44PM +0800, Dr. David Al

Re: [PATCH] usb: usbtest: fix missing kfree(dev->buf) in usbtest_disconnect

2020-06-03 Thread Alan Stern
1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c > index 98ada1a3425c..bae88893ee8e 100644 > --- a/drivers/usb/misc/usbtest.c > +++ b/drivers/usb/misc/usbtest.c > @@ -2873,6 +2873,7 @@ static void usbtest_disconnect(struct usb_interface > *intf) > > usb_set_intfdata(intf, NULL); > dev_dbg(>dev, "disconnect\n"); > + kfree(dev->buf); > kfree(dev); > } > > -- > 2.24.1 Aside from that one issue, Acked-by: Alan Stern

Re: [PATCH] Documentation: kunit: Add some troubleshooting tips to the FAQ

2020-06-02 Thread Alan Maguire
of UML so can be useful to do if running under UML is failing. When tests are built-in they will execute on boot, and modules will automatically execute associated tests when loaded. Test results can be collected from /sys/kernel/debug/kunit//results. For more details see "KUnit on non-UML architectures" in :doc:`usage`. Reviewed-by: Alan Maguire

Re: [PATCH] usb: storage: alauda: fix possible buffer overflow casued by bad DMA value in alauda_read_map()

2020-05-30 Thread Alan Stern
he way to fix the problem is not to change this one location. Instead, you should modify the driver so that us->iobuf is not stored in DMA memory. Alan Stern

[PATCH v4 kunit-next 2/2] kunit: add support for named resources

2020-05-29 Thread Alan Maguire
use a "match-by-name" callback. If an attempt to add a resource with a name that already exists is made kunit_add_named_resource() will return -EEXIST. Signed-off-by: Alan Maguire Reviewed-by: Brendan Higgins --- include/kunit/test.h | 54 +++

[PATCH v4 kunit-next 1/2] kunit: generalize kunit_resource API beyond allocated resources

2020-05-29 Thread Alan Maguire
tried moving to kunit_[action]_resource() as the format of function names for consistency and readability. [1] https://lkml.org/lkml/2020/2/26/1286 Signed-off-by: Alan Maguire Reviewed-by: Brendan Higgins --- include/kunit/test.h | 156 +- l

[PATCH v4 kunit-next 0/2] kunit: extend kunit resources API

2020-05-29 Thread Alan Maguire
for non-named resource (Brendan, patch 2) Alan Maguire (2): kunit: generalize kunit_resource API beyond allocated resources kunit: add support for named resources Alan Maguire (2): kunit: generalize kunit_resource API beyond allocated resources kunit: add support for named res

Re: [PATCH v3 3/7] kunit: tests for stats_fs API

2020-05-27 Thread Alan Maguire
ify CONFIG_KUNIT=m and CONFIG_STATS_FS_TEST=m, and testing would simply be a case of "modprobe"ing the stats fs module and collecting results in /sys/kernel/debug/kunit/ (rather than running kunit.py). Are you relying on unexported internals in the the tests that would prevent building them as a module? Thanks! Alan

Re: USB Security in the Linux Kernel

2020-05-25 Thread Alan Stern
On Mon, May 25, 2020 at 05:28:33AM +, Rick Mark wrote: > Hey Alan > > You and other previously rejected a patch I submitted 13 months ago Nobody rejected your patch. We pointed out problems with it, and we asked you to take a second look and provide more information. You never

Re: Some -serious- BPF-related litmus tests

2020-05-22 Thread Alan Stern
ffice. And if there wasn't > the trailing store, smp_store_release() would suffice. But that wasn't the context in the litmus test. The context was: smp_wmb(); smp_store_release(); spin_unlock(); smp_store_release(); That certainly looks like a lot more ordering than is really needed. Alan

Re: Some -serious- BPF-related litmus tests

2020-05-22 Thread Alan Stern
Indeed, it looks like one or the other of those is redundant (depending on the context). Also, what use is a spinlock that is accessed in only one thread? Finally, I doubt that these tests belong under tools/memory-model. Shouldn't they go under the new Documentation/ directory for litmus tests? And shouldn't the patch update a README file? Alan

Re: XHCI vs PCM2903B/PCM2904 part 2

2020-05-20 Thread Alan Stern
On Wed, May 20, 2020 at 03:21:44PM -0400, Rik van Riel wrote: > On Wed, 2020-05-20 at 12:38 -0400, Alan Stern wrote: > > On Wed, May 20, 2020 at 07:26:57AM -0400, Rik van Riel wrote: > > > After a few more weeks of digging, I have come to the tentative > > > conclusion

Re: [PATCH v10 1/5] usb: xhci: Change the XHCI link order in the Makefile

2020-05-20 Thread Alan Cooper
Greg, Alan, The other 4 related patches were accepted into usb-next and I just realized that this one didn't make it. This patch will not fix the "insmod out of order" issue, but will help our controllers work with some poorly behaved USB devices when the drivers are builtin. Thanks

Re: XHCI vs PCM2903B/PCM2904 part 2

2020-05-20 Thread Alan Stern
"halted" state. But obviously this isn't what you're talking about.) > - how should the USB sound driver recover from these > occasional and/or one-off errors? stop the sound > stream, or try to reinitialize the device and start > recording again? As far as I know, it should do its best to continue (perhaps fill in missing data with zeros). Alan Stern > I am willing to write patches and can test with my > setup, but both the sound code and the USB code are > new to me so I would like to know what direction I > should go in :)

Re: PCI: dwc: Warn only for non-prefetchable memory resource size >4GB

2020-05-19 Thread Alan Mikhak
s to deal with it. It cost me time to figure it out when I had an application that needed a region larger than 4GB. I figured the most I could do about it is to raise the issue by adding a warning. Regards, Alan

Re: [PATCH 1/3] usb/ohci-platform: Fix a warning when hibernating

2020-05-18 Thread Alan Stern
On Mon, May 18, 2020 at 03:57:49PM +0100, Qais Yousef wrote: > > For both this patch and the 3/3 patch (ehci-platform): > > > > Acked-by: Alan Stern > > Thanks Alan. Did this make it through to any tree? I don't see it on next, nor > on Linus. But it could be queued

Re: [PATCH v2 bpf-next 2/7] bpf: move to generic BTF show support, apply it to seq files/strings

2020-05-18 Thread Alan Maguire
; > \ > > + } > > \ > > + } while (0) > > + > > +#define btf_show_type_values(show, fmt, ...) > > \ > > + do { > > \ > > + btf_show(show, "%s%s" fmt "%s%s", btf_show_indent(show), > > \ > > +btf_show_name(show), > > \ > > +__VA_ARGS__, btf_show_delim(show), > > \ > > +btf_show_newline(show)); > > \ > > + if (show->state.depth > show->state.depth_shown) > > \ > > + show->state.depth_shown = show->state.depth; > > \ > > + } while (0) > > + > [...] > > > > static int btf_array_check_member(struct btf_verifier_env *env, > > @@ -2104,28 +2489,87 @@ static void btf_array_log(struct btf_verifier_env > > *env, > > array->type, array->index_type, array->nelems); > > } > > > > -static void btf_array_seq_show(const struct btf *btf, const struct btf_type > > *t, > > - u32 type_id, void *data, u8 bits_offset, > > - struct seq_file *m) > > +static void __btf_array_show(const struct btf *btf, const struct btf_type > > *t, > > +u32 type_id, void *data, u8 bits_offset, > > +struct btf_show *show) > > { > >const struct btf_array *array = btf_type_array(t); > >const struct btf_kind_operations *elem_ops; > >const struct btf_type *elem_type; > > - u32 i, elem_size, elem_type_id; > > + u32 i, elem_size = 0, elem_type_id; > > + u16 encoding = 0; > > > > elem_type_id = array->type; > > - elem_type = btf_type_id_size(btf, _type_id, _size); > > + elem_type = btf_type_skip_modifiers(btf, elem_type_id, NULL); > > + if (elem_type && btf_type_has_size(elem_type)) > > + elem_size = elem_type->size; > > + > > + if (elem_type && btf_type_is_int(elem_type)) { > > + u32 int_type = btf_type_int(elem_type); > > + > > + encoding = BTF_INT_ENCODING(int_type); > > + > > + /* > > +* BTF_INT_CHAR encoding never seems to be set for > > +* char arrays, so if size is 1 and element is > > +* printable as a char, we'll do that. > > +*/ > > + if (elem_size == 1) > + encoding = > > BTF_INT_CHAR; > > Some char array may be printable and some may not be printable, > how did you differentiate this? > I should probably change the logic to ensure all chars (before a \0) are printable. I'll do that for v2. We will always have cases (e.g. the skb cb[] field) where the char[] is not intended as a string, but I think the utility of showing them as strings where possible is worthwhile. Thanks again for reviewing! Alan

Re: [PATCH v2 bpf-next 6/7] bpf: add support for %pT format specifier for bpf_trace_printk() helper

2020-05-18 Thread Alan Maguire
y out an allocation associated with the attach, but that's messy as it's possible run-time might determine the type for display (and thus the amount of the buffer we need to copy safely). Great news about LLVM support for __builtin_btf_type_id()! Thanks! Alan

Re: [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparisonof an unsigned int

2020-05-15 Thread Alan Stern
On Sat, May 16, 2020 at 07:23:42AM +0800, Tang Bin wrote: > Hi Alan & Colin: > > On 2020/5/16 1:21, Alan Stern wrote: > > On Fri, May 15, 2020 at 05:54:53PM +0100, Colin King wrote: > > > From: Colin Ian King > > > > > > The comparison of

Re: [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int

2020-05-15 Thread Alan Stern
On Fri, May 15, 2020 at 06:26:04PM +0100, Colin Ian King wrote: > On 15/05/2020 18:21, Alan Stern wrote: > > On Fri, May 15, 2020 at 05:54:53PM +0100, Colin King wrote: > >> From: Colin Ian King > >> > >> The comparison of hcd->irq to less than zero for

Re: [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int

2020-05-15 Thread Alan Stern
in Ian King > --- Thanks to Coverity for spotting this. Any reason why it didn't spot exactly the same mistake in the ohci-da8xx.c driver? Also, why wasn't the patch CC'ed for the stable series? Alan Stern

Re: [PATCH v2 bpf-next 4/7] printk: add type-printing %pT format specifier which uses BTF

2020-05-14 Thread Alan Maguire
On Wed, 13 May 2020, Yonghong Song wrote: > > > On 5/11/20 10:56 PM, Alan Maguire wrote: > > printk supports multiple pointer object type specifiers (printing > > netdev features etc). Extend this support using BTF to cover > > arbitrary types. "

Re: [PATCH v2 bpf-next 0/7] bpf, printk: add BTF-based type printing

2020-05-14 Thread Alan Maguire
On Wed, 13 May 2020, Alexei Starovoitov wrote: > On Tue, May 12, 2020 at 06:56:38AM +0100, Alan Maguire wrote: > > The printk family of functions support printing specific pointer types > > using %p format specifiers (MAC addresses, IP addresses, etc). For > > full deta

Re: [PATCH] usb: gadget: u_serial: fix coverity warning: negative index at array

2020-05-14 Thread Alan Stern
uggy before then coverity got a false positive, so no change should be needed. Alan Stern > Signed-off-by: Stan Lu > Signed-off-by: Macpaul Lin > --- > drivers/usb/gadget/function/u_serial.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/d

Re: [PATCH] USB: dummy-hcd: use configurable endpoint naming scheme

2020-05-14 Thread Alan Stern
(and perhaps for some other drivers), > that reasons about whether an endpoint has configurable address based > on its name. > > Suggested-by: Alan Stern > Signed-off-by: Andrey Konovalov > --- > drivers/usb/gadget/udc/dummy_hcd.c | 26 +- &g

Re: [PATCH v10 1/5] usb: xhci: Change the XHCI link order in the Makefile

2020-05-13 Thread Alan Cooper
On Wed, May 13, 2020 at 1:46 PM Florian Fainelli wrote: > > > > On 5/13/2020 10:39 AM, Alan Stern wrote: > > On Wed, May 13, 2020 at 07:05:05PM +0200, Greg Kroah-Hartman wrote: > >> On Wed, May 13, 2020 at 09:31:11AM -0700, Florian Fainelli wrote: > >>>

Re: [PATCH v10 1/5] usb: xhci: Change the XHCI link order in the Makefile

2020-05-13 Thread Alan Stern
know, xhci-hcd will _never_ be loaded. One thing that might be possible (although not all platforms may support it) is if xhci-hcd could somehow disconnect all devices attached to a peer port when it starts up. But that would be disruptive to any devices that aren't USB-3. We faced a very similar ordering problem between ehci-hcd and [ou]hci-hcd many years ago, and we never found a good solution. We did arrange the link order so that ehci-hcd precedes the others, and we added a warning message to ehci-hcd which gets printed if the module initialization routine runs after [ou]hci-hcd is loaded. Also, there are MODULE_SOFTDEP lines in ohci-pci.c and uhci-pci.c. Alan Stern

Re: [RFC PATCH] kunit: Support skipped tests

2020-05-13 Thread Alan Maguire
TODO, etc). Plus a KUNIT_SKIPPED status could easily progagate up from the tests to the plan result line (all tests have status == SKIPPED => plan status = SKIPPED). Would that work? Thanks! Alan > kunit_tool will parse this SKIP directive, and renders skipped tests in > yellow and counts

Re: [PATCH 4/3] docs: litmus-tests: Clarify about the RCU pre-initialization test

2020-05-12 Thread Alan Stern
test > > Since this test returned to tools/memory-model/, make sure that it is > at least referenced from Documentation/litmus-tests/'s README. > > Co-developed-by: Joel Fernandes (Google) > Co-developed-by: Akira Yokosawa > [Alan: grammar nit] > Suggested-by: Alan Stern

Re: [PATCH v9 4/5] usb: ehci: Add new EHCI driver for Broadcom STB SoC's

2020-05-12 Thread Alan Cooper
On Mon, May 11, 2020 at 3:51 PM Alan Stern wrote: > > On Mon, 11 May 2020, Al Cooper wrote: > > > Add a new EHCI driver for Broadcom STB SoC's. A new EHCI driver > > was created instead of adding support to the existing ehci platform > > driver because of the code r

Re: [PATCH 0/3] tools/memory-model, Documentation/litmus-test: Sort out location of litmus test and README

2020-05-12 Thread Alan Stern
t; +MP+onceassign+derefonce.litmus (moved to tools/memory-model/litmus-tests/) > + Demonstrates that rcu_assign_pointer() and rcu_dereference() to > + ensure that an RCU reader will not see pre-initialization garbage. The grammar in this sentence is awful. Should the first "that" be changed to "the use of"? Alan

[PATCH v2 bpf-next 0/7] bpf, printk: add BTF-based type printing

2020-05-12 Thread Alan Maguire
approach taken; early boot initialization is one way to go here. - may be useful to have a "print integers as hex" format modifier (Joe) Important note: if running test_printf.ko - the version in the bpf-next tree will induce a panic when running the fwnode_pointer() tests due to a kobject i

[PATCH v2 bpf-next 3/7] checkpatch: add new BTF pointer format specifier

2020-05-12 Thread Alan Maguire
checkpatch complains about unknown format specifiers, so add the BTF format specifier we will implement in a subsequent patch to avoid errors. Signed-off-by: Alan Maguire --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b

[PATCH v2 bpf-next 2/7] bpf: move to generic BTF show support, apply it to seq files/strings

2020-05-12 Thread Alan Maguire
ERO - show zeroed values (by default they are not shown). Signed-off-by: Alan Maguire --- include/linux/btf.h | 33 +++ kernel/bpf/btf.c| 759 +--- 2 files changed, 690 insertions(+), 102 deletions(-) diff --git a/include/linux/btf.h b/inc

[PATCH v2 bpf-next 5/7] printk: extend test_printf to test %pT BTF-based format specifier

2020-05-12 Thread Alan Maguire
. These changes add up to approximately 20,000 new tests covering all enum, struct, union and typedefs in vmlinux BTF. Individual tests are also added for int, char, struct, enum and typedefs which verify output is as expected. Signed-off-by: Alan Maguire --- include/linux/btf.h | 10 ++ kernel/bpf

[PATCH v2 bpf-next 1/7] bpf: provide function to get vmlinux BTF information

2020-05-11 Thread Alan Maguire
It will be used later for BTF printk() support Signed-off-by: Alan Maguire --- include/linux/bpf.h | 2 ++ kernel/bpf/verifier.c | 18 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index cf4b6e4..de19a35 100644

<    1   2   3   4   5   6   7   8   9   10   >