Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM
On Sat, Oct 03, 2020 at 11:40:22AM +0200, Daniel Vetter wrote: > > That leaves the only interesting places as vb2_dc_get_userptr() and > > vb2_vmalloc_get_userptr() which both completely fail to follow the > > REQUIRED behavior in the function's comment about checking PTEs. It > > just DMA maps them. Badly broken. > > > > Guessing this hackery is for some embedded P2P DMA transfer? > > Yeah, see also the follow_pfn trickery in > videobuf_dma_contig_user_get(), I think this is fully intentional and > userspace abi we can't break :-/ We don't need to break uABI, it just needs to work properly in the kernel: vma = find_vma_intersection() dma_buf = dma_buf_get_from_vma(vma) sg = dma_buf_p2p_dma_map(dma_buf) [.. do dma ..] dma_buf_unmap(sg) dma_buf_put(dma_buf) It is as we discussed before, dma buf needs to be discoverable from a VMA, at least for users doing this kind of stuff. > Yup this should be done with dma_buf instead, and v4l has that. But > old uapi and all that. This is why I said we might need a new > VM_DYNAMIC_PFNMAP or so, to make follow_pfn not resolve this in the > case where the driver manages the underlying iomem range (or whatever > it is) dynamically and moves buffer objects around, like drm drivers > do. But I looked, and we've run out of vma->vm_flags :-( A VM flag doesn't help - we need to introduce some kind of lifetime, and that has to be derived from the VMA. It needs data not just a flag > The other problem is that I also have no real working clue about all > the VM_* flags and what they all mean, and whether drm drivers set the > right ones in all cases (they probably don't, but oh well). > Documentation for this stuff in headers is a bit thin at times. Yah, I don't really know either :\ The comment above vm_normal_page() is a bit helpful. Don't know what VM_IO/VM_PFNMAP mean in their 3 combinations There are very few places that set VM_PFNMAP without VM_IO.. Jason
Re: [PATCH AUTOSEL 5.8 08/29] net: dsa: microchip: look for phy-mode in port nodes
On Tue, Sep 29, 2020 at 07:56:30AM +0200, Helmut Grohne wrote: Hi Sascha, On Tue, Sep 29, 2020 at 03:30:05AM +0200, Sasha Levin wrote: From: Helmut Grohne [ Upstream commit edecfa98f602a597666e3c5cab2677ada38d93c5 ] Documentation/devicetree/bindings/net/dsa/dsa.txt says that the phy-mode property should be specified on port nodes. However, the microchip drivers read it from the switch node. Let the driver use the per-port property and fall back to the old location with a warning. Fix in-tree users. I don't think this patch is useful for stable users. It corrects a device tree layout issue. Any existing users of the functionality will have an odd, but working device tree and that will continue working (with a warning) after applying this patch. It just has a property on the "wrong" node. I don't think I'd like to update my device tree in a stable update. I've dropped it, thanks! -- Thanks, Sasha
[PATCH v2] media: mtk-vcodec: fix builds when remoteproc is disabled
The addition of MT8183 support added a dependency on the SCP remoteproc module. However the initial patch used the "select" Kconfig directive, which may result in the SCP module to not be compiled if remoteproc was disabled. In such a case, mtk-vcodec would try to link against non-existent SCP symbols. "select" was clearly misused here as explained in kconfig-language.txt. Replace this by a "depends" directive on at least one of the VPU and SCP modules, to allow the driver to be compiled as long as one of these is enabled, and adapt the code to support this new scenario. Also adapt the Kconfig text to explain the extra requirements for MT8173 and MT8183. Reported-by: Sakari Ailus Signed-off-by: Alexandre Courbot Acked-by: Randy Dunlap # build-tested --- drivers/media/platform/Kconfig| 10 +-- .../media/platform/mtk-vcodec/mtk_vcodec_fw.c | 72 --- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index a3cb104956d5..98eb62e49ec2 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -253,14 +253,16 @@ config VIDEO_MEDIATEK_VCODEC depends on MTK_IOMMU || COMPILE_TEST depends on VIDEO_DEV && VIDEO_V4L2 depends on ARCH_MEDIATEK || COMPILE_TEST + depends on VIDEO_MEDIATEK_VPU || MTK_SCP select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV - select VIDEO_MEDIATEK_VPU - select MTK_SCP help Mediatek video codec driver provides HW capability to - encode and decode in a range of video formats - This driver rely on VPU driver to communicate with VPU. + encode and decode in a range of video formats on MT8173 + and MT8183. + + Note that support for MT8173 requires VIDEO_MEDIATEK_VPU to + also be selected. Support for MT8183 depends on MTK_SCP. To compile this driver as modules, choose M here: the modules will be called mtk-vcodec-dec and mtk-vcodec-enc. diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw.c index 6c2a2568d844..23a80027a8fb 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw.c @@ -13,6 +13,7 @@ struct mtk_vcodec_fw_ops { mtk_vcodec_ipi_handler handler, const char *name, void *priv); int (*ipi_send)(struct mtk_vcodec_fw *fw, int id, void *buf, unsigned int len, unsigned int wait); + void (*release)(struct mtk_vcodec_fw *fw); }; struct mtk_vcodec_fw { @@ -22,6 +23,8 @@ struct mtk_vcodec_fw { struct mtk_scp *scp; }; +#if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VPU) + static int mtk_vcodec_vpu_load_firmware(struct mtk_vcodec_fw *fw) { return vpu_load_firmware(fw->pdev); @@ -64,6 +67,27 @@ static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf, return vpu_ipi_send(fw->pdev, id, buf, len); } +static void mtk_vcodec_vpu_release(struct mtk_vcodec_fw *fw) +{ + put_device(&fw->pdev->dev); +} + +static void mtk_vcodec_vpu_reset_handler(void *priv) +{ + struct mtk_vcodec_dev *dev = priv; + struct mtk_vcodec_ctx *ctx; + + mtk_v4l2_err("Watchdog timeout!!"); + + mutex_lock(&dev->dev_mutex); + list_for_each_entry(ctx, &dev->ctx_list, list) { + ctx->state = MTK_STATE_ABORT; + mtk_v4l2_debug(0, "[%d] Change to state MTK_STATE_ABORT", + ctx->id); + } + mutex_unlock(&dev->dev_mutex); +} + static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = { .load_firmware = mtk_vcodec_vpu_load_firmware, .get_vdec_capa = mtk_vcodec_vpu_get_vdec_capa, @@ -71,8 +95,13 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = { .map_dm_addr = mtk_vcodec_vpu_map_dm_addr, .ipi_register = mtk_vcodec_vpu_set_ipi_register, .ipi_send = mtk_vcodec_vpu_ipi_send, + .release = mtk_vcodec_vpu_release, }; +#endif /* IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VPU) */ + +#if IS_ENABLED(CONFIG_MTK_SCP) + static int mtk_vcodec_scp_load_firmware(struct mtk_vcodec_fw *fw) { return rproc_boot(scp_get_rproc(fw->scp)); @@ -107,6 +136,11 @@ static int mtk_vcodec_scp_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf, return scp_ipi_send(fw->scp, id, buf, len, wait); } +static void mtk_vcodec_scp_release(struct mtk_vcodec_fw *fw) +{ + scp_put(fw->scp); +} + static const struct mtk_vcodec_fw_ops mtk_vcodec_rproc_msg = { .load_firmware = mtk_vcodec_scp_load_firmware, .get_vdec_capa = mtk_vcodec_scp_get_vdec_capa, @@ -114,23 +148,10 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_rproc_msg = { .map_dm_addr = mtk_vcodec_vpu_scp_dm_addr, .ipi_register = mtk_vcodec_scp_set_ipi_register, .ipi_se
Re: [PATCH] media: mtk-vcodec: fix builds when remoteproc is disabled
On Sun, Oct 4, 2020 at 1:50 AM Randy Dunlap wrote: > > On 10/3/20 6:09 AM, Alexandre Courbot wrote: > > The addition of MT8183 support added a dependency on the SCP remoteproc > > module. However the initial patch used the "select" Kconfig directive, > > which may result in the SCP module to not be compiled if remoteproc was > > disabled. In such a case, mtk-vcodec would try to link against > > non-existent SCP symbols. "select" was clearly misused here as explained > > in kconfig-language.txt. > > > > Replace this by a "depends" directive on at least one of the VPU and > > SCP modules, to allow the driver to be compiled as long as one of these > > is enabled, and adapt the code to support this new scenario. > > > > Also adapt the Kconfig text to explain the extra requirements for MT8173 > > and MT8183. > > > > Reported-by: Sakari Ailus > > Signed-off-by: Alexandre Courbot > > I was seeing this also, so I checked this patch. WFM. > > Acked-by: Randy Dunlap # build-tested Thanks for checking! I will send a v2 with your Acked-by and fix. > > See below. > > > --- > > drivers/media/platform/Kconfig| 11 +-- > > .../media/platform/mtk-vcodec/mtk_vcodec_fw.c | 72 --- > > 2 files changed, 55 insertions(+), 28 deletions(-) > > > > diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig > > index a3cb104956d5..e559d9c529b6 100644 > > --- a/drivers/media/platform/Kconfig > > +++ b/drivers/media/platform/Kconfig > > @@ -253,14 +253,17 @@ config VIDEO_MEDIATEK_VCODEC > > depends on MTK_IOMMU || COMPILE_TEST > > depends on VIDEO_DEV && VIDEO_V4L2 > > depends on ARCH_MEDIATEK || COMPILE_TEST > > + depends on VIDEO_MEDIATEK_VPU || MTK_SCP > > select VIDEOBUF2_DMA_CONTIG > > select V4L2_MEM2MEM_DEV > > - select VIDEO_MEDIATEK_VPU > > - select MTK_SCP > > help > > Mediatek video codec driver provides HW capability to > > - encode and decode in a range of video formats > > - This driver rely on VPU driver to communicate with VPU. > > + encode and decode in a range of video formats on MT8173 > > + and MT8183. > > + > > + Note that support for support for MT8173 requires > > Drop one of "support for" above. (or "for support" ;) > > > + VIDEO_MEDIATEK_VPU to also be selected. Support for > > + MT8183 depends on MTK_SCP. > > > > To compile this driver as modules, choose M here: the > > modules will be called mtk-vcodec-dec and mtk-vcodec-enc. > > > thanks. > -- > ~Randy
Re: [PATCH] Revert "Bluetooth: Update resolving list when updating whitelist"
On Sun, 2020-10-04 at 12:51 +0200, Greg Kroah-Hartman wrote: > On Sat, Oct 03, 2020 at 08:33:18PM +0200, Marcel Holtmann wrote: > > Hi Greg, > > > > > > > This reverts commit 0eee35bdfa3b472cc986ecc6ad76293fdcda59e2 > > > > > as it > > > > > breaks all bluetooth connections on my machine. > > > > > > > > > > Cc: Marcel Holtmann > > > > > Cc: Sathish Narsimman > > > > > Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when > > > > > updating whitelist") > > > > > Signed-off-by: Greg Kroah-Hartman > > > > > > > > > > --- > > > > > net/bluetooth/hci_request.c | 41 ++-- > > > > > - > > > > > 1 file changed, 2 insertions(+), 39 deletions(-) > > > > > > > > > > This has been bugging me for since 5.9-rc1, when all > > > > > bluetooth devices > > > > > stopped working on my desktop system. I finally got the time > > > > > to do > > > > > bisection today, and it came down to this patch. Reverting > > > > > it on top of > > > > > 5.9-rc7 restored bluetooth devices and now my input devices > > > > > properly > > > > > work. > > > > > > > > > > As it's almost 5.9-final, any chance this can be merged now > > > > > to fix the > > > > > issue? > > > > > > > > can you be specific what breaks since our guys and I also think > > > > the > > > > ChromeOS guys have been testing these series of patches > > > > heavily. > > > > > > My bluetooth trackball does not connect at all. With this > > > reverted, it > > > all "just works". > > > > > > Same I think for a Bluetooth headset, can check that again if you > > > really > > > need me to, but the trackball is reliable here. > > > > > > > When you run btmon does it indicate any errors? > > > > > > How do I run it and where are the errors displayed? > > > > you can do btmon -w trace.log and just let it run like tcdpump. > > Ok, attached. > > The device is not connecting, and then I open the gnome bluetooth > dialog > and it scans for devices in the area, but does not connect to my > existing devices at all. > > Any ideas? Use bluetoothctl instead, the Bluetooth Settings from GNOME also run a discovery the whole time the panel is opened, and this breaks a fair number of poor quality adapters. This is worked-around in the most recent version, but using bluetoothctl is a better debugging option in all cases. Cheers
Re: [RFC][PATCHSET] epoll cleanups
On Sun, Oct 04, 2020 at 03:36:08AM +0100, Al Viro wrote: > Finally, there's the mess with reverse path check. When we insert > a new file into a epoll, we need to check that there won't be excessively long > (or excessively many) wakeup chains. If the target is not an epoll, we need > to check that for the target alone, but if it's another epoll we need the same > check done to everything reachable from that epoll. The way it's currently > done is Not Nice(tm): we collect the set of files to check and, once we have > verified the absence of loops, created a new epitem and inserted it into > the epoll data structures, we run reverse_path_check_proc() for every file > in the set. The set is maintained as a (global) cyclic list threaded through > some struct file. Everything is serialized on epmutex, so the list can be > global. Unfortunately, each struct file ends up with list_head embedded into > it, all for the sake of operation that is rare *and* involves a small fraction > of all struct file instances on the system. > Worse, files can end up disappearing while we are collecting the set; > explicit EPOLL_CTL_DEL does not grab epmutex, and final fput() won't touch > epmutex if all epitem refering to that file have already been removed. This > had been worked around this cycle (by grabbing temporary references to struct > file added to the set), but that's not a good solution. > What we need is to separate the head of epitem list (->f_ep_links) > from struct file; all we need in struct file is a reference to that head. > We could thread the list representing the set of files through those objects > (getting rid of 3 pointers in each struct file) and have epitem removal > free those objects if there's no epitems left *and* they are not included > into the set. Reference from struct file would be cleared as soon as there's > no epitems left. Dissolving the set would free those that have no epitems > left and thus would've been freed by ep_remove() if they hadn't been in the > set. > With some massage it can be done; we end up with > * 3 pointers gone from each struct file > * one pointer added to struct eventpoll > * two-pointer object kept for each non-epoll file that is currently watched by > some epoll. Have you considered just storing a pointer to each struct file in an epoll set in an XArray? Linked lists suck for modern CPUs, and there'd be no need to store any additional data in each struct file. Using xa_alloc() to store the pointer and throw away the index the pointer got stored at would leave you with something approximating a singly linked list, except it's an array. Which does zero memory allocations for a single entry and will then allocate a single node for your first 64 entries.
[RFC v5 1/1] selftests/cpuidle: Add support for cpuidle latency measurement
Measure cpuidle latencies on wakeup to determine and compare with the advertsied wakeup latencies for each idle state. Cpuidle wakeup latencies are determined for IPIs and can help determine any deviations from what is advertsied by the hardware. A baseline measurement for each case of IPIs is taken at 100 percent CPU usage to quantify for the kernel-userpsace overhead during execution. Signed-off-by: Pratik Rajesh Sampat --- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpuidle/Makefile | 7 + tools/testing/selftests/cpuidle/cpuidle.c | 479 ++ tools/testing/selftests/cpuidle/settings | 1 + 4 files changed, 488 insertions(+) create mode 100644 tools/testing/selftests/cpuidle/Makefile create mode 100644 tools/testing/selftests/cpuidle/cpuidle.c create mode 100644 tools/testing/selftests/cpuidle/settings diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 9018f45d631d..2bb0e87f76fd 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -8,6 +8,7 @@ TARGETS += cgroup TARGETS += clone3 TARGETS += core TARGETS += cpufreq +TARGETS += cpuidle TARGETS += cpu-hotplug TARGETS += drivers/dma-buf TARGETS += efivarfs diff --git a/tools/testing/selftests/cpuidle/Makefile b/tools/testing/selftests/cpuidle/Makefile new file mode 100644 index ..d332485e1bc5 --- /dev/null +++ b/tools/testing/selftests/cpuidle/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +TEST_GEN_PROGS := cpuidle + +CFLAGS += -O2 +LDLIBS += -lpthread + +include ../lib.mk diff --git a/tools/testing/selftests/cpuidle/cpuidle.c b/tools/testing/selftests/cpuidle/cpuidle.c new file mode 100644 index ..b2f6a0e655b8 --- /dev/null +++ b/tools/testing/selftests/cpuidle/cpuidle.c @@ -0,0 +1,479 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Cpuidle latency measurement microbenchmark + * + * A mechanism to measure wakeup latency for IPI based interrupts. Results of + * this microbenchmark can be used to check and validate against the + * advertised latencies for each cpuidle state + * + * IPIs (using pipes) are used to wake the CPU up and measure the + * time difference + * + * Baseline measurements on 100 busy load are used to account for the + * kernel-userspace overhead + * + * Usage: + * ./cpuidle --mode --output + * + * Copyright (C) 2020 Pratik Rajesh Sampat , IBM + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define READ 0 +#define WRITE 1 + +static int pipe_fd[2]; +static int *cpu_list; +static int cpus; +static int idle_states; +static uint64_t *latency_list; + +static char *log_file = "cpuidle.log"; + +static int get_online_cpus(int *online_cpu_list, int total_cpus) +{ + char filename[80]; + int i, index = 0; + FILE *fptr; + + for (i = 0; i < total_cpus; i++) { + char status; + + sprintf(filename, "/sys/devices/system/cpu/cpu"); + sprintf(filename + strlen(filename), "%d%s", i, "/online"); + fptr = fopen(filename, "r"); + if (!fptr) + continue; + assert(fscanf(fptr, "%c", &status) != EOF); + if (status == '1') + online_cpu_list[index++] = i; + fclose(fptr); + } + return index; +} + +static uint64_t us_to_ns(uint64_t val) +{ + return val * 1000; +} + +static void get_latency(int cpu) +{ + char filename[80]; + uint64_t latency; + FILE *fptr; + int state; + + for (state = 0; state < idle_states; state++) { + sprintf(filename, "%s%d%s%d%s", "/sys/devices/system/cpu/cpu", + cpu, "/cpuidle/state", + state, "/latency"); + fptr = fopen(filename, "r"); + assert(fptr); + + assert(fscanf(fptr, "%ld", &latency) != EOF); + latency_list[state] = latency; + fclose(fptr); + } +} + +static int get_idle_state_count(int cpu) +{ + struct dirent *entry; + int dir_count = 0; + char filename[80]; + DIR *dirp; + + sprintf(filename, "%s%d%s", "/sys/devices/system/cpu/cpu", + cpu, "/cpuidle"); + + dirp = opendir(filename); + if (!dirp) + return -1; + while (entry = readdir(dirp)) { + if (entry->d_type == DT_DIR) { + if (strcmp(entry->d_name, ".") == 0 || + strcmp(entry->d_name, "..") == 0) + continue; + dir_count++; + } + } + closedir(dirp); + return dir_count; +} + +/* Enable or disable all idle states */ +static int state_all_idle(char *disable) +{ + cha
[RFC v5 0/1] Selftest for cpuidle latency measurement
v4: https://lkml.org/lkml/2020/9/2/356 v4-->v5 Based on comments from Artem Bityutskiy, evaluation of timer based wakeup latencies may not be a fruitful measurement especially on the x86 platform which has the capability to pre-arm a CPU when a timer is set. Hence, including only the IPI based tests for latency measurement to acheive expected behaviour across platforms. kernel module + bash selftest approach which presents lower deviations and higher accuracy: https://lkml.org/lkml/2020/7/21/567 --- The patch series introduces a mechanism to measure wakeup latency for IPI based interrupts. The motivation behind this series is to find significant deviations behind advertised latency values To achieve this in the userspace, IPI latencies are calculated by sending information through pipes and inducing a wakeup. To account for delays from kernel-userspace interactions baseline observations are taken on a 100% busy CPU and subsequent obervations must be considered relative to that. One downside of the userspace approach in contrast to the kernel implementation is that the run to run variance can turn out to be high in the order of ms; which is the scope of the experiments at times. Another downside of the userspace approach is that it takes much longer to run and hence a command-line option quick and full are added to make sure quick 1 CPU tests can be carried out when needed and otherwise it can carry out a full system comprehensive test. Usage --- ./cpuidle --mode --output full: runs on all CPUS quick: run on a random CPU num_cpus: Limit the number of CPUS to run on Sample output snippet - --IPI Latency Test--- SRC_CPU DEST_CPU IPI_Latency(ns) ... 0 5 256178 0 6 478161 0 7 285445 0 8 273553 Expected IPI latency(ns): 10 Observed Average IPI latency(ns): 248334 Pratik Rajesh Sampat (1): selftests/cpuidle: Add support for cpuidle latency measurement tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpuidle/Makefile | 7 + tools/testing/selftests/cpuidle/cpuidle.c | 479 ++ tools/testing/selftests/cpuidle/settings | 1 + 4 files changed, 488 insertions(+) create mode 100644 tools/testing/selftests/cpuidle/Makefile create mode 100644 tools/testing/selftests/cpuidle/cpuidle.c create mode 100644 tools/testing/selftests/cpuidle/settings -- 2.26.2
Re: [BUG] slab: double free detected in cache 'kmalloc-128', objp daff5780
On Tue, Sep 15, 2020 at 1:00 PM Randy Dunlap wrote: > > On 9/15/20 4:41 AM, Peter Geis wrote: > > [33633.566567] [] (unwind_backtrace) from [] > > (show_stack+0x10/0x14) > > Hi Peter, > > In the future, could you prevent long lines from being line-wrapped? > E.g., the 2 lines above should all be on one line. > It is much harder to read as it was posted. Apologies, I'll be sure to use an external client for bug reports from now on. > > thanks. > -- > ~Randy > This issue appears to have been resolved by: 678ff6a7afcc mm: slab: fix potential double free in ___cache_free Thank you.
Re: [PATCH v3 6/7] can: usb: etas_es58X: add support for ETAS ES58X CAN USB interfaces
On 10/2/20 5:41 PM, Vincent Mailhol wrote: > This driver supports the ES581.4, ES582.1 and ES584.1 interfaces from > ETAS GmbH (https://www.etas.com/en/products/es58x.php). > > Co-developed-by: Arunachalam Santhanam > Signed-off-by: Arunachalam Santhanam > Signed-off-by: Vincent Mailhol > --- > > Changes in v3: > - Remove all the calls to likely() and unlikely(). > > Changes in v2: > - Fixed -W1 warnings (v1 was tested with GCC -WExtra but not with -W1). > --- > drivers/net/can/usb/Kconfig |9 + > drivers/net/can/usb/Makefile|1 + > drivers/net/can/usb/etas_es58x/Makefile |3 + > drivers/net/can/usb/etas_es58x/es581_4.c| 559 > drivers/net/can/usb/etas_es58x/es581_4.h| 237 ++ > drivers/net/can/usb/etas_es58x/es58x_core.c | 2725 +++ > drivers/net/can/usb/etas_es58x/es58x_core.h | 700 + > drivers/net/can/usb/etas_es58x/es58x_fd.c | 648 + > drivers/net/can/usb/etas_es58x/es58x_fd.h | 243 ++ > 9 files changed, 5125 insertions(+) > create mode 100644 drivers/net/can/usb/etas_es58x/Makefile > create mode 100644 drivers/net/can/usb/etas_es58x/es581_4.c > create mode 100644 drivers/net/can/usb/etas_es58x/es581_4.h > create mode 100644 drivers/net/can/usb/etas_es58x/es58x_core.c > create mode 100644 drivers/net/can/usb/etas_es58x/es58x_core.h > create mode 100644 drivers/net/can/usb/etas_es58x/es58x_fd.c > create mode 100644 drivers/net/can/usb/etas_es58x/es58x_fd.h [...] Just one header file for now :) > diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h > b/drivers/net/can/usb/etas_es58x/es58x_core.h > new file mode 100644 > index ..359ddc44a3ad > --- /dev/null > +++ b/drivers/net/can/usb/etas_es58x/es58x_core.h > @@ -0,0 +1,700 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +/* Driver for ETAS GmbH ES58X USB CAN(-FD) Bus Interfaces. > + * > + * File es58x_core.h: All common definitions and declarations. > + * > + * Copyright (C) 2019 Robert Bosch Engineering and Business > + * Solutions. All rights reserved. > + * Copyright (C) 2020 ETAS K.K.. All rights reserved. > + */ > + > +#ifndef __ES58X_COMMON_H__ > +#define __ES58X_COMMON_H__ > + > +#include > +#include > +#include > +#include > +#include > + > +#include "es581_4.h" > +#include "es58x_fd.h" > + > +/* Size of a CAN Standard Frame (rounded up and ignoring bitsuffing). */ > +#define ES58X_SFF_BYTES(data_len) (round_up(47, 8) / 8 + (data_len)) DIV_ROUNDUP > +/* Size of a CAN Extended Frame (rounded up and ignoring bitsuffing). */ > +#define ES58X_EFF_BYTES(data_len) (round_up(67, 8) / 8 + (data_len)) dame here > +/* Maximum size of a CAN frame (rounded up and ignoring bitsuffing). */ > +#define ES58X_CAN_FRAME_BYTES_MAX ES58X_EFF_BYTES(CAN_MAX_DLEN) please add a new file between the define and the doc of the next one > +/* Maximum size of a CAN-FD frame (rough estimation because > + * ES58X_SFF_BYTES() and ES58X_EFF_BYTES() macros are using the > + * constant values for CAN not CAN-FD). > + */ > +#define ES58X_CANFD_FRAME_BYTES_MAX ES58X_EFF_BYTES(CANFD_MAX_DLEN) > + > +/* Driver constants */ > +#define ES58X_RX_URBS_MAX 5 // Empirical value > +#define ES58X_TX_URBS_MAX 8 // Empirical value please use one space only > + > +#define ES58X_MAX(param) \ > + (ES581_4_##param > ES58X_FD_##param ? \ > + ES581_4_##param : ES58X_FD_##param) > +#define ES58X_TX_BULK_MAX ES58X_MAX(TX_BULK_MAX) > +#define ES58X_RX_BULK_MAX ES58X_MAX(RX_BULK_MAX) > +#define ES58X_RX_LOOPBACK_BULK_MAX ES58X_MAX(RX_LOOPBACK_BULK_MAX) > +#define ES58X_NUM_CAN_CH_MAX ES58X_MAX(NUM_CAN_CH) > + > +/* Use this when channel index is irrelevant (e.g. device > + * timestamp). > + */ > +#define ES58X_CHANNEL_IDX_NA 0xFF > +#define ES58X_EMPTY_MSG NULL > + > +/* Threshold on consecutive CAN_STATE_ERROR_PASSIVE. If we receive > + * ES58X_CONSECUTIVE_ERR_PASSIVE_MAX times the event > + * ES58X_ERR_CRTL_PASSIVE in a row without any successful Rx or Tx, > + * we force the device to switch to CAN_STATE_BUS_OFF state. > + */ > +#define ES58X_CONSECUTIVE_ERR_PASSIVE_MAX 254 Does the device recover from bus off automatically or why is this needed? > + > +enum es58x_self_reception_mode { > + ES58X_SELF_RECEPTION_OFF = 0, > + ES58X_SELF_RECEPTION_ON = 1 > +}; nitpick: can you name all enums (here and below) according to the type? e.g. ES58x_SELF_RECEPTION_MODE_OFF > + > +enum es58x_physical_media { > + ES58X_MEDIA_HIGH_SPEED = 1, > + ES58X_MEDIA_FAULT_TOLERANT = 2 You mean with FAULT_TOLERANT you mean ISO 11898-3? According to [1] they should be named low speed. [1] https://can-cia.org/news/press-releases/view/harmonized-transceiver-naming/2020/7/16/ > +}; > + > +enum es58x_samples_per_bit { > + ES58X_ONE_SAMPLE_PER_BIT = 1, > + > + /* Some CAN controllers do not support three samples per > + * bit. In this case the default value of one sample per bi
Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM
On Sun, Oct 4, 2020 at 1:24 AM Jason Gunthorpe wrote: > On Sat, Oct 03, 2020 at 03:52:32PM -0700, John Hubbard wrote: > > On 10/3/20 2:45 AM, Daniel Vetter wrote: > > > On Sat, Oct 3, 2020 at 12:39 AM John Hubbard wrote: > > > > > > > > On 10/2/20 10:53 AM, Daniel Vetter wrote: > > > > > For $reasons I've stumbled over this code and I'm not sure the change > > > > > to the new gup functions in 55a650c35fea ("mm/gup: frame_vector: > > > > > convert get_user_pages() --> pin_user_pages()") was entirely correct. > > > > > > > > > > This here is used for long term buffers (not just quick I/O) like > > > > > RDMA, and John notes this in his patch. But I thought the rule for > > > > > these is that they need to add FOLL_LONGTERM, which John's patch > > > > > didn't do. > > > > > > > > Yep. The earlier gup --> pup conversion patches were intended to not > > > > have any noticeable behavior changes, and FOLL_LONGTERM, with it's > > > > special cases and such, added some risk that I wasn't ready to take > > > > on yet. Also, FOLL_LONGTERM rules are only *recently* getting firmed > > > > up. So there was some doubt at least in my mind, about which sites > > > > should have it. > > > > > > > > But now that we're here, I think it's really good that you've brought > > > > this up. It's definitely time to add FOLL_LONGTERM wherever it's > > > > missing. > > > > > > So should I keep this patch, or will it collide with a series you're > > > working on? > > > > It doesn't collide with anything on my end yet, because I've been slow to > > pick up on the need for changing callsites to add FOLL_LONGTERM. :) > > > > And it looks like that's actually a problem, because: > > > > > > > > Also with the firmed up rules, correct that I can also drop the > > > vma_is_fsdax check when the FOLL_LONGTERM flag is set? > > > > That's the right direction to go *in general*, but I see that the > > pin_user_pages code is still a bit stuck in the past. And this patch > > won't actually work, with or without that vma_is_fsdax() check. > > Because: > > > > get_vaddr_frames(FOLL_LONGTERM) > >pin_user_pages_locked() > > if (WARN_ON_ONCE(gup_flags & FOLL_LONGTERM)) > > return -EINVAL; > > There is no particular reason this code needs to have the mm sem at > that point. > > It should call pin_user_pages_fast() and only if that fails get the mmap > lock and extract the VMA to do broken hackery. Yeah I think that works. I tried understanding gup.c code a bit more, and it looks like FOLL_LONGTERM only works for the pup_fast variant right now? All others seem to have this comment that it's somehow incompatible with FAULT_FLAG_ALLOW_RETRY and daxfs. But grepping around for that didn't show up anything, at least not nearby dax code. For my understanding of all this, what's the hiccup there? For plans, I only started this for a bit of my own learning, but I think I'll respin with the following changes: - convert exynos and habanalabs to pin_user_pages_fast directly, instead of going through this frame-vector detour - move the locking and convert get_vaddr_frames to pup_fast as Jason suggested - hack up some truly gross rfc to plug the follow_pfn hole Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH v3 5/7] can: dev: add a helper function to calculate the duration of one bit
On 10/4/20 1:06 PM, Marc Kleine-Budde wrote: > On 10/2/20 5:41 PM, Vincent Mailhol wrote: >> Rename macro CAN_CALC_SYNC_SEG to CAN_SYNC_SEG and make it available >> through include/linux/can/dev.h >> >> Add an helper function can_bit_time() which returns the duration (in >> time quanta) of one CAN bit. >> >> Rationale for this patch: the sync segment and the bit time are two >> concepts which are defined in the CAN ISO standard. Device drivers for >> CAN might need those. >> >> Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for >> additional information. >> >> Signed-off-by: Vincent Mailhol [...] >> index 791c452d98e1..77c3ea49b8fb 100644 >> --- a/include/linux/can/dev.h >> +++ b/include/linux/can/dev.h >> @@ -82,6 +82,21 @@ struct can_priv { >> #endif >> }; >> >> +#define CAN_SYNC_SEG 1 >> + >> +/* >> + * can_bit_time() - Duration of one bit >> + * >> + * Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for >> + * additional information. >> + * >> + * Return: the number of time quanta in one bit. >> + */ >> +static inline int can_bit_time(struct can_bittiming *bt) > > make it return an unsigned int > make the bt pointer const I'll change this while applying the patch. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: OpenPGP digital signature
Re: [PATCH v3 5/7] can: dev: add a helper function to calculate the duration of one bit
On 10/2/20 5:41 PM, Vincent Mailhol wrote: > Rename macro CAN_CALC_SYNC_SEG to CAN_SYNC_SEG and make it available > through include/linux/can/dev.h > > Add an helper function can_bit_time() which returns the duration (in > time quanta) of one CAN bit. > > Rationale for this patch: the sync segment and the bit time are two > concepts which are defined in the CAN ISO standard. Device drivers for > CAN might need those. > > Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for > additional information. > > Signed-off-by: Vincent Mailhol > --- > > Changes in v3: None > > Changes in v2: None > --- > drivers/net/can/dev.c | 13 ++--- > include/linux/can/dev.h | 15 +++ > 2 files changed, 21 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c > index 8c3e11820e03..6070b4ab3bd8 100644 > --- a/drivers/net/can/dev.c > +++ b/drivers/net/can/dev.c > @@ -60,7 +60,6 @@ EXPORT_SYMBOL_GPL(can_len2dlc); > > #ifdef CONFIG_CAN_CALC_BITTIMING > #define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */ > -#define CAN_CALC_SYNC_SEG 1 > > /* Bit-timing calculation derived from: > * > @@ -86,8 +85,8 @@ can_update_sample_point(const struct can_bittiming_const > *btc, > int i; > > for (i = 0; i <= 1; i++) { > - tseg2 = tseg + CAN_CALC_SYNC_SEG - > - (sample_point_nominal * (tseg + CAN_CALC_SYNC_SEG)) / > + tseg2 = tseg + CAN_SYNC_SEG - > + (sample_point_nominal * (tseg + CAN_SYNC_SEG)) / > 1000 - i; > tseg2 = clamp(tseg2, btc->tseg2_min, btc->tseg2_max); > tseg1 = tseg - tseg2; > @@ -96,8 +95,8 @@ can_update_sample_point(const struct can_bittiming_const > *btc, > tseg2 = tseg - tseg1; > } > > - sample_point = 1000 * (tseg + CAN_CALC_SYNC_SEG - tseg2) / > - (tseg + CAN_CALC_SYNC_SEG); > + sample_point = 1000 * (tseg + CAN_SYNC_SEG - tseg2) / > + (tseg + CAN_SYNC_SEG); > sample_point_error = abs(sample_point_nominal - sample_point); > > if (sample_point <= sample_point_nominal && > @@ -145,7 +144,7 @@ static int can_calc_bittiming(struct net_device *dev, > struct can_bittiming *bt, > /* tseg even = round down, odd = round up */ > for (tseg = (btc->tseg1_max + btc->tseg2_max) * 2 + 1; >tseg >= (btc->tseg1_min + btc->tseg2_min) * 2; tseg--) { > - tsegall = CAN_CALC_SYNC_SEG + tseg / 2; > + tsegall = CAN_SYNC_SEG + tseg / 2; > > /* Compute all possible tseg choices (tseg=tseg1+tseg2) */ > brp = priv->clock.freq / (tsegall * bt->bitrate) + tseg % 2; > @@ -223,7 +222,7 @@ static int can_calc_bittiming(struct net_device *dev, > struct can_bittiming *bt, > > /* real bitrate */ > bt->bitrate = priv->clock.freq / > - (bt->brp * (CAN_CALC_SYNC_SEG + tseg1 + tseg2)); > + (bt->brp * (CAN_SYNC_SEG + tseg1 + tseg2)); > > return 0; > } > diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h > index 791c452d98e1..77c3ea49b8fb 100644 > --- a/include/linux/can/dev.h > +++ b/include/linux/can/dev.h > @@ -82,6 +82,21 @@ struct can_priv { > #endif > }; > > +#define CAN_SYNC_SEG 1 > + > +/* > + * can_bit_time() - Duration of one bit > + * > + * Please refer to ISO 11898-1:2015, section 11.3.1.1 "Bit time" for > + * additional information. > + * > + * Return: the number of time quanta in one bit. > + */ > +static inline int can_bit_time(struct can_bittiming *bt) make it return an unsigned int make the bt pointer const > +{ > + return CAN_SYNC_SEG + bt->prop_seg + bt->phase_seg1 + bt->phase_seg2; > +} > + > /* > * get_can_dlc(value) - helper macro to cast a given data length code (dlc) > * to u8 and ensure the dlc value to be max. 8 bytes. > tnx, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: OpenPGP digital signature
Re: [PATCH] USB: serial: option: Add Telit FT980-KS composition
On 10/4/2020 16:57, Leonid Bloch wrote: This commit adds the following Telit FT980-KS composition: 0x1054: rndis, diag, adb, nmea, modem, modem, aux AT commands can be sent to /dev/ttyUSB5. Please submit a verbose lsusb listing for the device, I can't imagine that the adb interface should be handled by the option serial driver so there will never be a ttyUSB5. thanks Lars
Re: [PATCH] Revert "Bluetooth: Update resolving list when updating whitelist"
On Sun, Oct 04, 2020 at 12:51:24PM +0200, Greg Kroah-Hartman wrote: > On Sat, Oct 03, 2020 at 08:33:18PM +0200, Marcel Holtmann wrote: > > Hi Greg, > > > > >>> This reverts commit 0eee35bdfa3b472cc986ecc6ad76293fdcda59e2 as it > > >>> breaks all bluetooth connections on my machine. > > >>> > > >>> Cc: Marcel Holtmann > > >>> Cc: Sathish Narsimman > > >>> Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when updating > > >>> whitelist") > > >>> Signed-off-by: Greg Kroah-Hartman > > >>> --- > > >>> net/bluetooth/hci_request.c | 41 ++--- > > >>> 1 file changed, 2 insertions(+), 39 deletions(-) > > >>> > > >>> This has been bugging me for since 5.9-rc1, when all bluetooth devices > > >>> stopped working on my desktop system. I finally got the time to do > > >>> bisection today, and it came down to this patch. Reverting it on top of > > >>> 5.9-rc7 restored bluetooth devices and now my input devices properly > > >>> work. > > >>> > > >>> As it's almost 5.9-final, any chance this can be merged now to fix the > > >>> issue? > > >> > > >> can you be specific what breaks since our guys and I also think the > > >> ChromeOS guys have been testing these series of patches heavily. > > > > > > My bluetooth trackball does not connect at all. With this reverted, it > > > all "just works". > > > > > > Same I think for a Bluetooth headset, can check that again if you really > > > need me to, but the trackball is reliable here. > > > > > >> When you run btmon does it indicate any errors? > > > > > > How do I run it and where are the errors displayed? > > > > you can do btmon -w trace.log and just let it run like tcdpump. > > Ok, attached. > > The device is not connecting, and then I open the gnome bluetooth dialog > and it scans for devices in the area, but does not connect to my > existing devices at all. > And any hints on how to read this file? 'btsnoop' has no man page, and the --help options are pretty sparse :( thanks, greg k-h
Re: [PATCH] Revert "Bluetooth: Update resolving list when updating whitelist"
On Sat, Oct 03, 2020 at 08:33:18PM +0200, Marcel Holtmann wrote: > Hi Greg, > > >>> This reverts commit 0eee35bdfa3b472cc986ecc6ad76293fdcda59e2 as it > >>> breaks all bluetooth connections on my machine. > >>> > >>> Cc: Marcel Holtmann > >>> Cc: Sathish Narsimman > >>> Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when updating > >>> whitelist") > >>> Signed-off-by: Greg Kroah-Hartman > >>> --- > >>> net/bluetooth/hci_request.c | 41 ++--- > >>> 1 file changed, 2 insertions(+), 39 deletions(-) > >>> > >>> This has been bugging me for since 5.9-rc1, when all bluetooth devices > >>> stopped working on my desktop system. I finally got the time to do > >>> bisection today, and it came down to this patch. Reverting it on top of > >>> 5.9-rc7 restored bluetooth devices and now my input devices properly > >>> work. > >>> > >>> As it's almost 5.9-final, any chance this can be merged now to fix the > >>> issue? > >> > >> can you be specific what breaks since our guys and I also think the > >> ChromeOS guys have been testing these series of patches heavily. > > > > My bluetooth trackball does not connect at all. With this reverted, it > > all "just works". > > > > Same I think for a Bluetooth headset, can check that again if you really > > need me to, but the trackball is reliable here. > > > >> When you run btmon does it indicate any errors? > > > > How do I run it and where are the errors displayed? > > you can do btmon -w trace.log and just let it run like tcdpump. Ok, attached. The device is not connecting, and then I open the gnome bluetooth dialog and it scans for devices in the area, but does not connect to my existing devices at all. Any ideas? thanks, greg k-h btsnoop � 5 5�� ⎉,~�Linux version 5.9.0-rc7-4-g0216685bdd99 (x86_64)! !�� ⎉,~�Bluetooth subsystem version 2.22 ⎉,~� pe��Phci0 ⎉,~� ⎉,~�pe��P �� ⎉,~� bluetoothd ⎉-:�L ⎉-:�Y � ⎉-:�p ⎉-:�q ⎉-:�� : ⎉-:��B ⎉-<�_B ⎉-<�n ���.&