git: be818f265e8c - main - linuxkpi: Use same field names in `struct xarray` as Linux
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=be818f265e8cd448f5bf442198c495ba554b45c9 commit be818f265e8cd448f5bf442198c495ba554b45c9 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-27 21:16:36 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:48 + linuxkpi: Use same field names in `struct xarray` as Linux [Why] The i915 DRM driver started to access the `xa_lock` field in Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48754 --- sys/compat/linuxkpi/common/include/linux/xarray.h | 12 +++ sys/compat/linuxkpi/common/src/linux_xarray.c | 38 +++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h index ab98c8d66805..fba36eea0ab5 100644 --- a/sys/compat/linuxkpi/common/include/linux/xarray.h +++ b/sys/compat/linuxkpi/common/include/linux/xarray.h @@ -49,14 +49,14 @@ #definexa_limit_32b XA_LIMIT(0, 0x) -#defineXA_ASSERT_LOCKED(xa) mtx_assert(&(xa)->mtx, MA_OWNED) -#definexa_lock(xa) mtx_lock(&(xa)->mtx) -#definexa_unlock(xa) mtx_unlock(&(xa)->mtx) +#defineXA_ASSERT_LOCKED(xa) mtx_assert(&(xa)->xa_lock, MA_OWNED) +#definexa_lock(xa) mtx_lock(&(xa)->xa_lock) +#definexa_unlock(xa) mtx_unlock(&(xa)->xa_lock) struct xarray { - struct radix_tree_root root; - struct mtx mtx; /* internal mutex */ - uint32_t flags; /* see XA_FLAGS_XXX */ + struct radix_tree_root xa_head; + struct mtx xa_lock; /* internal mutex */ + uint32_t xa_flags; /* see XA_FLAGS_XXX */ }; /* diff --git a/sys/compat/linuxkpi/common/src/linux_xarray.c b/sys/compat/linuxkpi/common/src/linux_xarray.c index 746cd6029544..54c536042392 100644 --- a/sys/compat/linuxkpi/common/src/linux_xarray.c +++ b/sys/compat/linuxkpi/common/src/linux_xarray.c @@ -52,7 +52,7 @@ __xa_erase(struct xarray *xa, uint32_t index) XA_ASSERT_LOCKED(xa); - retval = radix_tree_delete(&xa->root, index); + retval = radix_tree_delete(&xa->xa_head, index); if (retval == NULL_VALUE) retval = NULL; @@ -81,7 +81,7 @@ xa_load(struct xarray *xa, uint32_t index) void *retval; xa_lock(xa); - retval = radix_tree_lookup(&xa->root, index); + retval = radix_tree_lookup(&xa->xa_head, index); xa_unlock(xa); if (retval == NULL_VALUE) @@ -122,16 +122,16 @@ __xa_alloc(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, gfp_t XA_ASSERT_LOCKED(xa); /* mask should allow to allocate at least one item */ - MPASS(mask > ((xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0)); + MPASS(mask > ((xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0)); /* mask can be any power of two value minus one */ MPASS((mask & (mask + 1)) == 0); - *pindex = (xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0; + *pindex = (xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0; if (ptr == NULL) ptr = NULL_VALUE; retry: - retval = radix_tree_insert(&xa->root, *pindex, ptr); + retval = radix_tree_insert(&xa->xa_head, *pindex, ptr); switch (retval) { case -EEXIST: @@ -184,16 +184,16 @@ __xa_alloc_cyclic(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, XA_ASSERT_LOCKED(xa); /* mask should allow to allocate at least one item */ - MPASS(mask > ((xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0)); + MPASS(mask > ((xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0)); /* mask can be any power of two value minus one */ MPASS((mask & (mask + 1)) == 0); - *pnext_index = (xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0; + *pnext_index = (xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0; if (ptr == NULL) ptr = NULL_VALUE; retry: - retval = radix_tree_insert(&xa->root, *pnext_index, ptr); + retval = radix_tree_insert(&xa->xa_head, *pnext_index, ptr); switch (retval) { case -EEXIST: @@ -203,7 +203,7 @@ retry: } (*pnext_index)++; (*pnext_index) &= mask; - if (*pnext_index == 0 && (xa->flags & XA_FLAGS_ALLOC1) != 0) + if (*pnext_index == 0 && (xa->xa_flags & XA_FLAGS_ALLOC1) != 0) (*pnext_index)++; goto retry; case -ENOMEM: @@ -262,7 +262,7 @@ __xa_insert(struct xarray *xa, uint32_t index, void *ptr, gfp_t gfp) if (ptr == NULL) ptr = NULL_VALUE; retry: - retval = radix_tree_insert(&xa->root, index, ptr); + retval = radix_tree_insert(&xa->xa_head, index, ptr); switch (retval) { case -ENOMEM: @@ -306,7 +306,7
git: 668fe90dc826 - main - linuxkpi: Add `xa_alloc_cyclic_irq()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=668fe90dc826704077de9e4dbe29b737363eeb5f commit 668fe90dc826704077de9e4dbe29b737363eeb5f Author: Jean-Sébastien Pédron AuthorDate: 2024-12-27 21:07:32 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:48 + linuxkpi: Add `xa_alloc_cyclic_irq()` [Why] This function is used by the i915 DRM driver starting with Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48753 --- sys/compat/linuxkpi/common/include/linux/xarray.h | 1 + sys/compat/linuxkpi/common/src/linux_xarray.c | 13 + 2 files changed, 14 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h index d293a8f7c2a3..ab98c8d66805 100644 --- a/sys/compat/linuxkpi/common/include/linux/xarray.h +++ b/sys/compat/linuxkpi/common/include/linux/xarray.h @@ -67,6 +67,7 @@ void *xa_erase(struct xarray *, uint32_t); void *xa_load(struct xarray *, uint32_t); int xa_alloc(struct xarray *, uint32_t *, void *, uint32_t, gfp_t); int xa_alloc_cyclic(struct xarray *, uint32_t *, void *, uint32_t, uint32_t *, gfp_t); +int xa_alloc_cyclic_irq(struct xarray *, uint32_t *, void *, uint32_t, uint32_t *, gfp_t); int xa_insert(struct xarray *, uint32_t, void *, gfp_t); void *xa_store(struct xarray *, uint32_t, void *, gfp_t); void xa_init_flags(struct xarray *, uint32_t); diff --git a/sys/compat/linuxkpi/common/src/linux_xarray.c b/sys/compat/linuxkpi/common/src/linux_xarray.c index 44900666242f..746cd6029544 100644 --- a/sys/compat/linuxkpi/common/src/linux_xarray.c +++ b/sys/compat/linuxkpi/common/src/linux_xarray.c @@ -233,6 +233,19 @@ xa_alloc_cyclic(struct xarray *xa, uint32_t *pindex, void *ptr, uint32_t mask, return (retval); } +int +xa_alloc_cyclic_irq(struct xarray *xa, uint32_t *pindex, void *ptr, +uint32_t mask, uint32_t *pnext_index, gfp_t gfp) +{ + int retval; + + xa_lock_irq(xa); + retval = __xa_alloc_cyclic(xa, pindex, ptr, mask, pnext_index, gfp); + xa_unlock_irq(xa); + + return (retval); +} + /* * This function tries to insert an element at the given index. The * "gfp" argument basically decides of this function can sleep or not
git: 2da778e62e59 - main - linuxkpi: Include from
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=2da778e62e591fc8841a5395ce0b601b70144074 commit 2da778e62e591fc8841a5395ce0b601b70144074 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-27 00:18:03 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:48 + linuxkpi: Include from [Why] Some files in the i915 DRM driver in Linux 6.7 depend on these implicit inclusions. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48751 --- sys/compat/linuxkpi/common/include/video/vga.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/video/vga.h b/sys/compat/linuxkpi/common/include/video/vga.h index e327246cc457..a5012d9e2f3f 100644 --- a/sys/compat/linuxkpi/common/include/video/vga.h +++ b/sys/compat/linuxkpi/common/include/video/vga.h @@ -3,6 +3,9 @@ #ifndef _LINUXKPI_VIDEO_VGA_H #define _LINUXKPI_VIDEO_VGA_H +#include +#include + #define VGA_MIS_W 0x3c2 #define VGA_SEQ_I 0x3c4 #define VGA_SEQ_D 0x3c5
git: 3fd7fd4974c8 - main - linuxkpi: Add `__assign_bit()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=3fd7fd4974c8000148360af2f02002f1c083681a commit 3fd7fd4974c8000148360af2f02002f1c083681a Author: Jean-Sébastien Pédron AuthorDate: 2024-12-27 00:33:08 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:48 + linuxkpi: Add `__assign_bit()` [Why] This function is used by the i915 DRM driver in Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48752 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 9 + 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 1415d5224084..23aabb546cb2 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -288,6 +288,15 @@ find_next_zero_bit(const unsigned long *addr, unsigned long size, #definetest_bit(i, a) \ !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i)) +static inline void +__assign_bit(long bit, volatile unsigned long *addr, bool value) +{ + if (value) + __set_bit(bit, addr); + else + __clear_bit(bit, addr); +} + static inline int test_and_clear_bit(long bit, volatile unsigned long *var) {
git: 73281513fc85 - main - linuxkpi: Add `pci_wake_from_d3()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=73281513fc8516c54ca30726498b282ca59a9fe8 commit 73281513fc8516c54ca30726498b282ca59a9fe8 Author: Jean-Sébastien Pédron AuthorDate: 2025-01-01 15:43:44 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add `pci_wake_from_d3()` [Why] This is used by the amdgpu DRM driver starting with Linux 6.7. [How] The function just returns 0 for now. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48759 --- sys/compat/linuxkpi/common/include/linux/pci.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 782f79080873..64f44812ee3e 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1500,4 +1500,11 @@ pci_irq_vector(struct pci_dev *pdev, unsigned int vector) return (-ENXIO); } +static inline int +pci_wake_from_d3(struct pci_dev *pdev, bool enable) +{ + + return (0); +} + #endif /* _LINUXKPI_LINUX_PCI_H_ */
git: f570760e5fef - main - linuxkpi: Add several headers to reproduce namespace pollution
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=f570760e5fefc8544400ff3328c5f7dde8c8fcf0 commit f570760e5fefc8544400ff3328c5f7dde8c8fcf0 Author: Jean-Sébastien Pédron AuthorDate: 2025-01-13 22:42:38 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add several headers to reproduce namespace pollution [Why] The i915 DRM driver relies on this chain of includes to access the definition of `struct tasklet_struct` in ``. Reviewed by:imp, manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48760 --- sys/compat/linuxkpi/common/include/linux/cgroup.h | 34 ++ .../linuxkpi/common/include/linux/kernel_stat.h| 34 ++ .../linuxkpi/common/include/linux/perf_event.h | 34 ++ .../linuxkpi/dummy/include/linux/perf_event.h | 0 4 files changed, 102 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/cgroup.h b/sys/compat/linuxkpi/common/include/linux/cgroup.h new file mode 100644 index ..a9dd22fd0f4c --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/cgroup.h @@ -0,0 +1,34 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Jean-Sébastien Pédron + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in + *the documentation and/or other materials provided with the + *distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_CGROUP_H_ +#define _LINUXKPI_LINUX_CGROUP_H_ + +#include + +#endif /* _LINUXKPI_LINUX_CGROUP_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/kernel_stat.h b/sys/compat/linuxkpi/common/include/linux/kernel_stat.h new file mode 100644 index ..c960b4ad2cff --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/kernel_stat.h @@ -0,0 +1,34 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Jean-Sébastien Pédron + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in + *the documentation and/or other materials provided with the + *distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_KERNEL_STAT_H_ +#define _LINUXKPI_LINUX_KERNEL_STAT_H_ + +#include + +#endif /* _LINUXKPI_LINUX_KERNEL_STAT_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/perf_event.h b/sys/compat/linuxkpi/common/include/linux/perf_event.h new file mode 100644 index ..86b0d06cdc1f --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/perf_event.h @@ -0,0 +1,34 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Jean-Sébastien
git: e5764cf07588 - main - linuxkpi: Don't destroy the mutex in `xa_destroy()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=e5764cf0758855e2d5a9ebab6d6addc6eaccd56e commit e5764cf0758855e2d5a9ebab6d6addc6eaccd56e Author: Jean-Sébastien Pédron AuthorDate: 2025-01-21 22:54:51 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:50 + linuxkpi: Don't destroy the mutex in `xa_destroy()` [Why] The mutex initialized in `xa_init_flags()` is not destroyed here on purpose. The reason is that on Linux, the xarray remains usable after a call to `xa_destroy()`. For instance the i915 DRM driver relies on that during the initialixation of its GuC. Basically, `xa_destroy()` "resets" the structure to zero but doesn't really destroy it. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48762 --- sys/compat/linuxkpi/common/src/linux_xarray.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_xarray.c b/sys/compat/linuxkpi/common/src/linux_xarray.c index 54c536042392..3f07f6d7c59f 100644 --- a/sys/compat/linuxkpi/common/src/linux_xarray.c +++ b/sys/compat/linuxkpi/common/src/linux_xarray.c @@ -362,9 +362,19 @@ xa_destroy(struct xarray *xa) struct radix_tree_iter iter; void **ppslot; + xa_lock(xa); radix_tree_for_each_slot(ppslot, &xa->xa_head, &iter, 0) radix_tree_iter_delete(&xa->xa_head, &iter, ppslot); - mtx_destroy(&xa->xa_lock); + xa_unlock(xa); + + /* +* The mutex initialized in `xa_init_flags()` is not destroyed here on +* purpose. The reason is that on Linux, the xarray remains usable +* after a call to `xa_destroy()`. For instance the i915 DRM driver +* relies on that during the initialixation of its GuC. Basically, +* `xa_destroy()` "resets" the structure to zero but doesn't really +* destroy it. +*/ } /*
git: 2ee1311820be - main - lindebugfs: Add `debugfs_lookup()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=2ee1311820be0ffbe76a0226049910ade470ed1e commit 2ee1311820be0ffbe76a0226049910ade470ed1e Author: Jean-Sébastien Pédron AuthorDate: 2025-01-13 18:55:00 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:50 + lindebugfs: Add `debugfs_lookup()` [Why] This function is used by hhe DRM generic code starting with Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48761 --- sys/compat/lindebugfs/lindebugfs.c | 17 + sys/compat/linuxkpi/common/include/linux/debugfs.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c index d32de5d0657e..5449dabede66 100644 --- a/sys/compat/lindebugfs/lindebugfs.c +++ b/sys/compat/lindebugfs/lindebugfs.c @@ -328,6 +328,23 @@ debugfs_create_symlink(const char *name, struct dentry *parent, return (NULL); } +struct dentry * +debugfs_lookup(const char *name, struct dentry *parent) +{ + struct dentry_meta *dm; + struct dentry *dnode; + struct pfs_node *pnode; + + pnode = pfs_find_node(parent->d_pfs_node, name); + if (pnode == NULL) + return (NULL); + + dm = (struct dentry_meta *)pnode->pn_data; + dnode = &dm->dm_dnode; + + return (dnode); +} + void debugfs_remove(struct dentry *dnode) { diff --git a/sys/compat/linuxkpi/common/include/linux/debugfs.h b/sys/compat/linuxkpi/common/include/linux/debugfs.h index 13186334d75c..54145b61503e 100644 --- a/sys/compat/linuxkpi/common/include/linux/debugfs.h +++ b/sys/compat/linuxkpi/common/include/linux/debugfs.h @@ -82,6 +82,8 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, const char *dest); +struct dentry *debugfs_lookup(const char *name, struct dentry *parent); + void debugfs_remove(struct dentry *dentry); void debugfs_remove_recursive(struct dentry *dentry);
git: 1de8fcf419fc - main - linuxkpi: Add Linux 6.7 `get_file_rcu()` variant
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=1de8fcf419fce890474271215dce3b6e4876b60a commit 1de8fcf419fce890474271215dce3b6e4876b60a Author: Jean-Sébastien Pédron AuthorDate: 2025-01-01 13:11:14 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add Linux 6.7 `get_file_rcu()` variant [Why] In Linux 6.7, the signature of `get_file_rcu()` changed significantly, going from: bool get_file_rcu(struct linux_file *f); ... to: struct linux_file * get_file_rcu(struct linux_file **f); I.e., both the argument and the return value changed in an incompatible way. This is used by the i915 DRM driver. [How] This patch introduces the variant and hide the new prototype behind `LINUXKPI_VERSION >= 60700`. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48756 --- sys/compat/linuxkpi/common/include/linux/fs.h | 5 sys/compat/linuxkpi/common/src/linux_compat.c | 39 +++ 2 files changed, 44 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h index d277b717423f..86b922ac9a1d 100644 --- a/sys/compat/linuxkpi/common/include/linux/fs.h +++ b/sys/compat/linuxkpi/common/include/linux/fs.h @@ -264,12 +264,17 @@ get_file(struct linux_file *f) return (f); } +struct linux_file * linux67_get_file_rcu(struct linux_file **f); +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60700 +#defineget_file_rcu(f) linux67_get_file_rcu(f) +#else static inline bool get_file_rcu(struct linux_file *f) { return (refcount_acquire_if_not_zero( f->_file == NULL ? &f->f_count : &f->_file->f_count)); } +#endif static inline struct inode * igrab(struct inode *inode) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index ec3ccb16b47d..e5049a4b8f43 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -75,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -1082,6 +1083,44 @@ linux_poll_wakeup(struct linux_file *filp) spin_unlock(&filp->f_kqlock); } +static struct linux_file * +__get_file_rcu(struct linux_file **f) +{ + struct linux_file *file1, *file2; + + file1 = READ_ONCE(*f); + if (file1 == NULL) + return (NULL); + + if (!refcount_acquire_if_not_zero( + file1->_file == NULL ? &file1->f_count : &file1->_file->f_count)) + return (ERR_PTR(-EAGAIN)); + + file2 = READ_ONCE(*f); + if (file2 == file1) + return (file2); + + fput(file1); + return (ERR_PTR(-EAGAIN)); +} + +struct linux_file * +linux67_get_file_rcu(struct linux_file **f) +{ + struct linux_file *file1; + + for (;;) { + file1 = __get_file_rcu(f); + if (file1 == NULL) + return (NULL); + + if (IS_ERR(file1)) + continue; + + return (file1); + } +} + static void linux_file_kqfilter_detach(struct knote *kn) {
git: e3cf2321b084 - main - linuxkpi: Add `get_file_active()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=e3cf2321b084df599a28979e624ff8083c150dc7 commit e3cf2321b084df599a28979e624ff8083c150dc7 Author: Jean-Sébastien Pédron AuthorDate: 2025-01-01 14:38:38 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add `get_file_active()` [Why] This is used by the i915 DRM driver starting from Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48757 --- sys/compat/linuxkpi/common/include/linux/fs.h | 1 + sys/compat/linuxkpi/common/src/linux_compat.c | 14 ++ 2 files changed, 15 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h index 86b922ac9a1d..56de0e3e490a 100644 --- a/sys/compat/linuxkpi/common/include/linux/fs.h +++ b/sys/compat/linuxkpi/common/include/linux/fs.h @@ -265,6 +265,7 @@ get_file(struct linux_file *f) } struct linux_file * linux67_get_file_rcu(struct linux_file **f); +struct linux_file * get_file_active(struct linux_file **f); #if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60700 #defineget_file_rcu(f) linux67_get_file_rcu(f) #else diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index e5049a4b8f43..3e2938ab2c2b 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1121,6 +1121,20 @@ linux67_get_file_rcu(struct linux_file **f) } } +struct linux_file * +get_file_active(struct linux_file **f) +{ + struct linux_file *file1; + + rcu_read_lock(); + file1 = __get_file_rcu(f); + rcu_read_unlock(); + if (IS_ERR(file1)) + file1 = NULL; + + return (file1); +} + static void linux_file_kqfilter_detach(struct knote *kn) {
git: 479c61bd5f66 - main - linuxkpi: Add `pci_get_base_class()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=479c61bd5f661f0e5927276c7eaea074235f6acc commit 479c61bd5f661f0e5927276c7eaea074235f6acc Author: Jean-Sébastien Pédron AuthorDate: 2024-12-22 16:26:49 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:47 + linuxkpi: Add `pci_get_base_class()` [Why] This new API is used by the amdgpu DRM driver is Linux 6.7. [How] This is the same as `pci_get_class()` except that it searches a PCI device matching the base class only; the subclass is ignored. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48746 --- sys/compat/linuxkpi/common/include/linux/pci.h | 3 +++ sys/compat/linuxkpi/common/src/linux_pci.c | 18 ++ 2 files changed, 21 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index aa6b778c3477..782f79080873 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1355,6 +1355,9 @@ pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, int pos, struct pci_dev *lkpi_pci_get_class(unsigned int class, struct pci_dev *from); #definepci_get_class(class, from) lkpi_pci_get_class(class, from) +struct pci_dev *lkpi_pci_get_base_class(unsigned int class, +struct pci_dev *from); +#definepci_get_base_class(class, from) lkpi_pci_get_base_class(class, from) /* -- */ diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 366731081072..a9942a657dce 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -400,6 +400,24 @@ lkpi_pci_get_class(unsigned int class, struct pci_dev *from) return (pdev); } +struct pci_dev * +lkpi_pci_get_base_class(unsigned int baseclass, struct pci_dev *from) +{ + device_t dev; + device_t devfrom = NULL; + struct pci_dev *pdev; + + if (from != NULL) + devfrom = from->dev.bsddev; + + dev = pci_find_base_class_from(baseclass, devfrom); + if (dev == NULL) + return (NULL); + + pdev = lkpinew_pci_dev(dev); + return (pdev); +} + struct pci_dev * lkpi_pci_get_domain_bus_and_slot(int domain, unsigned int bus, unsigned int devfn)
git: 8bdb76f20245 - main - linuxkpi: Add `dev_is_removable()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=8bdb76f2024545934ca7aff8cbd87bd6f2ffe38f commit 8bdb76f2024545934ca7aff8cbd87bd6f2ffe38f Author: Jean-Sébastien Pédron AuthorDate: 2025-01-01 14:39:25 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add `dev_is_removable()` [Why] This is used by the amdgpy DRM driver starting from Linux 6.7. [How] The function always returns false, like `pci_is_thunderbolt_attached()` because we don't have an API for this in FreeBSD yet. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48758 --- sys/compat/linuxkpi/common/include/linux/device.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index f56a39e904c8..a5f6874a07f6 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -330,6 +330,13 @@ dev_name(const struct device *dev) return kobject_name(&dev->kobj); } +static inline bool +dev_is_removable(struct device *dev) +{ + + return (false); +} + #definedev_set_name(_dev, _fmt, ...) \ kobject_set_name(&(_dev)->kobj, (_fmt), ##__VA_ARGS__)
Re: git: 0078df5f0258 - main - vm_phys: reduce touching of page->pool fields
On 30 Jan 2025, at 22:11, Ruslan Bukin wrote: > > Hi Doug, > > riscv seems to panic after this commit. See the message > https://people.freebsd.org/~br/panic.txt > > I think I hit the same panic around a week ago with the previous (now > reverted) commit. Does 4015ff43cbbe fix this for you? Jess > On Wed, Jan 29, 2025 at 09:14:38AM +, Doug Moore wrote: >> The branch main has been updated by dougm: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=0078df5f025854600595462e56fa95d34e732141 >> >> commit 0078df5f025854600595462e56fa95d34e732141 >> Author: Doug Moore >> AuthorDate: 2025-01-29 09:13:17 + >> Commit: Doug Moore >> CommitDate: 2025-01-29 09:13:17 + >> >>vm_phys: reduce touching of page->pool fields >> >>Change the usage of the pool field in vm_page structs. >> >>Currently, every page belongs to a pool, and the pool field identifies >>that pool, whether the page is allocated or free. >> >>With this change, the pool field of the first page of a free block is >>used by the buddy allocator to identify its pool, but the buddy >>allocator makes no guarantees about the pool field value for allocated >>pages. The buddy allocator requires that a pool parameter be passed as >>part of freeing memory. A function that allocates memory may use the >>pool field of a page to record what pool to pass as that parameter >>when the memory is freed, but might not need to do so for every >>allocated page. >> >>Suggested by: alc >>Reviewed by:markj (previous version) >>Tested by: pho >>Differential Revision: https://reviews.freebsd.org/D45409 >> --- >> sys/vm/vm_kern.c | 2 +- >> sys/vm/vm_page.c | 97 ++ >> sys/vm/vm_phys.c | 123 >> - >> sys/vm/vm_phys.h | 6 +-- >> sys/vm/vm_reserv.c | 31 +++--- >> 5 files changed, 136 insertions(+), 123 deletions(-) >> >> diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c >> index 86ab2529e27f..2b85dbde1dd6 100644 >> --- a/sys/vm/vm_kern.c >> +++ b/sys/vm/vm_kern.c >> @@ -953,7 +953,7 @@ kmem_bootstrap_free(vm_offset_t start, vm_size_t size) >> >> vmd = vm_pagequeue_domain(m); >> vm_domain_free_lock(vmd); >> - vm_phys_free_pages(m, 0); >> + vm_phys_free_pages(m, m->pool, 0); >> vm_domain_free_unlock(vmd); >> >> vm_domain_freecnt_inc(vmd, 1); >> diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c >> index ba22c7f97f2f..961b32da6599 100644 >> --- a/sys/vm/vm_page.c >> +++ b/sys/vm/vm_page.c >> @@ -572,6 +572,7 @@ vm_page_startup(vm_offset_t vaddr) >> #if defined(__i386__) && defined(VM_PHYSSEG_DENSE) >> long ii; >> #endif >> + int pool; >> #ifdef VM_FREEPOOL_LAZYINIT >> int lazyinit; >> #endif >> @@ -651,6 +652,8 @@ vm_page_startup(vm_offset_t vaddr) >> dump_add_page(pa); >> pa += PAGE_SIZE; >> } >> +#else >> + (void)pa; >> #endif >> /* >> * Compute the number of pages of memory that will be available for >> @@ -755,9 +758,12 @@ vm_page_startup(vm_offset_t vaddr) >> */ >> vm_phys_init(); >> >> + pool = VM_FREEPOOL_DEFAULT; >> #ifdef VM_FREEPOOL_LAZYINIT >> lazyinit = 1; >> TUNABLE_INT_FETCH("debug.vm.lazy_page_init", &lazyinit); >> + if (lazyinit) >> + pool = VM_FREEPOOL_LAZYINIT; >> #endif >> >> /* >> @@ -777,48 +783,27 @@ vm_page_startup(vm_offset_t vaddr) >> seg = &vm_phys_segs[segind]; >> >> /* >> - * If lazy vm_page initialization is not enabled, simply >> - * initialize all of the pages in the segment. Otherwise, we >> - * only initialize: >> - * 1. Pages not covered by phys_avail[], since they might be >> - *freed to the allocator at some future point, e.g., by >> - *kmem_bootstrap_free(). >> - * 2. The first page of each run of free pages handed to the >> - *vm_phys allocator, which in turn defers initialization >> - *of pages until they are needed. >> - * This avoids blocking the boot process for long periods, which >> - * may be relevant for VMs (which ought to boot as quickly as >> - * possible) and/or systems with large amounts of physical >> - * memory. >> + * Initialize pages not covered by phys_avail[], since they >> + * might be freed to the allocator at some future point, e.g., >> + * by kmem_bootstrap_free(). >> */ >> -#ifdef VM_FREEPOOL_LAZYINIT >> - if (lazyinit) { >> - startp = seg->start; >> - for (i = 0; phys_avail[i + 1] != 0; i += 2) { >> - if (startp >= seg->end) >> - break; >> - >> - if (phys_avail[i + 1] < startp) >> - continue; >> - if (phys_avail[i] <= startp) { >> - startp = phys_avail[i + 1]; >> - continue; >> - } >> - >> - m = vm_phys_seg_paddr_to_vm_page(seg, startp); >> - for (endp = MIN(phys_avail[i], seg->end); >> -startp < endp; startp += PAGE_SIZE, m++) { >> - vm_page_init_page(m, startp, segind, >> -VM_FREEPOOL_DEFAULT); >> - } >> + startp = seg->start; >> + for (i = 0; phys_avail[i + 1] != 0; i += 2) { >> + if (startp >= seg->end) >> + break; >> + if (phys_avail[i + 1] < startp) >> + continue; >>
git: cd245b794186 - main - linuxkpi: Add `kstrtou32()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=cd245b79418638e0fa8dc4027275ef5da9039993 commit cd245b79418638e0fa8dc4027275ef5da9039993 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-22 15:33:04 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:47 + linuxkpi: Add `kstrtou32()` [Why] This is used by the amdgpu DRM driver in Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48744 --- sys/compat/linuxkpi/common/include/linux/kstrtox.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/kstrtox.h b/sys/compat/linuxkpi/common/include/linux/kstrtox.h index 0567aa99f7a4..5da99de24197 100644 --- a/sys/compat/linuxkpi/common/include/linux/kstrtox.h +++ b/sys/compat/linuxkpi/common/include/linux/kstrtox.h @@ -179,6 +179,13 @@ kstrtou32(const char *cp, unsigned int base, uint32_t *res) return (kstrtouint(cp, base, res)); } +static inline int +kstrtos32(const char *cp, unsigned int base, int32_t *res) +{ + + return (kstrtoint(cp, base, res)); +} + static inline int kstrtos64(const char *cp, unsigned int base, int64_t *res) {
git: 03e39d3d42e7 - main - linuxkpi: Declare `PCI_IRQ_LEGACY` even for linuxkpi 6.7
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=03e39d3d42e70482cd6f65ecaa5cf8ff9674d27c commit 03e39d3d42e70482cd6f65ecaa5cf8ff9674d27c Author: Jean-Sébastien Pédron AuthorDate: 2024-12-21 22:02:16 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:46 + linuxkpi: Declare `PCI_IRQ_LEGACY` even for linuxkpi 6.7 [Why] DRM drivers in Linux 6.7 already use this constant. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48742 --- sys/compat/linuxkpi/common/include/linux/pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index c6fc1195f71b..aa6b778c3477 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -238,7 +238,7 @@ extern const char *pci_power_names[6]; #definePCI_IRQ_MSIX0x04 #definePCI_IRQ_ALL_TYPES (PCI_IRQ_MSIX|PCI_IRQ_MSI|PCI_IRQ_INTX) -#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION >= 60800) +#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION >= 60700) #definePCI_IRQ_LEGACY PCI_IRQ_INTX #endif
git: 08c2f6cf46d8 - main - linuxkpi: Unify definition of `outb()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=08c2f6cf46d8981bfc7219295882e38ec7dc8ffc commit 08c2f6cf46d8981bfc7219295882e38ec7dc8ffc Author: Jean-Sébastien Pédron AuthorDate: 2024-12-27 00:17:06 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:48 + linuxkpi: Unify definition of `outb()` [Why] It is already defined in to use the FreeBSD versions. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48750 --- sys/compat/linuxkpi/common/include/linux/io.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index 164347dbc4e7..2d6fef4e7c52 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -36,6 +36,7 @@ #include #include +#include #include #if !defined(__arm__) #include @@ -395,11 +396,7 @@ iowrite32be(uint32_t v, volatile void *addr) #defineiowrite32be(v, addr)iowrite32be(v, addr) #if defined(__i386__) || defined(__amd64__) -static inline void -_outb(u_char data, u_int port) -{ - __asm __volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); -} +#define_outb(data, port) outb((data), (port)) #endif #if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv)
git: f4ffe677397f - main - linuxkpi: Add `private_data` to `struct shrinker`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=f4ffe677397f122899dc656c32ba6bd8d0448277 commit f4ffe677397f122899dc656c32ba6bd8d0448277 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-22 18:15:58 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:47 + linuxkpi: Add `private_data` to `struct shrinker` [Why] This field is used by the i915 DRM driver in Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48748 --- sys/compat/linuxkpi/common/include/linux/shrinker.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/shrinker.h b/sys/compat/linuxkpi/common/include/linux/shrinker.h index a865241cc7cb..88cbca2dcf60 100644 --- a/sys/compat/linuxkpi/common/include/linux/shrinker.h +++ b/sys/compat/linuxkpi/common/include/linux/shrinker.h @@ -39,6 +39,7 @@ struct shrinker { unsigned long (*count_objects)(struct shrinker *, struct shrink_control *); unsigned long (*scan_objects)(struct shrinker *, struct shrink_control *); int seeks; + void * private_data; longbatch; TAILQ_ENTRY(shrinker) next; };
git: d526b2115e7e - main - linuxkpi: Add `num_online_nodes()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=d526b2115e7e67991a4a4fe497cb7e5939ad55e6 commit d526b2115e7e67991a4a4fe497cb7e5939ad55e6 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-22 18:37:44 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:47 + linuxkpi: Add `num_online_nodes()` [Why] This is used by the amdkfd DRM driver in Linux 6.7. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48749 --- sys/compat/linuxkpi/common/include/linux/nodemask.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/nodemask.h b/sys/compat/linuxkpi/common/include/linux/nodemask.h index e61573bbc19f..7a245cc6f256 100644 --- a/sys/compat/linuxkpi/common/include/linux/nodemask.h +++ b/sys/compat/linuxkpi/common/include/linux/nodemask.h @@ -30,6 +30,12 @@ #include /* pr_debug */ +static inline int +num_online_nodes(void) +{ + return (1); +} + static inline int num_possible_nodes(void) {
git: c118e4da1296 - main - pci: Add `pci_find_base_class_from()`
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=c118e4da12969b98f52b3b6f35857c32541d7fa5 commit c118e4da12969b98f52b3b6f35857c32541d7fa5 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-22 16:23:34 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:47 + pci: Add `pci_find_base_class_from()` [Why] linuxkpi needs to export `pci_get_base_class()` for DRM drivers from Linux 6.7. [How] This new function searches a PCI device with the given base class and returns it, regardless of its subclass. The behavior is the same as `pci_find_class_from()` but the subclass is ignored. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48745 --- sys/dev/pci/pci.c| 21 + sys/dev/pci/pcivar.h | 1 + 2 files changed, 22 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 30a95298a114..edebb718ec53 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -523,6 +523,27 @@ pci_find_class_from(uint8_t class, uint8_t subclass, device_t from) return (NULL); } +device_t +pci_find_base_class_from(uint8_t class, device_t from) +{ + struct pci_devinfo *dinfo; + bool found = false; + + STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { + if (from != NULL && found == false) { + if (from != dinfo->cfg.dev) + continue; + found = true; + continue; + } + if (dinfo->cfg.baseclass == class) { + return (dinfo->cfg.dev); + } + } + + return (NULL); +} + static int pci_printf(pcicfgregs *cfg, const char *fmt, ...) { diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index c2c1f055def9..1c7b772afea9 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -670,6 +670,7 @@ device_t pci_find_dbsf(uint32_t, uint8_t, uint8_t, uint8_t); device_t pci_find_device(uint16_t, uint16_t); device_t pci_find_class(uint8_t class, uint8_t subclass); device_t pci_find_class_from(uint8_t class, uint8_t subclass, device_t devfrom); +device_t pci_find_base_class_from(uint8_t class, device_t devfrom); /* Can be used by drivers to manage the MSI-X table. */ intpci_pending_msix(device_t dev, u_int index);
git: 9136a44a2dff - main - linuxkpi: Add
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=9136a44a2dff46e3236df221569ead08f4d48de8 commit 9136a44a2dff46e3236df221569ead08f4d48de8 Author: Jean-Sébastien Pédron AuthorDate: 2024-12-19 22:58:04 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:42 + linuxkpi: Add Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48740 --- sys/compat/linuxkpi/common/include/linux/cec.h | 8 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/cec.h b/sys/compat/linuxkpi/common/include/linux/cec.h new file mode 100644 index ..e0854d87d85c --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/cec.h @@ -0,0 +1,8 @@ +/* Public domain */ + +#ifndef _LINUXKPI_LINUX_CEC_H_ +#define_LINUXKPI_LINUX_CEC_H_ + +#define CEC_PHYS_ADDR_INVALID 0x + +#endif /* _LINUXKPI_LINUX_CEC_H_ */
git: 2cd532415386 - main - linuxkpi: Add idr.h -> radix-tree.h -> rcupdate.h includes
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=2cd53241538632fa1c731fbf85384b785e77bd1b commit 2cd53241538632fa1c731fbf85384b785e77bd1b Author: Jean-Sébastien Pédron AuthorDate: 2024-12-21 21:56:53 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:46 + linuxkpi: Add idr.h -> radix-tree.h -> rcupdate.h includes [Why] Some files in DRM rely on namespace pollution: they use the API without including it explicitly. [How] Reproduce the Linux chain of includes even if it means nothing on FreeBSD. This allows consumers of to "inherit" API. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48741 --- sys/compat/linuxkpi/common/include/linux/idr.h| 1 + sys/compat/linuxkpi/common/include/linux/radix-tree.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/idr.h b/sys/compat/linuxkpi/common/include/linux/idr.h index 7f55b8e57c7e..535d8ce07fb4 100644 --- a/sys/compat/linuxkpi/common/include/linux/idr.h +++ b/sys/compat/linuxkpi/common/include/linux/idr.h @@ -34,6 +34,7 @@ #include #include +#include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/radix-tree.h b/sys/compat/linuxkpi/common/include/linux/radix-tree.h index a1204cb20a79..ea75836c26fb 100644 --- a/sys/compat/linuxkpi/common/include/linux/radix-tree.h +++ b/sys/compat/linuxkpi/common/include/linux/radix-tree.h @@ -29,6 +29,7 @@ #ifndef_LINUXKPI_LINUX_RADIX_TREE_H_ #define_LINUXKPI_LINUX_RADIX_TREE_H_ +#include #include #defineRADIX_TREE_MAP_SHIFT6
git: 1c2ae9233b0e - main - Limit some cc options based upon features
The branch main has been updated by netchild: URL: https://cgit.FreeBSD.org/src/commit/?id=1c2ae9233b0ed4f6b92c59c0e4026f6ddc073e4a commit 1c2ae9233b0ed4f6b92c59c0e4026f6ddc073e4a Author: Alexander Leidinger AuthorDate: 2025-01-31 12:11:06 + Commit: Alexander Leidinger CommitDate: 2025-01-31 12:15:29 + Limit some cc options based upon features Limit the use of stack clash protection and zeroregs based upon compiler features: - switch unconditional use of stack clash protection into a compiler feature - limit the use of stack clash protection on unsupported architectures (I did not wade into the source of each compiler to determine when support arrived for each architecture, I used the compiler version when it was introduced with what is supported currently) - add a safeguard for stack clash protection in places where we have no SSP provisions (we may not need it, but better safe than sorry when something changes or is overridden by the user) - limit the use of zeroregs the same way, so that even specifying it will not lead to build failures (useful for universe builds when WITH_ZEROREGS is specified in src.conf) Differential Revision: https://reviews.freebsd.org/D48724 --- share/mk/bsd.compiler.mk | 13 - share/mk/bsd.lib.mk | 10 +- share/mk/bsd.sys.mk | 4 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index bf6ef3956d7d..f93d3495b1aa 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -24,6 +24,7 @@ # - retpoline: supports the retpoline speculative execution vulnerability # mitigation. # - init-all: supports stack variable initialization. +# - stackclash:supports stack clash protection # - zeroregs: supports zeroing used registers on return # - aarch64-sha512: supports the AArch64 sha512 intrinsic functions. # @@ -264,8 +265,18 @@ ${X_}COMPILER_FEATURES+= compressed-debug ${X_}COMPILER_FEATURES+= fileprefixmap .endif +.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 7 \ + && ${MACHINE_ARCH:Mriscv*} != "" && ${MACHINE_ARCH:Mpower*} != "") || \ + (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 81000 \ + && ${MACHINE_ARCH:Mriscv*} != "") +${X_}COMPILER_FEATURES+= stackclash +.endif + + .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 15) || \ - (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 11) + (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 11) && \ + ${MACHINE_ARCH:Mriscv*} != "" && ${MACHINE_ARCH:Mpower*} != "" && \ + ${MACHINE_ARCH:Marmv7*} != "" ${X_}COMPILER_FEATURES+= zeroregs .endif diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index cf4140d0b3e6..cf8057907a1f 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -170,7 +170,7 @@ PO_FLAG=-pg ${CTFCONVERT_CMD} .c.nossppico: - ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} ${CFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} + ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .c.pieo: @@ -184,7 +184,7 @@ PO_FLAG=-pg ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: - ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} + ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} .cc.pieo .C.pieo .cpp.pieo .cxx.pieo: ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} @@ -198,7 +198,7 @@ PO_FLAG=-pg ${CTFCONVERT_CMD} .f.nossppico: - ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC} + ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} .s.po .s.pico .s.nossppico .s.pieo: @@ -217,7 +217,7 @@ PO_FLAG=-pg .asm.nossppico: ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ - ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} ${ACFLAGS} -c ${.IMPSRC}
git: 4015ff43cbbe - main - vm: Fix overflow issues in vm_page_startup
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=4015ff43cbbe819316104258da6a79bef76e52c2 commit 4015ff43cbbe819316104258da6a79bef76e52c2 Author: Jessica Clarke AuthorDate: 2025-01-31 18:37:27 + Commit: Jessica Clarke CommitDate: 2025-01-31 18:37:27 + vm: Fix overflow issues in vm_page_startup Firstly, pagecount is a u_long so we should ensure j is the same for the sake of 64-bit systems. Secondly, ptoa is just a macro, and does not cast its argument, so in order to handle PAE systems correctly we need to cast j to vm_paddr_t (the type of startp). Fixes: 0078df5f0258 ("vm_phys: reduce touching of page->pool fields") --- sys/vm/vm_page.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 961b32da6599..f0e3fc73fb34 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -836,9 +836,10 @@ vm_page_startup(vm_offset_t vaddr) m = vm_phys_seg_paddr_to_vm_page(seg, startp); vm_page_init_page(m, startp, segind, pool); if (pool == VM_FREEPOOL_DEFAULT) { - for (int j = 1; j < pagecount; j++) { + for (u_long j = 1; j < pagecount; j++) { vm_page_init_page(&m[j], - startp + ptoa(j), segind, pool); + startp + ptoa((vm_paddr_t)j), + segind, pool); } } vmd = VM_DOMAIN(seg->domain);
git: c55f457df678 - stable/14 - ip: Defer checks for an unspecified dstaddr until after pfil hooks
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c55f457df6788fdaae244ab8ba87069bf5f2373f commit c55f457df6788fdaae244ab8ba87069bf5f2373f Author: Mark Johnston AuthorDate: 2025-01-16 15:46:37 + Commit: Mark Johnston CommitDate: 2025-01-31 19:18:01 + ip: Defer checks for an unspecified dstaddr until after pfil hooks To comply with Common Criteria certification requirements, it may be necessary to ensure that packets to 0.0.0.0/::0 are dropped and logged by the system firewall. Currently, such packets are dropped by ip_input() and ip6_input() before reaching pfil hooks; let's defer the checks slightly to give firewalls a chance to drop the packets themselves, as this gives better observability. Add some regression tests for this with pf+pflog. Note that prior to commit 713264f6b8b, v4 packets to the unspecified address were not dropped by the IP stack at all. Note that ip_forward() and ip6_forward() ensure that such packets are not forwarded; they are passed back unmodified. Add a regression test which ensures that such packets are visible to pflog. Reviewed by:glebius MFC after: 3 weeks Sponsored by: Klara, Inc. Sponsored by: OPNsense Differential Revision: https://reviews.freebsd.org/D48163 (cherry picked from commit 40faf87894ff67ffdf8126fce9bb438ddf61a26f) --- sys/netinet/ip_input.c | 16 +++- sys/netinet6/ip6_fastfwd.c | 1 + sys/netinet6/ip6_input.c | 17 ++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 1b080aa65e4e..6d8165003950 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -523,11 +523,6 @@ ip_input(struct mbuf *m) goto bad; } } - /* The unspecified address can appear only as a src address - RFC1122 */ - if (__predict_false(ntohl(ip->ip_dst.s_addr) == INADDR_ANY)) { - IPSTAT_INC(ips_badaddr); - goto bad; - } if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED) { sum = !(m->m_pkthdr.csum_flags & CSUM_IP_VALID); @@ -645,6 +640,17 @@ tooshort: } } passin: + /* +* The unspecified address can appear only as a src address - RFC1122. +* +* The check is deferred to here to give firewalls a chance to block +* (and log) such packets. ip_tryforward() will not process such +* packets. +*/ + if (__predict_false(ntohl(ip->ip_dst.s_addr) == INADDR_ANY)) { + IPSTAT_INC(ips_badaddr); + goto bad; + } /* * Process options and, if not destined for us, diff --git a/sys/netinet6/ip6_fastfwd.c b/sys/netinet6/ip6_fastfwd.c index 08531cee05bf..0ed313bd49a5 100644 --- a/sys/netinet6/ip6_fastfwd.c +++ b/sys/netinet6/ip6_fastfwd.c @@ -107,6 +107,7 @@ ip6_tryforward(struct mbuf *m) IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst) || IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) || in6_localip(&ip6->ip6_dst)) return (m); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index c5b9f9202cea..b3f10ddc5ea7 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -623,10 +623,10 @@ ip6_input(struct mbuf *m) IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6); /* -* Check against address spoofing/corruption. +* Check against address spoofing/corruption. The unspecified address +* is checked further below. */ - if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src) || - IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst)) { + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) { /* * XXX: "badscope" is not very suitable for a multicast source. */ @@ -751,6 +751,17 @@ ip6_input(struct mbuf *m) } passin: + /* +* The check is deferred to here to give firewalls a chance to block +* (and log) such packets. ip6_tryforward() will not process such +* packets. +*/ + if (__predict_false(IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst))) { + IP6STAT_INC(ip6s_badscope); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); + goto bad; + } + /* * Disambiguate address scope zones (if there is ambiguity). * We first make sure that the original source or destination address
Re: git: 0078df5f0258 - main - vm_phys: reduce touching of page->pool fields
On Fri, Jan 31, 2025 at 06:40:29PM +, Jessica Clarke wrote: > On 30 Jan 2025, at 22:11, Ruslan Bukin wrote: > > > > Hi Doug, > > > > riscv seems to panic after this commit. See the message > > https://people.freebsd.org/~br/panic.txt > > > > I think I hit the same panic around a week ago with the previous (now > > reverted) commit. > > Does 4015ff43cbbe fix this for you? > Yes! Thank you, Jess. Ruslan
Re: git: 03e39d3d42e7 - main - linuxkpi: Declare `PCI_IRQ_LEGACY` even for linuxkpi 6.7
On Fri, 31 Jan 2025, Jean-SébastienPédron wrote: The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=03e39d3d42e70482cd6f65ecaa5cf8ff9674d27c commit 03e39d3d42e70482cd6f65ecaa5cf8ff9674d27c Author: Jean-Sébastien Pédron AuthorDate: 2024-12-21 22:02:16 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:46 + linuxkpi: Declare `PCI_IRQ_LEGACY` even for linuxkpi 6.7 [Why] DRM drivers in Linux 6.7 already use this constant. The change is wrong and if commits would have been for more than two hours in reviews that would have been helpful. % git tag --contains 58ff9c5acb4aef58e118bbf39736cc4d6c11a3d3 shows that the alias define came with v6.8-rc1 (and apart from rtw88 no one had been using the legacy version before, so the version check was kept to a minumum so it could be removed sooned than later). Adding more pre-6.8 drivers changes that backward compat need. In the meantime the define was removed in Linux 0e1fdd222f0a and that was in v6.10-rc1. So the check these days should simply read (LINUXKPI_VERSION <= 61000) and be good. /bz Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48742 --- sys/compat/linuxkpi/common/include/linux/pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index c6fc1195f71b..aa6b778c3477 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -238,7 +238,7 @@ extern const char *pci_power_names[6]; #define PCI_IRQ_MSIX0x04 #define PCI_IRQ_ALL_TYPES (PCI_IRQ_MSIX|PCI_IRQ_MSI|PCI_IRQ_INTX) -#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION >= 60800) +#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION >= 60700) #define PCI_IRQ_LEGACY PCI_IRQ_INTX #endif -- Bjoern A. Zeeb r15:7
git: 17b7a0c595a5 - main - nvmft: Don't offline a port being removed if it is already offline
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=17b7a0c595a51eaa7e83f16e99e1555bd13a445b commit 17b7a0c595a51eaa7e83f16e99e1555bd13a445b Author: John Baldwin AuthorDate: 2025-01-31 20:13:52 + Commit: John Baldwin CommitDate: 2025-01-31 20:13:52 + nvmft: Don't offline a port being removed if it is already offline This is generally harmless but can trigger spurious warnings on the console due to duplicate attempts to disable LUNs. Sponsored by: Chelsio Communications --- sys/dev/nvmf/controller/ctl_frontend_nvmf.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvmf/controller/ctl_frontend_nvmf.c b/sys/dev/nvmf/controller/ctl_frontend_nvmf.c index 75b36b4834f5..fcfa8b90ebb7 100644 --- a/sys/dev/nvmf/controller/ctl_frontend_nvmf.c +++ b/sys/dev/nvmf/controller/ctl_frontend_nvmf.c @@ -915,7 +915,13 @@ nvmft_port_remove(struct ctl_req *req) TAILQ_REMOVE(&nvmft_ports, np, link); sx_xunlock(&nvmft_ports_lock); - ctl_port_offline(&np->port); + sx_slock(&np->lock); + if (np->online) { + sx_sunlock(&np->lock); + ctl_port_offline(&np->port); + } else + sx_sunlock(&np->lock); + nvmft_port_rele(np); req->status = CTL_LUN_OK; }
git: 95ea57c85639 - main - LinnuxKPI: drm2: retire timespec_to_jiffies()
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=95ea57c856392e2824d9c5b68ac912066e7fde36 commit 95ea57c856392e2824d9c5b68ac912066e7fde36 Author: Bjoern A. Zeeb AuthorDate: 2025-01-07 19:57:41 + Commit: Bjoern A. Zeeb CommitDate: 2025-02-01 00:47:30 + LinnuxKPI: drm2: retire timespec_to_jiffies() Linux has removed timespec_to_jiffies() half a decade ago [1]. I cannot find any use of it anymore in recent drm-kmod branches or in the tree so retire it. While here also retire it from drm2. Reported by:emaste (D48318) [1]. Sponsored by: The freeBSD Foundation MFC after: 2 weeks Reviewed by:emaste, dumbbell (tested all drm-kmod versions, thanks!) Differential Revision: https://reviews.freebsd.org/D48379 --- sys/compat/linuxkpi/common/include/linux/jiffies.h | 13 - sys/dev/drm2/drm_os_freebsd.h | 1 - 2 files changed, 14 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h b/sys/compat/linuxkpi/common/include/linux/jiffies.h index bd05a0db0767..f099caa1ce18 100644 --- a/sys/compat/linuxkpi/common/include/linux/jiffies.h +++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h @@ -68,19 +68,6 @@ extern uint64_t lkpi_msec2hz_rem; extern uint64_t lkpi_msec2hz_div; extern uint64_t lkpi_msec2hz_max; -static inline int -timespec_to_jiffies(const struct timespec *ts) -{ - u64 result; - - result = ((u64)hz * ts->tv_sec) + - (((u64)hz * ts->tv_nsec + NSEC_PER_SEC - 1) / NSEC_PER_SEC); - if (result > MAX_JIFFY_OFFSET) - result = MAX_JIFFY_OFFSET; - - return ((int)result); -} - static inline int msecs_to_jiffies(uint64_t msec) { diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h index b2a2e82b748b..71a9637ddd9f 100644 --- a/sys/dev/drm2/drm_os_freebsd.h +++ b/sys/dev/drm2/drm_os_freebsd.h @@ -447,7 +447,6 @@ extern unsigned long drm_linux_timer_hz_mask; #define jiffiesticks #definejiffies_to_msecs(x) (((int64_t)(x)) * 1000 / hz) #definemsecs_to_jiffies(x) (((int64_t)(x)) * hz / 1000) -#definetimespec_to_jiffies(x) (((x)->tv_sec * 100 + (x)->tv_nsec) * hz / 100) #definetime_after(a,b) ((long)(b) - (long)(a) < 0) #definetime_after_eq(a,b) ((long)(b) - (long)(a) <= 0) #defineround_jiffies(j)((unsigned long)(((j) + drm_linux_timer_hz_mask) & ~drm_linux_timer_hz_mask))
Re: git: afc38f1f23ac - main - sysctl: Add a regression test which runs sysctl -a
> On Jan 31, 2025, at 11:22 PM, Mark Johnston wrote: > > The branch main has been updated by markj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=afc38f1f23ac3b579144d0d1d0c3fadf735d57bd > > commit afc38f1f23ac3b579144d0d1d0c3fadf735d57bd > Author: Mark Johnston > AuthorDate: 2025-01-31 15:20:04 + > Commit: Mark Johnston > CommitDate: 2025-01-31 15:22:24 + > >sysctl: Add a regression test which runs sysctl -a > >Run sysctl -a during the test suite so that KASAN/KMSAN have a chance to >catch something. > >Inspired by https://jprx.io/cve-2024-54507/ That's a damn good example ! > >Reviewed by:jhb, emaste >MFC after: 2 weeks >Sponsored by: Klara, Inc. >Differential Revision: https://reviews.freebsd.org/D48659 > --- > sbin/sysctl/tests/sysctl_test.sh | 57 > 1 file changed, 57 insertions(+) > > diff --git a/sbin/sysctl/tests/sysctl_test.sh > b/sbin/sysctl/tests/sysctl_test.sh > index e932626a9f14..dfc32a87b212 100644 > --- a/sbin/sysctl/tests/sysctl_test.sh > +++ b/sbin/sysctl/tests/sysctl_test.sh > @@ -1,3 +1,6 @@ > +# > +# SPDX-License-Identifier: BSD-2-Clause > +# > # Copyright (c) 2022 Yoshihiro Ota > # > # Redistribution and use in source and binary forms, with or without > @@ -20,12 +23,64 @@ > # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > # SUCH DAMAGE. > +# > > sysctl_name="kern.ostype" > sysctl_value="FreeBSD" > sysctl_type="string" > sysctl_description="Operating system type" > > +atf_test_case sysctl_aflag > +sysctl_aflag_head() > +{ > + atf_set "descr" "Exercise all sysctl handlers" > +} > +sysctl_aflag_body() > +{ > + # Avoid using atf_check here since sysctl -ao generates tons of > + # output and it would all otherwise be saved. > + sysctl -ao >/dev/null 2>stderr > + if [ $? -ne 0 ]; then > + atf_fail "sysctl -ao failed" > + elif [ -s stderr ]; then > + cat stderr > + atf_fail "sysctl -ao printed to stderr" > + fi > +} > + > + > +atf_test_case sysctl_aflag_jail > +sysctl_aflag_jail_head() > +{ > + atf_set "descr" "Exercise all sysctl handlers in a jail" > + atf_set "require.user" "root" > +} > +sysctl_aflag_jail_body() > +{ > + local jail > + > + jail=sysctl_test_aflag_jail > + > + # Avoid using atf_check here since sysctl -ao generates tons of > + # output and it would all otherwise be saved. > + jail -c name=$jail command=sysctl -ao >/dev/null 2>stderr > + if [ $? -ne 0 ]; then > + atf_fail "sysctl -ao failed" > + elif [ -s stderr ]; then > + cat stderr > + atf_fail "sysctl -ao printed to stderr" > + fi > + > + jail -c name=$jail vnet command=sysctl -ao >/dev/null 2>stderr > + if [ $? -ne 0 ]; then > + atf_fail "sysctl -ao failed" > + elif [ -s stderr ]; then > + cat stderr > + atf_fail "sysctl -ao printed to stderr" > + fi > +} > + > + > atf_test_case sysctl_by_name > sysctl_by_name_head() > { > @@ -106,6 +161,8 @@ sysctl_nflag_tflag_dflag_body() > > atf_init_test_cases() > { > + atf_add_test_case sysctl_aflag > + atf_add_test_case sysctl_aflag_jail > atf_add_test_case sysctl_by_name > atf_add_test_case sysctl_nflag > atf_add_test_case sysctl_eflag
git: ce6eed2fcc40 - main - src.conf.5: regen for WITH(OUT)_SSP description update
The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ce6eed2fcc40848de7fd51f08a33c627f8fac226 commit ce6eed2fcc40848de7fd51f08a33c627f8fac226 Author: Ed Maste AuthorDate: 2025-02-01 03:08:14 + Commit: Ed Maste CommitDate: 2025-02-01 03:09:13 + src.conf.5: regen for WITH(OUT)_SSP description update Fixes: 07423969869c ("src.conf.5: Update xref for SSP description") Sponsored by: The FreeBSD Foundation --- share/man/man5/src.conf.5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 4d48edff3c80..30b5d308724a 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd January 22, 2025 +.Dd January 31, 2025 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1603,7 +1603,7 @@ When set, it enforces these options: .It Va WITHOUT_SSP Do not build world with stack smashing protection. See -.Xr security 7 +.Xr mitigations 7 for more information. .It Va WITH_STAGING Enable staging of files to a stage tree.
git: a6b4af5e07af - stable/14 - nfsd: Add support for the NFSv4.2 change_attr_type attribute
The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a6b4af5e07af3309695de49207f9edba524e748f commit a6b4af5e07af3309695de49207f9edba524e748f Author: Rick Macklem AuthorDate: 2025-01-20 21:51:33 + Commit: Rick Macklem CommitDate: 2025-02-01 03:23:15 + nfsd: Add support for the NFSv4.2 change_attr_type attribute Richard Kojedzinszky reported an intermittent problem where the Linux NFSv4.2 client would sometimes not see changes done to a directory by another client, although the change attribute for the directory had changed. A test patch that added the change_attr_type attribute to the server and always returned NFS4_CHANGE_TYPE_VERSION_COUNTER_NOPNFS seems to have resolved the issue. Somewhat oddly, the Linux knfsd server does not support this attribute but does not seem to exhibit the stale caching problem. This patch uses the VFCF_FILEREVINC flag on a file system (UFS, ZFS) to return NFS4_CHANGE_TYPE_VERSION_COUNTER_NOPNFS. It also returns NFS4_CHANGE_TYPE_TIME_METADATA if VFCF_FILEREVCT is set, which may be useful for exported fuse file systems. PR: 284186 (cherry picked from commit 709c18911ad70978d47198556c0fb1c0e703fb68) --- sys/fs/nfs/nfs_commonsubs.c | 32 sys/fs/nfs/nfsproto.h | 11 ++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 510e497bce2e..9e10bba28c90 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2307,6 +2307,23 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, if (compare && !(*retcmpp) && i != nfs_srvmaxio) *retcmpp = NFSERR_NOTSAME; break; + case NFSATTRBIT_CHANGEATTRTYPE: + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (compare) { + if (!(*retcmpp)) { + tuint = NFSV4CHANGETYPE_UNDEFINED; + if ((vp->v_mount->mnt_vfc->vfc_flags & + VFCF_FILEREVINC) != 0) + tuint = NFSV4CHANGETYPE_VERS_COUNTER_NOPNFS; + else if ((vp->v_mount->mnt_vfc->vfc_flags & + VFCF_FILEREVCT) != 0) + tuint = NFSV4CHANGETYPE_TIME_METADATA; + if (fxdr_unsigned(uint32_t, *tl) != tuint) + *retcmpp = NFSERR_NOTSAME; + } + } + attrsum += NFSX_UNSIGNED; + break; default: printf("EEK! nfsv4_loadattr unknown attr=%d\n", bitpos); @@ -3131,6 +3148,21 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, *tl = 0; retnum += 2 * NFSX_UNSIGNED; break; + case NFSATTRBIT_CHANGEATTRTYPE: + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4CHANGETYPE_UNDEFINED); + if (mp != NULL) { + if ((mp->mnt_vfc->vfc_flags & + VFCF_FILEREVINC) != 0) + *tl = txdr_unsigned( + NFSV4CHANGETYPE_VERS_COUNTER_NOPNFS); + else if ((mp->mnt_vfc->vfc_flags & + VFCF_FILEREVCT) != 0) + *tl = txdr_unsigned( + NFSV4CHANGETYPE_TIME_METADATA); + } + retnum += NFSX_UNSIGNED; + break; default: printf("EEK! Bad V4 attribute bitpos=%d\n", bitpos); } diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index ce7acf102d41..323746ebbb6c 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -1176,6 +1176,7 @@ struct nfsv3_sattr { NFSATTRBM_LAYOUTBLKSIZE | \ NFSATTRBM_LAYOUTALIGNMENT | \ NFSATTRBM_SUPPATTREXCLCREAT | \ + NFSATTRBM_CHANGEATTRTYPE | \ NFSATTRBM_XATTRSUPPORT) /* @@ -1221,7 +1222,8 @@ struct nfsv3_sattr { * NFSATTRBIT_NFSV42 - Attributes only supported by NFSv4.2. */ #defineNFSATTRBIT_NFSV42_2 \ - (NFSATTRBM_XATTRSUPPORT |
git: d9753f86679d - stable/13 - mtree: TESTSBASE directory always starts with a /
The branch stable/13 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=d9753f86679d0659137b5ee38b1df31cf509f640 commit d9753f86679d0659137b5ee38b1df31cf509f640 Author: Jose Luis Duran AuthorDate: 2025-01-24 23:10:05 + Commit: Jose Luis Duran CommitDate: 2025-02-01 03:33:22 + mtree: TESTSBASE directory always starts with a / Remove the extra forward slash ("/"), otherwise the mtree specification file will have the double slash and will not be parsed by makefs when attempting to build NanoBSD with NO_ROOT privileges. Fixes: 07670b30fa43 ("Create /usr/tests *.debug file directory hierarchy") Reviewed by:emaste Approved by:emaste (mentor) Differential Revision: https://reviews.freebsd.org/D47722 (cherry picked from commit 01ff67f4bdf5959a719a6511a855f6a60c0e3a93) --- Makefile.inc1 | 2 +- etc/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 65a5aa203aa3..d5c7eee442b0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1450,7 +1450,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null .if ${MK_DEBUG_FILES} != "no" ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ - -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null + -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} >/dev/null .endif .endif .if defined(NO_ROOT) diff --git a/etc/Makefile b/etc/Makefile index 6d53b64a79eb..42d9e4763da0 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -108,7 +108,7 @@ MTREES+=mtree/BSD.libsoft.dist /usr/lib/debug/usr .endif .if ${MK_TESTS} != "no" MTREES+= mtree/BSD.tests.dist${TESTSBASE} -MTREES+= mtree/BSD.tests.dist/usr/lib/debug/${TESTSBASE} +MTREES+= mtree/BSD.tests.dist/usr/lib/debug${TESTSBASE} .endif .if ${MK_SENDMAIL} != "no" MTREES+= mtree/BSD.sendmail.dist /
git: 81a8f67a5b55 - stable/14 - mtree: TESTSBASE directory always starts with a /
The branch stable/14 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=81a8f67a5b55905320233cbfdae321173a92a172 commit 81a8f67a5b55905320233cbfdae321173a92a172 Author: Jose Luis Duran AuthorDate: 2025-01-24 23:10:05 + Commit: Jose Luis Duran CommitDate: 2025-02-01 03:32:32 + mtree: TESTSBASE directory always starts with a / Remove the extra forward slash ("/"), otherwise the mtree specification file will have the double slash and will not be parsed by makefs when attempting to build NanoBSD with NO_ROOT privileges. Fixes: 07670b30fa43 ("Create /usr/tests *.debug file directory hierarchy") Reviewed by:emaste Approved by:emaste (mentor) Differential Revision: https://reviews.freebsd.org/D47722 (cherry picked from commit 01ff67f4bdf5959a719a6511a855f6a60c0e3a93) --- Makefile.inc1 | 2 +- etc/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 94f74392f4fb..b1a882a042a6 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1469,7 +1469,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null .if ${MK_DEBUG_FILES} != "no" ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ - -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null + -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} >/dev/null .endif .endif .if defined(NO_ROOT) diff --git a/etc/Makefile b/etc/Makefile index bd6d692e5316..27070e726943 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -113,7 +113,7 @@ MTREES+=mtree/BSD.lib${libcompat}.dist /usr/lib/debug/usr .endfor .if ${MK_TESTS} != "no" MTREES+= mtree/BSD.tests.dist${TESTSBASE} -MTREES+= mtree/BSD.tests.dist/usr/lib/debug/${TESTSBASE} +MTREES+= mtree/BSD.tests.dist/usr/lib/debug${TESTSBASE} .endif .if ${MK_SENDMAIL} != "no" MTREES+= mtree/BSD.sendmail.dist /
Re: git: 0f1bf1c22a0c - main - umb: Introduce the USB umb(4) network driver
On Fri, 31 Jan 2025 at 15:31, Bjoern A. Zeeb wrote: > On Mon, 20 Jan 2025, Adrian Chadd wrote: > > > The branch main has been updated by adrian: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=0f1bf1c22a0c97e84a4db19197a75952487aa20b > > > > commit 0f1bf1c22a0c97e84a4db19197a75952487aa20b > > Author: Adrian Chadd > > AuthorDate: 2025-01-20 23:46:15 + > > Commit: Adrian Chadd > > CommitDate: 2025-01-20 23:46:15 + > > > >umb: Introduce the USB umb(4) network driver > > Still breaks at least: > amd64 MINIMAL kernel failed, check _.amd64.MINIMAL for details > amd64 MINIMALUP kernel failed, check _.amd64.MINIMALUP for details > It wasn't broken when it landed, I did a universe pass. -- >>> Kernel build for MINIMAL completed on Tue Jan 21 08:18:12 UTC 2025 -- >>> Kernel(s) MINIMAL built in 892 seconds, ncpu: 32, make -j16 -- I'll go update the tree and start again.
git: afc38f1f23ac - main - sysctl: Add a regression test which runs sysctl -a
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=afc38f1f23ac3b579144d0d1d0c3fadf735d57bd commit afc38f1f23ac3b579144d0d1d0c3fadf735d57bd Author: Mark Johnston AuthorDate: 2025-01-31 15:20:04 + Commit: Mark Johnston CommitDate: 2025-01-31 15:22:24 + sysctl: Add a regression test which runs sysctl -a Run sysctl -a during the test suite so that KASAN/KMSAN have a chance to catch something. Inspired by https://jprx.io/cve-2024-54507/ Reviewed by:jhb, emaste MFC after: 2 weeks Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D48659 --- sbin/sysctl/tests/sysctl_test.sh | 57 1 file changed, 57 insertions(+) diff --git a/sbin/sysctl/tests/sysctl_test.sh b/sbin/sysctl/tests/sysctl_test.sh index e932626a9f14..dfc32a87b212 100644 --- a/sbin/sysctl/tests/sysctl_test.sh +++ b/sbin/sysctl/tests/sysctl_test.sh @@ -1,3 +1,6 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# # Copyright (c) 2022 Yoshihiro Ota # # Redistribution and use in source and binary forms, with or without @@ -20,12 +23,64 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. +# sysctl_name="kern.ostype" sysctl_value="FreeBSD" sysctl_type="string" sysctl_description="Operating system type" +atf_test_case sysctl_aflag +sysctl_aflag_head() +{ + atf_set "descr" "Exercise all sysctl handlers" +} +sysctl_aflag_body() +{ + # Avoid using atf_check here since sysctl -ao generates tons of + # output and it would all otherwise be saved. + sysctl -ao >/dev/null 2>stderr + if [ $? -ne 0 ]; then + atf_fail "sysctl -ao failed" + elif [ -s stderr ]; then + cat stderr + atf_fail "sysctl -ao printed to stderr" + fi +} + + +atf_test_case sysctl_aflag_jail +sysctl_aflag_jail_head() +{ + atf_set "descr" "Exercise all sysctl handlers in a jail" + atf_set "require.user" "root" +} +sysctl_aflag_jail_body() +{ + local jail + + jail=sysctl_test_aflag_jail + + # Avoid using atf_check here since sysctl -ao generates tons of + # output and it would all otherwise be saved. + jail -c name=$jail command=sysctl -ao >/dev/null 2>stderr + if [ $? -ne 0 ]; then + atf_fail "sysctl -ao failed" + elif [ -s stderr ]; then + cat stderr + atf_fail "sysctl -ao printed to stderr" + fi + + jail -c name=$jail vnet command=sysctl -ao >/dev/null 2>stderr + if [ $? -ne 0 ]; then + atf_fail "sysctl -ao failed" + elif [ -s stderr ]; then + cat stderr + atf_fail "sysctl -ao printed to stderr" + fi +} + + atf_test_case sysctl_by_name sysctl_by_name_head() { @@ -106,6 +161,8 @@ sysctl_nflag_tflag_dflag_body() atf_init_test_cases() { + atf_add_test_case sysctl_aflag + atf_add_test_case sysctl_aflag_jail atf_add_test_case sysctl_by_name atf_add_test_case sysctl_nflag atf_add_test_case sysctl_eflag
git: 8126ed28bda6 - stable/13 - gvinum.8: Update deprecation warning to note that this is removed in 15.0
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8126ed28bda6b1b93b2e9a59db4a22e2dc115597 commit 8126ed28bda6b1b93b2e9a59db4a22e2dc115597 Author: John Baldwin AuthorDate: 2025-01-23 15:27:44 + Commit: John Baldwin CommitDate: 2025-01-31 21:33:26 + gvinum.8: Update deprecation warning to note that this is removed in 15.0 Reviewed by:emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48592 (cherry picked from commit 916f6e6dd3a95145c70e1c2c55467dd4979a0118) --- sbin/gvinum/gvinum.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/gvinum/gvinum.8 b/sbin/gvinum/gvinum.8 index e634379f7b51..60ac005a7af6 100644 --- a/sbin/gvinum/gvinum.8 +++ b/sbin/gvinum/gvinum.8 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 28, 2021 +.Dd January 23, 2025 .Dt GVINUM 8 .Os .Sh NAME @@ -36,8 +36,8 @@ .Nm and associated .Xr geom 4 -kernel support is deprecated, and may not be available in -.Fx 14.0 +kernel support is deprecated, and is not available in +.Fx 15.0 and later. Users are advised to migrate to .Xr gconcat 8 ,
git: 55cb3a33d920 - stable/14 - ccdconfig.8: Refer to graid(8) and zfs(8) instead of gvinum(8)
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=55cb3a33d9200544b2b6578b7b6c40825daaea5a commit 55cb3a33d9200544b2b6578b7b6c40825daaea5a Author: John Baldwin AuthorDate: 2025-01-23 15:28:27 + Commit: John Baldwin CommitDate: 2025-01-31 21:35:27 + ccdconfig.8: Refer to graid(8) and zfs(8) instead of gvinum(8) Reviewed by:imp, emaste Differential Revision: https://reviews.freebsd.org/D48536 (cherry picked from commit 86116ab256c476191e2fc1fffd79f94382960362) (cherry picked from commit 8432ddac21b3da5fa45b4f934e90e80deaa9cabf) --- sbin/ccdconfig/ccdconfig.8 | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sbin/ccdconfig/ccdconfig.8 b/sbin/ccdconfig/ccdconfig.8 index 07fa3e6348fc..5acfeb6df179 100644 --- a/sbin/ccdconfig/ccdconfig.8 +++ b/sbin/ccdconfig/ccdconfig.8 @@ -27,7 +27,7 @@ .\" .\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $ .\" -.Dd March 22, 2024 +.Dd January 23, 2025 .Dt CCDCONFIG 8 .Os .Sh NAME @@ -199,15 +199,16 @@ If you need more than this you should look into external hardware RAID SCSI boxes, RAID controllers (see GENERIC), or software RAID systems such as -.Xr geom 8 -and -.Xr gvinum 8 . +.Xr graid 8 +or +.Xr zfs 8 . .Sh SEE ALSO .Xr dd 1 , .Xr ccd 4 , .Xr gpart 8 , -.Xr gvinum 8 , -.Xr rc 8 +.Xr graid 8 , +.Xr rc 8 , +.Xr zfs 8 .Sh HISTORY The .Nm
git: dec497a9fcbf - stable/14 - gvinum.8: Update deprecation warning to note that this is removed in 15.0
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dec497a9fcbfcf264bbdcacaebb1d32cb31f4676 commit dec497a9fcbfcf264bbdcacaebb1d32cb31f4676 Author: John Baldwin AuthorDate: 2025-01-23 15:27:44 + Commit: John Baldwin CommitDate: 2025-01-31 21:31:25 + gvinum.8: Update deprecation warning to note that this is removed in 15.0 Reviewed by:emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48592 (cherry picked from commit 916f6e6dd3a95145c70e1c2c55467dd4979a0118) --- sbin/gvinum/gvinum.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/gvinum/gvinum.8 b/sbin/gvinum/gvinum.8 index 28e4cd7d76db..54c6f119a051 100644 --- a/sbin/gvinum/gvinum.8 +++ b/sbin/gvinum/gvinum.8 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 28, 2021 +.Dd January 23, 2025 .Dt GVINUM 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nm and associated .Xr geom 4 -kernel support is deprecated, and may not be available in +kernel support is deprecated, and is not available in .Fx 15.0 and later. Users are advised to migrate to
git: 9e3c356f11a9 - stable/13 - ccdconfig.8: Refer to graid(8) and zfs(8) instead of gvinum(8)
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9e3c356f11a92ed9fa9f029391c5e613f295c0d8 commit 9e3c356f11a92ed9fa9f029391c5e613f295c0d8 Author: John Baldwin AuthorDate: 2025-01-23 15:28:27 + Commit: John Baldwin CommitDate: 2025-01-31 21:34:58 + ccdconfig.8: Refer to graid(8) and zfs(8) instead of gvinum(8) Reviewed by:imp, emaste Differential Revision: https://reviews.freebsd.org/D48536 (cherry picked from commit 86116ab256c476191e2fc1fffd79f94382960362) (cherry picked from commit 8432ddac21b3da5fa45b4f934e90e80deaa9cabf) --- sbin/ccdconfig/ccdconfig.8 | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sbin/ccdconfig/ccdconfig.8 b/sbin/ccdconfig/ccdconfig.8 index 07fa3e6348fc..5acfeb6df179 100644 --- a/sbin/ccdconfig/ccdconfig.8 +++ b/sbin/ccdconfig/ccdconfig.8 @@ -27,7 +27,7 @@ .\" .\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $ .\" -.Dd March 22, 2024 +.Dd January 23, 2025 .Dt CCDCONFIG 8 .Os .Sh NAME @@ -199,15 +199,16 @@ If you need more than this you should look into external hardware RAID SCSI boxes, RAID controllers (see GENERIC), or software RAID systems such as -.Xr geom 8 -and -.Xr gvinum 8 . +.Xr graid 8 +or +.Xr zfs 8 . .Sh SEE ALSO .Xr dd 1 , .Xr ccd 4 , .Xr gpart 8 , -.Xr gvinum 8 , -.Xr rc 8 +.Xr graid 8 , +.Xr rc 8 , +.Xr zfs 8 .Sh HISTORY The .Nm
Re: git: 1de8fcf419fc - main - linuxkpi: Add Linux 6.7 `get_file_rcu()` variant
On Fri, 31 Jan 2025, Jean-SébastienPédron wrote: The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=1de8fcf419fce890474271215dce3b6e4876b60a commit 1de8fcf419fce890474271215dce3b6e4876b60a Author: Jean-Sébastien Pédron AuthorDate: 2025-01-01 13:11:14 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add Linux 6.7 `get_file_rcu()` variant [Why] In Linux 6.7, the signature of `get_file_rcu()` changed significantly, going from: bool get_file_rcu(struct linux_file *f); ... to: struct linux_file * get_file_rcu(struct linux_file **f); I.e., both the argument and the return value changed in an incompatible way. This is used by the i915 DRM driver. [How] This patch introduces the variant and hide the new prototype behind `LINUXKPI_VERSION >= 60700`. I was under the impression that current version should always be the default while older versions should be hidden behind a special #ifdef as otherwise you end up setting LINUXKPI_VERSION for all drivers very soon to get the current versions and you cannot unset it to get older versions and if you are sitting between two of these checks it won't work. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48756 --- sys/compat/linuxkpi/common/include/linux/fs.h | 5 sys/compat/linuxkpi/common/src/linux_compat.c | 39 +++ 2 files changed, 44 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h index d277b717423f..86b922ac9a1d 100644 --- a/sys/compat/linuxkpi/common/include/linux/fs.h +++ b/sys/compat/linuxkpi/common/include/linux/fs.h @@ -264,12 +264,17 @@ get_file(struct linux_file *f) return (f); } +struct linux_file * linux67_get_file_rcu(struct linux_file **f); +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60700 +#defineget_file_rcu(f) linux67_get_file_rcu(f) +#else static inline bool get_file_rcu(struct linux_file *f) { return (refcount_acquire_if_not_zero( f->_file == NULL ? &f->f_count : &f->_file->f_count)); } +#endif static inline struct inode * igrab(struct inode *inode) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index ec3ccb16b47d..e5049a4b8f43 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -75,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -1082,6 +1083,44 @@ linux_poll_wakeup(struct linux_file *filp) spin_unlock(&filp->f_kqlock); } +static struct linux_file * +__get_file_rcu(struct linux_file **f) +{ + struct linux_file *file1, *file2; + + file1 = READ_ONCE(*f); + if (file1 == NULL) + return (NULL); + + if (!refcount_acquire_if_not_zero( + file1->_file == NULL ? &file1->f_count : &file1->_file->f_count)) + return (ERR_PTR(-EAGAIN)); + + file2 = READ_ONCE(*f); + if (file2 == file1) + return (file2); + + fput(file1); + return (ERR_PTR(-EAGAIN)); +} + +struct linux_file * +linux67_get_file_rcu(struct linux_file **f) +{ + struct linux_file *file1; + + for (;;) { + file1 = __get_file_rcu(f); + if (file1 == NULL) + return (NULL); + + if (IS_ERR(file1)) + continue; + + return (file1); + } +} + static void linux_file_kqfilter_detach(struct knote *kn) { -- Bjoern A. Zeeb r15:7
Re: git: 0f1bf1c22a0c - main - umb: Introduce the USB umb(4) network driver
On Mon, 20 Jan 2025, Adrian Chadd wrote: The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=0f1bf1c22a0c97e84a4db19197a75952487aa20b commit 0f1bf1c22a0c97e84a4db19197a75952487aa20b Author: Adrian Chadd AuthorDate: 2025-01-20 23:46:15 + Commit: Adrian Chadd CommitDate: 2025-01-20 23:46:15 + umb: Introduce the USB umb(4) network driver Still breaks at least: amd64 MINIMAL kernel failed, check _.amd64.MINIMAL for details amd64 MINIMALUP kernel failed, check _.amd64.MINIMALUP for details
git: c75a558d0729 - main - LinuxKPI: 802.11: implement ieee80211_get_{he,eht}_iftype_cap{,_vif}
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c75a558d0729da87ee3c016b57cc8f5ac4fc65d0 commit c75a558d0729da87ee3c016b57cc8f5ac4fc65d0 Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 11:46:58 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:30 + LinuxKPI: 802.11: implement ieee80211_get_{he,eht}_iftype_cap{,_vif} Implement the combination of all four functions, the *_vif versions from mac80211.h as a wrapper to the non-*_vif ones in cfg80211.h. Put the function pairs next to each other and in the right files and harmonize argument naming, etc. Both of them have shown up too often in the todo-tracing to bother enough to implement them now for a time in the future when we will support HE/EHT. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 34 +-- sys/compat/linuxkpi/common/include/net/mac80211.h | 26 - 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 7780b265cf6b..0b6a66033536 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -2073,12 +2073,40 @@ ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *band, return (NULL); } -static __inline const struct ieee80211_sta_eht_cap * +static inline const struct ieee80211_sta_he_cap * +ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band, +enum nl80211_iftype iftype) +{ + const struct ieee80211_sband_iftype_data *iftype_data; + const struct ieee80211_sta_he_cap *he_cap; + + iftype_data = ieee80211_get_sband_iftype_data(band, iftype); + if (iftype_data == NULL) + return (NULL); + + he_cap = NULL; + if (iftype_data->he_cap.has_he) + he_cap = &iftype_data->he_cap; + + return (he_cap); +} + +static inline const struct ieee80211_sta_eht_cap * ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band, enum nl80211_iftype iftype) { - TODO(); - return (NULL); + const struct ieee80211_sband_iftype_data *iftype_data; + const struct ieee80211_sta_eht_cap *eht_cap; + + iftype_data = ieee80211_get_sband_iftype_data(band, iftype); + if (iftype_data == NULL) + return (NULL); + + eht_cap = NULL; + if (iftype_data->eht_cap.has_eht) + eht_cap = &iftype_data->eht_cap; + + return (eht_cap); } static inline bool diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index fe36f1adf28a..68d135a441c1 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1609,7 +1609,7 @@ ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id) TODO(); } -static __inline enum nl80211_iftype +static inline enum nl80211_iftype ieee80211_vif_type_p2p(struct ieee80211_vif *vif) { @@ -2275,14 +2275,6 @@ ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x) TODO(); } -static __inline const struct ieee80211_sta_he_cap * -ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band, -enum nl80211_iftype type) -{ - TODO(); -return (NULL); -} - static __inline void ieee80211_key_mic_failure(struct ieee80211_key_conf *key) { @@ -2431,20 +2423,24 @@ ieee80211_vif_is_mld(const struct ieee80211_vif *vif) return (vif->valid_links != 0); } -static __inline const struct ieee80211_sta_he_cap * +static inline const struct ieee80211_sta_he_cap * ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band, struct ieee80211_vif *vif) { - TODO(); - return (NULL); + enum nl80211_iftype iftype; + + iftype = ieee80211_vif_type_p2p(vif); + return (ieee80211_get_he_iftype_cap(band, iftype)); } -static __inline const struct ieee80211_sta_eht_cap * +static inline const struct ieee80211_sta_eht_cap * ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band, struct ieee80211_vif *vif) { - TODO(); - return (NULL); + enum nl80211_iftype iftype; + + iftype = ieee80211_vif_type_p2p(vif); + return (ieee80211_get_eht_iftype_cap(band, iftype)); } static inline uint32_t
git: ecb2e5f9c30a - main - LinuxKPI; 802.11 initalize ic_vht_cap.supp_mcs
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ecb2e5f9c30a8c0ae491d07b2300e37eb599c298 commit ecb2e5f9c30a8c0ae491d07b2300e37eb599c298 Author: Bjoern A. Zeeb AuthorDate: 2025-01-10 23:55:59 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:30 + LinuxKPI; 802.11 initalize ic_vht_cap.supp_mcs Given the channel struct has an extra bool we cannot assign the information 1:1 to net80211. While the caps where assigned the suppoerted mcs sets were not. Fix that. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 77e23775ba19..9d601050ba69 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4551,6 +4551,8 @@ lkpi_ic_getradiocaps(struct ieee80211com *ic, int maxchan, ic->ic_flags_ext |= IEEE80211_FEXT_VHT; ic->ic_vht_cap.vht_cap_info = hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.cap; + ic->ic_vht_cap.supp_mcs = + hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.vht_mcs; setbit(bands, IEEE80211_MODE_VHT_5GHZ); chan_flags |= NET80211_CBW_FLAG_VHT80;
git: 411c857b4cce - main - iwlwifi: module correct -DCONFIG_*
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=411c857b4ccedd6491dff9a35e952bc49d053053 commit 411c857b4ccedd6491dff9a35e952bc49d053053 Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 12:47:09 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:31 + iwlwifi: module correct -DCONFIG_* Remove the =1 from -DCONFIG_* in the conditional cases. They are not needed. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/modules/iwlwifi/Makefile | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/modules/iwlwifi/Makefile b/sys/modules/iwlwifi/Makefile index c41a1a1757c1..6e0fea6efc3a 100644 --- a/sys/modules/iwlwifi/Makefile +++ b/sys/modules/iwlwifi/Makefile @@ -31,13 +31,13 @@ SRCS+= pcie/tx-gen2.c pcie/tx.c .if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0 SRCS+= fw/debugfs.c mvm/debugfs.c mvm/debugfs-vif.c -CFLAGS+= -DCONFIG_IWLWIFI_DEBUGFS=${WITH_DEBUGFS} -CFLAGS+= -DCONFIG_MAC80211_DEBUGFS=${WITH_DEBUGFS} +CFLAGS+= -DCONFIG_IWLWIFI_DEBUGFS +CFLAGS+= -DCONFIG_MAC80211_DEBUGFS .endif .if defined(WITH_CONFIG_PM) && ${WITH_CONFIG_PM} > 0 SRCS+= mvm/d3.c -CFLAGS+= -DCONFIG_PM=${WITH_CONFIG_PM} -CFLAGS+= -DCONFIG_PM_SLEEP=${WITH_CONFIG_PM} +CFLAGS+= -DCONFIG_PM +CFLAGS+= -DCONFIG_PM_SLEEP .endif SRCS+= iwl-devtrace.c
git: 7a5b55e3b448 - main - rtw88/rtw89: add module_param to enable/disable HT/VHT and EHT
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7a5b55e3b448744b099c274763992cba2e3ebce5 commit 7a5b55e3b448744b099c274763992cba2e3ebce5 Author: Bjoern A. Zeeb AuthorDate: 2025-01-26 00:26:14 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:31 + rtw88/rtw89: add module_param to enable/disable HT/VHT and EHT In order to better test HT and VHT support with LinuxKPI add (tunable) options disabled by default to on-demand enable HT/VHT and for rtw89 also EHT. It is expected that we will remove this FreeBSD-specific code again in the future. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/contrib/dev/rtw88/main.c | 22 ++ sys/contrib/dev/rtw89/core.c | 30 ++ 2 files changed, 52 insertions(+) diff --git a/sys/contrib/dev/rtw88/main.c b/sys/contrib/dev/rtw88/main.c index de94f750200e..5157f447b93c 100644 --- a/sys/contrib/dev/rtw88/main.c +++ b/sys/contrib/dev/rtw88/main.c @@ -46,6 +46,16 @@ MODULE_PARM_DESC(disable_lps_deep, "Set Y to disable Deep PS"); MODULE_PARM_DESC(support_bf, "Set Y to enable beamformee support"); MODULE_PARM_DESC(debug_mask, "Debugging mask"); +#if defined(__FreeBSD__) +static bool rtw_ht_support = false; +module_param_named(support_ht, rtw_ht_support, bool, 0644); +MODULE_PARM_DESC(support_ht, "Set to Y to enable HT support"); + +static bool rtw_vht_support = false; +module_param_named(support_vht, rtw_vht_support, bool, 0644); +MODULE_PARM_DESC(support_vht, "Set to Y to enable VHT support"); +#endif + static struct ieee80211_channel rtw_channeltable_2g[] = { {.center_freq = 2412, .hw_value = 1,}, {.center_freq = 2417, .hw_value = 2,}, @@ -1666,7 +1676,11 @@ static void rtw_set_supported_band(struct ieee80211_hw *hw, sband = kmemdup(&rtw_band_2ghz, sizeof(*sband), GFP_KERNEL); if (!sband) goto err_out; +#if defined(__linux__) if (chip->ht_supported) +#elif defined(__FreeBSD__) + if (rtw_ht_support && chip->ht_supported) +#endif rtw_init_ht_cap(rtwdev, &sband->ht_cap); hw->wiphy->bands[NL80211_BAND_2GHZ] = sband; } @@ -1675,9 +1689,17 @@ static void rtw_set_supported_band(struct ieee80211_hw *hw, sband = kmemdup(&rtw_band_5ghz, sizeof(*sband), GFP_KERNEL); if (!sband) goto err_out; +#if defined(__linux__) if (chip->ht_supported) +#elif defined(__FreeBSD__) + if (rtw_ht_support && chip->ht_supported) +#endif rtw_init_ht_cap(rtwdev, &sband->ht_cap); +#if defined(__linux__) if (chip->vht_supported) +#elif defined(__FreeBSD__) + if (rtw_vht_support && chip->vht_supported) +#endif rtw_init_vht_cap(rtwdev, &sband->vht_cap); hw->wiphy->bands[NL80211_BAND_5GHZ] = sband; } diff --git a/sys/contrib/dev/rtw89/core.c b/sys/contrib/dev/rtw89/core.c index d1f82bfad4a9..85d8dee4e85d 100644 --- a/sys/contrib/dev/rtw89/core.c +++ b/sys/contrib/dev/rtw89/core.c @@ -29,6 +29,21 @@ static bool rtw89_disable_ps_mode; module_param_named(disable_ps_mode, rtw89_disable_ps_mode, bool, 0644); MODULE_PARM_DESC(disable_ps_mode, "Set Y to disable low power mode"); +#if defined(__FreeBSD__) +static bool rtw_ht_support = false; +module_param_named(support_ht, rtw_ht_support, bool, 0644); +MODULE_PARM_DESC(support_ht, "Set to Y to enable HT support"); + +static bool rtw_vht_support = false; +module_param_named(support_vht, rtw_vht_support, bool, 0644); +MODULE_PARM_DESC(support_vht, "Set to Y to enable VHT support"); + +static bool rtw_eht_support = false; +module_param_named(support_eht, rtw_eht_support, bool, 0644); +MODULE_PARM_DESC(support_eht, "Set to Y to enable EHT support"); +#endif + + #define RTW89_DEF_CHAN(_freq, _hw_val, _flags, _band) \ { .center_freq = _freq, .hw_value = _hw_val, .flags = _flags, .band = _band, } #define RTW89_DEF_CHAN_2G(_freq, _hw_val) \ @@ -4006,7 +4021,13 @@ static int rtw89_core_set_supported_band(struct rtw89_dev *rtwdev) sband_2ghz = kmemdup(&rtw89_sband_2ghz, size, GFP_KERNEL); if (!sband_2ghz) goto err; +#if defined(__FreeBSD__) + if (rtw_ht_support) +#endif rtw89_init_ht_cap(rtwdev, &sband_2ghz->ht_cap); +#if defined(__FreeBSD__) + if (rtw_eht_support) +#endif rtw89_init_he_eht_cap(rtwdev, NL80211_BAND_2GHZ, sband_2ghz); hw->wiphy->bands[NL80211_BAND_2GHZ] = sband_2ghz; } @@ -4015,8 +4036,17 @@ static int rtw89_core_set_supported_band(struct rtw89_dev *rtwdev) sband_5ghz = kmemdup(&rtw89_sband_5ghz, size, GFP_KERNEL); if (!sband_5ghz) goto err; +
git: b4886c4ece3e - main - rtw88/rtw89: avoid duplicate top-level directory with debugfs
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b4886c4ece3e692c294aa853da7aec849f8d00a2 commit b4886c4ece3e692c294aa853da7aec849f8d00a2 Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 23:55:53 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:31 + rtw88/rtw89: avoid duplicate top-level directory with debugfs If people like me having multiple cards in the same system creating the debugfs dirctory leads to a panic upon attaching the 2nd card due to the duplicate name. Rather than using the hard coded driver name, use the device name (e.g., rtw880, rtw881, rtw882). This solves two issues: it avoids the duplicate name and we get individual debugging/statistic information for each card. Sponsored by: The FreeBSD Foundation MFC after: 3 days X-Note: ath1[01]k and mt76 likely will need a similar change --- sys/contrib/dev/rtw88/debug.c | 4 sys/contrib/dev/rtw89/debug.c | 4 2 files changed, 8 insertions(+) diff --git a/sys/contrib/dev/rtw88/debug.c b/sys/contrib/dev/rtw88/debug.c index e84f25b34c46..1373633d73ee 100644 --- a/sys/contrib/dev/rtw88/debug.c +++ b/sys/contrib/dev/rtw88/debug.c @@ -1223,7 +1223,11 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev) { struct dentry *debugfs_topdir; +#if defined(__linux__) debugfs_topdir = debugfs_create_dir("rtw88", +#elif defined(__FreeBSD__) + debugfs_topdir = debugfs_create_dir(dev_name(rtwdev->dev), +#endif rtwdev->hw->wiphy->debugfsdir); rtw_debugfs_add_w(write_reg); rtw_debugfs_add_rw(read_reg); diff --git a/sys/contrib/dev/rtw89/debug.c b/sys/contrib/dev/rtw89/debug.c index 750ef1578e18..a87f4b49829d 100644 --- a/sys/contrib/dev/rtw89/debug.c +++ b/sys/contrib/dev/rtw89/debug.c @@ -3974,7 +3974,11 @@ void rtw89_debugfs_init(struct rtw89_dev *rtwdev) { struct dentry *debugfs_topdir; +#if defined(__linux__) debugfs_topdir = debugfs_create_dir("rtw89", +#elif defined(__FreeBSD__) + debugfs_topdir = debugfs_create_dir(dev_name(rtwdev->dev), +#endif rtwdev->hw->wiphy->debugfsdir); rtw89_debugfs_add_rw(read_reg);
git: 1b840f09b6b3 - main - LinuxKPI: 802.11: remove rate_lowest_index()
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1b840f09b6b379c0aae5a558ba5a4ed6bb571a85 commit 1b840f09b6b379c0aae5a558ba5a4ed6bb571a85 Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 11:51:16 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:31 + LinuxKPI: 802.11: remove rate_lowest_index() rate_lowest_index() is no longer used anywhere in our code. Garbage collect it. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/net/mac80211.h | 9 - 1 file changed, 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 68d135a441c1..8872be569e44 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -2186,15 +2186,6 @@ ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt, linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt); } -static __inline int -rate_lowest_index(struct ieee80211_supported_band *band, -struct ieee80211_sta *sta) -{ - IMPROVE(); - return (0); -} - - static __inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, uint8_t *addr) {
git: 446eab491e52 - main - rtw89: turn on debugfs support
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=446eab491e523e3d7586e11cb16448e524297da4 commit 446eab491e523e3d7586e11cb16448e524297da4 Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 22:17:18 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:31 + rtw89: turn on debugfs support Following 07f6575585bf also turn on debugfs support for rtw89. Sponnsored by: The FreeBSD Foundation MFC after: 3 days --- sys/modules/rtw89/Makefile | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/modules/rtw89/Makefile b/sys/modules/rtw89/Makefile index b75d29e67b3c..a67b5fba345b 100644 --- a/sys/modules/rtw89/Makefile +++ b/sys/modules/rtw89/Makefile @@ -3,6 +3,7 @@ DEVRTW89DIR=${SRCTOP}/sys/contrib/dev/rtw89 .PATH: ${DEVRTW89DIR} WITH_CONFIG_PM=0 +WITH_DEBUGFS= 1 KMOD= if_rtw89 @@ -42,7 +43,9 @@ CFLAGS+= -DLINUXKPI_VERSION=60800 CFLAGS+= -I${DEVRTW89DIR} CFLAGS+= ${LINUXKPI_INCLUDES} CFLAGS+= -DCONFIG_RTW89_DEBUGMSG -#CFLAGS+= -DCONFIG_RTW89_DEBUGFS +.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0 +CFLAGS+= -DCONFIG_RTW89_DEBUGFS +.endif #CFLAGS+= -ferror-limit=0
git: 94e6c8d7d19d - main - lindebugfs: use __func__ not __FUNCTION__
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=94e6c8d7d19de68b29233e59c85b16c645c1a872 commit 94e6c8d7d19de68b29233e59c85b16c645c1a872 Author: Bjoern A. Zeeb AuthorDate: 2025-01-25 12:07:12 + Commit: Bjoern A. Zeeb CommitDate: 2025-01-31 23:53:31 + lindebugfs: use __func__ not __FUNCTION__ Change to the C99 version and not the old gcc name. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by:dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D48736 --- sys/compat/lindebugfs/lindebugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c index 5449dabede66..37028b667be8 100644 --- a/sys/compat/lindebugfs/lindebugfs.c +++ b/sys/compat/lindebugfs/lindebugfs.c @@ -130,7 +130,7 @@ debugfs_fill(PFS_FILL_ARGS) rc = d->dm_fops->open(&vn, &lf); if (rc < 0) { #ifdef INVARIANTS - printf("%s:%d open failed with %d\n", __FUNCTION__, __LINE__, rc); + printf("%s:%d open failed with %d\n", __func__, __LINE__, rc); #endif return (-rc); } @@ -165,7 +165,7 @@ debugfs_fill(PFS_FILL_ARGS) if (rc < 0) { #ifdef INVARIANTS - printf("%s:%d read/write failed with %d\n", __FUNCTION__, __LINE__, rc); + printf("%s:%d read/write failed with %d\n", __func__, __LINE__, rc); #endif return (-rc); }
Re: git: 0f1bf1c22a0c - main - umb: Introduce the USB umb(4) network driver
On Fri, Jan 31, 2025 at 08:16:53PM -0800, Adrian Chadd wrote: A> > > commit 0f1bf1c22a0c97e84a4db19197a75952487aa20b A> > > Author: Adrian Chadd A> > > AuthorDate: 2025-01-20 23:46:15 + A> > > Commit: Adrian Chadd A> > > CommitDate: 2025-01-20 23:46:15 + A> > > A> > >umb: Introduce the USB umb(4) network driver A> > A> > Still breaks at least: A> > amd64 MINIMAL kernel failed, check _.amd64.MINIMAL for details A> > amd64 MINIMALUP kernel failed, check _.amd64.MINIMALUP for details A> A> It wasn't broken when it landed, I did a universe pass. This is not related to Adrian's changes, but to a44301da39d7b7459c784230e1405e8980f8. I have the patch in my queue, waiting for universe. -- Gleb Smirnoff
git: 4298ce72f650 - main - nvme/nvmf: Add NVME_GET_CONTROLLER_DATA ioctl to fetch cached cdata
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4298ce72f650f1e93b4f43681446df2c1f8cab57 commit 4298ce72f650f1e93b4f43681446df2c1f8cab57 Author: John Baldwin AuthorDate: 2025-01-31 20:46:49 + Commit: John Baldwin CommitDate: 2025-01-31 20:46:49 + nvme/nvmf: Add NVME_GET_CONTROLLER_DATA ioctl to fetch cached cdata Both nvme and nvmf cache a copy of the controller's identify data in the softc. Add an ioctl to fetch this copy of the cdata. This is primarily useful for allowing commands like 'nvmecontrol devlist' to work against a disconnected Fabrics host. Reviewed by:dab, imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48218 --- sys/dev/nvme/nvme.h | 1 + sys/dev/nvme/nvme_ctrlr.c | 3 +++ sys/dev/nvmf/host/nvmf.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 5a18d69c96f4..a08abcb4aec6 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -40,6 +40,7 @@ #defineNVME_RESET_CONTROLLER _IO('n', 1) #defineNVME_GET_NSID _IOR('n', 2, struct nvme_get_nsid) #defineNVME_GET_MAX_XFER_SIZE _IOR('n', 3, uint64_t) +#defineNVME_GET_CONTROLLER_DATA_IOR('n', 4, struct nvme_controller_data) #defineNVME_IO_TEST_IOWR('n', 100, struct nvme_io_test) #defineNVME_BIO_TEST _IOWR('n', 101, struct nvme_io_test) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 29c165899f7f..98a9e62f851b 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1443,6 +1443,9 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag, case NVME_GET_MAX_XFER_SIZE: *(uint64_t *)arg = ctrlr->max_xfer_size; break; + case NVME_GET_CONTROLLER_DATA: + memcpy(arg, &ctrlr->cdata, sizeof(ctrlr->cdata)); + break; /* Linux Compatible (see nvme_linux.h) */ case NVME_IOCTL_ID: td->td_retval[0] = 0xul; diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c index 94205666accf..befe93dbbbc0 100644 --- a/sys/dev/nvmf/host/nvmf.c +++ b/sys/dev/nvmf/host/nvmf.c @@ -1107,6 +1107,9 @@ nvmf_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag, case NVME_GET_MAX_XFER_SIZE: *(uint64_t *)arg = sc->max_xfer_size; return (0); + case NVME_GET_CONTROLLER_DATA: + memcpy(arg, sc->cdata, sizeof(*sc->cdata)); + return (0); case NVMF_RECONNECT_PARAMS: nv = (struct nvmf_ioc_nv *)arg; return (nvmf_reconnect_params(sc, nv));
git: 38e1083940a2 - main - nvmf: Add NVMF_CONNECTION_STATUS ioctl
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=38e1083940a274783cc9e8ebd845e35df6d0a1ff commit 38e1083940a274783cc9e8ebd845e35df6d0a1ff Author: John Baldwin AuthorDate: 2025-01-31 20:47:58 + Commit: John Baldwin CommitDate: 2025-01-31 20:47:58 + nvmf: Add NVMF_CONNECTION_STATUS ioctl This returns an nvlist indicating if a Fabrics host is connected and the time of the most recent disconnection. Reviewed by:imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48219 --- lib/libnvmf/libnvmf.h| 5 + lib/libnvmf/nvmf_host.c | 7 +++ sys/dev/nvmf/host/nvmf.c | 25 + sys/dev/nvmf/host/nvmf_var.h | 2 ++ sys/dev/nvmf/nvmf.h | 10 ++ 5 files changed, 49 insertions(+) diff --git a/lib/libnvmf/libnvmf.h b/lib/libnvmf/libnvmf.h index f34ccdb177e7..9840e190a24f 100644 --- a/lib/libnvmf/libnvmf.h +++ b/lib/libnvmf/libnvmf.h @@ -372,4 +372,9 @@ int nvmf_reconnect_host(int fd, const struct nvme_discovery_log_entry *dle, const char *hostnqn, struct nvmf_qpair *admin_qp, u_int num_queues, struct nvmf_qpair **io_queues, const struct nvme_controller_data *cdata); +/* + * Fetch connection status from an existing kernel host. + */ +intnvmf_connection_status(int fd, nvlist_t **nvlp); + #endif /* !__LIBNVMF_H__ */ diff --git a/lib/libnvmf/nvmf_host.c b/lib/libnvmf/nvmf_host.c index e194522870d1..89cdd5c6bb70 100644 --- a/lib/libnvmf/nvmf_host.c +++ b/lib/libnvmf/nvmf_host.c @@ -5,6 +5,7 @@ * Written by: John Baldwin */ +#include #include #include #include @@ -1001,3 +1002,9 @@ out: (void)nvmf_free_qpair(admin_qp); return (error); } + +int +nvmf_connection_status(int fd, nvlist_t **nvlp) +{ + return (nvmf_read_ioc_nv(fd, NVMF_CONNECTION_STATUS, nvlp)); +} diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c index befe93dbbbc0..dbdd4568bdf1 100644 --- a/sys/dev/nvmf/host/nvmf.c +++ b/sys/dev/nvmf/host/nvmf.c @@ -654,6 +654,7 @@ nvmf_disconnect_task(void *arg, int pending __unused) return; } + nanotime(&sc->last_disconnect); callout_drain(&sc->ka_tx_timer); callout_drain(&sc->ka_rx_timer); sc->ka_traffic = false; @@ -1085,6 +1086,27 @@ nvmf_reconnect_params(struct nvmf_softc *sc, struct nvmf_ioc_nv *nv) return (error); } +static int +nvmf_connection_status(struct nvmf_softc *sc, struct nvmf_ioc_nv *nv) +{ + nvlist_t *nvl, *nvl_ts; + int error; + + nvl = nvlist_create(0); + nvl_ts = nvlist_create(0); + + sx_slock(&sc->connection_lock); + nvlist_add_bool(nvl, "connected", sc->admin != NULL); + nvlist_add_number(nvl_ts, "tv_sec", sc->last_disconnect.tv_sec); + nvlist_add_number(nvl_ts, "tv_nsec", sc->last_disconnect.tv_nsec); + sx_sunlock(&sc->connection_lock); + nvlist_move_nvlist(nvl, "last_disconnect", nvl_ts); + + error = nvmf_pack_ioc_nvlist(nvl, nv); + nvlist_destroy(nvl); + return (error); +} + static int nvmf_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag, struct thread *td) @@ -1116,6 +1138,9 @@ nvmf_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag, case NVMF_RECONNECT_HOST: nv = (struct nvmf_ioc_nv *)arg; return (nvmf_reconnect_host(sc, nv)); + case NVMF_CONNECTION_STATUS: + nv = (struct nvmf_ioc_nv *)arg; + return (nvmf_connection_status(sc, nv)); default: return (ENOTTY); } diff --git a/sys/dev/nvmf/host/nvmf_var.h b/sys/dev/nvmf/host/nvmf_var.h index 470f76527e46..e45a31f413a4 100644 --- a/sys/dev/nvmf/host/nvmf_var.h +++ b/sys/dev/nvmf/host/nvmf_var.h @@ -86,6 +86,8 @@ struct nvmf_softc { nvlist_t *rparams; + struct timespec last_disconnect; + eventhandler_tag shutdown_pre_sync_eh; eventhandler_tag shutdown_post_sync_eh; }; diff --git a/sys/dev/nvmf/nvmf.h b/sys/dev/nvmf/nvmf.h index 79facfd4ede2..d4e7b1511e9d 100644 --- a/sys/dev/nvmf/nvmf.h +++ b/sys/dev/nvmf/nvmf.h @@ -90,6 +90,15 @@ struct nvmf_ioc_nv { * booldata_digests */ +/* + * The fields in the nvlist for NVMF_CONNECTION_STATUS are: + * + * boolconnected + * timespec nvlist last_disconnect + * number tv_sec + * number tv_nsec + */ + /* * The fields in the nvlist for handing off a controller qpair are: * @@ -107,5 +116,6 @@ struct nvmf_ioc_nv { /* Operations on /dev/nvmeX */ #defineNVMF_RECONNECT_PARAMS _IOWR('n', 203, struct nvmf_ioc_nv) #defineNVMF_RECONNECT_HOST _IOW('n', 204, struct nvmf_ioc_nv) +#defineNVMF_CONNECTION_STATUS _IOWR('n', 205, struct nvmf_ioc_nv) #endif /* !__NVMF_H__ */
git: 858280e60f05 - main - nvmecontrol devlist: Annotate connected Fabrics hosts
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=858280e60f0505a2fcf26920ef0b8c9e20cd2d49 commit 858280e60f0505a2fcf26920ef0b8c9e20cd2d49 Author: John Baldwin AuthorDate: 2025-01-31 20:49:11 + Commit: John Baldwin CommitDate: 2025-01-31 20:49:11 + nvmecontrol devlist: Annotate connected Fabrics hosts If a Fabrics host is connected, use the discovery log entry from the reconnect parameters to output the transport type and address. Reviewed by:chuck Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48731 --- sbin/nvmecontrol/devlist.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/devlist.c b/sbin/nvmecontrol/devlist.c index 31445a2ef920..7bf6bc6f097c 100644 --- a/sbin/nvmecontrol/devlist.c +++ b/sbin/nvmecontrol/devlist.c @@ -152,7 +152,23 @@ print_controller_info(const char *name, int fd) nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH); printf("%6s: %s", name, mn); - if (!connected) { + if (connected) { + const struct nvme_discovery_log_entry *dle; + size_t len; + + nvlist_destroy(nvl); + if (nvmf_reconnect_params(fd, &nvl) == 0) { + dle = nvlist_get_binary(nvl, "dle", &len); + if (len == sizeof(*dle)) { + printf(" (connected via %s %.*s:%.*s)", + nvmf_transport_type(dle->trtype), + (int)sizeof(dle->traddr), dle->traddr, + (int)sizeof(dle->trsvcid), dle->trsvcid); + } + } else { + nvl = NULL; + } + } else { if (now.tv_sec == 0) clock_gettime(CLOCK_REALTIME, &now);
git: ad9dc97e4dce - main - nvmecontrol devlist: Handle disconnected Fabrics hosts
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ad9dc97e4dce478452edc4877020adf37ff5790c commit ad9dc97e4dce478452edc4877020adf37ff5790c Author: John Baldwin AuthorDate: 2025-01-31 20:48:21 + Commit: John Baldwin CommitDate: 2025-01-31 20:48:21 + nvmecontrol devlist: Handle disconnected Fabrics hosts If a Fabrics host is disconnected, use the cached controller data instead of reading the cdata via a pass-through command. In addition, annotate disconnected hosts including the amount of time since the connection was lost. Reviewed by:chuck Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48220 --- sbin/nvmecontrol/devlist.c | 63 +- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/sbin/nvmecontrol/devlist.c b/sbin/nvmecontrol/devlist.c index d2386e7ea800..31445a2ef920 100644 --- a/sbin/nvmecontrol/devlist.c +++ b/sbin/nvmecontrol/devlist.c @@ -27,11 +27,14 @@ */ #include +#include +#include #include #include #include #include +#include #include #include #include @@ -39,6 +42,7 @@ #include #include #include +#include #include #include "nvmecontrol.h" @@ -113,12 +117,62 @@ scan_namespace(int fd, int ctrlr, uint32_t nsid) } static bool -scan_controller(int ctrlr) +print_controller_info(const char *name, int fd) { + static struct timespec now; struct nvme_controller_data cdata; + struct timespec last_disconnect, delta; + uint8_t mn[64]; + nvlist_t*nvl; + const nvlist_t *nvl_ts; + boolconnected; + + /* +* If the controller doesn't support connection status, assume +* it is connected. +*/ + if (nvmf_connection_status(fd, &nvl) != 0) { + connected = true; + nvl = NULL; + } else { + connected = nvlist_get_bool(nvl, "connected"); + } + + if (connected) { + if (read_controller_data(fd, &cdata) != 0) { + nvlist_destroy(nvl); + return (false); + } + } else { + if (ioctl(fd, NVME_GET_CONTROLLER_DATA, &cdata) == -1) { + nvlist_destroy(nvl); + return (false); + } + } + + nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH); + printf("%6s: %s", name, mn); + if (!connected) { + if (now.tv_sec == 0) + clock_gettime(CLOCK_REALTIME, &now); + + nvl_ts = nvlist_get_nvlist(nvl, "last_disconnect"); + last_disconnect.tv_sec = nvlist_get_number(nvl_ts, "tv_sec"); + last_disconnect.tv_nsec = nvlist_get_number(nvl_ts, "tv_nsec"); + timespecsub(&now, &last_disconnect, &delta); + printf(" (disconnected for %ju seconds)", + (uintmax_t)delta.tv_sec); + } + printf("\n"); + nvlist_destroy(nvl); + return (connected); +} + +static bool +scan_controller(int ctrlr) +{ struct nvme_ns_list nslist; charname[64]; - uint8_t mn[64]; uint32_tnsid; int fd, ret; @@ -132,14 +186,11 @@ scan_controller(int ctrlr) } else if (ret != 0) return (false); - if (read_controller_data(fd, &cdata) != 0) { + if (!print_controller_info(name, fd)) { close(fd); return (true); } - nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH); - printf("%6s: %s\n", name, mn); - nsid = 0; for (;;) { if (read_active_namespaces(fd, nsid, &nslist) != 0)
git: f66a407de25e - main - sys: Add cpu_update_pcb hook
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f66a407de25eaa4c58b4f6f02086d55141593b63 commit f66a407de25eaa4c58b4f6f02086d55141593b63 Author: John Baldwin AuthorDate: 2025-01-31 20:39:10 + Commit: John Baldwin CommitDate: 2025-01-31 20:40:29 + sys: Add cpu_update_pcb hook This MD function is invoked before dumping register set notes when writing out a core dump to ensure that the PCB for a given thread is up to date. This provides a centralized place to update the PCB with values of the current thread for each arch rather than doing this work in each register set's get method. Discussed with: jrtc27 Reviewed by:kib, markj Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D44910 --- share/man/man9/Makefile | 3 ++- share/man/man9/cpu_machdep.9| 23 +-- sys/amd64/amd64/ptrace_machdep.c| 4 sys/amd64/amd64/vm_machdep.c| 7 +++ sys/arm/arm/vm_machdep.c| 7 +++ sys/arm64/arm64/vm_machdep.c| 8 sys/i386/i386/vm_machdep.c | 7 +++ sys/kern/imgact_elf.c | 3 +++ sys/powerpc/include/reg.h | 5 - sys/powerpc/powerpc/elf32_machdep.c | 2 -- sys/powerpc/powerpc/elf64_machdep.c | 2 -- sys/powerpc/powerpc/exec_machdep.c | 6 +++--- sys/powerpc/powerpc/vm_machdep.c| 2 +- sys/riscv/riscv/vm_machdep.c| 5 + sys/sys/proc.h | 1 + 15 files changed, 65 insertions(+), 20 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index a284eaca5ecb..6af9880b8d57 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -931,7 +931,8 @@ MLINKS+=cpu_machdep.9 cpu_copy_thread.9 \ cpu_machdep.9 cpu_thread_clean.9 \ cpu_machdep.9 cpu_thread_exit.9 \ cpu_machdep.9 cpu_thread_free.9 \ - cpu_machdep.9 cpu_throw.9 + cpu_machdep.9 cpu_throw.9 \ + cpu_machdep.9 cpu_update_pcb.9 MLINKS+=cpuset.9 CPUSET_T_INITIALIZER.9 \ cpuset.9 CPUSET_FSET.9 \ cpuset.9 CPU_CLR.9 \ diff --git a/share/man/man9/cpu_machdep.9 b/share/man/man9/cpu_machdep.9 index 9ab42807eac1..30ac5ea36642 100644 --- a/share/man/man9/cpu_machdep.9 +++ b/share/man/man9/cpu_machdep.9 @@ -8,7 +8,7 @@ .\" Technology), and Capabilities Limited under Defense Advanced Research .\" Projects Agency (DARPA) Contract No. FA8750-24-C-B047 ("DEC"). .\" -.Dd January 3, 2025 +.Dd January 31, 2025 .Dt cpu_machdep 9 .Os .Sh NAME @@ -31,7 +31,8 @@ .Nm cpu_thread_clean , .Nm cpu_thread_exit , .Nm cpu_thread_free , -.Nm cpu_throw +.Nm cpu_throw , +.Nm cpu_update_pcb .Nd machine-dependent interfaces to handle CPU and thread state .Sh SYNOPSIS .In sys/proc.h @@ -84,6 +85,8 @@ .Fn cpu_thread_free "struct thread *td" .Ft void .Fn cpu_throw "struct thread *old" "struct thread *new" +.Ft void +.Fn cpu_update_pcb "struct thread *td" .Sh DESCRIPTION These functions provide architecture-specific implementations of machine-independent abstractions. @@ -183,6 +186,22 @@ sets a new thread's initial user thread pointer register to reference the user TLS base pointer .Fa tls_base . .Pp +.Fn cpu_update_pcb +updates the pcb of the current thread with current user register values. +This is invoked before writing out register notes in a core dump. +This function typically only has to update user registers for the current +thread that are saved in the pcb during context switches rather than +in the trapframe on kernel entry. +.Pp +Note that when +.Fn cpu_update_pcb +is used, +threads in a process other than the current thread are stopped, +typically by +.Fn thread_single . +The pcbs of those stopped threads should already be updated by +.Fn cpu_switch . +.Pp .Fn cpu_fetch_syscall_args fetches the current system call arguments for the native FreeBSD ABI from the current thread's user register state and/or user stack. diff --git a/sys/amd64/amd64/ptrace_machdep.c b/sys/amd64/amd64/ptrace_machdep.c index 3b05fded585f..715f0749bda9 100644 --- a/sys/amd64/amd64/ptrace_machdep.c +++ b/sys/amd64/amd64/ptrace_machdep.c @@ -63,8 +63,6 @@ get_segbases(struct regset *rs, struct thread *td, void *buf, reg = buf; pcb = td->td_pcb; - if (td == curthread) - update_pcb_bases(pcb); reg->r_fsbase = pcb->pcb_fsbase; reg->r_gsbase = pcb->pcb_gsbase; } @@ -113,8 +111,6 @@ get_segbases32(struct regset *rs, struct thread *td, void *buf, reg = buf; pcb = td->td_pcb; - if (td == curthread) - update_pcb_bases(pcb); reg->r_fsbase = (uint32_t)pcb->pcb_fsbase; reg->r_gsbase = (uint32_t)pcb->pcb_gsbase; } diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 1c
Re: git: e5764cf07588 - main - linuxkpi: Don't destroy the mutex in `xa_destroy()`
On Fri, Jan 31, 2025 at 04:03:27PM +, Jean-SébastienPédron wrote: > The branch main has been updated by dumbbell: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=e5764cf0758855e2d5a9ebab6d6addc6eaccd56e > > commit e5764cf0758855e2d5a9ebab6d6addc6eaccd56e > Author: Jean-Sébastien Pédron > AuthorDate: 2025-01-21 22:54:51 + > Commit: Jean-Sébastien Pédron > CommitDate: 2025-01-31 16:00:50 + > > linuxkpi: Don't destroy the mutex in `xa_destroy()` > > [Why] > The mutex initialized in `xa_init_flags()` is not destroyed here on > purpose. The reason is that on Linux, the xarray remains usable after a > call to `xa_destroy()`. For instance the i915 DRM driver relies on that > during the initialixation of its GuC. Basically, `xa_destroy()` "resets" > the structure to zero but doesn't really destroy it. > > Reviewed by:manu > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D48762 > --- > sys/compat/linuxkpi/common/src/linux_xarray.c | 12 +++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/sys/compat/linuxkpi/common/src/linux_xarray.c > b/sys/compat/linuxkpi/common/src/linux_xarray.c > index 54c536042392..3f07f6d7c59f 100644 > --- a/sys/compat/linuxkpi/common/src/linux_xarray.c > +++ b/sys/compat/linuxkpi/common/src/linux_xarray.c > @@ -362,9 +362,19 @@ xa_destroy(struct xarray *xa) > struct radix_tree_iter iter; > void **ppslot; > > + xa_lock(xa); > radix_tree_for_each_slot(ppslot, &xa->xa_head, &iter, 0) > radix_tree_iter_delete(&xa->xa_head, &iter, ppslot); > - mtx_destroy(&xa->xa_lock); > + xa_unlock(xa); > + > + /* > + * The mutex initialized in `xa_init_flags()` is not destroyed here on > + * purpose. The reason is that on Linux, the xarray remains usable > + * after a call to `xa_destroy()`. For instance the i915 DRM driver > + * relies on that during the initialixation of its GuC. Basically, > + * `xa_destroy()` "resets" the structure to zero but doesn't really > + * destroy it. > + */ > } > > /* Was this tested with WITNESS and unloading a module that created xarray? I suspect this situation should result in panic/page fault.
Re: git: 73281513fc85 - main - linuxkpi: Add `pci_wake_from_d3()`
On Fri, 31 Jan 2025, Jean-SébastienPédron wrote: The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=73281513fc8516c54ca30726498b282ca59a9fe8 commit 73281513fc8516c54ca30726498b282ca59a9fe8 Author: Jean-Sébastien Pédron AuthorDate: 2025-01-01 15:43:44 + Commit: Jean-Sébastien Pédron CommitDate: 2025-01-31 16:00:49 + linuxkpi: Add `pci_wake_from_d3()` [Why] This is used by the amdgpu DRM driver starting with Linux 6.7. [How] The function just returns 0 for now. Reviewed by:manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48759 --- sys/compat/linuxkpi/common/include/linux/pci.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 782f79080873..64f44812ee3e 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1500,4 +1500,11 @@ pci_irq_vector(struct pci_dev *pdev, unsigned int vector) return (-ENXIO); } +static inline int +pci_wake_from_d3(struct pci_dev *pdev, bool enable) +{ + This smells like it wants a pr_debug so someone will see that it needs implementation if needed in the future and not find it through debugging by accident. + return (0); +} + #endif /* _LINUXKPI_LINUX_PCI_H_ */ -- Bjoern A. Zeeb r15:7
git: 88b187401d51 - main - iflib: Simplify CACHE_PTR_NEXT
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=88b187401d5186e7274a9f064efa8a16d5fa76ea commit 88b187401d5186e7274a9f064efa8a16d5fa76ea Author: Alfredo Mazzinghi AuthorDate: 2025-01-31 20:40:48 + Commit: John Baldwin CommitDate: 2025-01-31 20:41:45 + iflib: Simplify CACHE_PTR_NEXT Reviewed by:Krzysztof Galazka Obtained from: CheriBSD Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D48446 --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 1ae2207c9d13..4c626edd8f31 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -275,7 +275,7 @@ iflib_get_extra_msix_vectors_sysctl(if_ctx_t ctx) #define IP_ALIGNED(m) uintptr_t)(m)->m_data) & 0x3) == 0x2) #define CACHE_PTR_INCREMENT(CACHE_LINE_SIZE / sizeof(void *)) -#define CACHE_PTR_NEXT(ptr)((void *)(((uintptr_t)(ptr) + CACHE_LINE_SIZE - 1) & (CACHE_LINE_SIZE - 1))) +#define CACHE_PTR_NEXT(ptr)((void *)(roundup2(ptr, CACHE_LINE_SIZE))) #define LINK_ACTIVE(ctx) ((ctx)->ifc_link_state == LINK_STATE_UP) #define CTX_IS_VF(ctx) ((ctx)->ifc_sctx->isc_flags & IFLIB_IS_VF)
git: 2d99af941040 - main - tcp: remove check for condition that never happens
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=2d99af941040548234c7945cc6d62c416bd9133c commit 2d99af941040548234c7945cc6d62c416bd9133c Author: Gleb Smirnoff AuthorDate: 2025-01-31 22:24:24 + Commit: Gleb Smirnoff CommitDate: 2025-01-31 22:24:24 + tcp: remove check for condition that never happens A tcpcb in TCPS_LISTEN has always socket in SO_ACCEPTCONN. One block above there is an assertion that proves that this never happens. We stopped ever clearing SO_ACCEPTCONN back in 779f106aa169. This reverts commit 982c1675ff8864f51007e0be402ead88429222bb. Reviewed by:cc, markj Differential Revision: https://reviews.freebsd.org/D48710 --- sys/netinet/tcp_input.c | 9 - 1 file changed, 9 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 03d493b1d7a9..647bcd17f7bc 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1354,15 +1354,6 @@ tfo_socket_result: * Only the listen socket is unlocked by syncache_add(). */ return (IPPROTO_DONE); - } else if (tp->t_state == TCPS_LISTEN) { - /* -* When a listen socket is torn down the SO_ACCEPTCONN -* flag is removed first while connections are drained -* from the accept queue in a unlock/lock cycle of the -* ACCEPT_LOCK, opening a race condition allowing a SYN -* attempt go through unhandled. -*/ - goto dropunlock; } #if defined(IPSEC_SUPPORT) || defined(TCP_SIGNATURE) if (tp->t_flags & TF_SIGNATURE) {