Split the code that check for the uniformity of misaligned accesses
performance on all cpus from check_unaligned_access_emulated_all_cpus()
to its own function which will be used for delegation check. No
functional changes intended.
Signed-off-by: Clément Léger
Reviewed-by: Andrew Jones
---
arc
On Mon, Mar 17, 2025 at 10:43:38AM +0100, Przemek Kitszel wrote:
> On 3/17/25 10:26, Przemek Kitszel wrote:
> > On 3/15/25 04:15, Kees Cook wrote:
> > > Introduce __flex_counter() which wraps __builtin_counted_by_ref(),
> > > as newly introduced by GCC[1] and Clang[2]. Use of __flex_counter()
> > >
On Tue, Mar 11, 2025 at 10:43:08AM -0700, Nicolin Chen wrote:
> > > +int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
> > > + struct arm_smmu_nested_domain
> > > *nested_domain)
> > > +{
> > > + struct arm_smmu_vmaster *vmaster;
> > > + unsigned
Now that we can safely handle user memory accesses while in the
misaligned access handlers, use get_user() instead of __get_user() to
have user memory access checks.
Signed-off-by: Clément Léger
---
arch/riscv/kernel/traps_misaligned.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff
riscv supports the "unaligned-trap" sysctl variable, add it to the list
of supported architectures.
Signed-off-by: Clément Léger
---
Documentation/admin-guide/sysctl/kernel.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/sysctl/kernel.rst
b/
Add basic infrastructure to support the FWFT extension in KVM.
Signed-off-by: Clément Léger
Reviewed-by: Andrew Jones
---
arch/riscv/include/asm/kvm_host.h | 4 +
arch/riscv/include/asm/kvm_vcpu_sbi.h | 1 +
arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h | 29 +++
arch/riscv/incl
Currently, only the STA extension needed a reset function but that's
going to be the case for FWFT as well. Add a reset callback that can be
implemented by SBI extensions.
Signed-off-by: Clément Léger
Reviewed-by: Andrew Jones
---
arch/riscv/include/asm/kvm_host.h | 1 -
arch/riscv/include
The SBI Firmware Feature extension allows the S-mode to request some
specific features (either hardware or software) to be enabled. This
series uses this extension to request misaligned access exception
delegation to S-mode in order to let the kernel handle it. It also adds
support for the KVM FWFT
This SBI extensions enables supervisor mode to control feature that are
under M-mode control (For instance, Svadu menvcfg ADUE bit, Ssdbltrp
DTE, etc). Add an interface to set local features for a specific cpu
mask as well as for the online cpu mask.
Signed-off-by: Clément Léger
---
arch/riscv/i
Now that the kernel can handle misaligned accesses in S-mode, request
misaligned access exception delegation from SBI. This uses the FWFT SBI
extension defined in SBI version 3.0.
Signed-off-by: Clément Léger
Reviewed-by: Andrew Jones
---
arch/riscv/include/asm/cpufeature.h| 3 +-
arch
misaligned accesses traps are not nmi and should be treated as normal
one using irqentry_enter()/exit(). Since both load/store and user/kernel
should use almost the same path and that we are going to add some code
around that, factorize it.
Signed-off-by: Clément Léger
---
arch/riscv/kernel/trap
Checking for the delegability of the misaligned access trap is needed
for the KVM FWFT extension implementation. Add a function to get the
delegability of the misaligned trap exception.
Signed-off-by: Clément Léger
Reviewed-by: Andrew Jones
---
arch/riscv/include/asm/cpufeature.h | 5 +
a
The FWFT SBI extension will need to dynamically allocate memory and do
init time specific initialization. Add an init/deinit callbacks that
allows to do so.
Signed-off-by: Clément Léger
---
arch/riscv/include/asm/kvm_vcpu_sbi.h | 9 +
arch/riscv/kvm/vcpu.c | 2 ++
arch/
A few new errors have been added with SBI V3.0, maps them as close as
possible to errno values.
Signed-off-by: Clément Léger
---
arch/riscv/include/asm/sbi.h | 9 +
1 file changed, 9 insertions(+)
diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index bb077d0c912
Add FWFT extension calls. This will be ratified in SBI V3.0 hence, it is
provided as a separate commit that can be left out if needed.
Signed-off-by: Clément Léger
---
arch/riscv/kernel/sbi.c | 30 --
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/arch
The Firmware Features extension (FWFT) was added as part of the SBI 3.0
specification. Add SBI definitions to use this extension.
Signed-off-by: Clément Léger
Reviewed-by: Samuel Holland
Tested-by: Samuel Holland
Reviewed-by: Deepak Gupta
Reviewed-by: Andrew Jones
---
arch/riscv/include/asm/
misaligned_access_speed is defined under CONFIG_RISCV_SCALAR_MISALIGNED
but was used under CONFIG_RISCV_PROBE_UNALIGNED_ACCESS. Fix that by
using the correct config option.
Signed-off-by: Clément Léger
Reviewed-by: Andrew Jones
---
arch/riscv/kernel/traps_misaligned.c | 2 +-
1 file changed, 1
schedule_on_each_cpu() was used without any good reason while documented
as very slow. This call was in the boot path, so better use
on_each_cpu() for scalar misaligned checking. Vector misaligned check
still needs to use schedule_on_each_cpu() since it requires irqs to be
enabled but that's less o
We can safely reenable IRQs if they were enabled in the previous
context. This allows to access user memory that could potentially
trigger a page fault.
Signed-off-by: Clément Léger
---
arch/riscv/kernel/traps.c | 8
1 file changed, 8 insertions(+)
diff --git a/arch/riscv/kernel/traps.
Now that the kernel can emulate misaligned access and control its
behavior, add a selftest for that. This selftest tests all the currently
emulated instruction (except for the RV32 compressed ones which are left
as a future exercise for a RV32 user). For the FPU instructions, all the
FPU registers
SBI_FWFT_MISALIGNED_DELEG needs hedeleg to be modified to delegate
misaligned load/store exceptions. Save and restore it during CPU
load/put.
Signed-off-by: Clément Léger
Reviewed-by: Deepak Gupta
Reviewed-by: Andrew Jones
---
arch/riscv/kvm/vcpu.c | 3 +++
arch/riscv/kvm/vcpu_sbi_fw
On Mon, Mar 17, 2025 at 12:44:23PM -0300, Jason Gunthorpe wrote:
> On Tue, Mar 11, 2025 at 10:43:08AM -0700, Nicolin Chen wrote:
> > > > +int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state
> > > > *state,
> > > > + struct arm_smmu_nested_domain
> >
On Tue, Mar 11, 2025 at 12:44:18PM -0700, Nicolin Chen wrote:
> As the vIOMMU infrastructure series part-3, this introduces a new vEVENTQ
> object. The existing FAULT object provides a nice notification pathway to
> the user space with a queue already, so let vEVENTQ reuse that.
>
> Mimicing the H
On Mon, Mar 17, 2025 at 11:49:14AM -0700, Nicolin Chen wrote:
> On Mon, Mar 17, 2025 at 12:44:23PM -0300, Jason Gunthorpe wrote:
> > On Tue, Mar 11, 2025 at 10:43:08AM -0700, Nicolin Chen wrote:
> > > > > +int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state
> > > > > *state,
> > > > >
Ignacio Encinas Rubio writes:
> On 15/3/25 3:41, Akira Yokosawa wrote:
>> This might be something Jon would like to keep secret, but ...
>>
>> See the message and the thread it belongs at:
>>
>>
>> https://lore.kernel.org/lkml/pine.lnx.4.44l0.1907310947340.1497-100...@iolanthe.rowland.org/
On Mon, Mar 17, 2025 at 3:07 PM Akihiko Odaki wrote:
>
> On 2025/03/17 10:12, Jason Wang wrote:
> > On Wed, Mar 12, 2025 at 1:03 PM Akihiko Odaki
> > wrote:
> >>
> >> On 2025/03/12 11:35, Jason Wang wrote:
> >>> On Tue, Mar 11, 2025 at 2:11 PM Akihiko Odaki
> >>> wrote:
>
> On 2025/0
QE tested this series of patches v11 under linux-next repo with
virtio-net regression tests, everything works fine.
Tested-by: Lei Yang
On Tue, Mar 18, 2025 at 8:29 AM Jason Wang wrote:
>
> On Mon, Mar 17, 2025 at 6:58 PM Akihiko Odaki
> wrote:
> >
> > virtio-net have two usage of hashes: one
Jonathan Corbet writes:
> Sorry for being slow ... but also, I guess, for not communicating my
> point very well. My concern wasn't about somebody not wanting to appear
> in the repository at all; it was more with somebody not wanting their
> tag in a specific patch where they had not offered it
On Mon, Mar 17, 2025 at 6:58 PM Akihiko Odaki wrote:
>
> virtio-net have two usage of hashes: one is RSS and another is hash
> reporting. Conventionally the hash calculation was done by the VMM.
> However, computing the hash after the queue was chosen defeats the
> purpose of RSS.
>
> Another appr
They are useful to implement VIRTIO_NET_F_RSS and
VIRTIO_NET_F_HASH_REPORT.
Signed-off-by: Akihiko Odaki
Tested-by: Lei Yang
---
include/linux/virtio_net.h | 188 +
1 file changed, 188 insertions(+)
diff --git a/include/linux/virtio_net.h b/include/l
They only test the ioctls are wired up to the implementation common with
tun as it is already tested for tun.
Signed-off-by: Akihiko Odaki
---
tools/testing/selftests/net/tap.c | 97 ++-
1 file changed, 95 insertions(+), 2 deletions(-)
diff --git a/tools/test
Add ioctls and storage required for the virtio-net hash feature to TUN.
Signed-off-by: Akihiko Odaki
---
drivers/net/Kconfig| 1 +
drivers/net/tun.c | 54 ++
include/linux/skbuff.h | 3 +++
net/core/skbuff.c | 4
4 files chang
virtio-net have two usage of hashes: one is RSS and another is hash
reporting. Conventionally the hash calculation was done by the VMM.
However, computing the hash after the queue was chosen defeats the
purpose of RSS.
Another approach is to use eBPF steering program. This approach has
another dow
This clarifies a steering eBPF program takes precedence over the other
steering algorithms.
Signed-off-by: Akihiko Odaki
---
Documentation/networking/tuntap.rst | 7 +++
drivers/net/tun.c | 28 +---
include/uapi/linux/if_tun.h | 9 +
flow_keys_dissector_symmetric is useful to derive a symmetric hash
and to know its source such as IPv4, IPv6, TCP, and UDP.
Signed-off-by: Akihiko Odaki
Tested-by: Lei Yang
---
include/net/flow_dissector.h | 1 +
net/core/flow_dissector.c| 3 ++-
2 files changed, 3 insertions(+), 1 deletion
Add common code required for the features being added to TUN and TAP.
They will be enabled for each of them in following patches.
Added Features
==
Hash reporting
--
Allow the guest to reuse the hash value to make receive steering
consistent between the host and guest, an
Add ioctls and storage required for the virtio-net hash feature to TAP.
Signed-off-by: Akihiko Odaki
---
drivers/net/ipvlan/ipvtap.c | 2 +-
drivers/net/macvtap.c | 2 +-
drivers/net/tap.c | 70 +
include/linux/if_tap.h | 4 ++-
The added tests confirm tun can perform RSS for all supported hash types
to select the receive queue and report hash values.
Signed-off-by: Akihiko Odaki
Tested-by: Lei Yang
---
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/net/tun.c| 455 +++
VIRTIO_NET_F_HASH_REPORT allows to report hash values calculated on the
host. When VHOST_NET_F_VIRTIO_NET_HDR is employed, it will report no
hash values (i.e., the hash_report member is always set to
VIRTIO_NET_HASH_REPORT_NONE). Otherwise, the values reported by the
underlying socket will be repor
Ensure that vnet ioctls result in EBADFD when the underlying device is
deleted.
Signed-off-by: Akihiko Odaki
Tested-by: Lei Yang
---
tools/testing/selftests/net/tun.c | 38 ++
1 file changed, 38 insertions(+)
diff --git a/tools/testing/selftests/net/tun.c
b
On 2025/03/17 10:12, Jason Wang wrote:
On Wed, Mar 12, 2025 at 1:03 PM Akihiko Odaki wrote:
On 2025/03/12 11:35, Jason Wang wrote:
On Tue, Mar 11, 2025 at 2:11 PM Akihiko Odaki wrote:
On 2025/03/11 9:38, Jason Wang wrote:
On Mon, Mar 10, 2025 at 3:45 PM Akihiko Odaki wrote:
On 2025/03/
On 3/13/25 8:01 AM, Akihiko Odaki wrote:
> @@ -998,6 +1044,16 @@ static long tap_ioctl(struct file *file, unsigned int
> cmd,
> rtnl_unlock();
> return ret;
>
> + case TUNGETVNETHASHCAP:
> + return tun_vnet_ioctl_gethashcap(argp);
> +
> + case TUNS
On 3/15/25 04:15, Kees Cook wrote:
Introduce __flex_counter() which wraps __builtin_counted_by_ref(),
as newly introduced by GCC[1] and Clang[2]. Use of __flex_counter()
allows access to the counter member of a struct's flexible array member
when it has been annotated with __counted_by().
Introd
On 3/17/25 10:26, Przemek Kitszel wrote:
On 3/15/25 04:15, Kees Cook wrote:
Introduce __flex_counter() which wraps __builtin_counted_by_ref(),
as newly introduced by GCC[1] and Clang[2]. Use of __flex_counter()
allows access to the counter member of a struct's flexible array member
when it has b
44 matches
Mail list logo