Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-28 Thread Kirill A. Shutemov
On Mon, Oct 28, 2024 at 08:44:10AM -1000, Linus Torvalds wrote: > I The *hardware* presumably uses either bit 47/56 because that's the > actual hardware width of the TLB / cache matching. It is a guess, right? The bug makes more sense to me if the bit number depends on the active paging mode: thi

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-28 Thread Linus Torvalds
On Mon, 28 Oct 2024 at 10:31, Kirill A. Shutemov wrote: > > On Mon, Oct 28, 2024 at 08:44:10AM -1000, Linus Torvalds wrote: > > I The *hardware* presumably uses either bit 47/56 because that's the > > actual hardware width of the TLB / cache matching. > > It is a guess, right? Yes, I have no idea

[PATCH v5 4/6] ASoC: fsl_asrc_m2m: Add memory to memory function

2024-10-28 Thread Shengjiu Wang
Implement the ASRC memory to memory function using the compress framework, user can use this function with compress ioctl interface. This feature can be shared by ASRC and EASRC drivers Signed-off-by: Shengjiu Wang Acked-by: Jaroslav Kysela --- sound/soc/fsl/Kconfig | 1 + sound/so

[PATCH v5 2/6] ASoC: fsl_asrc: define functions for memory to memory usage

2024-10-28 Thread Shengjiu Wang
ASRC can be used on memory to memory case, define several functions for m2m usage. m2m_prepare: prepare for the start step m2m_start: the start step m2m_unprepare: unprepare for stop step, optional m2m_stop: stop step m2m_check_format: check format is supported or not m2m_calc_out_len: calculate o

[PATCH v5 0/6] ASoC: fsl: add memory to memory function for ASRC

2024-10-28 Thread Shengjiu Wang
This function is base on the accelerator implementation for compress API: https://patchwork.kernel.org/project/alsa-devel/patch/20241002093904.1809799-1-pe...@perex.cz/ Audio signal processing also has the requirement for memory to memory similar as Video. This asrc memory to memory (memory ->asr

[PATCH v5 3/6] ASoC: fsl_easrc: define functions for memory to memory usage

2024-10-28 Thread Shengjiu Wang
ASRC can be used on memory to memory case, define several functions for m2m usage and export them as function pointer. Signed-off-by: Shengjiu Wang Acked-by: Jaroslav Kysela --- sound/soc/fsl/fsl_easrc.c | 228 ++ sound/soc/fsl/fsl_easrc.h | 4 + 2 files ch

[PATCH v5 5/6] ASoC: fsl_asrc: register m2m platform device

2024-10-28 Thread Shengjiu Wang
Register m2m platform device, that user can use M2M feature. Signed-off-by: Shengjiu Wang Acked-by: Jaroslav Kysela --- sound/soc/fsl/fsl_asrc.c | 37 + 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fs

[PATCH v5 6/6] ASoC: fsl_easrc: register m2m platform device

2024-10-28 Thread Shengjiu Wang
Register m2m platform device,that user can use M2M feature. Signed-off-by: Shengjiu Wang Acked-by: Jaroslav Kysela --- sound/soc/fsl/fsl_easrc.c | 33 +++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_e

[PATCH v5 1/6] ALSA: compress: Add output rate and output format support

2024-10-28 Thread Shengjiu Wang
Add 'pcm_format' for struct snd_codec, add 'pcm_formats' for struct snd_codec_desc, these are used for accelerator usage. Current accelerator example is sample rate converter (SRC). Define struct snd_codec_desc_src for descript minmum and maxmum sample rates. And add 'src_d' in union snd_codec_opt

Re: [PATCH 10/12] fs/dax: Properly refcount fs dax pages

2024-10-28 Thread Dan Williams
Alistair Popple wrote: [..] > >> > It follows that that the DMA-idle condition still needs to look for the > >> > case where the refcount is > 1 rather than 0 since refcount == 1 is the > >> > page-mapped-but-DMA-idle condition. > > Because if the DAX page-cache holds a reference the refcount won

[PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 64-bit copy_from_user() is slow. Instead use pointer masking to force the user pointer to all 1's if the access_ok() mispredicted true for an invalid address. The kernel test robot reports a 2.6% improvement in the per_thread_ops benchmark (see link below). To avoid regre

[PATCH v3 0/6] x86/uaccess: avoid barrier_nospec()

2024-10-28 Thread Josh Poimboeuf
v3: - rebase on Linus' patch (v6.12-rc5) - remove putuser(), copy_to_user(), clear_user() changes: as Linus points out, they don't produce a value that could be used in a dependent load to leak anything. - convert 32-bit versions of copy_from_user(), get_user() and __get_user() and converg

Re: [PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-10-28 Thread Josh Poimboeuf
On Mon, Oct 28, 2024 at 06:56:15PM -0700, Josh Poimboeuf wrote: > The barrier_nospec() in 64-bit __get_user() is slow. Instead use > pointer masking to force the user pointer to all 1's if a previous > access_ok() mispredicted true for an invalid address. Linus pointed out that __get_user() may b

[PATCH v3 6/6] x86/uaccess: Converge [__]get_user() implementations

2024-10-28 Thread Josh Poimboeuf
The x86 implementations of get_user() and __get_user() are now identical. Merge their implementations and make the __get_user() implementations aliases of their get_user() counterparts. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 58 +- 1 f

[PATCH v3 5/6] x86/uaccess: Avoid barrier_nospec() in 32-bit __get_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 34-bit __get_user() is slow. Instead use pointer masking to force the user pointer to all 1's if the access_ok() mispredicted true for an invalid address. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 18 -- 1 file changed, 18 deletions(-) d

[PATCH v3 3/6] x86/uaccess: Avoid barrier_nospec() in 32-bit copy_from_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 32-bit copy_from_user() is slow. Instead use pointer masking to force the user pointer to all 1's if a previous access_ok() mispredicted true for an invalid address. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/uaccess.h| 34 +++

[PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 64-bit __get_user() is slow. Instead use pointer masking to force the user pointer to all 1's if a previous access_ok() mispredicted true for an invalid address. Note that for safety on some AMD CPUs, this relies on recent commit 86e6b1547b3d ("x86: fix user address maskin

[PATCH v2] sched/membarrier: Fix redundant load of membarrier_state

2024-10-28 Thread Nysal Jan K.A.
On architectures where ARCH_HAS_SYNC_CORE_BEFORE_USERMODE is not selected, sync_core_before_usermode() is a no-op. In membarrier_mm_sync_core_before_usermode() the compiler does not eliminate redundant branches and load of mm->membarrier_state for this case as the atomic_read() cannot be optimized

Re: [PATCH v6 17/17] powerpc64/bpf: Add support for bpf trampolines

2024-10-28 Thread Hari Bathini
On 28/10/24 7:53 am, Michael Ellerman wrote: Hari Bathini writes: From: Naveen N Rao Add support for bpf_arch_text_poke() and arch_prepare_bpf_trampoline() for 64-bit powerpc. While the code is generic, BPF trampolines are only enabled on 64-bit powerpc. 32-bit powerpc will need testing an

[PATCH v3 4/6] x86/uaccess: Convert 32-bit get_user() to unconditional pointer masking

2024-10-28 Thread Josh Poimboeuf
Convert the 32-bit get_user() implementations to use the new unconditional masking scheme for consistency with 64-bit. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/arch/x86/lib/get

[PATCH] KVM: PPC: Book3S HV: Add Power11 capability support for Nested PAPR guests

2024-10-28 Thread Amit Machhiwal
The Power11 architected and raw mode support in Linux was merged via [1] and the corresponding support in QEMU is pending in [2], which is currently in its V6. Currently, booting a KVM guest inside a pseries LPAR (Logical Partition) on a kernel without [1] results the guest boot in a Power10 compa

[PATCH v3] KVM: PPC: Book3S HV: Mask off LPCR_MER for a vCPU before running it to avoid spurious interrupts

2024-10-28 Thread Gautam Menghani
Running a L2 vCPU (see [1] for terminology) with LPCR_MER bit set and no pending interrupts results in that L2 vCPU getting an infinite flood of spurious interrupts. The 'if check' in kvmhv_run_single_vcpu() sets the LPCR_MER bit if there are pending interrupts. The spurious flood problem can be o

Re: [PATCH v3 3/3] selftests/powerpc: Use PKEY_UNRESTRICTED macro

2024-10-28 Thread Kevin Brodsky
On 28/10/2024 10:07, Yury Khrustalev wrote: > Replace literal 0 with macro PKEY_UNRESTRICTED where pkey_*() functions > are used in mm selftests for memory protection keys for ppc target. > > Signed-off-by: Yury Khrustalev > Suggested-by: Kevin Brodsky Reviewed-by: Kevin Brodsky - Kevin

[PATCH AUTOSEL 6.11 05/32] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

[PATCH AUTOSEL 6.11 24/32] ASoC: fsl_micfil: Add sample rate constraint

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit b9a8ecf81066e01e8a3de35517481bc5aa0439e5 ] On some platforms, for example i.MX93, there is only one audio PLL source, so some sample rate can't be supported. If the PLL source is used for 8kHz series rates, then 11kHz series rates can't be supported. So add

[PATCH AUTOSEL 6.6 03/15] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

[PATCH AUTOSEL 6.1 2/8] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

[PATCH AUTOSEL 5.15 2/7] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

[PATCH AUTOSEL 4.19 1/3] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

Re: [PATCH v2] of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify

2024-10-28 Thread Usama Arif
On 25/10/2024 23:15, Rob Herring wrote: > On Wed, Oct 23, 2024 at 12:14 PM Usama Arif wrote: >> >> __pa() is only intended to be used for linear map addresses and using >> it for initial_boot_params which is in fixmap for arm64 will give an >> incorrect value. Hence save the physical address w

Re: [PATCH v2] of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify

2024-10-28 Thread Rob Herring
On Mon, Oct 28, 2024 at 10:41 AM Will Deacon wrote: > > On Wed, Oct 23, 2024 at 06:14:26PM +0100, Usama Arif wrote: > > __pa() is only intended to be used for linear map addresses and using > > it for initial_boot_params which is in fixmap for arm64 will give an > > incorrect value. Hence save th

Re: [PATCH v2] of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify

2024-10-28 Thread Will Deacon
On Wed, Oct 23, 2024 at 06:14:26PM +0100, Usama Arif wrote: > __pa() is only intended to be used for linear map addresses and using > it for initial_boot_params which is in fixmap for arm64 will give an > incorrect value. Hence save the physical address when it is known at > boot time when calling

Re: [PATCH 05/28] arm64: vdso: Use only one single vvar mapping

2024-10-28 Thread Will Deacon
On Thu, Oct 10, 2024 at 09:01:07AM +0200, Thomas Weißschuh wrote: > The vvar mapping is the same for all processes. Use a single mapping to > simplify the logic and align it with the other architectures. > > In addition this will enable the move of the vvar handling into generic code. > > Signed-

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-28 Thread Linus Torvalds
On Mon, 28 Oct 2024 at 01:29, Kirill A. Shutemov wrote: > > I think it is worth looking at this approach again as it gets better > code: removes two instructions from get_user() and doesn't get flags > involved. The problem with the 'and' is that it's just re-introducing the same old bug. > The

Re: [PATCH 04/28] arm64: vdso: Drop LBASE_VDSO

2024-10-28 Thread Will Deacon
On Thu, Oct 10, 2024 at 09:01:06AM +0200, Thomas Weißschuh wrote: > This constant is always "0", providing no value and making the logic > harder to understand. > Also prepare for a consolidation of the vdso linkerscript logic by > aligning it with other architectures. > > Signed-off-by: Thomas We

[PATCH AUTOSEL 5.4 1/3] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

[PATCH AUTOSEL 5.10 2/4] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] Irq handler need to be executed as fast as possible, so the log in irq handler is better to use dev_dbg which needs to be enabled when debugging. Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: ht

Re: [PATCH AUTOSEL 6.11 05/32] ASoC: fsl_esai: change dev_warn to dev_dbg in irq handler

2024-10-28 Thread Mark Brown
On Mon, Oct 28, 2024 at 06:49:47AM -0400, Sasha Levin wrote: > From: Shengjiu Wang > > [ Upstream commit 54c805c1eb264c839fa3027d0073bb7f323b0722 ] > > Irq handler need to be executed as fast as possible, so > the log in irq handler is better to use dev_dbg which needs > to be enabled when debug

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-28 Thread Kirill A. Shutemov
On Wed, Oct 16, 2024 at 03:34:11PM -0700, Linus Torvalds wrote: > On Wed, 16 Oct 2024 at 15:13, Kirill A. Shutemov wrote: > > > > It is worse than that. If we get LAM_SUP enabled (there's KASAN patchset > > in works) this check will allow arbitrary kernel addresses. > > Ugh. I haven't seen the LA

[PATCH AUTOSEL 6.6 13/15] ASoC: fsl_micfil: Add sample rate constraint

2024-10-28 Thread Sasha Levin
From: Shengjiu Wang [ Upstream commit b9a8ecf81066e01e8a3de35517481bc5aa0439e5 ] On some platforms, for example i.MX93, there is only one audio PLL source, so some sample rate can't be supported. If the PLL source is used for 8kHz series rates, then 11kHz series rates can't be supported. So add

[PATCH v3 2/3] selftests/mm: Use PKEY_UNRESTRICTED macro

2024-10-28 Thread Yury Khrustalev
Replace literal 0 with macro PKEY_UNRESTRICTED where pkey_*() functions are used in mm selftests for memory protection keys. Signed-off-by: Yury Khrustalev Suggested-by: Joey Gouly --- tools/testing/selftests/mm/mseal_test.c| 6 +++--- tools/testing/selftests/mm/pkey-helpers.h

[PATCH v3 1/3] mm/pkey: Add PKEY_UNRESTRICTED macro

2024-10-28 Thread Yury Khrustalev
Memory protection keys (pkeys) uapi has two macros for pkeys restrictions: - PKEY_DISABLE_ACCESS 0x1 - PKEY_DISABLE_WRITE 0x2 with implicit literal value of 0x0 that means "unrestricted". Code that works with pkeys has to use this literal value when implying that a pkey imposes no restrictions

[PATCH v3 3/3] selftests/powerpc: Use PKEY_UNRESTRICTED macro

2024-10-28 Thread Yury Khrustalev
Replace literal 0 with macro PKEY_UNRESTRICTED where pkey_*() functions are used in mm selftests for memory protection keys for ppc target. Signed-off-by: Yury Khrustalev Suggested-by: Kevin Brodsky --- Note that I couldn't build these tests so I would appreciate if someone could check this pat

[PATCH v3 0/3] mm/pkey: Add PKEY_UNRESTRICTED macro

2024-10-28 Thread Yury Khrustalev
Add PKEY_UNRESTRICTED macro to mman.h and use it in selftests. For context, this change will also allow for more consistent update of the Glibc manual [1] which in turn will help with introducing memory protection keys on AArch64 targets [2]. Applies to 42f7652d3eb5 (tag: v6.12-rc4). Note that I