Skip to content

Commit

Permalink
Merge tag 'v6.1.107' into 6.1-main
Browse files Browse the repository at this point in the history
This is the 6.1.107 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmbQlHAACgkQONu9yGCS
# aT5hMw/9Ep3OR2rU28KzDT9w1MdpGKkNs7wNPH25sncWQI8iIguJ0706z9RiMqts
# UqydYpZGRKP0kCq/ETbEPnCOkzNGCwLqEthbh5s3isSjlKPrbh6FM+4kUOven88x
# Y9RH8zQYg0LWfjL3XLYBW/lCb8s0YPJVUWH7tCY8uml02wvNiWt6s6fp7p0WAJ+o
# gWrjhq7jZ1QnWpYzcnhlFhlOlEBLe0rfN269azAe7BnhDi6kcXvYHKmSjJvAFB2J
# Q6prnXhC7S0pA+755surN0V8Bpe78AXMRx7W6WbkDtL5i+I0pRK+B/ndpp1Qh8rH
# ylRvys/ewr7e7qsNaLiE3b58uWGHxgjdpqVRGSLqCrWHoPu+TQ6LIQVcjwzqLVnc
# S9yzx5A35hYWJFigemgksROOEtjzfLO/rrVIopzyeCr5FGeCb9oBFe0SKy7+iCLh
# 3oVraCbZNpGcEFB6KR4sHPhpuonVA5yYlkW5LXihZFy2oc78/7Cv0KCxU7C+9QYH
# D9P3ikwq7UTP7IWgcgtQI9iu5DTCzasmg4walemjcNpb7khG4TQd+Ht2BVHJnx2V
# YpIMMdtQAut6F550b5zSMuA5Pt8W0HpcGn7j4J4x1wMwOC6YVDZFrU/Wt/HTalxk
# dx4os7AgAnvdM7izVlZb6xCgJRkblhB3OHcc37rXRcsnXWlGF5U=
# =Hyvv
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Aug 29 17:32:00 2024 CEST
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
  • Loading branch information
frank-w committed Sep 14, 2024
2 parents 5e7e454 + 311d850 commit cbfae92
Show file tree
Hide file tree
Showing 340 changed files with 4,069 additions and 2,057 deletions.
181 changes: 181 additions & 0 deletions Documentation/bpf/map_lpm_trie.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
.. SPDX-License-Identifier: GPL-2.0-only
.. Copyright (C) 2022 Red Hat, Inc.
=====================
BPF_MAP_TYPE_LPM_TRIE
=====================

.. note::
- ``BPF_MAP_TYPE_LPM_TRIE`` was introduced in kernel version 4.11

``BPF_MAP_TYPE_LPM_TRIE`` provides a longest prefix match algorithm that
can be used to match IP addresses to a stored set of prefixes.
Internally, data is stored in an unbalanced trie of nodes that uses
``prefixlen,data`` pairs as its keys. The ``data`` is interpreted in
network byte order, i.e. big endian, so ``data[0]`` stores the most
significant byte.

LPM tries may be created with a maximum prefix length that is a multiple
of 8, in the range from 8 to 2048. The key used for lookup and update
operations is a ``struct bpf_lpm_trie_key_u8``, extended by
``max_prefixlen/8`` bytes.

- For IPv4 addresses the data length is 4 bytes
- For IPv6 addresses the data length is 16 bytes

The value type stored in the LPM trie can be any user defined type.

.. note::
When creating a map of type ``BPF_MAP_TYPE_LPM_TRIE`` you must set the
``BPF_F_NO_PREALLOC`` flag.

Usage
=====

Kernel BPF
----------

.. c:function::
void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
The longest prefix entry for a given data value can be found using the
``bpf_map_lookup_elem()`` helper. This helper returns a pointer to the
value associated with the longest matching ``key``, or ``NULL`` if no
entry was found.

The ``key`` should have ``prefixlen`` set to ``max_prefixlen`` when
performing longest prefix lookups. For example, when searching for the
longest prefix match for an IPv4 address, ``prefixlen`` should be set to
``32``.

.. c:function::
long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
Prefix entries can be added or updated using the ``bpf_map_update_elem()``
helper. This helper replaces existing elements atomically.

``bpf_map_update_elem()`` returns ``0`` on success, or negative error in
case of failure.

.. note::
The flags parameter must be one of BPF_ANY, BPF_NOEXIST or BPF_EXIST,
but the value is ignored, giving BPF_ANY semantics.

.. c:function::
long bpf_map_delete_elem(struct bpf_map *map, const void *key)
Prefix entries can be deleted using the ``bpf_map_delete_elem()``
helper. This helper will return 0 on success, or negative error in case
of failure.

Userspace
---------

Access from userspace uses libbpf APIs with the same names as above, with
the map identified by ``fd``.

.. c:function::
int bpf_map_get_next_key (int fd, const void *cur_key, void *next_key)
A userspace program can iterate through the entries in an LPM trie using
libbpf's ``bpf_map_get_next_key()`` function. The first key can be
fetched by calling ``bpf_map_get_next_key()`` with ``cur_key`` set to
``NULL``. Subsequent calls will fetch the next key that follows the
current key. ``bpf_map_get_next_key()`` returns ``0`` on success,
``-ENOENT`` if ``cur_key`` is the last key in the trie, or negative
error in case of failure.

``bpf_map_get_next_key()`` will iterate through the LPM trie elements
from leftmost leaf first. This means that iteration will return more
specific keys before less specific ones.

Examples
========

Please see ``tools/testing/selftests/bpf/test_lpm_map.c`` for examples
of LPM trie usage from userspace. The code snippets below demonstrate
API usage.

Kernel BPF
----------

The following BPF code snippet shows how to declare a new LPM trie for IPv4
address prefixes:

.. code-block:: c
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
struct ipv4_lpm_key {
__u32 prefixlen;
__u32 data;
};
struct {
__uint(type, BPF_MAP_TYPE_LPM_TRIE);
__type(key, struct ipv4_lpm_key);
__type(value, __u32);
__uint(map_flags, BPF_F_NO_PREALLOC);
__uint(max_entries, 255);
} ipv4_lpm_map SEC(".maps");
The following BPF code snippet shows how to lookup by IPv4 address:

.. code-block:: c
void *lookup(__u32 ipaddr)
{
struct ipv4_lpm_key key = {
.prefixlen = 32,
.data = ipaddr
};
return bpf_map_lookup_elem(&ipv4_lpm_map, &key);
}
Userspace
---------

The following snippet shows how to insert an IPv4 prefix entry into an
LPM trie:

.. code-block:: c
int add_prefix_entry(int lpm_fd, __u32 addr, __u32 prefixlen, struct value *value)
{
struct ipv4_lpm_key ipv4_key = {
.prefixlen = prefixlen,
.data = addr
};
return bpf_map_update_elem(lpm_fd, &ipv4_key, value, BPF_ANY);
}
The following snippet shows a userspace program walking through the entries
of an LPM trie:


.. code-block:: c
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
void iterate_lpm_trie(int map_fd)
{
struct ipv4_lpm_key *cur_key = NULL;
struct ipv4_lpm_key next_key;
struct value value;
int err;
for (;;) {
err = bpf_map_get_next_key(map_fd, cur_key, &next_key);
if (err)
break;
bpf_map_lookup_elem(map_fd, &next_key, &value);
/* Use key and value here */
cur_key = &next_key;
}
}
3 changes: 1 addition & 2 deletions Documentation/filesystems/gfs2-glocks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ The gl_holders list contains all the queued lock requests (not
just the holders) associated with the glock. If there are any
held locks, then they will be contiguous entries at the head
of the list. Locks are granted in strictly the order that they
are queued, except for those marked LM_FLAG_PRIORITY which are
used only during recovery, and even then only for journal locks.
are queued.

There are three lock states that users of the glock layer can request,
namely shared (SH), deferred (DF) and exclusive (EX). Those translate
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 6
PATCHLEVEL = 1
SUBLEVEL = 106
SUBLEVEL = 107
EXTRAVERSION =
NAME = Curry Ramen

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/acpi_numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <asm/numa.h>

static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE };
static int acpi_early_node_map[NR_CPUS] __initdata = { [0 ... NR_CPUS - 1] = NUMA_NO_NODE };

int __init acpi_numa_get_nid(unsigned int cpu)
{
Expand Down
3 changes: 0 additions & 3 deletions arch/arm64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)
smp_init_cpus();
smp_build_mpidr_hash();

/* Init percpu seeds for random tags after cpus are set up. */
kasan_init_sw_tags();

#ifdef CONFIG_ARM64_SW_TTBR0_PAN
/*
* Make sure init_thread_info.ttbr0 always generates translation
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ void __init smp_prepare_boot_cpu(void)
init_gic_priority_masking();

kasan_init_hw_tags();
/* Init percpu seeds for random tags after cpus are set up. */
kasan_init_sw_tags();
}

/*
Expand Down
6 changes: 6 additions & 0 deletions arch/arm64/kvm/sys_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <trace/events/kvm.h>

#include "sys_regs.h"
#include "vgic/vgic.h"

#include "trace.h"

Expand Down Expand Up @@ -200,6 +201,11 @@ static bool access_gic_sgi(struct kvm_vcpu *vcpu,
{
bool g1;

if (!kvm_has_gicv3(vcpu->kvm)) {
kvm_inject_undefined(vcpu);
return false;
}

if (!p->is_write)
return read_from_write_only(vcpu, p, r);

Expand Down
7 changes: 7 additions & 0 deletions arch/arm64/kvm/vgic/vgic.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,11 @@ void vgic_v4_configure_vsgis(struct kvm *kvm);
void vgic_v4_get_vlpi_state(struct vgic_irq *irq, bool *val);
int vgic_v4_request_vpe_irq(struct kvm_vcpu *vcpu, int irq);

static inline bool kvm_has_gicv3(struct kvm *kvm)
{
return (static_branch_unlikely(&kvm_vgic_global_state.gicv3_cpuif) &&
irqchip_in_kernel(kvm) &&
kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3);
}

#endif
4 changes: 4 additions & 0 deletions arch/mips/kernel/cpu-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,12 +1723,16 @@ static inline void cpu_probe_loongson(struct cpuinfo_mips *c, unsigned int cpu)
c->ases |= (MIPS_ASE_LOONGSON_MMI | MIPS_ASE_LOONGSON_CAM |
MIPS_ASE_LOONGSON_EXT | MIPS_ASE_LOONGSON_EXT2);
c->ases &= ~MIPS_ASE_VZ; /* VZ of Loongson-3A2000/3000 is incomplete */
change_c0_config6(LOONGSON_CONF6_EXTIMER | LOONGSON_CONF6_INTIMER,
LOONGSON_CONF6_INTIMER);
break;
case PRID_IMP_LOONGSON_64G:
__cpu_name[cpu] = "ICT Loongson-3";
set_elf_platform(cpu, "loongson3a");
set_isa(c, MIPS_CPU_ISA_M64R2);
decode_cpucfg(c);
change_c0_config6(LOONGSON_CONF6_EXTIMER | LOONGSON_CONF6_INTIMER,
LOONGSON_CONF6_INTIMER);
break;
default:
panic("Unknown Loongson Processor ID!");
Expand Down
6 changes: 3 additions & 3 deletions arch/openrisc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ void calibrate_delay(void)

void __init setup_arch(char **cmdline_p)
{
/* setup memblock allocator */
setup_memory();

unflatten_and_copy_device_tree();

setup_cpuinfo();
Expand All @@ -293,9 +296,6 @@ void __init setup_arch(char **cmdline_p)
}
#endif

/* setup memblock allocator */
setup_memory();

/* paging_init() sets up the MMU and marks all pages as reserved */
paging_init();

Expand Down
4 changes: 2 additions & 2 deletions arch/parisc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)

old_regs = set_irq_regs(regs);
local_irq_disable();
irq_enter();
irq_enter_rcu();

eirr_val = mfctl(23) & cpu_eiem & per_cpu(local_ack_eiem, cpu);
if (!eirr_val)
Expand Down Expand Up @@ -536,7 +536,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
#endif /* CONFIG_IRQSTACKS */

out:
irq_exit();
irq_exit_rcu();
set_irq_regs(old_regs);
return;

Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/boot/simple_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ static void *simple_realloc(void *ptr, unsigned long size)
return ptr;

new = simple_malloc(size);
memcpy(new, ptr, p->size);
simple_free(ptr);
if (new) {
memcpy(new, ptr, p->size);
simple_free(ptr);
}

return new;
}

Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/sysdev/xics/icp-native.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ static int __init icp_native_map_one_cpu(int hw_id, unsigned long addr,
rname = kasprintf(GFP_KERNEL, "CPU %d [0x%x] Interrupt Presentation",
cpu, hw_id);

if (!rname)
return -ENOMEM;
if (!request_mem_region(addr, size, rname)) {
pr_warn("icp_native: Could not reserve ICP MMIO for CPU %d, interrupt server #0x%x\n",
cpu, hw_id);
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ static void __init create_kernel_page_table(pgd_t *pgdir,
PMD_SIZE, PAGE_KERNEL_EXEC);

/* Map the data in RAM */
end_va = kernel_map.virt_addr + XIP_OFFSET + kernel_map.size;
end_va = kernel_map.virt_addr + kernel_map.size;
for (va = kernel_map.virt_addr + XIP_OFFSET; va < end_va; va += PMD_SIZE)
create_pgd_mapping(pgdir, va,
kernel_map.phys_addr + (va - (kernel_map.virt_addr + XIP_OFFSET)),
Expand Down Expand Up @@ -947,7 +947,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)

phys_ram_base = CONFIG_PHYS_RAM_BASE;
kernel_map.phys_addr = (uintptr_t)CONFIG_PHYS_RAM_BASE;
kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_sdata);
kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_start);

kernel_map.va_kernel_xip_pa_offset = kernel_map.virt_addr - kernel_map.xiprom;
#else
Expand Down
5 changes: 4 additions & 1 deletion arch/s390/include/asm/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ static inline int share(unsigned long addr, u16 cmd)

if (!uv_call(0, (u64)&uvcb))
return 0;
return -EINVAL;
pr_err("%s UVC failed (rc: 0x%x, rrc: 0x%x), possible hypervisor bug.\n",
uvcb.header.cmd == UVC_CMD_SET_SHARED_ACCESS ? "Share" : "Unshare",
uvcb.header.rc, uvcb.header.rrc);
panic("System security cannot be guaranteed unless the system panics now.\n");
}

/*
Expand Down
12 changes: 3 additions & 9 deletions arch/s390/kernel/early.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,9 @@ static inline void save_vector_registers(void)
#endif
}

static inline void setup_control_registers(void)
static inline void setup_low_address_protection(void)
{
unsigned long reg;

__ctl_store(reg, 0, 0);
reg |= CR0_LOW_ADDRESS_PROTECTION;
reg |= CR0_EMERGENCY_SIGNAL_SUBMASK;
reg |= CR0_EXTERNAL_CALL_SUBMASK;
__ctl_load(reg, 0, 0);
__ctl_set_bit(0, 28);
}

static inline void setup_access_registers(void)
Expand Down Expand Up @@ -304,7 +298,7 @@ void __init startup_init(void)
save_vector_registers();
setup_topology();
sclp_early_detect();
setup_control_registers();
setup_low_address_protection();
setup_access_registers();
lockdep_on();
}
Loading

0 comments on commit cbfae92

Please sign in to comment.