6.1.110-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 156/192 fuse: add request extension
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit 15d937d7ca8c55d2b0ce9116e20c780fdd0b67cc ]
Will need to add supplementary groups to create messages, so add the general concept of a request extension. A request extension is appended to the end of the main request. It has a header indicating the size and type of the extension.
The create security context (fuse_secctx_*) is similar to the generic request extension, so include that as well in a backward compatible manner.
Add the total extension length to the request header. The offset of the extension block within the request can be calculated by:
inh->len - inh->total_extlen * 8
Stable-dep-of: 3002240d1649 ("fuse: fix memory leak in fuse_create_open")
--- fs/fuse/dev.c | 2 ++ fs/fuse/dir.c | 66 ++++++++++++++++++++++----------------- fs/fuse/fuse_i.h | 6 ++-- include/uapi/linux/fuse.h | 28 ++++++++++++++++- 4 files changed, 71 insertions(+), 31 deletions(-)
fs/fuse/dev.c +2 -0
@@ -476,6 +476,8 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args) req->in.h.opcode = args->opcode; req->in.h.nodeid = args->nodeid; req->args = args; +if (args->is_ext) + req->in.h.total_extlen = args->in_args[args->ext_idx].size /8 ;if (args->end)__set_bit (FR_ASYNC , &req->flags); }
fs/fuse/dir.c +38 -28
115 lines not on this page · raw message
fs/fuse/fuse_i.h +4 -2
@@ -264,8 +264,9 @@ struct fuse_page_desc {struct fuse_args {uint64_t nodeid;uint32_t opcode; -unsigned short in_numargs; -unsigned short out_numargs; +uint8_t in_numargs; +uint8_t out_numargs; +uint8_t ext_idx;bool force:1 ;bool noreply:1 ;bool nocreds:1 ;
@@ -276,6 +277,7 @@ struct fuse_args { bool page_zeroing:1; bool page_replace:1; bool may_block:1; + bool is_ext:1;struct fuse_in_arg in_args[3 ];struct fuse_arg out_args[2 ];void (*end)(struct fuse_mount *fm,struct fuse_args *args,int error);
include/uapi/linux/fuse.h +27 -1
@@ -201,6 +201,9 @@* 7.38 * - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry * - add FOPEN_PARALLEL_DIRECT_WRITES +* - add total_extlen to fuse_in_header +* - add FUSE_MAX_NR_SECCTX +* - add extension header */ #ifndef _LINUX_FUSE_H
@@ -503,6 +506,15 @@ struct fuse_file_lock {*/ #define FUSE_EXPIRE_ONLY (1 << 0) +/** +* extension type +* FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx +*/ +enum fuse_ext_type { +/* Types 0..31 are reserved for fuse_secctx_header */ +FUSE_MAX_NR_SECCTX =31 , +}; +enum fuse_opcode {FUSE_LOOKUP =1 ,FUSE_FORGET =2 ,/* no reply */
@@ -886,7 +898,8 @@ struct fuse_in_header {uint32_t uid;uint32_t gid;uint32_t pid; -uint32_t padding; +uint16_t total_extlen;/* length of extensions in 8byte units */ +uint16_t padding; };struct fuse_out_header {
@@ -1047,4 +1060,17 @@ struct fuse_secctx_header { uint32_t nr_secctx; }; +/** +* struct fuse_ext_header - extension header +* @size: total size of this extension including this header +* @type: type of extension +* +* This is made compatible with fuse_secctx_header by using type values > +* FUSE_MAX_NR_SECCTX +*/ +struct fuse_ext_header { +uint32_t size; +uint32_t type; +}; +#endif /* _LINUX_FUSE_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/192 fuse: fix memory leak in fuse_create_open
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: yangyun <[email protected]>
[ Upstream commit 3002240d16494d798add0575e8ba1f284258ab34 ]
The memory of struct fuse_file is allocated but not freed when get_create_ext return error.
--- fs/fuse/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/dir.c +1 -1
@@ -618,7 +618,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, err =get_create_ext (&args, entry, mode);if (err) - goto out_put_forget_req; + goto out_free_ff; err =fuse_simple_request (fm, &args);free_ext_value (&args);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/192 x86/mm/pae: Make pmd_t similar to pte_t
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit fbfdec9989e69e0b17aa3bf32fcb22d04cc33301 ]
Instead of mucking about with at least 2 different ways of fudging it, do the same thing we do for pte_t.
Stable-dep-of: 71c186efc1b2 ("userfaultfd: fix checks for huge PMDs")
--- arch/x86/include/asm/pgtable-3level.h | 42 +++++++-------------- arch/x86/include/asm/pgtable-3level_types.h | 7 ++++ arch/x86/include/asm/pgtable_64_types.h | 1 + arch/x86/include/asm/pgtable_types.h | 4 +- 4 files changed, 23 insertions(+), 31 deletions(-)
arch/x86/include/asm/pgtable-3level.h +14 -28
@@ -87,7 +87,7 @@ static inline pmd_t pmd_read_atomic(pmd_t *pmdp) ret |= ((pmdval_t)*(tmp +1 )) <<32 ; } -return (pmd_t ) { ret }; +return (pmd_t ) { .pmd = ret }; }static inline void native_set_pte_atomic (pte_t *ptep,pte_t pte)
@@ -121,12 +121,11 @@ static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, ptep->pte_high =0 ; } -static inline void native_pmd_clear (pmd_t *pmd) +static inline void native_pmd_clear (pmd_t *pmdp) { -u32 *tmp = (u32 *)pmd; - *tmp =0 ; + pmdp->pmd_low =0 ;smp_wmb (); - *(tmp +1 ) =0 ; + pmdp->pmd_high =0 ; }static inline void native_pud_clear (pud_t *pudp)
@@ -162,25 +161,17 @@ static inline pte_t native_ptep_get_and_clear(pte_t *ptep)#define native_ptep_get_and_clear (xp) native_local_ptep_get_and_clear(xp)#endif -union split_pmd { -struct { -u32 pmd_low; -u32 pmd_high; - }; -pmd_t pmd; -}; -#ifdef CONFIG_SMP static inline pmd_t native_pmdp_get_and_clear (pmd_t *pmdp) { -union split_pmd res, *orig = (union split_pmd *)pmdp; +pmd_t res;/* xchg acts as a barrier before setting of the high bits */ - res.pmd_low =xchg (&orig->pmd_low,0 ); - res.pmd_high = orig->pmd_high; - orig->pmd_high =0 ; + res.pmd_low =xchg (&pmdp->pmd_low,0 ); + res.pmd_high =READ_ONCE (pmdp->pmd_high); +WRITE_ONCE (pmdp->pmd_high,0 ); -return res.pmd; +return res; }#else #define native_pmdp_get_and_clear (xp) native_local_pmdp_get_and_clear(xp)
@@ -199,17 +190,12 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,* anybody. */ if (!(pmd_val (pmd) & _PAGE_PRESENT)) { -union split_pmd old, new, *ptr; - - ptr = (union split_pmd *)pmdp; - - new.pmd = pmd; -/* xchg acts as a barrier before setting of the high bits */ - old.pmd_low =xchg (&ptr->pmd_low, new.pmd_low); - old.pmd_high = ptr->pmd_high; - ptr->pmd_high = new.pmd_high; -return old.pmd; + old.pmd_low =xchg (&pmdp->pmd_low, pmd.pmd_low); + old.pmd_high =READ_ONCE (pmdp->pmd_high); +WRITE_ONCE (pmdp->pmd_high, pmd.pmd_high); + +return old; } do {
arch/x86/include/asm/pgtable-3level_types.h +7 -0
@@ -18,6 +18,13 @@ typedef union { };pteval_t pte; } pte_t; + +typedef union { +struct { +unsigned long pmd_low, pmd_high; + }; +pmdval_t pmd; +}pmd_t ;#endif /* !__ASSEMBLY__ */ #define SHARED_KERNEL_PMD (!static_cpu_has(X86_FEATURE_PTI))
arch/x86/include/asm/pgtable_64_types.h +1 -0
@@ -19,6 +19,7 @@ typedef unsigned long pgdval_t;typedef unsigned long pgprotval_t ;typedef struct {pteval_t pte; }pte_t ; +typedef struct {pmdval_t pmd; }pmd_t ;#ifdef CONFIG_X86_5LEVEL extern unsigned int __pgtable_l5_enabled;
arch/x86/include/asm/pgtable_types.h +1 -3
@@ -363,11 +363,9 @@ static inline pudval_t native_pud_val(pud_t pud)#endif #if CONFIG_PGTABLE_LEVELS >2 -typedef struct {pmdval_t pmd; }pmd_t ; -static inline pmd_t native_make_pmd (pmdval_t val) { -return (pmd_t ) { val }; +return (pmd_t ) { .pmd = val }; }static inline pmdval_t native_pmd_val (pmd_t pmd)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/192 mm: Fix pmd_read_atomic()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 024d232ae4fcd7a7ce8ea239607d6c1246d7adc8 ]
AFAICT there's no reason to do anything different than what we do for PTEs. Make it so (also affects SH).
Stable-dep-of: 71c186efc1b2 ("userfaultfd: fix checks for huge PMDs")
--- arch/x86/include/asm/pgtable-3level.h | 56 --------------------------- include/linux/pgtable.h | 47 +++++++++++++++++----- 2 files changed, 37 insertions(+), 66 deletions(-)
arch/x86/include/asm/pgtable-3level.h +0 -56
@@ -34,62 +34,6 @@ static inline void native_set_pte(pte_t *ptep, pte_t pte) ptep->pte_low = pte.pte_low; } -#define pmd_read_atomic pmd_read_atomic -/* -* pte_offset_map_lock() on 32-bit PAE kernels was reading the pmd_t with -* a "*pmdp" dereference done by GCC. Problem is, in certain places -* where pte_offset_map_lock() is called, concurrent page faults are -* allowed, if the mmap_lock is hold for reading. An example is mincore -* vs page faults vs MADV_DONTNEED. On the page fault side -* pmd_populate() rightfully does a set_64bit(), but if we're reading the -* pmd_t with a "*pmdp" on the mincore side, a SMP race can happen -* because GCC will not read the 64-bit value of the pmd atomically. -* -* To fix this all places running pte_offset_map_lock() while holding the -* mmap_lock in read mode, shall read the pmdp pointer using this -* function to know if the pmd is null or not, and in turn to know if -* they can run pte_offset_map_lock() or pmd_trans_huge() or other pmd -* operations. -* -* Without THP if the mmap_lock is held for reading, the pmd can only -* transition from null to not null while pmd_read_atomic() runs. So -* we can always return atomic pmd values with this function. -* -* With THP if the mmap_lock is held for reading, the pmd can become -* trans_huge or none or point to a pte (and in turn become "stable") -* at any time under pmd_read_atomic(). We could read it truly -* atomically here with an atomic64_read() for the THP enabled case (and -* it would be a whole lot simpler), but to avoid using cmpxchg8b we -* only return an atomic pmdval if the low part of the pmdval is later -* found to be stable (i.e. pointing to a pte). We are also returning a -* 'none' (zero) pmdval if the low part of the pmd is zero. -* -* In some cases the high and low part of the pmdval returned may not be -* consistent if THP is enabled (the low part may point to previously -* mapped hugepage, while the high part may point to a more recently -* mapped hugepage), but pmd_none_or_trans_huge_or_clear_bad() only -* needs the low part of the pmd to be read atomically to decide if the -* pmd is unstable or not, with the only exception when the low part -* of the pmd is zero, in which case we return a 'none' pmd. -*/ -static inline pmd_t pmd_read_atomic (pmd_t *pmdp) -{ -pmdval_t ret; -u32 *tmp = (u32 *)pmdp; - - ret = (pmdval_t) (*tmp); -if (ret) { -/* -* If the low part is null, we must not read the high part -* or we can end up with a partial pmd. -*/ -smp_rmb (); - ret |= ((pmdval_t)*(tmp +1 )) <<32 ; - } - -return (pmd_t ) { .pmd = ret }; -} -static inline void native_set_pte_atomic (pte_t *ptep,pte_t pte) {set_64bit ((unsigned long long *)(ptep),native_pte_val (pte));
include/linux/pgtable.h +37 -10
75 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/192 mm: Rename pmd_read_atomic()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit dab6e717429e5ec795d558a0e9a5337a1ed33a3d ]
There's no point in having the identical routines for PTE/PMD have different names.
Stable-dep-of: 71c186efc1b2 ("userfaultfd: fix checks for huge PMDs")
--- include/linux/pgtable.h | 9 ++------- mm/hmm.c | 2 +- mm/khugepaged.c | 2 +- mm/mapping_dirty_helpers.c | 2 +- mm/mprotect.c | 2 +- mm/userfaultfd.c | 2 +- mm/vmscan.c | 4 ++-- 7 files changed, 9 insertions(+), 14 deletions(-)
include/linux/pgtable.h +2 -7
@@ -1373,11 +1373,6 @@ static inline int pud_trans_unstable(pud_t *pud)#endif } -static inline pmd_t pmd_read_atomic (pmd_t *pmdp) -{ -return pmdp_get_lockless (pmdp); -} -#ifndef arch_needs_pgtable_deposit#define arch_needs_pgtable_deposit () (false)#endif
@@ -1404,13 +1399,13 @@ static inline pmd_t pmd_read_atomic(pmd_t *pmdp)*/ static inline int pmd_none_or_trans_huge_or_clear_bad (pmd_t *pmd) { -pmd_t pmdval =pmd_read_atomic (pmd); +pmd_t pmdval =pmdp_get_lockless (pmd);/* * The barrier will stabilize the pmdval in a register or on * the stack so that it will stop changing under the code. * * When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE, -* pmd_read_atomic is allowed to return a not atomic pmdval +* pmdp_get_lockless is allowed to return a not atomic pmdval * (for example pointing to an hugepage that has never been * mapped in the pmd). The below checks will only care about * the low part of the pmd with 32bit PAE x86 anyway, with the
mm/hmm.c +1 -1
@@ -361,7 +361,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,* huge or device mapping one and compute corresponding pfn * values. */ - pmd =pmd_read_atomic (pmdp); + pmd =pmdp_get_lockless (pmdp);barrier ();if (!pmd_devmap (pmd) && !pmd_trans_huge (pmd)) goto again;
mm/khugepaged.c +1 -1
@@ -866,7 +866,7 @@ static int find_pmd_or_thp_or_none(struct mm_struct *mm,if (!*pmd)return SCAN_PMD_NULL ; - pmde =pmd_read_atomic (*pmd); + pmde =pmdp_get_lockless (*pmd);#ifdef CONFIG_TRANSPARENT_HUGEPAGE /* See comments in pmd_none_or_trans_huge_or_clear_bad() */
mm/mapping_dirty_helpers.c +1 -1
@@ -126,7 +126,7 @@ static int clean_record_pte(pte_t *pte, unsigned long addr,static int wp_clean_pmd_entry (pmd_t *pmd,unsigned long addr,unsigned long end,struct mm_walk *walk) { -pmd_t pmdval =pmd_read_atomic (pmd); +pmd_t pmdval =pmdp_get_lockless (pmd);if (!pmd_trans_unstable (&pmdval))return 0 ;
mm/mprotect.c +1 -1
@@ -294,7 +294,7 @@ static unsigned long change_pte_range(struct mmu_gather *tlb,*/ static inline int pmd_none_or_clear_bad_unless_trans_huge (pmd_t *pmd) { -pmd_t pmdval =pmd_read_atomic (pmd); +pmd_t pmdval =pmdp_get_lockless (pmd);/* See pmd_none_or_trans_huge_or_clear_bad for info on barrier */ #ifdef CONFIG_TRANSPARENT_HUGEPAGE
mm/userfaultfd.c +1 -1
@@ -641,7 +641,7 @@ static __always_inline ssize_t __mcopy_atomic(struct mm_struct *dst_mm,break ; } - dst_pmdval =pmd_read_atomic (dst_pmd); + dst_pmdval =pmdp_get_lockless (dst_pmd);/* * If the dst_pmd is mapped as THP don't * override it and just be strict.
mm/vmscan.c +2 -2
@@ -4068,9 +4068,9 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,/* walk_pte_range() may call get_next_vma() */ vma = args->vma;for (i =pmd_index (start), addr = start; addr != end; i++, addr = next) { -pmd_t val =pmd_read_atomic (pmd + i); +pmd_t val =pmdp_get_lockless (pmd + i); -/* for pmd_read_atomic() */ +/* for pmdp_get_lockless() */ barrier (); next =pmd_addr_end (addr, end);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/192 userfaultfd: fix checks for huge PMDs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 71c186efc1b2cf1aeabfeff3b9bd5ac4c5ac14d8 ]
Patch series "userfaultfd: fix races around pmd_trans_huge() check", v2.
The pmd_trans_huge() code in mfill_atomic() is wrong in three different ways depending on kernel version:
1. The pmd_trans_huge() check is racy and can lead to a BUG_ON() (if you hit the right two race windows) - I've tested this in a kernel build with some extra mdelay() calls. See the commit message for a description of the race scenario.
On older kernels (before 6.5), I think the same bug can even theoretically lead to accessing transhuge page contents as a page table if you hit the right 5 narrow race windows (I haven't tested this case).
2. As pointed out by Qi Zheng, pmd_trans_huge() is not sufficient for detecting PMDs that don't point to page tables.
On older kernels (before 6.5), you'd just have to win a single fairly wide race to hit this.
I've tested this on 6.1 stable by racing migration (with a mdelay() patched into try_to_migrate()) against UFFDIO_ZEROPAGE - on my x86 VM, that causes a kernel oops in ptlock_ptr().
3. On newer kernels (>=6.5), for shmem mappings, khugepaged is allowed to yank page tables out from under us (though I haven't tested that), so I think the BUG_ON() checks in mfill_atomic() are just wrong.
I decided to write two separate fixes for these (one fix for bugs 1+2, one fix for bug 3), so that the first fix can be backported to kernels affected by bugs 1+2.
This patch (of 2):
This fixes two issues.
I discovered that the following race can occur:
mfill_atomic other thread
============ ============
<zap PMD>
pmdp_get_lockless() [reads none pmd]
<bail if trans_huge>
<if none:>
<pagefault creates transhuge zeropage>
__pte_alloc [no-op]
<zap PMD>
<bail if pmd_trans_huge(*dst_pmd)> BUG_ON(pmd_none(*dst_pmd))
I have experimentally verified this in a kernel with extra mdelay() calls; the BUG_ON(pmd_none(*dst_pmd)) triggers.
On kernels newer than commit 0d940a9b270b ("mm/pgtable: allow pte_offset_map[_lock]() to fail"), this can't lead to anything worse than a BUG_ON(), since the page table access helpers are actually designed to deal with page tables concurrently disappearing; but on older kernels (<=6.4), I think we could probably theoretically race past the two BUG_ON() checks and end up treating a hugepage as a page table.
The second issue is that, as Qi Zheng pointed out, there are other types of huge PMDs that pmd_trans_huge() can't catch: devmap PMDs and swap PMDs (in particular, migration PMDs).
On <=6.4, this is worse than the first issue: If mfill_atomic() runs on a PMD that contains a migration entry (which just requires winning a single, fairly wide race), it will pass the PMD to pte_offset_map_lock(), which assumes that the PMD points to a page table.
Breakage follows: First, the kernel tries to take the PTE lock (which will crash or maybe worse if there is no "struct page" for the address bits in the migration entry PMD - I think at least on X86 there usually is no corresponding "struct page" thanks to the PTE inversion mitigation, amd64 looks different).
If that didn't crash, the kernel would next try to write a PTE into what it wrongly thinks is a page table.
As part of fixing these issues, get rid of the check for pmd_trans_huge() before __pte_alloc() - that's redundant, we're going to have to check for that after the __pte_alloc() anyway.
Backport note: pmdp_get_lockless() is pmd_read_atomic() in older kernels.
--- mm/userfaultfd.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
mm/userfaultfd.c +12 -10
@@ -642,21 +642,23 @@ static __always_inline ssize_t __mcopy_atomic(struct mm_struct *dst_mm, } dst_pmdval =pmdp_get_lockless (dst_pmd); -/* -* If the dst_pmd is mapped as THP don't -* override it and just be strict. -*/ -if (unlikely (pmd_trans_huge (dst_pmdval))) { - err = -EEXIST ; -break ; - }if (unlikely (pmd_none (dst_pmdval)) &&unlikely (__pte_alloc (dst_mm, dst_pmd))) { err = -ENOMEM ;break ; } -/* If an huge pmd materialized from under us fail */ -if (unlikely (pmd_trans_huge (*dst_pmd))) { + dst_pmdval =pmdp_get_lockless (dst_pmd); +/* +* If the dst_pmd is THP don't override it and just be strict. +* (This includes the case where the PMD used to be THP and +* changed back to none after __pte_alloc().) +*/ +if (unlikely (!pmd_present (dst_pmdval) ||pmd_trans_huge (dst_pmdval) || +pmd_devmap (dst_pmdval))) { + err = -EEXIST ; +break ; + } +if (unlikely (pmd_bad (dst_pmdval))) { err = -EFAULT ;break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/192 net: mana: Fix error handling in mana_create_txq/rxqs NAPI cleanup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Souradeep Chakrabarti <[email protected]>
[ Upstream commit b6ecc662037694488bfff7c9fd21c405df8411f2 ]
Currently napi_disable() gets called during rxq and txq cleanup, even before napi is enabled and hrtimer is initialized. It causes kernel panic.
? page_fault_oops+0x136/0x2b0 ? page_counter_cancel+0x2e/0x80 ? do_user_addr_fault+0x2f2/0x640 ? refill_obj_stock+0xc4/0x110 ? exc_page_fault+0x71/0x160 ? asm_exc_page_fault+0x27/0x30 ? __mmdrop+0x10/0x180 ? __mmdrop+0xec/0x180 ? hrtimer_active+0xd/0x50 hrtimer_try_to_cancel+0x2c/0xf0 hrtimer_cancel+0x15/0x30 napi_disable+0x65/0x90 mana_destroy_rxq+0x4c/0x2f0 mana_create_rxq.isra.0+0x56c/0x6d0 ? mana_uncfg_vport+0x50/0x50 mana_alloc_queues+0x21b/0x320 ? skb_dequeue+0x5f/0x80
--- drivers/net/ethernet/microsoft/mana/mana.h | 2 ++ drivers/net/ethernet/microsoft/mana/mana_en.c | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-)
drivers/net/ethernet/microsoft/mana/mana.h +2 -0
@@ -86,6 +86,8 @@ struct mana_txq {atomic_t pending_sends; +bool napi_initialized; +struct mana_stats_tx stats; };
drivers/net/ethernet/microsoft/mana/mana_en.c +13 -9
@@ -1391,10 +1391,12 @@ static void mana_destroy_txq(struct mana_port_context *apc)for (i =0 ; i < apc->num_queues; i++) { napi = &apc->tx_qp[i].tx_cq.napi; -napi_synchronize (napi); -napi_disable (napi); -netif_napi_del (napi); - +if (apc->tx_qp[i].txq.napi_initialized) { +napi_synchronize (napi); +napi_disable (napi); +netif_napi_del (napi); + apc->tx_qp[i].txq.napi_initialized = false; + }mana_destroy_wq_obj (apc,GDMA_SQ , apc->tx_qp[i].tx_object);mana_deinit_cq (apc, &apc->tx_qp[i].tx_cq);
@@ -1450,6 +1452,7 @@ static int mana_create_txq(struct mana_port_context *apc, txq->ndev = net; txq->net_txq =netdev_get_tx_queue (net, i); txq->vp_offset = apc->tx_vp_offset; + txq->napi_initialized = false;skb_queue_head_init (&txq->pending_skbs);memset (&spec,0 ,sizeof (spec));
@@ -1514,6 +1517,7 @@ static int mana_create_txq(struct mana_port_context *apc,netif_napi_add_tx (net, &cq->napi, mana_poll);napi_enable (&cq->napi); + txq->napi_initialized = true;mana_gd_ring_cq (cq->gdma_cq,SET_ARM_BIT ); }
@@ -1525,7 +1529,7 @@ static int mana_create_txq(struct mana_port_context *apc, }static void mana_destroy_rxq (struct mana_port_context *apc, -struct mana_rxq *rxq,bool validate_state) +struct mana_rxq *rxq,bool napi_initialized) {struct gdma_context *gc = apc->ac->gdma_dev->gdma_context;
@@ -1539,15 +1543,15 @@ static void mana_destroy_rxq(struct mana_port_context *apc, napi = &rxq->rx_cq.napi; -if (validate_state) +if (napi_initialized) {napi_synchronize (napi); -napi_disable (napi); +napi_disable (napi); +netif_napi_del (napi); + }xdp_rxq_info_unreg (&rxq->xdp_rxq); -netif_napi_del (napi); -mana_destroy_wq_obj (apc,GDMA_RQ , rxq->rxobj);mana_deinit_cq (apc, &rxq->rx_cq);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/192 workqueue: wq_watchdog_touch is always called with valid CPU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
[ Upstream commit 18e24deb1cc92f2068ce7434a94233741fbd7771 ]
Warn in the case it is called with cpu == -1. This does not appear to happen anywhere.
--- kernel/workqueue.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/workqueue.c +2 -0
@@ -5893,6 +5893,8 @@ notrace void wq_watchdog_touch(int cpu) {if (cpu >=0 )per_cpu (wq_watchdog_touched_cpu, cpu) = jiffies; +else +WARN_ONCE (1 ,"%s should be called with valid CPU" , __func__); wq_watchdog_touched = jiffies; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/192 workqueue: Improve scalability of workqueue watchdog touch
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
[ Upstream commit 98f887f820c993e05a12e8aa816c80b8661d4c87 ]
On a ~2000 CPU powerpc system, hard lockups have been observed in the workqueue code when stop_machine runs (in this case due to CPU hotplug). This is due to lots of CPUs spinning in multi_cpu_stop, calling touch_nmi_watchdog() which ends up calling wq_watchdog_touch(). wq_watchdog_touch() writes to the global variable wq_watchdog_touched, and that can find itself in the same cacheline as other important workqueue data, which slows down operations to the point of lockups.
In the case of the following abridged trace, worker_pool_idr was in the hot line, causing the lockups to always appear at idr_find.
watchdog: CPU 1125 self-detected hard LOCKUP @ idr_find
Call Trace: get_work_pool __queue_work call_timer_fn run_timer_softirq __do_softirq do_softirq_own_stack irq_exit timer_interrupt decrementer_common_virt * interrupt: 900 (timer) at multi_cpu_stop multi_cpu_stop cpu_stopper_thread smpboot_thread_fn kthread
Fix this by having wq_watchdog_touch() only write to the line if the last time a touch was recorded exceeds 1/4 of the watchdog threshold.
--- kernel/workqueue.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
kernel/workqueue.c +8 -2
@@ -5891,12 +5891,18 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) notrace void wq_watchdog_touch(int cpu) { +unsigned long thresh =READ_ONCE (wq_watchdog_thresh) *HZ ; +unsigned long touch_ts =READ_ONCE (wq_watchdog_touched); +unsigned long now = jiffies; +if (cpu >=0 ) -per_cpu (wq_watchdog_touched_cpu, cpu) = jiffies; +per_cpu (wq_watchdog_touched_cpu, cpu) = now;else WARN_ONCE (1 ,"%s should be called with valid CPU" , __func__); - wq_watchdog_touched = jiffies; +/* Don't unnecessarily store to global cacheline */ +if (time_after (now, touch_ts + thresh /4 )) +WRITE_ONCE (wq_watchdog_touched, jiffies); }static void wq_watchdog_set_thresh (unsigned long thresh)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/192 ACPI: processor: Return an error if acpi_processor_get_info() fails in processor_add()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit fadf231f0a06a6748a7fc4a2c29ac9ef7bca6bfd ]
Rafael observed [1] that returning 0 from processor_add() will result in acpi_default_enumeration() being called which will attempt to create a platform device, but that makes little sense when the processor is known to be not available. So just return the error code from acpi_processor_get_info() instead.
--- drivers/acpi/acpi_processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpi_processor.c +1 -1
@@ -373,7 +373,7 @@ static int acpi_processor_add(struct acpi_device *device, result =acpi_processor_get_info (device);if (result)/* Processor is not physically present or unavailable */ -return 0 ; +return result;BUG_ON (pr->id >= nr_cpu_ids);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/192 ACPI: processor: Fix memory leaks in error paths of processor_add()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 47ec9b417ed9b6b8ec2a941cd84d9de62adc358a ]
If acpi_processor_get_info() returned an error, pr and the associated pr->throttling.shared_cpu_map were leaked.
The unwind code was in the wrong order wrt to setup, relying on some unwind actions having no affect (clearing variables that were never set etc). That makes it harder to reason about so reorder and add appropriate labels to only undo what was actually set up in the first place.
--- drivers/acpi/acpi_processor.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/acpi/acpi_processor.c +8 -7
@@ -373,7 +373,7 @@ static int acpi_processor_add(struct acpi_device *device, result =acpi_processor_get_info (device);if (result)/* Processor is not physically present or unavailable */ -return result; + goto err_clear_driver_data;BUG_ON (pr->id >= nr_cpu_ids);
@@ -388,7 +388,7 @@ static int acpi_processor_add(struct acpi_device *device,"BIOS reported wrong ACPI id %d for the processor\n" , pr->id);/* Give up, but do not abort the namespace scan. */ - goto err; + goto err_clear_driver_data; }/* * processor_device_array is not cleared on errors to allow buggy BIOS
@@ -400,12 +400,12 @@ static int acpi_processor_add(struct acpi_device *device, dev =get_cpu_device (pr->id);if (!dev) { result = -ENODEV ; - goto err; + goto err_clear_per_cpu; } result =acpi_bind_one (dev, device);if (result) - goto err; + goto err_clear_per_cpu; pr->dev = dev;
@@ -416,10 +416,11 @@ static int acpi_processor_add(struct acpi_device *device,dev_err (dev,"Processor driver could not be attached\n" );acpi_unbind_one (dev); - err: -free_cpumask_var (pr->throttling.shared_cpu_map); - device->driver_data =NULL ; + err_clear_per_cpu:per_cpu (processors, pr->id) =NULL ; + err_clear_driver_data: + device->driver_data =NULL ; +free_cpumask_var (pr->throttling.shared_cpu_map); err_free_pr:kfree (pr);return result;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/192 arm64: acpi: Move get_cpu_for_acpi_id() to a header
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
[ Upstream commit 8d34b6f17b9ac93faa2791eb037dcb08bdf755de ]
ACPI identifies CPUs by UID. get_cpu_for_acpi_id() maps the ACPI UID to the Linux CPU number.
The helper to retrieve this mapping is only available in arm64's NUMA code.
Move it to live next to get_acpi_id_for_cpu().
--- arch/arm64/include/asm/acpi.h | 11 +++++++++++ arch/arm64/kernel/acpi_numa.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-)
arch/arm64/include/asm/acpi.h +11 -0
@@ -97,6 +97,17 @@ static inline u32 get_acpi_id_for_cpu(unsigned int cpu)return acpi_cpu_get_madt_gicc (cpu)->uid; } +static inline int get_cpu_for_acpi_id (u32 uid) +{ +int cpu; + +for (cpu =0 ; cpu < nr_cpu_ids; cpu++) +if (uid ==get_acpi_id_for_cpu (cpu)) +return cpu; + +return -EINVAL ; +} +static inline void arch_fix_phys_package_id (int num,u32 slot) { }void __init acpi_init_cpus (void );int apei_claim_sea (struct pt_regs *regs);
arch/arm64/kernel/acpi_numa.c +0 -11
@@ -34,17 +34,6 @@ int __init acpi_numa_get_nid(unsigned int cpu)return acpi_early_node_map[cpu]; } -static inline int get_cpu_for_acpi_id (u32 uid) -{ -int cpu; - -for (cpu =0 ; cpu < nr_cpu_ids; cpu++) -if (uid ==get_acpi_id_for_cpu (cpu)) -return cpu; - -return -EINVAL ; -} -static int __init acpi_parse_gicc_pxm (union acpi_subtable_headers *header,const unsigned long end) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/192 arm64: acpi: Harden get_cpu_for_acpi_id() against missing CPU entry
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 2488444274c70038eb6b686cba5f1ce48ebb9cdd ]
In a review discussion of the changes to support vCPU hotplug where a check was added on the GICC being enabled if was online, it was noted that there is need to map back to the cpu and use that to index into a cpumask. As such, a valid ID is needed.
If an MPIDR check fails in acpi_map_gic_cpu_interface() it is possible for the entry in cpu_madt_gicc[cpu] == NULL. This function would
then cause a NULL pointer dereference. Whilst a path to trigger
this has not been established, harden this caller against the possibility.
--- arch/arm64/include/asm/acpi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/acpi.h +2 -1
@@ -102,7 +102,8 @@ static inline int get_cpu_for_acpi_id(u32 uid)int cpu;for (cpu =0 ; cpu < nr_cpu_ids; cpu++) -if (uid ==get_acpi_id_for_cpu (cpu)) +if (acpi_cpu_get_madt_gicc (cpu) && + uid ==get_acpi_id_for_cpu (cpu))return cpu;return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/192 can: mcp251xfd: mcp251xfd_handle_rxif_ring_uinc(): factor out in separate function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
[ Upstream commit d49184b7b585f9da7ee546b744525f62117019f6 ]
This is a preparation patch.
Sending the UINC messages followed by incrementing the tail pointer will be called in more than one place in upcoming patches, so factor this out into a separate function.
Also make mcp251xfd_handle_rxif_ring_uinc() safe to be called with a "len" of 0.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c | 48 +++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c +32 -16
@@ -197,6 +197,37 @@ mcp251xfd_rx_obj_read(const struct mcp251xfd_priv *priv,return err; } +static int +mcp251xfd_handle_rxif_ring_uinc (const struct mcp251xfd_priv *priv, +struct mcp251xfd_rx_ring *ring, +u8 len) +{ +int offset; +int err; + +if (!len) +return 0 ; + +/* Increment the RX FIFO tail pointer 'len' times in a +* single SPI message. +* +* Note: +* Calculate offset, so that the SPI transfer ends on +* the last message of the uinc_xfer array, which has +* "cs_change == 0", to properly deactivate the chip +* select. +*/ + offset =ARRAY_SIZE (ring->uinc_xfer) - len; + err =spi_sync_transfer (priv->spi, + ring->uinc_xfer + offset, len); +if (err) +return err; + + ring->tail += len; + +return 0 ; +} +static int mcp251xfd_handle_rxif_ring (struct mcp251xfd_priv *priv,struct mcp251xfd_rx_ring *ring)
@@ -210,8 +241,6 @@ mcp251xfd_handle_rxif_ring(struct mcp251xfd_priv *priv,return err;while ((len =mcp251xfd_get_rx_linear_len (ring))) { -int offset; - rx_tail =mcp251xfd_get_rx_tail (ring); err = mcp251xfd_rx_obj_read(priv, ring, hw_rx_obj,
@@ -227,22 +256,9 @@ mcp251xfd_handle_rxif_ring(struct mcp251xfd_priv *priv,return err; } -/* Increment the RX FIFO tail pointer 'len' times in a -* single SPI message. -* -* Note: -* Calculate offset, so that the SPI transfer ends on -* the last message of the uinc_xfer array, which has -* "cs_change == 0", to properly deactivate the chip -* select. -*/ - offset =ARRAY_SIZE (ring->uinc_xfer) - len; - err =spi_sync_transfer (priv->spi, - ring->uinc_xfer + offset, len); + err =mcp251xfd_handle_rxif_ring_uinc (priv, ring, len);if (err)return err; - - ring->tail += len; }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/192 can: mcp251xfd: rx: prepare to workaround broken RX FIFO head index erratum
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
[ Upstream commit 85505e585637a737e4713c1386c30e37c325b82e ]
This is a preparatory patch to work around erratum DS80000789E 6 of the mcp2518fd, the other variants of the chip family (mcp2517fd and mcp251863) are probably also affected.
When handling the RX interrupt, the driver iterates over all pending FIFOs (which are implemented as ring buffers in hardware) and reads the FIFO header index from the RX FIFO STA register of the chip.
In the bad case, the driver reads a too large head index. In the original code, the driver always trusted the read value, which caused old CAN frames that were already processed, or new, incompletely written CAN frames to be (re-)processed.
Instead of reading and trusting the head index, read the head index and calculate the number of CAN frames that were supposedly received - replace mcp251xfd_rx_ring_update() with mcp251xfd_get_rx_len().
The mcp251xfd_handle_rxif_ring() function reads the received CAN frames from the chip, iterates over them and pushes them into the network stack. Prepare that the iteration can be stopped if an old CAN frame is detected. The actual code to detect old or incomplete frames and abort will be added in the next patch.
--- .../net/can/spi/mcp251xfd/mcp251xfd-ring.c | 2 + drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c | 89 +++++++++++-------- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 12 +-- 3 files changed, 56 insertions(+), 47 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c +2 -0
@@ -513,6 +513,8 @@ int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv) } rx_ring->obj_num = rx_obj_num; + rx_ring->obj_num_shift_to_u8 =BITS_PER_TYPE (rx_ring->obj_num_shift_to_u8) - +ilog2 (rx_obj_num); rx_ring->obj_size = rx_obj_size; priv->rx[i] = rx_ring; }
drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c +52 -37
148 lines not on this page · raw message
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +2 -10
@@ -553,6 +553,7 @@ struct mcp251xfd_rx_ring {u8 nr;u8 fifo_nr;u8 obj_num; +u8 obj_num_shift_to_u8;u8 obj_size;union mcp251xfd_write_reg_buf irq_enable_buf;
@@ -889,18 +890,9 @@ static inline u8 mcp251xfd_get_rx_tail(const struct mcp251xfd_rx_ring *ring)return ring->tail & (ring->obj_num -1 ); } -static inline u8 mcp251xfd_get_rx_len (const struct mcp251xfd_rx_ring *ring) -{ -return ring->head - ring->tail; -} -static inline u8 -mcp251xfd_get_rx_linear_len (const struct mcp251xfd_rx_ring *ring) +mcp251xfd_get_rx_linear_len (const struct mcp251xfd_rx_ring *ring,u8 len) { -u8 len; - - len =mcp251xfd_get_rx_len (ring); -return min_t (u8, len, ring->obj_num -mcp251xfd_get_rx_tail (ring)); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/192 can: mcp251xfd: clarify the meaning of timestamp
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
[ Upstream commit e793c724b48ca8cae9693bc3be528e85284c126a ]
The mcp251xfd chip is configured to provide a timestamp with each received and transmitted CAN frame. The timestamp is derived from the internal free-running timer, which can also be read from the TBC register via SPI. The timer is 32 bits wide and is clocked by the external oscillator (typically 20 or 40 MHz).
To avoid confusion, we call this timestamp "timestamp_raw" or "ts_raw" for short.
Using the timecounter framework, the "ts_raw" is converted to 64 bit nanoseconds since the epoch. This is what we call "timestamp".
This is a preparation for the next patches which use the "timestamp" to work around a bug where so far only the "ts_raw" is used.
--- .../net/can/spi/mcp251xfd/mcp251xfd-core.c | 28 +++++++++---------- drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c | 2 +- drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c | 2 +- .../can/spi/mcp251xfd/mcp251xfd-timestamp.c | 22 ++++----------- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 27 ++++++++++++++---- 5 files changed, 43 insertions(+), 38 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +14 -14
@@ -2,7 +2,7 @@// // mcp251xfd - Microchip MCP251xFD Family CAN controller driver // -// Copyright (c) 2019, 2020, 2021 Pengutronix, +// Copyright (c) 2019, 2020, 2021, 2023 Pengutronix, // Marc Kleine-Budde <[email protected]> // // Based on:
@@ -867,18 +867,18 @@ static int mcp251xfd_get_berr_counter(const struct net_device *ndev,static struct sk_buff *mcp251xfd_alloc_can_err_skb (struct mcp251xfd_priv *priv, -struct can_frame **cf,u32 *timestamp) +struct can_frame **cf,u32 *ts_raw) {struct sk_buff *skb;int err; - err =mcp251xfd_get_timestamp (priv, timestamp); + err =mcp251xfd_get_timestamp_raw (priv, ts_raw);if (err)return NULL ; skb =alloc_can_err_skb (priv->ndev, cf);if (skb) -mcp251xfd_skb_set_timestamp (priv, skb, *timestamp); +mcp251xfd_skb_set_timestamp_raw (priv, skb, *ts_raw);return skb; }
@@ -889,7 +889,7 @@ static int mcp251xfd_handle_rxovif(struct mcp251xfd_priv *priv)struct mcp251xfd_rx_ring *ring;struct sk_buff *skb;struct can_frame *cf; -u32 timestamp, rxovif; +u32 ts_raw, rxovif;int err, i; stats->rx_over_errors++;
@@ -924,14 +924,14 @@ static int mcp251xfd_handle_rxovif(struct mcp251xfd_priv *priv)return err; } - skb =mcp251xfd_alloc_can_err_skb (priv, &cf, ×tamp); + skb =mcp251xfd_alloc_can_err_skb (priv, &cf, &ts_raw);if (!skb)return 0 ; cf->can_id |=CAN_ERR_CRTL ; cf->data[1 ] =CAN_ERR_CRTL_RX_OVERFLOW ; - err =can_rx_offload_queue_timestamp (&priv->offload, skb, timestamp); + err =can_rx_offload_queue_timestamp (&priv->offload, skb, ts_raw);if (err) stats->rx_fifo_errors++;
@@ -948,12 +948,12 @@ static int mcp251xfd_handle_txatif(struct mcp251xfd_priv *priv)static int mcp251xfd_handle_ivmif (struct mcp251xfd_priv *priv) {struct net_device_stats *stats = &priv->ndev->stats; -u32 bdiag1, timestamp; +u32 bdiag1, ts_raw;struct sk_buff *skb;struct can_frame *cf =NULL ;int err; - err =mcp251xfd_get_timestamp (priv, ×tamp); + err =mcp251xfd_get_timestamp_raw (priv, &ts_raw);if (err)return err;
@@ -1035,8 +1035,8 @@ static int mcp251xfd_handle_ivmif(struct mcp251xfd_priv *priv)if (!cf)return 0 ; -mcp251xfd_skb_set_timestamp (priv, skb, timestamp); - err =can_rx_offload_queue_timestamp (&priv->offload, skb, timestamp); +mcp251xfd_skb_set_timestamp_raw (priv, skb, ts_raw); + err =can_rx_offload_queue_timestamp (&priv->offload, skb, ts_raw);if (err) stats->rx_fifo_errors++;
@@ -1049,7 +1049,7 @@ static int mcp251xfd_handle_cerrif(struct mcp251xfd_priv *priv)struct sk_buff *skb;struct can_frame *cf =NULL ;enum can_state new_state, rx_state, tx_state; -u32 trec, timestamp; +u32 trec, ts_raw;int err; err =regmap_read (priv->map_reg,MCP251XFD_REG_TREC , &trec);
@@ -1079,7 +1079,7 @@ static int mcp251xfd_handle_cerrif(struct mcp251xfd_priv *priv)/* The skb allocation might fail, but can_change_state() * handles cf == NULL. */ - skb =mcp251xfd_alloc_can_err_skb (priv, &cf, ×tamp); + skb =mcp251xfd_alloc_can_err_skb (priv, &cf, &ts_raw);can_change_state (priv->ndev, cf, tx_state, rx_state);if (new_state ==CAN_STATE_BUS_OFF ) {
@@ -1110,7 +1110,7 @@ static int mcp251xfd_handle_cerrif(struct mcp251xfd_priv *priv) cf->data[7 ] = bec.rxerr; } - err =can_rx_offload_queue_timestamp (&priv->offload, skb, timestamp); + err =can_rx_offload_queue_timestamp (&priv->offload, skb, ts_raw);if (err) stats->rx_fifo_errors++;
drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c +1 -1
@@ -160,7 +160,7 @@ mcp251xfd_hw_rx_obj_to_skb(const struct mcp251xfd_priv *priv,if (!(hw_rx_obj->flags &MCP251XFD_OBJ_FLAGS_RTR ))memcpy (cfd->data, hw_rx_obj->data, cfd->len); -mcp251xfd_skb_set_timestamp (priv, skb, hw_rx_obj->ts); +mcp251xfd_skb_set_timestamp_raw (priv, skb, hw_rx_obj->ts); } static int
drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c +1 -1
@@ -97,7 +97,7 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv, tef_tail =mcp251xfd_get_tef_tail (priv); skb = priv->can.echo_skb[tef_tail];if (skb) -mcp251xfd_skb_set_timestamp (priv, skb, hw_tef_obj->ts); +mcp251xfd_skb_set_timestamp_raw (priv, skb, hw_tef_obj->ts); stats->tx_bytes += can_rx_offload_get_echo_skb(&priv->offload, tef_tail, hw_tef_obj->ts,
drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c +6 -16
@@ -2,7 +2,7 @@// // mcp251xfd - Microchip MCP251xFD Family CAN controller driver // -// Copyright (c) 2021 Pengutronix, +// Copyright (c) 2021, 2023 Pengutronix, // Marc Kleine-Budde <[email protected]> //
@@ -11,20 +11,20 @@#include "mcp251xfd.h" -static u64 mcp251xfd_timestamp_read (const struct cyclecounter *cc) +static u64 mcp251xfd_timestamp_raw_read (const struct cyclecounter *cc) {const struct mcp251xfd_priv *priv; -u32 timestamp =0 ; +u32 ts_raw =0 ;int err; priv = container_of(cc, struct mcp251xfd_priv, cc); - err =mcp251xfd_get_timestamp (priv, ×tamp); + err =mcp251xfd_get_timestamp_raw (priv, &ts_raw);if (err)netdev_err (priv->ndev,"Error %d while reading timestamp. HW timestamps may be inaccurate." , err); -return timestamp; +return ts_raw; }static void mcp251xfd_timestamp_work (struct work_struct *work)
@@ -39,21 +39,11 @@ static void mcp251xfd_timestamp_work(struct work_struct *work) MCP251XFD_TIMESTAMP_WORK_DELAY_SEC * HZ); } -void mcp251xfd_skb_set_timestamp (const struct mcp251xfd_priv *priv, -struct sk_buff *skb,u32 timestamp) -{ -struct skb_shared_hwtstamps *hwtstamps =skb_hwtstamps (skb); -u64 ns; - - ns =timecounter_cyc2time (&priv->tc, timestamp); - hwtstamps->hwtstamp =ns_to_ktime (ns); -} -void mcp251xfd_timestamp_init (struct mcp251xfd_priv *priv) {struct cyclecounter *cc = &priv->cc; - cc->read = mcp251xfd_timestamp_read; + cc->read = mcp251xfd_timestamp_raw_read; cc->mask =CYCLECOUNTER_MASK (32 ); cc->shift =1 ; cc->mult =clocksource_hz2mult (priv->can.clock.freq, cc->shift);
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +21 -6
@@ -2,7 +2,7 @@* * mcp251xfd - Microchip MCP251xFD Family CAN controller driver * -* Copyright (c) 2019, 2020, 2021 Pengutronix, +* Copyright (c) 2019, 2020, 2021, 2023 Pengutronix, * Marc Kleine-Budde <[email protected]> * Copyright (c) 2019 Martin Sperl <[email protected]> */
@@ -794,10 +794,27 @@ mcp251xfd_spi_cmd_write(const struct mcp251xfd_priv *priv,return data; } -static inline int mcp251xfd_get_timestamp (const struct mcp251xfd_priv *priv, -u32 *timestamp) +static inline int mcp251xfd_get_timestamp_raw (const struct mcp251xfd_priv *priv, +u32 *ts_raw) { -return regmap_read (priv->map_reg,MCP251XFD_REG_TBC , timestamp); +return regmap_read (priv->map_reg,MCP251XFD_REG_TBC , ts_raw); +} + +static inline void mcp251xfd_skb_set_timestamp (struct sk_buff *skb,u64 ns) +{ +struct skb_shared_hwtstamps *hwtstamps =skb_hwtstamps (skb); + + hwtstamps->hwtstamp =ns_to_ktime (ns); +} + +static inline +void mcp251xfd_skb_set_timestamp_raw (const struct mcp251xfd_priv *priv, +struct sk_buff *skb,u32 ts_raw) +{ +u64 ns; + + ns =timecounter_cyc2time (&priv->tc, ts_raw); +mcp251xfd_skb_set_timestamp (skb, ns); }static inline u16 mcp251xfd_get_tef_obj_addr (u8 n)
@@ -918,8 +935,6 @@ void mcp251xfd_ring_free(struct mcp251xfd_priv *priv);int mcp251xfd_ring_alloc (struct mcp251xfd_priv *priv);int mcp251xfd_handle_rxif (struct mcp251xfd_priv *priv);int mcp251xfd_handle_tefif (struct mcp251xfd_priv *priv); -void mcp251xfd_skb_set_timestamp (const struct mcp251xfd_priv *priv, -struct sk_buff *skb,u32 timestamp);void mcp251xfd_timestamp_init (struct mcp251xfd_priv *priv);void mcp251xfd_timestamp_stop (struct mcp251xfd_priv *priv);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/192 can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
[ Upstream commit 24436be590c6fbb05f6161b0dfba7d9da60214aa ]
This patch tries to works around erratum DS80000789E 6 of the mcp2518fd, the other variants of the chip family (mcp2517fd and mcp251863) are probably also affected.
In the bad case, the driver reads a too large head index. In the original code, the driver always trusted the read value, which caused old, already processed CAN frames or new, incompletely written CAN frames to be (re-)processed.
To work around this issue, keep a per FIFO timestamp [1] of the last valid received CAN frame and compare against the timestamp of every received CAN frame. If an old CAN frame is detected, abort the iteration and mark the number of valid CAN frames as processed in the chip by incrementing the FIFO's tail index.
Further tests showed that this workaround can recognize old CAN frames, but a small time window remains in which partially written CAN frames [2] are not recognized but then processed. These CAN frames have the correct data and time stamps, but the DLC has not yet been updated.
[1] As the raw timestamp overflows every 107 seconds (at the usual clock rate of 40 MHz) convert it to nanoseconds with the timecounter framework and use this to detect stale CAN frames.
--- .../net/can/spi/mcp251xfd/mcp251xfd-ring.c | 1 + drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c | 32 +++++++++++++++++-- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 3 ++ 3 files changed, 33 insertions(+), 3 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c +1 -0
@@ -196,6 +196,7 @@ mcp251xfd_ring_init_rx(struct mcp251xfd_priv *priv, u16 *base, u8 *fifo_nr)int i, j;mcp251xfd_for_each_rx_ring (priv, rx_ring, i) { + rx_ring->last_valid =timecounter_read (&priv->tc); rx_ring->head =0 ; rx_ring->tail =0 ; rx_ring->base = *base;
drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c +29 -3
@@ -159,8 +159,6 @@ mcp251xfd_hw_rx_obj_to_skb(const struct mcp251xfd_priv *priv,if (!(hw_rx_obj->flags &MCP251XFD_OBJ_FLAGS_RTR ))memcpy (cfd->data, hw_rx_obj->data, cfd->len); - -mcp251xfd_skb_set_timestamp_raw (priv, skb, hw_rx_obj->ts); } static int
@@ -171,8 +169,26 @@ mcp251xfd_handle_rxif_one(struct mcp251xfd_priv *priv,struct net_device_stats *stats = &priv->ndev->stats;struct sk_buff *skb;struct canfd_frame *cfd; +u64 timestamp;int err; +/* According to mcp2518fd erratum DS80000789E 6. the FIFOCI +* bits of a FIFOSTA register, here the RX FIFO head index +* might be corrupted and we might process past the RX FIFO's +* head into old CAN frames. +* +* Compare the timestamp of currently processed CAN frame with +* last valid frame received. Abort with -EBADMSG if an old +* CAN frame is detected. +*/ + timestamp =timecounter_cyc2time (&priv->tc, hw_rx_obj->ts); +if (timestamp <= ring->last_valid) { + stats->rx_fifo_errors++; + +return -EBADMSG ; + } + ring->last_valid = timestamp; +if (hw_rx_obj->flags &MCP251XFD_OBJ_FLAGS_FDF ) skb =alloc_canfd_skb (priv->ndev, &cfd);else
@@ -183,6 +199,7 @@ mcp251xfd_handle_rxif_one(struct mcp251xfd_priv *priv,return 0 ; } +mcp251xfd_skb_set_timestamp (skb, timestamp);mcp251xfd_hw_rx_obj_to_skb (priv, hw_rx_obj, skb); err =can_rx_offload_queue_timestamp (&priv->offload, skb, hw_rx_obj->ts);if (err)
@@ -265,7 +282,16 @@ mcp251xfd_handle_rxif_ring(struct mcp251xfd_priv *priv, err =mcp251xfd_handle_rxif_one (priv, ring, (void *)hw_rx_obj + i * ring->obj_size); -if (err) + +/* -EBADMSG means we're affected by mcp2518fd +* erratum DS80000789E 6., i.e. the timestamp +* in the RX object is older that the last +* valid received CAN frame. Don't process any +* further and mark processed frames as good. +*/ +if (err == -EBADMSG ) +return mcp251xfd_handle_rxif_ring_uinc (priv, ring, i); +else if (err)return err; }
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +3 -0
@@ -549,6 +549,9 @@ struct mcp251xfd_rx_ring {unsigned int head;unsigned int tail; +/* timestamp of the last valid received CAN frame */ +u64 last_valid; +u16 base;u8 nr;u8 fifo_nr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/192 drm/amd: Add gfx12 swizzle mode defs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurabindo Pillai <[email protected]>
[ Upstream commit 7ceb94e87bffff7c12b61eb29749e1d8ac976896 ]
Add GFX12 swizzle mode definitions for use with DCN401
--- include/uapi/drm/drm_fourcc.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
include/uapi/drm/drm_fourcc.h +16 -0
@@ -1390,6 +1390,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)#define AMD_FMT_MOD_TILE_VER_GFX10 2#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3#define AMD_FMT_MOD_TILE_VER_GFX11 4 +#define AMD_FMT_MOD_TILE_VER_GFX12 5/* * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical
@@ -1400,6 +1401,8 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)/* * 64K_D for non-32 bpp is the same for GFX9/GFX10/GFX10_RBPLUS and hence has * GFX9 as canonical version. +* +* 64K_D_2D on GFX12 is identical to 64K_D on GFX11. */ #define AMD_FMT_MOD_TILE_GFX9_64K_D 10#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
@@ -1407,6 +1410,19 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27#define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31 +/* Gfx12 swizzle modes: +* 0 - LINEAR +* 1 - 256B_2D - 2D block dimensions +* 2 - 4KB_2D +* 3 - 64KB_2D +* 4 - 256KB_2D +* 5 - 4KB_3D - 3D block dimensions +* 6 - 64KB_3D +* 7 - 256KB_3D +*/ +#define AMD_FMT_MOD_TILE_GFX12_64K_2D 3 +#define AMD_FMT_MOD_TILE_GFX12_256K_2D 4 +#define AMD_FMT_MOD_DCC_BLOCK_64B 0#define AMD_FMT_MOD_DCC_BLOCK_128B 1#define AMD_FMT_MOD_DCC_BLOCK_256B 2
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/192 drm/amdgpu: handle gfx12 in amdgpu_display_verify_sizes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Olšák <[email protected]>
[ Upstream commit 8dd1426e2c80e32ac1995007330c8f95ffa28ebb ]
It verified GFX9-11 swizzle modes on GFX12, which has undefined behavior.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 27 ++++++++++++++++++++- include/uapi/drm/drm_fourcc.h | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +26 -1
@@ -997,6 +997,30 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb) block_width =256 / format_info->cpp[i]; block_height =1 ; block_size_log2 =8 ; + }else if (AMD_FMT_MOD_GET (TILE_VERSION , modifier) >=AMD_FMT_MOD_TILE_VER_GFX12 ) { +int swizzle =AMD_FMT_MOD_GET (TILE , modifier); + +switch (swizzle) { +case AMD_FMT_MOD_TILE_GFX12_256B_2D : + block_size_log2 =8 ; +break ; +case AMD_FMT_MOD_TILE_GFX12_4K_2D : + block_size_log2 =12 ; +break ; +case AMD_FMT_MOD_TILE_GFX12_64K_2D : + block_size_log2 =16 ; +break ; +case AMD_FMT_MOD_TILE_GFX12_256K_2D : + block_size_log2 =18 ; +break ; +default : +drm_dbg_kms (rfb->base.dev, +"Gfx12 swizzle mode with unknown block size: %d\n" , swizzle); +return -EINVAL ; + } + +get_block_dimensions (block_size_log2, format_info->cpp[i], + &block_width, &block_height); }else {int swizzle =AMD_FMT_MOD_GET (TILE , modifier);
@@ -1032,7 +1056,8 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)return ret; } -if (AMD_FMT_MOD_GET (DCC , modifier)) { +if (AMD_FMT_MOD_GET (TILE_VERSION , modifier) <=AMD_FMT_MOD_TILE_VER_GFX11 && +AMD_FMT_MOD_GET (DCC , modifier)) {if (AMD_FMT_MOD_GET (DCC_RETILE , modifier)) { block_size_log2 =get_dcc_block_size (modifier, false, false); get_block_dimensions(block_size_log2 + 8, format_info->cpp[0],
include/uapi/drm/drm_fourcc.h +2 -0
@@ -1420,6 +1420,8 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)* 6 - 64KB_3D * 7 - 256KB_3D */ +#define AMD_FMT_MOD_TILE_GFX12_256B_2D 1 +#define AMD_FMT_MOD_TILE_GFX12_4K_2D 2#define AMD_FMT_MOD_TILE_GFX12_64K_2D 3#define AMD_FMT_MOD_TILE_GFX12_256K_2D 4
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/192 powerpc/64e: remove unused IBM HTW code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 88715b6e5d529f4ef3830ad2a893e4624c6af0b8 ]
Patch series "Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)", v7.
Unlike most architectures, powerpc 8xx HW requires a two-level pagetable topology for all page sizes. So a leaf PMD-contig approach is not feasible as such.
Possible sizes on 8xx are 4k, 16k, 512k and 8M.
First level (PGD/PMD) covers 4M per entry. For 8M pages, two PMD entries must point to a single entry level-2 page table. Until now that was done using hugepd. This series changes it to use standard page tables where the entry is replicated 1024 times on each of the two pagetables refered by the two associated PMD entries for that 8M page.
For e500 and book3s/64 there are less constraints because it is not tied to the HW assisted tablewalk like on 8xx, so it is easier to use leaf PMDs (and PUDs).
On e500 the supported page sizes are 4M, 16M, 64M, 256M and 1G. All at PMD level on e500/32 (mpc85xx) and mix of PMD and PUD for e500/64. We encode page size with 4 available bits in PTE entries. On e300/32 PGD entries size is increases to 64 bits in order to allow leaf-PMD entries because PTE are 64 bits on e500.
On book3s/64 only the hash-4k mode is concerned. It supports 16M pages as cont-PMD and 16G pages as cont-PUD. In other modes (radix-4k, radix-6k and hash-64k) the sizes match with PMD and PUD sizes so that's just leaf entries. The hash processing make things a bit more complex. To ease things, __hash_page_huge() is modified to bail out when DIRTY or ACCESSED bits are missing, leaving it to mm core to fix it.
This patch (of 23):
The nohash HTW_IBM (Hardware Table Walk) code is unused since support for A2 was removed in commit fb5a515704d7 ("powerpc: Remove platforms/ wsp and associated pieces") (2014).
The remaining supported CPUs use either no HTW (data_tlb_miss_bolted), or the e6500 HTW (data_tlb_miss_e6500).
Stable-dep-of: d92b5cc29c79 ("powerpc/64e: Define mmu_pte_psize static")
--- arch/powerpc/include/asm/nohash/mmu-e500.h | 3 +- arch/powerpc/mm/nohash/tlb.c | 57 +----- arch/powerpc/mm/nohash/tlb_low_64e.S | 195 --------------------- 3 files changed, 2 insertions(+), 253 deletions(-)
arch/powerpc/include/asm/nohash/mmu-e500.h +1 -2
@@ -303,8 +303,7 @@ extern unsigned long linear_map_top;extern int book3e_htw_mode;#define PPC_HTW_NONE 0 -#define PPC_HTW_IBM 1 -#define PPC_HTW_E6500 2 +#define PPC_HTW_E6500 1/* * 64-bit booke platforms don't load the tlb in the tlb miss handler code.
arch/powerpc/mm/nohash/tlb.c +1 -56
82 lines not on this page · raw message
arch/powerpc/mm/nohash/tlb_low_64e.S +0 -195
201 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/192 powerpc/64e: split out nohash Book3E 64-bit code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit a898530eea3d0ba08c17a60865995a3bb468d1bc ]
A reasonable chunk of nohash/tlb.c is 64-bit only code, split it out into a separate file.
Stable-dep-of: d92b5cc29c79 ("powerpc/64e: Define mmu_pte_psize static")
--- arch/powerpc/mm/nohash/Makefile | 2 +- arch/powerpc/mm/nohash/tlb.c | 343 +---------------------------- arch/powerpc/mm/nohash/tlb_64e.c | 361 +++++++++++++++++++++++++++++++ 3 files changed, 363 insertions(+), 343 deletions(-) create mode 100644 arch/powerpc/mm/nohash/tlb_64e.c
arch/powerpc/mm/nohash/Makefile +1 -1
@@ -3,7 +3,7 @@ ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) obj-y += mmu_context.o tlb.o tlb_low.o kup.o -obj-$(CONFIG_PPC_BOOK3E_64) += tlb_low_64e.o book3e_pgtable.o +obj-$(CONFIG_PPC_BOOK3E_64) += tlb_64e.o tlb_low_64e.o book3e_pgtable.o obj-$(CONFIG_40x) += 40x.o obj-$(CONFIG_44x) += 44x.o obj-$(CONFIG_PPC_8xx) += 8xx.o
arch/powerpc/mm/nohash/tlb.c +1 -342
355 lines not on this page · raw message
arch/powerpc/mm/nohash/tlb_64e.c new file +361 -0
361 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/192 powerpc/64e: Define mmu_pte_psize static
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit d92b5cc29c792f1d3f0aaa3b29dddfe816c03e88 ]
mmu_pte_psize is only used in the tlb_64e.c, define it static.
--- arch/powerpc/mm/nohash/tlb_64e.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/nohash/tlb_64e.c +1 -1
@@ -33,7 +33,7 @@* though this will probably be made common with other nohash * implementations at some point */ -int mmu_pte_psize;/* Page size used for PTE pages */ +static int mmu_pte_psize;/* Page size used for PTE pages */ int mmu_vmemmap_psize;/* Page size used for the virtual mem map */ int book3e_htw_mode;/* HW tablewalk? Value is PPC_HTW_* */ unsigned long linear_map_top;/* Top of linear mapping */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/192 ASoC: tegra: Fix CBB error during probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohan Kumar <[email protected]>
[ Upstream commit 6781b962d97bc52715a8db8cc17278cc3c23ebe8 ]
When Tegra audio drivers are built as part of the kernel image, TIMEOUT_ERR is observed from cbb-fabric. Following is seen on Jetson AGX Orin during boot:
[ 8.012482] ************************************** [ 8.017423] CPU:0, Error:cbb-fabric, Errmon:2 [ 8.021922] Error Code : TIMEOUT_ERR [ 8.025966] Overflow : Multiple TIMEOUT_ERR [ 8.030644] [ 8.032175] Error Code : TIMEOUT_ERR [ 8.036217] MASTER_ID : CCPLEX [ 8.039722] Address : 0x290a0a8 [ 8.043318] Cache : 0x1 -- Bufferable [ 8.047630] Protection : 0x2 -- Unprivileged, Non-Secure, Data Access [ 8.054628] Access_Type : Write
[ 8.106130] WARNING: CPU: 0 PID: 124 at drivers/soc/tegra/cbb/tegra234-cbb.c:604 tegra234_cbb_isr+0x134/0x178
[ 8.240602] Call trace: [ 8.243126] tegra234_cbb_isr+0x134/0x178 [ 8.247261] __handle_irq_event_percpu+0x60/0x238 [ 8.252132] handle_irq_event+0x54/0xb8
These errors happen when MVC device, which is a child of AHUB device, tries to access its device registers. This happens as part of call tegra210_mvc_reset_vol_settings() in MVC device probe().
The root cause of this problem is, the child MVC device gets probed before the AHUB clock gets enabled. The AHUB clock is enabled in runtime PM resume of parent AHUB device and due to the wrong sequence of pm_runtime_enable() in AHUB driver, runtime PM resume doesn't happen for AHUB device when MVC makes register access.
Fix this by calling pm_runtime_enable() for parent AHUB device before of_platform_populate() in AHUB driver. This ensures that clock becomes available when MVC makes register access.
--- sound/soc/tegra/tegra210_ahub.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra210_ahub.c +6 -4
@@ -2,7 +2,7 @@// // tegra210_ahub.c - Tegra210 AHUB driver // -// Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. #include <linux/clk.h> #include <linux/device.h>
@@ -1401,11 +1401,13 @@ static int tegra_ahub_probe(struct platform_device *pdev)return err; } +pm_runtime_enable (&pdev->dev); + err =of_platform_populate (pdev->dev.of_node,NULL ,NULL , &pdev->dev); -if (err) +if (err) { +pm_runtime_disable (&pdev->dev);return err; - -pm_runtime_enable (&pdev->dev); + }return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/192 nvmet-tcp: fix kernel crash if commands allocation fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit 5572a55a6f830ee3f3a994b6b962a5c327d28cb3 ]
If the commands allocation fails in nvmet_tcp_alloc_cmds() the kernel crashes in nvmet_tcp_release_queue_work() because of a NULL pointer dereference.
nvmet: failed to install queue 0 cntlid 1 ret 6
Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000008Fix the bug by setting queue->nr_cmds to zero in case nvmet_tcp_alloc_cmd() fails.
--- drivers/nvme/target/tcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/tcp.c +3 -1
@@ -1816,8 +1816,10 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) } queue->nr_cmds = sq->size *2 ; -if (nvmet_tcp_alloc_cmds (queue)) +if (nvmet_tcp_alloc_cmds (queue)) { + queue->nr_cmds =0 ;return NVME_SC_INTERNAL ; + }return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/192 ASoc: SOF: topology: Clear SOF link platform name upon unload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit e0be875c5bf03a9676a6bfed9e0f1766922a7dbd ]
The SOF topology loading function sets the device name for the platform component link. This should be unset when unloading the topology, otherwise a machine driver unbind/bind or reprobe would complain about an invalid component as having both its component name and of_node set:
mt8186_mt6366 sound: ASoC: Both Component name/of_node are set for AFE_SOF_DL1 mt8186_mt6366 sound: error -EINVAL: Cannot register card mt8186_mt6366 sound: probe with driver mt8186_mt6366 failed with error -22
This happens with machine drivers that set the of_node separately.
Clear the SOF link platform name in the topology unload callback.
--- sound/soc/sof/topology.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/sof/topology.c +2 -0
@@ -1817,6 +1817,8 @@ static int sof_link_unload(struct snd_soc_component *scomp, struct snd_soc_dobjif (!slink)return 0 ; + slink->link->platforms->name =NULL ; +kfree (slink->tuples);list_del (&slink->list);kfree (slink->hw_configs);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/192 ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matteo Martelli <[email protected]>
[ Upstream commit 3e83957e8dd7433a69116780d9bad217b00913ea ]
This fixes the LRCLK polarity for sun8i-h3 and sun50i-h6 in i2s mode which was wrongly inverted.
The LRCLK was being set in reversed logic compared to the DAI format:
inverted LRCLK for SND_SOC_DAIFMT_IB_NF and SND_SOC_DAIFMT_NB_NF; normal LRCLK for SND_SOC_DAIFMT_IB_IF and SND_SOC_DAIFMT_NB_IF. Such reversed logic applies properly for DSP_A, DSP_B, LEFT_J and RIGHT_J modes but not for I2S mode, for which the LRCLK signal results reversed to what expected on the bus. The issue is due to a misinterpretation of the LRCLK polarity bit of the H3 and H6 i2s controllers. Such bit in this case does not mean "0 => normal" or "1 => inverted" according to the expected bus operation, but it means "0 => frame starts on low edge" and "1 => frame starts on high edge" (from the User Manuals).
This commit fixes the LRCLK polarity by setting the LRCLK polarity bit according to the selected bus mode and renames the LRCLK polarity bit definition to avoid further confusion.
--- sound/soc/sunxi/sun4i-i2s.c | 143 ++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 70 deletions(-)
sound/soc/sunxi/sun4i-i2s.c +73 -70
@@ -100,8 +100,8 @@#define SUN8I_I2S_CTRL_MODE_PCM (0 << 4)#define SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK BIT(19) -#define SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED (1 << 19) -#define SUN8I_I2S_FMT0_LRCLK_POLARITY_NORMAL (0 << 19) +#define SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH (1 << 19) +#define SUN8I_I2S_FMT0_LRCLK_POLARITY_START_LOW (0 << 19)#define SUN8I_I2S_FMT0_LRCK_PERIOD_MASK GENMASK(17, 8)#define SUN8I_I2S_FMT0_LRCK_PERIOD (period) ((period - 1) << 8)#define SUN8I_I2S_FMT0_BCLK_POLARITY_MASK BIT(7)
@@ -727,65 +727,37 @@ static int sun4i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s,static int sun8i_i2s_set_soc_fmt (const struct sun4i_i2s *i2s,unsigned int fmt) { -u32 mode, val; +u32 mode, lrclk_pol, bclk_pol, val;u8 offset; -/* -* DAI clock polarity -* -* The setup for LRCK contradicts the datasheet, but under a -* scope it's clear that the LRCK polarity is reversed -* compared to the expected polarity on the bus. -*/ -switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { -case SND_SOC_DAIFMT_IB_IF : -/* Invert both clocks */ - val =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED ; -break ; -case SND_SOC_DAIFMT_IB_NF : -/* Invert bit clock */ - val =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED | -SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED ; -break ; -case SND_SOC_DAIFMT_NB_IF : -/* Invert frame clock */ - val =0 ; -break ; -case SND_SOC_DAIFMT_NB_NF : - val =SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED ; -break ; -default : -return -EINVAL ; - } - -regmap_update_bits (i2s->regmap,SUN4I_I2S_FMT0_REG , -SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK | -SUN8I_I2S_FMT0_BCLK_POLARITY_MASK , - val); -/* DAI Mode */ switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_DSP_A : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_PCM ; offset =1 ;break ;case SND_SOC_DAIFMT_DSP_B : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_PCM ; offset =0 ;break ;case SND_SOC_DAIFMT_I2S : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_LOW ; mode =SUN8I_I2S_CTRL_MODE_LEFT ; offset =1 ;break ;case SND_SOC_DAIFMT_LEFT_J : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_LEFT ; offset =0 ;break ;case SND_SOC_DAIFMT_RIGHT_J : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_RIGHT ; offset =0 ;break ;
@@ -803,6 +775,35 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s,SUN8I_I2S_TX_CHAN_OFFSET_MASK , SUN8I_I2S_TX_CHAN_OFFSET(offset)); +/* DAI clock polarity */ + bclk_pol =SUN8I_I2S_FMT0_BCLK_POLARITY_NORMAL ; + +switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { +case SND_SOC_DAIFMT_IB_IF : +/* Invert both clocks */ + lrclk_pol ^=SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK ; + bclk_pol =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED ; +break ; +case SND_SOC_DAIFMT_IB_NF : +/* Invert bit clock */ + bclk_pol =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED ; +break ; +case SND_SOC_DAIFMT_NB_IF : +/* Invert frame clock */ + lrclk_pol ^=SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK ; +break ; +case SND_SOC_DAIFMT_NB_NF : +/* No inversion */ +break ; +default : +return -EINVAL ; + } + +regmap_update_bits (i2s->regmap,SUN4I_I2S_FMT0_REG , +SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK | +SUN8I_I2S_FMT0_BCLK_POLARITY_MASK , + lrclk_pol | bclk_pol); +/* DAI clock master masks */ switch (fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK ) {case SND_SOC_DAIFMT_BP_FP :
@@ -834,65 +835,37 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s,static int sun50i_h6_i2s_set_soc_fmt (const struct sun4i_i2s *i2s,unsigned int fmt) { -u32 mode, val; +u32 mode, lrclk_pol, bclk_pol, val;u8 offset; -/* -* DAI clock polarity -* -* The setup for LRCK contradicts the datasheet, but under a -* scope it's clear that the LRCK polarity is reversed -* compared to the expected polarity on the bus. -*/ -switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { -case SND_SOC_DAIFMT_IB_IF : -/* Invert both clocks */ - val =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED ; -break ; -case SND_SOC_DAIFMT_IB_NF : -/* Invert bit clock */ - val =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED | -SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED ; -break ; -case SND_SOC_DAIFMT_NB_IF : -/* Invert frame clock */ - val =0 ; -break ; -case SND_SOC_DAIFMT_NB_NF : - val =SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED ; -break ; -default : -return -EINVAL ; - } - -regmap_update_bits (i2s->regmap,SUN4I_I2S_FMT0_REG , -SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK | -SUN8I_I2S_FMT0_BCLK_POLARITY_MASK , - val); -/* DAI Mode */ switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_DSP_A : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_PCM ; offset =1 ;break ;case SND_SOC_DAIFMT_DSP_B : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_PCM ; offset =0 ;break ;case SND_SOC_DAIFMT_I2S : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_LOW ; mode =SUN8I_I2S_CTRL_MODE_LEFT ; offset =1 ;break ;case SND_SOC_DAIFMT_LEFT_J : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_LEFT ; offset =0 ;break ;case SND_SOC_DAIFMT_RIGHT_J : + lrclk_pol =SUN8I_I2S_FMT0_LRCLK_POLARITY_START_HIGH ; mode =SUN8I_I2S_CTRL_MODE_RIGHT ; offset =0 ;break ;
@@ -910,6 +883,36 @@ static int sun50i_h6_i2s_set_soc_fmt(const struct sun4i_i2s *i2s,SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET_MASK , SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET(offset)); +/* DAI clock polarity */ + bclk_pol =SUN8I_I2S_FMT0_BCLK_POLARITY_NORMAL ; + +switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { +case SND_SOC_DAIFMT_IB_IF : +/* Invert both clocks */ + lrclk_pol ^=SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK ; + bclk_pol =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED ; +break ; +case SND_SOC_DAIFMT_IB_NF : +/* Invert bit clock */ + bclk_pol =SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED ; +break ; +case SND_SOC_DAIFMT_NB_IF : +/* Invert frame clock */ + lrclk_pol ^=SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK ; +break ; +case SND_SOC_DAIFMT_NB_NF : +/* No inversion */ +break ; +default : +return -EINVAL ; + } + +regmap_update_bits (i2s->regmap,SUN4I_I2S_FMT0_REG , +SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK | +SUN8I_I2S_FMT0_BCLK_POLARITY_MASK , + lrclk_pol | bclk_pol); + +/* DAI clock master masks */ switch (fmt &SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK ) {case SND_SOC_DAIFMT_BP_FP :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/192 drm/i915/fence: Mark debug_fence_init_onstack() with __maybe_unused
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit fcd9e8afd546f6ced378d078345a89bf346d065e ]
When debug_fence_init_onstack() is unused (CONFIG_DRM_I915_SELFTEST=n), it prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
.../i915_sw_fence.c:97:20: error: unused function 'debug_fence_init_onstack' [-Werror,-Wunused-function]
97 | static inline void debug_fence_init_onstack(struct i915_sw_fence *fence)
| ^~~~~~~~~~~~~~~~~~~~~~~~
Fix this by marking debug_fence_init_onstack() with __maybe_unused.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").
--- drivers/gpu/drm/i915/i915_sw_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_sw_fence.c +2 -2
@@ -51,7 +51,7 @@ static inline void debug_fence_init(struct i915_sw_fence *fence)debug_object_init (fence, &i915_sw_fence_debug_descr); } -static inline void debug_fence_init_onstack (struct i915_sw_fence *fence) +static inline __maybe_unused void debug_fence_init_onstack (struct i915_sw_fence *fence) {debug_object_init_on_stack (fence, &i915_sw_fence_debug_descr); }
@@ -94,7 +94,7 @@ static inline void debug_fence_init(struct i915_sw_fence *fence) { } -static inline void debug_fence_init_onstack (struct i915_sw_fence *fence) +static inline __maybe_unused void debug_fence_init_onstack (struct i915_sw_fence *fence) { }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/192 drm/i915/fence: Mark debug_fence_free() with __maybe_unused
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit f99999536128b14b5d765a9982763b5134efdd79 ]
When debug_fence_free() is unused (CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS=n), it prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
.../i915_sw_fence.c:118:20: error: unused function 'debug_fence_free' [-Werror,-Wunused-function]
118 | static inline void debug_fence_free(struct i915_sw_fence *fence)
| ^~~~~~~~~~~~~~~~
Fix this by marking debug_fence_free() with __maybe_unused.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").
--- drivers/gpu/drm/i915/i915_sw_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_sw_fence.c +2 -2
@@ -77,7 +77,7 @@ static inline void debug_fence_destroy(struct i915_sw_fence *fence)debug_object_destroy (fence, &i915_sw_fence_debug_descr); } -static inline void debug_fence_free (struct i915_sw_fence *fence) +static inline __maybe_unused void debug_fence_free (struct i915_sw_fence *fence) {debug_object_free (fence, &i915_sw_fence_debug_descr);smp_wmb ();/* flush the change in state before reallocation */
@@ -115,7 +115,7 @@ static inline void debug_fence_destroy(struct i915_sw_fence *fence) { } -static inline void debug_fence_free (struct i915_sw_fence *fence) +static inline __maybe_unused void debug_fence_free (struct i915_sw_fence *fence) { }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/192 gpio: rockchip: fix OF node leak in probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit adad2e460e505a556f5ea6f0dc16fe95e62d5d76 ]
Driver code is leaking OF node reference from of_get_parent() in probe().
--- drivers/gpio/gpio-rockchip.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-rockchip.c +1 -0
@@ -713,6 +713,7 @@ static int rockchip_gpio_probe(struct platform_device *pdev)return -ENODEV ; pctldev =of_pinctrl_get (pctlnp); +of_node_put (pctlnp);if (!pctldev)return -EPROBE_DEFER ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/192 gpio: modepin: Enable module autoloading
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chen <[email protected]>
[ Upstream commit a5135526426df5319d5f4bcd15ae57c45a97714b ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpio/gpio-zynqmp-modepin.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-zynqmp-modepin.c +1 -0
@@ -146,6 +146,7 @@ static const struct of_device_id modepin_platform_id[] = { { .compatible = "xlnx,zynqmp-gpio-modepin", }, { } }; +MODULE_DEVICE_TABLE (of, modepin_platform_id);static struct platform_driver modepin_platform_driver = { .driver = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 186/192 ublk_drv: fix NULL pointer dereference in ublk_ctrl_start_recovery()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit e58f5142f88320a5b1449f96a146f2f24615c5c7 ]
When two UBLK_CMD_START_USER_RECOVERY commands are submitted, the first one sets 'ubq->ubq_daemon' to NULL, and the second one triggers WARN in ublk_queue_reinit() and subsequently a NULL pointer dereference issue.
Fix it by adding the check in ublk_ctrl_start_recovery() and return immediately in case of zero 'ub->nr_queues_ready'.
BUG: kernel NULL pointer dereference, address: 0000000000000028 RIP: 0010:ublk_ctrl_start_recovery.constprop.0+0x82/0x180 Call Trace: <TASK> ? __die+0x20/0x70 ? page_fault_oops+0x75/0x170 ? exc_page_fault+0x64/0x140 ? asm_exc_page_fault+0x22/0x30 ? ublk_ctrl_start_recovery.constprop.0+0x82/0x180 ublk_ctrl_uring_cmd+0x4f7/0x6c0 ? pick_next_task_idle+0x26/0x40 io_uring_cmd+0x9a/0x1b0 io_issue_sqe+0x193/0x3f0 io_wq_submit_work+0x9b/0x390 io_worker_handle_work+0x165/0x360 io_wq_worker+0xcb/0x2f0 ? finish_task_switch.isra.0+0x203/0x290 ? finish_task_switch.isra.0+0x203/0x290 ? __pfx_io_wq_worker+0x10/0x10 ret_from_fork+0x2d/0x50 ? __pfx_io_wq_worker+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK>
--- drivers/block/ublk_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/ublk_drv.c +2 -0
@@ -1915,6 +1915,8 @@ static int ublk_ctrl_start_recovery(struct ublk_device *ub,mutex_lock (&ub->mutex);if (!ublk_can_use_recovery (ub)) goto out_unlock; +if (!ub->nr_queues_ready) + goto out_unlock;/* * START_RECOVERY is only allowd after: *
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 187/192 x86/mm: Fix PTI for i386 some more
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit c48b5a4cf3125adb679e28ef093f66ff81368d05 upstream.
So it turns out that we have to do two passes of pti_clone_entry_text(), once before initcalls, such that device and late initcalls can use user-mode-helper / modprobe and once after free_initmem() / mark_readonly().
Now obviously mark_readonly() can cause PMD splits, and pti_clone_pgtable() doesn't like that much.
Allow the late clone to split PMDs so that pagetables stay in sync.
--- arch/x86/mm/pti.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-)
arch/x86/mm/pti.c +29 -16
@@ -241,7 +241,7 @@ static pmd_t *pti_user_pagetable_walk_pm* * Returns a pointer to a PTE on success, or NULL on failure. */ -static pte_t *pti_user_pagetable_walk_pte (unsigned long address) +static pte_t *pti_user_pagetable_walk_pte (unsigned long address,bool late_text) {gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);pmd_t *pmd;
@@ -251,10 +251,15 @@ static pte_t *pti_user_pagetable_walk_ptif (!pmd)return NULL ; -/* We can't do anything sensible if we hit a large mapping. */ +/* Large PMD mapping found */ if (pmd_large (*pmd)) { -WARN_ON (1 ); -return NULL ; +/* Clear the PMD if we hit a large mapping from the first round */ +if (late_text) { +set_pmd (pmd,__pmd (0 )); + }else { +WARN_ON_ONCE (1 ); +return NULL ; + } }if (pmd_none (*pmd)) {
@@ -283,7 +288,7 @@ static void __init pti_setup_vsyscall(voif (!pte ||WARN_ON (level !=PG_LEVEL_4K ) ||pte_none (*pte))return ; - target_pte =pti_user_pagetable_walk_pte (VSYSCALL_ADDR ); + target_pte =pti_user_pagetable_walk_pte (VSYSCALL_ADDR , false);if (WARN_ON (!target_pte))return ;
@@ -301,7 +306,7 @@ enum pti_clone_level {static void pti_clone_pgtable (unsigned long start,unsigned long end, -enum pti_clone_level level) +enum pti_clone_level level,bool late_text) {unsigned long addr;
@@ -390,7 +395,7 @@ pti_clone_pgtable(unsigned long start, ureturn ;/* Allocate PTE in the user page-table */ - target_pte =pti_user_pagetable_walk_pte (addr); + target_pte =pti_user_pagetable_walk_pte (addr, late_text);if (WARN_ON (!target_pte))return ;
@@ -452,7 +457,7 @@ static void __init pti_clone_user_sharedphys_addr_t pa =per_cpu_ptr_to_phys ((void *)va);pte_t *target_pte; - target_pte =pti_user_pagetable_walk_pte (va); + target_pte =pti_user_pagetable_walk_pte (va, false);if (WARN_ON (!target_pte))return ;
@@ -475,7 +480,7 @@ static void __init pti_clone_user_shared start =CPU_ENTRY_AREA_BASE ; end = start + (PAGE_SIZE *CPU_ENTRY_AREA_PAGES ); - pti_clone_pgtable(start, end, PTI_CLONE_PMD); + pti_clone_pgtable(start, end, PTI_CLONE_PMD, false); }#endif /* CONFIG_X86_64 */
@@ -492,11 +497,11 @@ static void __init pti_setup_espfix64(vo/* * Clone the populated PMDs of the entry text and force it RO. */ -static void pti_clone_entry_text (void ) +static void pti_clone_entry_text (bool late) {pti_clone_pgtable ((unsigned long ) __entry_text_start, (unsigned long ) __entry_text_end, -PTI_LEVEL_KERNEL_IMAGE ); +PTI_LEVEL_KERNEL_IMAGE , late); }/*
@@ -571,7 +576,7 @@ static void pti_clone_kernel_text(void)* pti_set_kernel_image_nonglobal() did to clear the * global bit. */ -pti_clone_pgtable (start, end_clone,PTI_LEVEL_KERNEL_IMAGE ); +pti_clone_pgtable (start, end_clone,PTI_LEVEL_KERNEL_IMAGE , false);/* * pti_clone_pgtable() will set the global bit in any PMDs
@@ -638,8 +643,15 @@ void __init pti_init(void)/* Undo all global bits from the init pagetables in head_64.S: */ pti_set_kernel_image_nonglobal (); +/* Replace some of the global bits just for shared entry text: */ -pti_clone_entry_text (); +/* +* This is very early in boot. Device and Late initcalls can do +* modprobe before free_initmem() and mark_readonly(). This +* pti_clone_entry_text() allows those user-mode-helpers to function, +* but notably the text is still RW. +*/ +pti_clone_entry_text (false);pti_setup_espfix64 ();pti_setup_vsyscall (); }
@@ -656,10 +668,11 @@ void pti_finalize(void)if (!boot_cpu_has (X86_FEATURE_PTI ))return ;/* -* We need to clone everything (again) that maps parts of the -* kernel image. +* This is after free_initmem() (all initcalls are done) and we've done +* mark_readonly(). Text is now NX which might've split some PMDs +* relative to the early clone. */ -pti_clone_entry_text (); +pti_clone_entry_text (true);pti_clone_kernel_text ();debug_checkwx_user ();
Greg Kroah-Hartman
maintainerPATCH 188/192 btrfs: fix race between direct IO write and fsync when using same fd
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit cd9253c23aedd61eb5ff11f37a36247cd46faf86 upstream.
If we have 2 threads that are using the same file descriptor and one of them is doing direct IO writes while the other is doing fsync, we have a race where we can end up either:
1) Attempt a fsync without holding the inode's lock, triggering an assertion failures when assertions are enabled;
2) Do an invalid memory access from the fsync task because the file private points to memory allocated on stack by the direct IO task and it may be used by the fsync task after the stack was destroyed.
The race happens like this:
1) A user space program opens a file descriptor with O_DIRECT;
2) The program spawns 2 threads using libpthread for example;
3) One of the threads uses the file descriptor to do direct IO writes, while the other calls fsync using the same file descriptor.
4) Call task A the thread doing direct IO writes and task B the thread doing fsyncs;
5) Task A does a direct IO write, and at btrfs_direct_write() sets the file's private to an on stack allocated private with the member 'fsync_skip_inode_lock' set to true;
6) Task B enters btrfs_sync_file() and sees that there's a private structure associated to the file which has 'fsync_skip_inode_lock' set to true, so it skips locking the inode's VFS lock;
7) Task A completes the direct IO write, and resets the file's private to NULL since it had no prior private and our private was stack allocated. Then it unlocks the inode's VFS lock;
8) Task B enters btrfs_get_ordered_extents_for_logging(), then the assertion that checks the inode's VFS lock is held fails, since task B never locked it and task A has already unlocked it.
The stack trace produced is the following:
assertion failed: inode_is_locked(&inode->vfs_inode), in fs/btrfs/ordered-data.c:983
------------[ cut here ]------------
kernel BUG at fs/btrfs/ordered-data.c:983!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI
CPU: 9 PID: 5072 Comm: worker Tainted: G U OE 6.10.5-1-default #1 openSUSE Tumbleweed 69f48d427608e1c09e60ea24c6c55e2ca1b049e8
Hardware name: Acer Predator PH315-52/Covini_CFS, BIOS V1.12 07/28/2020
RIP: 0010:btrfs_get_ordered_extents_for_logging.cold+0x1f/0x42 [btrfs]
Code: 50 d6 86 c0 e8 (...)
RSP: 0018:ffff9e4a03dcfc78 EFLAGS: 00010246
RAX: 0000000000000054 RBX: ffff9078a9868e98 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff907dce4a7800 RDI: ffff907dce4a7800
RBP: ffff907805518800 R08: 0000000000000000 R09: ffff9e4a03dcfb38
R10: ffff9e4a03dcfb30 R11: 0000000000000003 R12: ffff907684ae7800
R13: 0000000000000001 R14: ffff90774646b600 R15: 0000000000000000
FS: 00007f04b96006c0(0000) GS:ffff907dce480000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f32acbfc000 CR3: 00000001fd4fa005 CR4: 00000000003726f0
Call Trace:
<TASK>
? __die_body.cold+0x14/0x24
? die+0x2e/0x50
? do_trap+0xca/0x110
? do_error_trap+0x6a/0x90
? btrfs_get_ordered_extents_for_logging.cold+0x1f/0x42 [btrfs bb26272d49b4cdc847cf3f7faadd459b62caee9a]
? exc_invalid_op+0x50/0x70
? btrfs_get_ordered_extents_for_logging.cold+0x1f/0x42 [btrfs bb26272d49b4cdc847cf3f7faadd459b62caee9a]
? asm_exc_invalid_op+0x1a/0x20
? btrfs_get_ordered_extents_for_logging.cold+0x1f/0x42 [btrfs bb26272d49b4cdc847cf3f7faadd459b62caee9a]
? btrfs_get_ordered_extents_for_logging.cold+0x1f/0x42 [btrfs bb26272d49b4cdc847cf3f7faadd459b62caee9a]
btrfs_sync_file+0x21a/0x4d0 [btrfs bb26272d49b4cdc847cf3f7faadd459b62caee9a]
? __seccomp_filter+0x31d/0x4f0
__x64_sys_fdatasync+0x4f/0x90
do_syscall_64+0x82/0x160
? do_futex+0xcb/0x190
? __x64_sys_futex+0x10e/0x1d0
? switch_fpu_return+0x4f/0xd0
? syscall_exit_to_user_mode+0x72/0x220
? do_syscall_64+0x8e/0x160
? syscall_exit_to_user_mode+0x72/0x220
? do_syscall_64+0x8e/0x160
? syscall_exit_to_user_mode+0x72/0x220
? do_syscall_64+0x8e/0x160
? syscall_exit_to_user_mode+0x72/0x220
? do_syscall_64+0x8e/0x160
entry_SYSCALL_64_after_hwframe+0x76/0x7eAnother problem here is if task B grabs the private pointer and then uses it after task A has finished, since the private was allocated in the stack of task A, it results in some invalid memory access with a hard to predict result.
This issue, triggering the assertion, was observed with QEMU workloads by two users in the Link tags below.
Fix this by not relying on a file's private to pass information to fsync that it should skip locking the inode and instead pass this information through a special value stored in current->journal_info. This is safe because in the relevant section of the direct IO write path we are not holding a transaction handle, so current->journal_info is NULL.
The following C program triggers the issue:
$ cat repro.c /* Get the O_DIRECT definition. */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdint.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <pthread.h>
static int fd;
static ssize_t do_write(int fd, const void *buf, size_t count, off_t offset)
{
while (count > 0) {
ssize_t ret; ret = pwrite(fd, buf, count, offset);
if (ret < 0) {
if (errno == EINTR)
continue;
return ret;
}
count -= ret;
buf += ret;
}
return 0;}
static void *fsync_loop(void *arg)
{
while (1) {
int ret; ret = fsync(fd);
if (ret != 0) {
perror("Fsync failed");
exit(6);
}
}}
int main(int argc, char *argv[])
{
long pagesize;
void *write_buf;
pthread_t fsyncer;
int ret; if (argc != 2) {
fprintf(stderr, "Use: %s <file path>\n", argv[0]);
return 1;
}
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC | O_DIRECT, 0666);
if (fd == -1) {
perror("Failed to open/create file");
return 1;
}
pagesize = sysconf(_SC_PAGE_SIZE);
if (pagesize == -1) {
perror("Failed to get page size");
return 2;
}
ret = posix_memalign(&write_buf, pagesize, pagesize);
if (ret) {
perror("Failed to allocate buffer");
return 3;
}
ret = pthread_create(&fsyncer, NULL, fsync_loop, NULL);
if (ret != 0) {
fprintf(stderr, "Failed to create writer thread: %d\n", ret);
return 4;
}
while (1) {
ret = do_write(fd, write_buf, pagesize, 0);
if (ret != 0) {
perror("Write failed");
exit(5);
}
}
return 0;}
$ mkfs.btrfs -f /dev/sdi $ mount /dev/sdi /mnt/sdi $ timeout 10 ./repro /mnt/sdi/foo
Usually the race is triggered within less than 1 second. A test case for fstests will follow soon.
---
--- fs/btrfs/ctree.h | 1 - fs/btrfs/file.c | 25 ++++++++++--------------- fs/btrfs/transaction.h | 6 ++++++ 3 files changed, 16 insertions(+), 16 deletions(-)
fs/btrfs/ctree.h +0 -1
@@ -1553,7 +1553,6 @@ struct btrfs_drop_extents_args {struct btrfs_file_private {void *filldir_buf;u64 last_index; -bool fsync_skip_inode_lock; };
fs/btrfs/file.c +10 -15
@@ -1534,13 +1534,6 @@ again:if (IS_ERR_OR_NULL (dio)) { err =PTR_ERR_OR_ZERO (dio); }else { -struct btrfs_file_private stack_private = {0 }; -struct btrfs_file_private *private; -const bool have_private = (file->private_data !=NULL ); - -if (!have_private) - file->private_data = &stack_private; -/* * If we have a synchoronous write, we must make sure the fsync * triggered by the iomap_dio_complete() call below doesn't
@@ -1549,13 +1542,10 @@ again:* partial writes due to the input buffer (or parts of it) not * being already faulted in. */ - private = file->private_data; - private->fsync_skip_inode_lock = true; +ASSERT (current->journal_info ==NULL ); + current->journal_info =BTRFS_TRANS_DIO_WRITE_STUB ; err =iomap_dio_complete (dio); - private->fsync_skip_inode_lock = false; - -if (!have_private) - file->private_data =NULL ; + current->journal_info =NULL ; }/* No increment (+=) because iomap returns a cumulative value. */
@@ -1795,7 +1785,6 @@ static inline bool skip_inode_logging(co*/ int btrfs_sync_file (struct file *file,loff_t start,loff_t end,int datasync) { -struct btrfs_file_private *private = file->private_data;struct dentry *dentry =file_dentry (file);struct inode *inode =d_inode (dentry);struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb);
@@ -1805,7 +1794,13 @@ int btrfs_sync_file(struct file *file, lint ret =0 , err;u64 len;bool full_sync; -const bool skip_ilock = (private ? private->fsync_skip_inode_lock : false); +bool skip_ilock = false; + +if (current->journal_info ==BTRFS_TRANS_DIO_WRITE_STUB ) { + skip_ilock = true; + current->journal_info =NULL ; +lockdep_assert_held (&inode->i_rwsem); + }trace_btrfs_sync_file (file, datasync);
fs/btrfs/transaction.h +6 -0
@@ -11,6 +11,12 @@#include "delayed-ref.h" #include "ctree.h" +/* +* Signal that a direct IO write is in progress, to avoid deadlock for sync +* direct IO writes when fsync is called during the direct IO write path. +*/ +#define BTRFS_TRANS_DIO_WRITE_STUB ((void *) 1) +enum btrfs_trans_state {TRANS_STATE_RUNNING ,TRANS_STATE_COMMIT_START ,
Greg Kroah-Hartman
maintainerPATCH 189/192 bpf: Silence a warning in btf_type_id_size()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
commit e6c2f594ed961273479505b42040782820190305 upstream.
syzbot reported a warning in [1] with the following stacktrace:
WARNING: CPU: 0 PID: 5005 at kernel/bpf/btf.c:1988 btf_type_id_size+0x2d9/0x9d0 kernel/bpf/btf.c:1988 ... RIP: 0010:btf_type_id_size+0x2d9/0x9d0 kernel/bpf/btf.c:1988 ... Call Trace: <TASK> map_check_btf kernel/bpf/syscall.c:1024 [inline] map_create+0x1157/0x1860 kernel/bpf/syscall.c:1198 __sys_bpf+0x127f/0x5420 kernel/bpf/syscall.c:5040 __do_sys_bpf kernel/bpf/syscall.c:5162 [inline] __se_sys_bpf kernel/bpf/syscall.c:5160 [inline] __x64_sys_bpf+0x79/0xc0 kernel/bpf/syscall.c:5160 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
With the following btf
[1] DECL_TAG 'a' type_id=4 component_idx=-1
[2] PTR '(anon)' type_id=0
[3] TYPE_TAG 'a' type_id=2
[4] VAR 'a' type_id=3, linkage=static
and when the bpf_attr.btf_key_type_id = 1 (DECL_TAG), the following WARN_ON_ONCE in btf_type_id_size() is triggered:
if (WARN_ON_ONCE(!btf_type_is_modifier(size_type) &&
!btf_type_is_var(size_type)))
return NULL;Note that 'return NULL' is the correct behavior as we don't want a DECL_TAG type to be used as a btf_{key,value}_type_id even for the case like 'DECL_TAG -> STRUCT'. So there
is no correctness issue here, we just want to silence warning.
To silence the warning, I added DECL_TAG as one of kinds in btf_type_nosize() which will cause btf_type_id_size() returning NULL earlier without the warning.
[1] https://lore.kernel.org/bpf/[email protected]/
--- kernel/bpf/btf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
kernel/bpf/btf.c +7 -6
@@ -466,10 +466,16 @@ static bool btf_type_is_fwd(const structreturn BTF_INFO_KIND (t->info) ==BTF_KIND_FWD ; } +static bool btf_type_is_decl_tag (const struct btf_type *t) +{ +return BTF_INFO_KIND (t->info) ==BTF_KIND_DECL_TAG ; +} +static bool btf_type_nosize (const struct btf_type *t) {return btf_type_is_void (t) ||btf_type_is_fwd (t) || -btf_type_is_func (t) ||btf_type_is_func_proto (t); +btf_type_is_func (t) ||btf_type_is_func_proto (t) || +btf_type_is_decl_tag (t); }static bool btf_type_nosize_or_null (const struct btf_type *t)
@@ -492,11 +498,6 @@ static bool btf_type_is_datasec(const streturn BTF_INFO_KIND (t->info) ==BTF_KIND_DATASEC ; } -static bool btf_type_is_decl_tag (const struct btf_type *t) -{ -return BTF_INFO_KIND (t->info) ==BTF_KIND_DECL_TAG ; -} -static bool btf_type_is_decl_tag_target (const struct btf_type *t) { return btf_type_is_func(t) || btf_type_is_struct(t) ||
Greg Kroah-Hartman
maintainerPATCH 190/192 memcg: protect concurrent access to mem_cgroup_idr
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
commit 9972605a238339b85bd16b084eed5f18414d22db upstream.
Commit 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after many small jobs") decoupled the memcg IDs from the CSS ID space to fix the cgroup creation failures. It introduced IDR to maintain the memcg ID space. The IDR depends on external synchronization mechanisms for modifications. For the mem_cgroup_idr, the idr_alloc() and idr_replace() happen within css callback and thus are protected through cgroup_mutex from concurrent modifications. However idr_remove() for mem_cgroup_idr was not protected against concurrency and can be run concurrently for different memcgs when they hit their refcnt to zero. Fix that.
We have been seeing list_lru based kernel crashes at a low frequency in our fleet for a long time. These crashes were in different part of list_lru code including list_lru_add(), list_lru_del() and reparenting code. Upon further inspection, it looked like for a given object (dentry and inode), the super_block's list_lru didn't have list_lru_one for the memcg of that object. The initial suspicions were either the object is not allocated through kmem_cache_alloc_lru() or somehow memcg_list_lru_alloc() failed to allocate list_lru_one() for a memcg but returned success. No evidence were found for these cases.
Looking more deeply, we started seeing situations where valid memcg's id is not present in mem_cgroup_idr and in some cases multiple valid memcgs have same id and mem_cgroup_idr is pointing to one of them. So, the most reasonable explanation is that these situations can happen due to race between multiple idr_remove() calls or race between idr_alloc()/idr_replace() and idr_remove(). These races are causing multiple memcgs to acquire the same ID and then offlining of one of them would cleanup list_lrus on the system for all of them. Later access from other memcgs to the list_lru cause crashes due to missing list_lru_one.
[ Adapted over commit 6f0df8e16eb5 ("memcontrol: ensure memcg acquired by id is
properly set up") not in the tree ]
--- mm/memcontrol.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
mm/memcontrol.c +20 -2
@@ -5143,11 +5143,28 @@ static struct cftype mem_cgroup_legacy_f*/ static DEFINE_IDR (mem_cgroup_idr); +static DEFINE_SPINLOCK (memcg_idr_lock); + +static int mem_cgroup_alloc_id (void ) +{ +int ret; + +idr_preload (GFP_KERNEL ); +spin_lock (&memcg_idr_lock); + ret =idr_alloc (&mem_cgroup_idr,NULL ,1 ,MEM_CGROUP_ID_MAX +1 , +GFP_NOWAIT ); +spin_unlock (&memcg_idr_lock); +idr_preload_end (); +return ret; +}static void mem_cgroup_id_remove (struct mem_cgroup *memcg) {if (memcg->id.id >0 ) { +spin_lock (&memcg_idr_lock);idr_remove (&mem_cgroup_idr, memcg->id.id); +spin_unlock (&memcg_idr_lock); + memcg->id.id =0 ; } }
@@ -5270,8 +5287,7 @@ static struct mem_cgroup *mem_cgroup_allif (!memcg)return ERR_PTR (error); - memcg->id.id =idr_alloc (&mem_cgroup_idr,NULL , -1 ,MEM_CGROUP_ID_MAX +1 ,GFP_KERNEL ); + memcg->id.id =mem_cgroup_alloc_id ();if (memcg->id.id <0 ) { error = memcg->id.id; goto fail;
@@ -5316,7 +5332,9 @@ static struct mem_cgroup *mem_cgroup_allINIT_LIST_HEAD (&memcg->deferred_split_queue.split_queue); memcg->deferred_split_queue.split_queue_len =0 ;#endif +spin_lock (&memcg_idr_lock);idr_replace (&mem_cgroup_idr, memcg, memcg->id.id); +spin_unlock (&memcg_idr_lock);lru_gen_init_memcg (memcg);return memcg; fail:
Greg Kroah-Hartman
maintainerPATCH 191/192 regulator: of: fix a NULL vs IS_ERR() check in of_regulator_bulk_get_all()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Wu <[email protected]>
commit c957387c402a1a213102e38f92b800d7909a728d upstream.
The regulator_get() function never returns NULL. It returns error pointers.
--- drivers/regulator/of_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/of_regulator.c +1 -1
@@ -767,7 +767,7 @@ restart:memcpy (name, prop->name, i); name[i] ='\0' ; tmp =regulator_get (dev, name); -if (!tmp) { +if (IS_ERR (tmp)) { ret = -EINVAL ; goto error; }
Greg Kroah-Hartman
maintainerPATCH 192/192 fuse: add feature flag for expire-only
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 5cadfbd5a11e5495cac217534c5f788168b1afd7 upstream.
Add an init flag idicating whether the FUSE_EXPIRE_ONLY flag of FUSE_NOTIFY_INVAL_ENTRY is effective.
This is needed for backports of this feature, otherwise the server could just check the protocol version.
--- fs/fuse/inode.c | 3 ++- include/uapi/linux/fuse.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
fs/fuse/inode.c +2 -1
@@ -1327,7 +1327,8 @@ void fuse_send_init(struct fuse_mount *fFUSE_ABORT_ERROR |FUSE_MAX_PAGES |FUSE_CACHE_SYMLINKS |FUSE_NO_OPENDIR_SUPPORT |FUSE_EXPLICIT_INVAL_DATA |FUSE_HANDLE_KILLPRIV_V2 |FUSE_SETXATTR_EXT |FUSE_INIT_EXT | -FUSE_SECURITY_CTX ; +FUSE_SECURITY_CTX | +FUSE_HAS_EXPIRE_ONLY ;#ifdef CONFIG_FUSE_DAX if (fm->fc->dax) flags |=FUSE_MAP_ALIGNMENT ;
include/uapi/linux/fuse.h +2 -0
@@ -365,6 +365,7 @@ struct fuse_file_lock {* FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and * mknod * FUSE_HAS_INODE_DAX: use per inode DAX +* FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation */ #define FUSE_ASYNC_READ (1 << 0)#define FUSE_POSIX_LOCKS (1 << 1)
@@ -401,6 +402,7 @@ struct fuse_file_lock {/* bits 32..63 get shifted down 32 bits into the flags2 field */ #define FUSE_SECURITY_CTX (1ULL << 32)#define FUSE_HAS_INODE_DAX (1ULL << 33) +#define FUSE_HAS_EXPIRE_ONLY (1ULL << 35)/** * CUSE INIT request/reply flags
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Can you quote git hash of the 6.1.110-rc1?
We do have
Linux 6.1.110-rc1 (244a97bb85be)
Greg Kroah-Hartman authored 1 day ago
passing tests
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.1.y
. But that's 1 day old.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg Kroah-Hartman
maintainerQuoted 8 lines · Pavel Machek
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Can you quote git hash of the 6.1.110-rc1?
Nope! We create the git trees for those that want throw-away trees, once I create them I automatically delete them so I don't even know the hash anymore.
Quoted 10 lines
We do have
Linux 6.1.110-rc1 (
244a97bb85be)
Greg Kroah-Hartman authored 1 day agopassing tests
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.1.y
. But that's 1 day old.
Lots have changed since then, please use the latest.
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Pavel Machek
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 5 lines
Quoted 1 line
Can you quote git hash of the 6.1.110-rc1?
Nope! We create the git trees for those that want throw-away trees, once I create them I automatically delete them so I don't even know the hash anymore.
Modify your scripts so that you can quote hash in the announcement?
Avoid using "-rc1" tag for things that are... well... not released as -rc1?
Quoted 5 lines
Quoted 5 lines
We do have
Linux 6.1.110-rc1 (
244a97bb85be)
Greg Kroah-Hartman authored 1 day ago
Quoted 7 lines
Quoted 5 lines
passing tests
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.1.y
. But that's 1 day old.
Lots have changed since then, please use the latest.
I will, but matching releases and tests based on timestamps is just not right.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 12 Sep 2024 09:25:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
The SuperH defconfig builds failed due to following build warnings / errors on the stable-rc linux-6.1.y.
* SuperH, build
- gcc-8-defconfig
- gcc-11-shx3_defconfig
- gcc-11-defconfig
- gcc-8-shx3_defconfig
Build log:
--------
In file included from include/linux/mm.h:29,
from arch/sh/kernel/asm-offsets.c:14:
include/linux/pgtable.h: In function 'pmdp_get_lockless':
include/linux/pgtable.h:379:20: error: 'pmd_t' has no member named 'pmd_low'
379 | pmd.pmd_low = pmdp->pmd_low;
| ^
include/linux/pgtable.h:379:35: error: 'pmd_t' has no member named 'pmd_low'
379 | pmd.pmd_low = pmdp->pmd_low;
| ^~
Metadata:
--------
build_name: gcc-11-defconfig
config: https://storage.tuxsuite.com/public/linaro/lkft/builds/2lsNsLYIfqdkNQOzLLZO4lq580E/config
download_url:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2lsNsLYIfqdkNQOzLLZO4lq580E/
git_describe: v6.1.109-193-gb220bb28da0f
git_repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git_sha: b220bb28da0f6a629a0d88be3f8e57ea5025c728
compiler: {'name': 'sh4-linux-gnu-gcc', 'version': '11',
'version_full': 'sh4-linux-gnu-gcc (Debian 11.4.0-5) 11.4.0'}
Steps to reproduce:
-------
- # tuxmake --runtime podman --target-arch sh --toolchain gcc-11
--kconfig defconfig
--
Linaro LKFT
https://lkft.linaro.org
Quoted 32 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 12 Sep 2024 09:25:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
The SuperH defconfig builds failed due to following build warnings / errors on the stable-rc linux-6.1.y.
* SuperH, build
- gcc-8-defconfig
- gcc-11-shx3_defconfig
- gcc-11-defconfig
- gcc-8-shx3_defconfig
Quoted 12 lines
Build log:
--------
In file included frominclude/linux/mm.h:29,
fromarch/sh/kernel/asm-offsets.c:14:
include/linux/pgtable.h: In function 'pmdp_get_lockless':
include/linux/pgtable.h:379:20: error: 'pmd_t' has no member named 'pmd_low'
379 | pmd.pmd_low =pmdp->pmd_low;
| ^
include/linux/pgtable.h:379:35: error: 'pmd_t' has no member named 'pmd_low'
379 | pmd.pmd_low =pmdp->pmd_low;
| ^~
Anders bisected this down to,
# first bad commit:
[4f5373c50a1177e2a195f0ef6a6e5b7f64bf8b6c]
mm: Fix pmd_read_atomic()
[ Upstream commit 024d232ae4fcd7a7ce8ea239607d6c1246d7adc8 ]AFAICT there's no reason to do anything different than what we do for PTEs. Make it so (also affects SH)
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 46 lines · Naresh Kamboju
Quoted 32 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 12 Sep 2024 09:25:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
The SuperH defconfig builds failed due to following build warnings / errors on the stable-rc linux-6.1.y.
* SuperH, build
- gcc-8-defconfig
- gcc-11-shx3_defconfig
- gcc-11-defconfig
- gcc-8-shx3_defconfigQuoted 12 lines
Build log:
--------
In file included frominclude/linux/mm.h:29,
fromarch/sh/kernel/asm-offsets.c:14:
include/linux/pgtable.h: In function 'pmdp_get_lockless':
include/linux/pgtable.h:379:20: error: 'pmd_t' has no member named 'pmd_low'
379 | pmd.pmd_low =pmdp->pmd_low;
| ^
include/linux/pgtable.h:379:35: error: 'pmd_t' has no member named 'pmd_low'
379 | pmd.pmd_low =pmdp->pmd_low;
| ^~
Quoted 8 lines
Anders bisected this down to,
# first bad commit: [4f5373c50a1177e2a195f0ef6a6e5b7f64bf8b6c] mm: Fix pmd_read_atomic() [ Upstream commit 024d232ae4fcd7a7ce8ea239607d6c1246d7adc8 ]AFAICT there's no reason to do anything different than what we do for PTEs. Make it so (also affects SH)
Ok, I'm going to drop this series as it shouldn't be breaking builds :(
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 12 Sep 2024 09:25:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.110 release. There are 192 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 12 Sep 2024 09:25:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah