5.2.3-stable review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 302/413 arm64: Fix interrupt tracing in the presence of NMIs
In reply to Greg Kroah-HartmanFrom: Julien Thierry <[email protected]>
commit 17ce302f3117e9518395847a3120c8a108b587b8 upstream.
In the presence of any form of instrumentation, nmi_enter() should be done before calling any traceable code and any instrumentation code.
Currently, nmi_enter() is done in handle_domain_nmi(), which is much too late as instrumentation code might get called before. Move the nmi_enter/exit() calls to the arch IRQ vector handler.
On arm64, it is not possible to know if the IRQ vector handler was called because of an NMI before acknowledging the interrupt. However, It is possible to know whether normal interrupts could be taken in the interrupted context (i.e. if taking an NMI in that context could introduce a potential race condition).
When interrupting a context with IRQs disabled, call nmi_enter() as soon as possible. In contexts with IRQs enabled, defer this to the interrupt controller, which is in a better position to know if an interrupt taken is an NMI.
--- arch/arm64/kernel/entry.S | 44 ++++++++++++++++++++++++++++++++----------- arch/arm64/kernel/irq.c | 17 ++++++++++++++++ drivers/irqchip/irq-gic-v3.c | 7 ++++++ kernel/irq/irqdesc.c | 8 +++++-- 4 files changed, 63 insertions(+), 13 deletions(-)
arch/arm64/kernel/entry.S +33 -11
@@ -424,6 +424,20 @@ tsk .req x28 // current thread_info irq_stack_exit .endm +#ifdef CONFIG_ARM64_PSEUDO_NMI + /* + * Set res to 0 if irqs were unmasked in interrupted context. + * Otherwise set res to non-0 value. + */ + .macro test_irqs_unmasked res:req, pmr:req +alternative_if ARM64_HAS_IRQ_PRIO_MASKING + sub \res, \pmr, #GIC_PRIO_IRQON +alternative_else + mov \res, xzr +alternative_endif + .endm +#endif + .text /*
@@ -620,19 +634,19 @@ ENDPROC(el1_sync) el1_irq: kernel_entry 1 enable_da_f -#ifdef CONFIG_TRACE_IRQFLAGS + #ifdef CONFIG_ARM64_PSEUDO_NMI alternative_if ARM64_HAS_IRQ_PRIO_MASKING ldr x20, [sp, #S_PMR_SAVE] -alternative_else - mov x20, #GIC_PRIO_IRQON -alternative_endif - cmp x20, #GIC_PRIO_IRQOFF - /* Irqs were disabled, don't trace */ - b.ls 1f +alternative_else_nop_endif + test_irqs_unmasked res=x0, pmr=x20 + cbz x0, 1f + bl asm_nmi_enter +1: #endif + +#ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off -1: #endif irq_handler
@@ -651,14 +665,22 @@ alternative_else_nop_endif bl preempt_schedule_irq // irq en/disable is done inside 1: #endif -#ifdef CONFIG_TRACE_IRQFLAGS + #ifdef CONFIG_ARM64_PSEUDO_NMI /* * if IRQs were disabled when we received the interrupt, we have an NMI * and we are not re-enabling interrupt upon eret. Skip tracing. */ - cmp x20, #GIC_PRIO_IRQOFF - b.ls 1f + test_irqs_unmasked res=x0, pmr=x20 + cbz x0, 1f + bl asm_nmi_exit +1: +#endif + +#ifdef CONFIG_TRACE_IRQFLAGS +#ifdef CONFIG_ARM64_PSEUDO_NMI + test_irqs_unmasked res=x0, pmr=x20 + cbnz x0, 1f #endif bl trace_hardirqs_on 1:
arch/arm64/kernel/irq.c +17 -0
@@ -16,8 +16,10 @@#include <linux/smp.h> #include <linux/init.h> #include <linux/irqchip.h> +#include <linux/kprobes.h> #include <linux/seq_file.h> #include <linux/vmalloc.h> +#include <asm/daifflags.h> #include <asm/vmap_stack.h> unsigned long irq_err_count;
@@ -65,3 +67,18 @@ void __init init_IRQ(void)if (!handle_arch_irq)panic ("No interrupt controller found." ); } + +/* +* Stubs to make nmi_enter/exit() code callable from ASM +*/ +asmlinkage void notrace asm_nmi_enter(void) +{ +nmi_enter (); +} +NOKPROBE_SYMBOL (asm_nmi_enter); + +asmlinkage void notrace asm_nmi_exit(void) +{ +nmi_exit (); +} +NOKPROBE_SYMBOL (asm_nmi_exit);
drivers/irqchip/irq-gic-v3.c +7 -0
@@ -461,8 +461,12 @@ static void gic_deactivate_unhandled(u32static inline void gic_handle_nmi (u32 irqnr,struct pt_regs *regs) { +bool irqs_enabled =interrupts_enabled (regs);int err; +if (irqs_enabled) +nmi_enter (); +if (static_branch_likely (&supports_deactivate_key))gic_write_eoir (irqnr);/*
@@ -474,6 +478,9 @@ static inline void gic_handle_nmi(u32 ir err =handle_domain_nmi (gic_data.domain, irqnr, regs);if (err)gic_deactivate_unhandled (irqnr); + +if (irqs_enabled) +nmi_exit (); } static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
kernel/irq/irqdesc.c +6 -2
@@ -680,6 +680,8 @@ int __handle_domain_irq(struct irq_domai* @hwirq: The HW irq number to convert to a logical one * @regs: Register file coming from the low-level handling code * +* This function must be called from an NMI context. +* * Returns: 0 on success, or -EINVAL if conversion has failed */ int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
@@ -689,7 +691,10 @@ int handle_domain_nmi(struct irq_domainunsigned int irq;int ret =0 ; -nmi_enter (); +/* +* NMI context needs to be setup earlier in order to deal with tracing. +*/ +WARN_ON (!in_nmi ()); irq =irq_find_mapping (domain, hwirq);
@@ -702,7 +707,6 @@ int handle_domain_nmi(struct irq_domainelse ret = -EINVAL ; -nmi_exit ();set_irq_regs (old_regs);return ret; }
Greg Kroah-Hartman
maintainerPATCH 303/413 tracing: Fix user stack trace "??" output
In reply to Greg Kroah-HartmanFrom: Eiichi Tsukata <[email protected]>
commit 6d54ceb539aacc3df65c89500e8b045924f3ef81 upstream.
Commit c5c27a0a5838 ("x86/stacktrace: Remove the pointless ULONG_MAX marker") removes ULONG_MAX marker from user stack trace entries but trace_user_stack_print() still uses the marker and it outputs unnecessary "??".
For example:
less-1911 [001] d..2 34.758944: <user stack trace>
=> <00007f16f2295910>
=> ??
=> ??
=> ??
=> ??
=> ??
=> ??
=> ??
The user stack trace code zeroes the storage before saving the stack, so if the trace is shorter than the maximum number of entries it can terminate the print loop if a zero entry is detected.
--- kernel/trace/trace_output.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
kernel/trace/trace_output.c +1 -8
@@ -1109,17 +1109,10 @@ static enum print_line_t trace_user_stacfor (i =0 ; i <FTRACE_STACK_ENTRIES ; i++) {unsigned long ip = field->caller[i]; -if (ip ==ULONG_MAX ||trace_seq_has_overflowed (s)) +if (!ip ||trace_seq_has_overflowed (s))break ;trace_seq_puts (s," => " ); - -if (!ip) { -trace_seq_puts (s,"??" ); -trace_seq_putc (s,'\n' ); -continue ; - } -seq_print_user_ip (s, mm, ip, flags);trace_seq_putc (s,'\n' ); }
Greg Kroah-Hartman
maintainerPATCH 304/413 NFSv4: Handle the special Linux file open access mode
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 44942b4e457beda00981f616402a1a791e8c616e upstream.
According to the open() manpage, Linux reserves the access mode 3 to mean "check for read and write permission on the file and return a file descriptor that can't be used for reading or writing."
Currently, the NFSv4 code will ask the server to open the file, and will use an incorrect share access mode of 0. Since it has an incorrect share access mode, the client later forgets to send a corresponding close, meaning it can leak stateids on the server.
--- fs/nfs/inode.c | 1 + fs/nfs/nfs4file.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
fs/nfs/inode.c +1 -0
@@ -1100,6 +1100,7 @@ int nfs_open(struct inode *inode, structnfs_fscache_open_file (inode, filp);return 0 ; } +EXPORT_SYMBOL_GPL (nfs_open);/* * This function is called whenever some part of NFS notices that
fs/nfs/nfs4file.c +1 -1
@@ -49,7 +49,7 @@ nfs4_file_open(struct inode *inode, strureturn err;if ((openflags &O_ACCMODE ) ==3 ) - openflags--; +return nfs_open (inode, filp);/* We can't create new files here */ openflags &= ~(O_CREAT |O_EXCL );
Greg Kroah-Hartman
maintainerPATCH 305/413 Revert "NFS: readdirplus optimization by cache mechanism" (memleak)
In reply to Greg Kroah-HartmanFrom: Max Kellermann <[email protected]>
commit db531db951f950b86d274cc8ed7b21b9e2240036 upstream.
This reverts commit be4c2d4723a4a637f0d1b4f7c66447141a4b3564.
That commit caused a severe memory leak in nfs_readdir_make_qstr().
When listing a directory with more than 100 files (this is how many struct nfs_cache_array_entry elements fit in one 4kB page), all allocated file name strings past those 100 leak.
The root of the leakage is that those string pointers are managed in pages which are never linked into the page cache.
fs/nfs/dir.c puts pages into the page cache by calling read_cache_page(); the callback function nfs_readdir_filler() will then fill the given page struct which was passed to it, which is already linked in the page cache (by do_read_cache_page() calling add_to_page_cache_lru()).
Commit be4c2d4723a4 added another (local) array of allocated pages, to be filled with more data, instead of discarding excess items received from the NFS server. Those additional pages can be used by the next nfs_readdir_filler() call (from within the same nfs_readdir() call).
The leak happens when some of those additional pages are never used (copied to the page cache using copy_highpage()). The pages will be freed by nfs_readdir_free_pages(), but their contents will not. The commit did not invoke nfs_readdir_clear_array() (and doing so would have been dangerous, because it did not track which of those pages were already copied to the page cache, risking double free bugs).
How to reproduce the leak:
- Use a kernel with CONFIG_SLUB_DEBUG_ON.
- Create a directory on a NFS mount with more than 100 files with names long enough to use the "kmalloc-32" slab (so we can easily look up the allocation counts):
for i in `seq 110`; do touch ${i}_0123456789abcdef; done- Drop all caches:
echo 3 >/proc/sys/vm/drop_caches
- Check the allocation counter:
grep nfs_readdir /sys/kernel/slab/kmalloc-32/alloc_calls
30564391 nfs_readdir_add_to_array+0x73/0xd0 age=534558/4791307/6540952 pid=370-1048386 cpus=0-47 nodes=0-1
- Request a directory listing and check the allocation counters again:
ls
[...]
grep nfs_readdir /sys/kernel/slab/kmalloc-32/alloc_calls
30564511 nfs_readdir_add_to_array+0x73/0xd0 age=207/4792999/6542663 pid=370-1048386 cpus=0-47 nodes=0-1
There are now 120 new allocations.
- Drop all caches and check the counters again:
echo 3 >/proc/sys/vm/drop_caches
grep nfs_readdir /sys/kernel/slab/kmalloc-32/alloc_calls
30564401 nfs_readdir_add_to_array+0x73/0xd0 age=735/4793524/6543176 pid=370-1048386 cpus=0-47 nodes=0-1
110 allocations are gone, but 10 have leaked and will never be freed.
Unhelpfully, those allocations are explicitly excluded from KMEMLEAK, that's why my initial attempts with KMEMLEAK were not successful:
/* * Avoid a kmemleak false positive. The pointer to the name is stored * in a page cache page which kmemleak does not scan. */ kmemleak_not_leak(string->name);
It would be possible to solve this bug without reverting the whole commit:
- keep track of which pages were not used, and call nfs_readdir_clear_array() on them, or
- manually link those pages into the page cache
But for now I have decided to just revert the commit, because the real fix would require complex considerations, risking more dangerous (crash) bugs, which may seem unsuitable for the stable branches.
--- fs/nfs/dir.c | 90 +++--------------------------------------------------- fs/nfs/internal.h | 3 - 2 files changed, 7 insertions(+), 86 deletions(-)
fs/nfs/dir.c +6 -84
@@ -140,19 +140,12 @@ struct nfs_cache_array {struct nfs_cache_array_entry array[0 ]; }; -struct readdirvec { -unsigned long nr; -unsigned long index; -struct page *pages[NFS_MAX_READDIR_RAPAGES ]; -}; -typedef int (*decode_dirent_t )(struct xdr_stream *,struct nfs_entry *,bool ); typedef struct { struct file *file; struct page *page; struct dir_context *ctx; unsigned long page_index; - struct readdirvec pvec; u64 *dir_cookie; u64 last_cookie; loff_t current_index;
@@ -532,10 +525,6 @@ int nfs_readdir_page_filler(nfs_readdir_struct nfs_cache_array *array;unsigned int count =0 ;int status; -int max_rapages =NFS_MAX_READDIR_RAPAGES ; - - desc->pvec.index = desc->page_index; - desc->pvec.nr =0 ; scratch =alloc_page (GFP_KERNEL );if (scratch ==NULL )
@@ -560,40 +549,20 @@ int nfs_readdir_page_filler(nfs_readdir_if (desc->plus)nfs_prime_dcache (file_dentry (desc->file), entry); - status =nfs_readdir_add_to_array (entry, desc->pvec.pages[desc->pvec.nr]); -if (status == -ENOSPC ) { - desc->pvec.nr++; -if (desc->pvec.nr == max_rapages) -break ; - status =nfs_readdir_add_to_array (entry, desc->pvec.pages[desc->pvec.nr]); - } + status =nfs_readdir_add_to_array (entry, page);if (status !=0 )break ; }while (!entry->eof); -/* -* page and desc->pvec.pages[0] are valid, don't need to check -* whether or not to be NULL. -*/ -copy_highpage (page, desc->pvec.pages[0 ]); - out_nopages:if (count ==0 || (status == -EBADCOOKIE && entry->eof !=0 )) { - array =kmap_atomic (desc->pvec.pages[desc->pvec.nr]); + array =kmap (page); array->eof_index = array->size; status =0 ; -kunmap_atomic (array); +kunmap (page); }put_page (scratch); - -/* -* desc->pvec.nr > 0 means at least one page was completely filled, -* we should return -ENOSPC. Otherwise function -* nfs_readdir_xdr_to_array will enter infinite loop. -*/ -if (desc->pvec.nr >0 ) -return -ENOSPC ;return status; }
@@ -627,24 +596,6 @@ out_freepages:return -ENOMEM ; } -/* -* nfs_readdir_rapages_init initialize rapages by nfs_cache_array structure. -*/ -static -void nfs_readdir_rapages_init (nfs_readdir_descriptor_t *desc) -{ -struct nfs_cache_array *array; -int max_rapages =NFS_MAX_READDIR_RAPAGES ; -int index; - -for (index =0 ; index < max_rapages; index++) { - array =kmap_atomic (desc->pvec.pages[index]); -memset (array,0 ,sizeof (struct nfs_cache_array )); - array->eof_index =-1 ; -kunmap_atomic (array); - } -} -static int nfs_readdir_xdr_to_array (nfs_readdir_descriptor_t *desc,struct page *page,struct inode *inode) {
@@ -655,12 +606,6 @@ int nfs_readdir_xdr_to_array(nfs_readdirint status = -ENOMEM ;unsigned int array_size =ARRAY_SIZE (pages); -/* -* This means we hit readdir rdpages miss, the preallocated rdpages -* are useless, the preallocate rdpages should be reinitialized. -*/ -nfs_readdir_rapages_init (desc); - entry.prev_cookie =0 ; entry.cookie = desc->last_cookie; entry.eof =0 ;
@@ -721,24 +666,9 @@ int nfs_readdir_filler(void *data, strucstruct inode *inode =file_inode (desc->file);int ret; -/* -* If desc->page_index in range desc->pvec.index and -* desc->pvec.index + desc->pvec.nr, we get readdir cache hit. -*/ -if (desc->page_index >= desc->pvec.index && - desc->page_index < (desc->pvec.index + desc->pvec.nr)) { -/* -* page and desc->pvec.pages[x] are valid, don't need to check -* whether or not to be NULL. -*/ -copy_highpage (page, desc->pvec.pages[desc->page_index - desc->pvec.index]); - ret =0 ; - }else { - ret =nfs_readdir_xdr_to_array (desc, page, inode); -if (ret <0 ) - goto error; - } - + ret =nfs_readdir_xdr_to_array (desc, page, inode); +if (ret <0 ) + goto error;SetPageUptodate (page);if (invalidate_inode_pages2_range (inode->i_mapping, page->index +1 ,-1 ) <0 ) {
@@ -903,7 +833,6 @@ static int nfs_readdir(struct file *file *desc = &my_desc;struct nfs_open_dir_context *dir_ctx = file->private_data;int res =0 ; -int max_rapages =NFS_MAX_READDIR_RAPAGES ;dfprintk (FILE ,"NFS: readdir(%pD2) starting at cookie %llu\n" , file, (long long )ctx->pos);
@@ -923,12 +852,6 @@ static int nfs_readdir(struct file *file desc->decode =NFS_PROTO (inode)->decode_dirent; desc->plus =nfs_use_readdirplus (inode, ctx); - res =nfs_readdir_alloc_pages (desc->pvec.pages, max_rapages); -if (res <0 ) -return -ENOMEM ; - -nfs_readdir_rapages_init (desc); -if (ctx->pos ==0 ||nfs_attribute_cache_expired (inode)) res =nfs_revalidate_mapping (inode, file->f_mapping);if (res <0 )
@@ -964,7 +887,6 @@ static int nfs_readdir(struct file *filebreak ; }while (!desc->eof); out: -nfs_readdir_free_pages (desc->pvec.pages, max_rapages);if (res >0 ) res =0 ;dfprintk (FILE ,"NFS: readdir(%pD2) returns %d\n" , file, res);
fs/nfs/internal.h +1 -2
@@ -69,8 +69,7 @@ struct nfs_clone_mount {* Maximum number of pages that readdir can use for creating * a vmapped array of pages. */ -#define NFS_MAX_READDIR_PAGES 64 -#define NFS_MAX_READDIR_RAPAGES 8 +#define NFS_MAX_READDIR_PAGES 8struct nfs_client_initdata {unsigned long init_flags;
Greg Kroah-Hartman
maintainerPATCH 306/413 pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 8e04fdfadda75a849c649f7e50fe7d97772e1fcb upstream.
mirror->mirror_ds can be NULL if uninitialised, but can contain a PTR_ERR() if call to GETDEVICEINFO failed.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +1 -1
@@ -257,7 +257,7 @@ int ff_layout_track_ds_error(struct nfs4if (status ==0 )return 0 ; -if (mirror->mirror_ds ==NULL ) +if (IS_ERR_OR_NULL (mirror->mirror_ds))return -EINVAL ; dserr =kmalloc (sizeof (*dserr), gfp_flags);
Greg Kroah-Hartman
maintainerPATCH 307/413 pnfs: Fix a problem where we gratuitously start doing I/O through the MDS
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 58bbeab425c6c5e318f5b6ae31d351331ddfb34b upstream.
If the client has to stop in pnfs_update_layout() to wait for another layoutget to complete, it currently exits and defaults to I/O through the MDS if the layoutget was successful.
--- fs/nfs/pnfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pnfs.c +1 -1
@@ -1890,7 +1890,7 @@ lookup_again:spin_unlock (&ino->i_lock); lseg =ERR_PTR (wait_var_event_killable (&lo->plh_outstanding, !atomic_read (&lo->plh_outstanding))); -if (IS_ERR (lseg) || !list_empty (&lo->plh_segs)) +if (IS_ERR (lseg)) goto out_put_layout_hdr;pnfs_put_layout_hdr (lo); goto lookup_again;
Greg Kroah-Hartman
maintainerPATCH 308/413 SUNRPC: Ensure the bvecs are reset when we re-encode the RPC request
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 75369089820473eac45e9ddd970081901a373c08 upstream.
The bvec tracks the list of pages, so if the number of pages changes due to a re-encode, we need to reset the bvec as well.
--- net/sunrpc/clnt.c | 3 +-- net/sunrpc/xprt.c | 2 ++ net/sunrpc/xprtsock.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/clnt.c +1 -2
@@ -1788,6 +1788,7 @@ rpc_xdr_encode(struct rpc_task *task) req->rq_snd_buf.head[0 ].iov_len =0 ;xdr_init_encode (&xdr, &req->rq_snd_buf, req->rq_snd_buf.head[0 ].iov_base, req); +xdr_free_bvec (&req->rq_snd_buf);if (rpc_encode_header (task, &xdr))return ;
@@ -1827,8 +1828,6 @@ call_encode(struct rpc_task *task)rpc_call_rpcerror (task, task->tk_status); }return ; - }else { -xprt_request_prepare (task->tk_rqstp); }/* Add task to reply queue before transmission to avoid races */
net/sunrpc/xprt.c +2 -0
@@ -1013,6 +1013,8 @@ xprt_request_enqueue_receive(struct rpc_if (!xprt_request_need_enqueue_receive (task, req))return ; + +xprt_request_prepare (task->tk_rqstp);spin_lock (&xprt->queue_lock);/* Update the softirq receive buffer */
net/sunrpc/xprtsock.c +1 -0
@@ -909,6 +909,7 @@ static int xs_nospace(struct rpc_rqst *rstatic void xs_stream_prepare_request (struct rpc_rqst *req) { +xdr_free_bvec (&req->rq_rcv_buf); req->rq_task->tk_status =xdr_alloc_bvec (&req->rq_rcv_buf,GFP_KERNEL ); }
Greg Kroah-Hartman
maintainerPATCH 309/413 lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit aeb87246537a83c2aff482f3f34a2e0991e02cbc upstream.
All mapping iterator logic is based on the assumption that sg->offset is always lower than PAGE_SIZE.
But there are situations where sg->offset is such that the SG item is on the second page. In that case sg_copy_to_buffer() fails properly copying the data into the buffer. One of the reason is that the data will be outside the kmapped area used to access that data.
This patch fixes the issue by adjusting the mapping iterator offset and pgoffset fields such that offset is always lower than PAGE_SIZE.
--- lib/scatterlist.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/scatterlist.c +5 -4
@@ -676,17 +676,18 @@ static bool sg_miter_get_next_page(struc {if (!miter->__remaining) {struct scatterlist *sg; -unsigned long pgoffset;if (!__sg_page_iter_next (&miter->piter))return false; sg = miter->piter.sg; - pgoffset = miter->piter.sg_pgoffset; - miter->__offset = pgoffset ?0 : sg->offset; + miter->__offset = miter->piter.sg_pgoffset ?0 : sg->offset; + miter->piter.sg_pgoffset += miter->__offset >>PAGE_SHIFT ; + miter->__offset &=PAGE_SIZE -1 ; miter->__remaining = sg->offset + sg->length - - (pgoffset <<PAGE_SHIFT ) - miter->__offset; + (miter->piter.sg_pgoffset <<PAGE_SHIFT ) - + miter->__offset; miter->__remaining = min_t(unsigned long, miter->__remaining,PAGE_SIZE - miter->__offset); }
Greg Kroah-Hartman
maintainerPATCH 310/413 ASoC: dapm: Adapt for debugfs API change
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
commit ceaea851b9ea75f9ea2bbefb53ff0d4b27cd5a6e upstream.
Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the debugfs APIs were changed to return error pointers rather than NULL pointers on error, breaking the error checking in ASoC. Update the code to use IS_ERR() and log the codes that are returned as part of the error messages.
--- sound/soc/soc-dapm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
sound/soc/soc-dapm.c +10 -8
@@ -2155,23 +2155,25 @@ void snd_soc_dapm_debugfs_init(struct sn {struct dentry *d; -if (!parent) +if (!parent ||IS_ERR (parent))return ; dapm->debugfs_dapm =debugfs_create_dir ("dapm" , parent); -if (!dapm->debugfs_dapm) { +if (IS_ERR (dapm->debugfs_dapm)) {dev_warn (dapm->dev, -"ASoC: Failed to create DAPM debugfs directory\n" ); +"ASoC: Failed to create DAPM debugfs directory %ld\n" , +PTR_ERR (dapm->debugfs_dapm));return ; } d =debugfs_create_file ("bias_level" ,0444 , dapm->debugfs_dapm, dapm, &dapm_bias_fops); -if (!d) +if (IS_ERR (d))dev_warn (dapm->dev, -"ASoC: Failed to create bias level debugfs file\n" ); +"ASoC: Failed to create bias level debugfs file: %ld\n" , +PTR_ERR (d)); }static void dapm_debugfs_add_widget (struct snd_soc_dapm_widget *w)
@@ -2185,10 +2187,10 @@ static void dapm_debugfs_add_widget(stru d =debugfs_create_file (w->name,0444 , dapm->debugfs_dapm, w, &dapm_widget_power_fops); -if (!d) +if (IS_ERR (d))dev_warn (w->dapm->dev, -"ASoC: Failed to create %s debugfs file\n" , - w->name); +"ASoC: Failed to create %s debugfs file: %ld\n" , + w->name,PTR_ERR (d)); }static void dapm_debugfs_cleanup (struct snd_soc_dapm_context *dapm)
Greg Kroah-Hartman
maintainerPATCH 311/413 ASoC: core: Adapt for debugfs API change
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
commit c2c928c93173f220955030e8440517b87ec7df92 upstream.
Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the debugfs APIs were changed to return error pointers rather than NULL pointers on error, breaking the error checking in ASoC. Update the code to use IS_ERR() and log the codes that are returned as part of the error messages.
--- sound/soc/soc-core.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
sound/soc/soc-core.c +10 -6
@@ -158,9 +158,10 @@ static void soc_init_component_debugfs(s component->card->debugfs_card_root); } -if (!component->debugfs_root) { +if (IS_ERR (component->debugfs_root)) {dev_warn (component->dev, -"ASoC: Failed to create component debugfs directory\n" ); +"ASoC: Failed to create component debugfs directory: %ld\n" , +PTR_ERR (component->debugfs_root));return ; }
@@ -212,18 +213,21 @@ static void soc_init_card_debugfs(struct card->debugfs_card_root =debugfs_create_dir (card->name, snd_soc_debugfs_root); -if (!card->debugfs_card_root) { +if (IS_ERR (card->debugfs_card_root)) {dev_warn (card->dev, -"ASoC: Failed to create card debugfs directory\n" ); +"ASoC: Failed to create card debugfs directory: %ld\n" , +PTR_ERR (card->debugfs_card_root)); + card->debugfs_card_root =NULL ;return ; } card->debugfs_pop_time =debugfs_create_u32 ("dapm_pop_time" ,0644 , card->debugfs_card_root, &card->pop_time); -if (!card->debugfs_pop_time) +if (IS_ERR (card->debugfs_pop_time))dev_warn (card->dev, -"ASoC: Failed to create pop time debugfs file\n" ); +"ASoC: Failed to create pop time debugfs file: %ld\n" , +PTR_ERR (card->debugfs_pop_time)); }static void soc_cleanup_card_debugfs (struct snd_soc_card *card)
Greg Kroah-Hartman
maintainerPATCH 312/413 raid5-cache: Need to do start() part job after adding journal device
In reply to Greg Kroah-HartmanFrom: Xiao Ni <[email protected]>
commit d9771f5ec46c282d518b453c793635dbdc3a2a94 upstream.
commit d5d885fd514f ("md: introduce new personality funciton start()") splits the init job to two parts. The first part run() does the jobs that do not require the md threads. The second part start() does the jobs that require the md threads.
Now it just does run() in adding new journal device. It needs to do the second part start() too.
--- drivers/md/raid5.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/md/raid5.c +9 -2
@@ -7672,7 +7672,7 @@ abort:static int raid5_add_disk (struct mddev *mddev,struct md_rdev *rdev) {struct r5conf *conf = mddev->private; -int err = -EEXIST ; +int ret, err = -EEXIST ;int disk;struct disk_info *p;int first =0 ;
@@ -7687,7 +7687,14 @@ static int raid5_add_disk(struct mddev ** The array is in readonly mode if journal is missing, so no * write requests running. We should be safe */ -log_init (conf, rdev, false); + ret =log_init (conf, rdev, false); +if (ret) +return ret; + + ret =r5l_start (conf->log); +if (ret) +return ret; +return 0 ; }if (mddev->recovery_disabled == conf->recovery_disabled)
Greg Kroah-Hartman
maintainerPATCH 313/413 kconfig: fix missing choice values in auto.conf
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 8e2442a5f86e1f77b86401fce274a7f622740bc4 upstream.
Since commit 00c864f8903d ("kconfig: allow all config targets to write auto.conf if missing"), Kconfig creates include/config/auto.conf in the defconfig stage when it is missing.
Joonas Kylmälä reported incorrect auto.conf generation under some circumstances.
To reproduce it, apply the following diff:
| --- a/arch/arm/configs/imx_v6_v7_defconfig | +++ b/arch/arm/configs/imx_v6_v7_defconfig | @@ -345,14 +345,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y | CONFIG_USB_CONFIGFS_F_HID=y | CONFIG_USB_CONFIGFS_F_UVC=y | CONFIG_USB_CONFIGFS_F_PRINTER=y | -CONFIG_USB_ZERO=m | -CONFIG_USB_AUDIO=m | -CONFIG_USB_ETH=m | -CONFIG_USB_G_NCM=m | -CONFIG_USB_GADGETFS=m | -CONFIG_USB_FUNCTIONFS=m | -CONFIG_USB_MASS_STORAGE=m | -CONFIG_USB_G_SERIAL=m | +CONFIG_USB_FUNCTIONFS=y | CONFIG_MMC=y | CONFIG_MMC_SDHCI=y | CONFIG_MMC_SDHCI_PLTFM=y
And then, run:
$ make ARCH=arm mrproper imx_v6_v7_defconfig
You will see CONFIG_USB_FUNCTIONFS=y is correctly contained in the .config, but not in the auto.conf.
Please note drivers/usb/gadget/legacy/Kconfig is included from a choice block in drivers/usb/gadget/Kconfig. So USB_FUNCTIONFS is a choice value.
This is probably a similar situation described in commit beaaddb62540 ("kconfig: tests: test defconfig when two choices interact").
When sym_calc_choice() is called, the choice symbol forgets the SYMBOL_DEF_USER unless all of its choice values are explicitly set by the user.
The choice symbol is given just one chance to recall it because set_all_choice_values() is called if SYMBOL_NEED_SET_CHOICE_VALUES is set.
When sym_calc_choice() is called again, the choice symbol forgets it forever, since SYMBOL_NEED_SET_CHOICE_VALUES is a one-time aid. Hence, we cannot call sym_clear_all_valid() again and again.
It is crazy to repeat set and unset of internal flags. However, we cannot simply get rid of "sym->flags &= flags | ~SYMBOL_DEF_USER;" Doing so would re-introduce the problem solved by commit 5d09598d488f ("kconfig: fix new choices being skipped upon config update").
To work around the issue, conf_write_autoconf() stopped calling sym_clear_all_valid().
conf_write() must be changed accordingly. Currently, it clears SYMBOL_WRITE after the symbol is written into the .config file. This is needed to prevent it from writing the same symbol multiple times in case the symbol is declared in two or more locations. I added the new flag SYMBOL_WRITTEN, to track the symbols that have been written.
Anyway, this is a cheesy workaround in order to suppress the issue as far as defconfig is concerned.
Handling of choices is totally broken. sym_clear_all_valid() is called every time a user touches a symbol from the GUI interface. To reproduce it, just add a new symbol drivers/usb/gadget/legacy/Kconfig, then touch around unrelated symbols from menuconfig. USB_FUNCTIONFS will disappear from the .config file.
I added the Fixes tag since it is more fatal than before. But, this has been broken since long long time before, and still it is. We should take a closer look to fix this correctly somehow.
--- scripts/kconfig/confdata.c | 7 +++---- scripts/kconfig/expr.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-)
scripts/kconfig/confdata.c +3 -4
@@ -914,7 +914,8 @@ int conf_write(const char *name)"# %s\n" "#\n", str); need_newline = false; - }else if (!(sym->flags &SYMBOL_CHOICE )) { + }else if (!(sym->flags &SYMBOL_CHOICE ) && + !(sym->flags &SYMBOL_WRITTEN )) {sym_calc_value (sym);if (!(sym->flags &SYMBOL_WRITE )) goto next;
@@ -922,7 +923,7 @@ int conf_write(const char *name)fprintf (out,"\n" ); need_newline = false; } - sym->flags &= ~SYMBOL_WRITE ; + sym->flags |=SYMBOL_WRITTEN ;conf_write_symbol (out, sym, &kconfig_printer_cb,NULL ); }
@@ -1082,8 +1083,6 @@ int conf_write_autoconf(int overwrite)if (!overwrite &&is_present (autoconf_name))return 0 ; -sym_clear_all_valid (); -conf_write_dep ("include/config/auto.conf.cmd" );if (conf_touch_deps ())
scripts/kconfig/expr.h +1 -0
@@ -141,6 +141,7 @@ struct symbol {#define SYMBOL_OPTIONAL 0x0100/* choice is optional - values can be 'n' */ #define SYMBOL_WRITE 0x0200/* write symbol to file (KCONFIG_CONFIG) */ #define SYMBOL_CHANGED 0x0400/* ? */ +#define SYMBOL_WRITTEN 0x0800/* track info to avoid double-write to .config */ #define SYMBOL_NO_WRITE 0x1000/* Symbol for internal use only; it will not be written */ #define SYMBOL_CHECKED 0x2000/* used during dependency checking */ #define SYMBOL_WARNED 0x8000/* warning has been issued */
Greg Kroah-Hartman
maintainerPATCH 314/413 ALSA: seq: Break too long mutex context in the write loop
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit ede34f397ddb063b145b9e7d79c6026f819ded13 upstream.
The fix for the racy writes and ioctls to sequencer widened the application of client->ioctl_mutex to the whole write loop. Although it does unlock/relock for the lengthy operation like the event dup, the loop keeps the ioctl_mutex for the whole time in other situations. This may take quite long time if the user-space would give a huge buffer, and this is a likely cause of some weird behavior spotted by syzcaller fuzzer.
This patch puts a simple workaround, just adding a mutex break in the loop when a large number of events have been processed. This shouldn't hit any performance drop because the threshold is set high enough for usual operations.
--- sound/core/seq/seq_clientmgr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
sound/core/seq/seq_clientmgr.c +10 -1
@@ -1021,7 +1021,7 @@ static ssize_t snd_seq_write(struct file {struct snd_seq_client *client = file->private_data;int written =0 , len; -int err; +int err, handled;struct snd_seq_event event;if (!(snd_seq_file_flags (file) &SNDRV_SEQ_LFLG_OUTPUT ))
@@ -1034,6 +1034,8 @@ static ssize_t snd_seq_write(struct fileif (!client->accept_output || client->pool ==NULL )return -ENXIO ; + repeat: + handled =0 ;/* allocate the pool now if the pool is not allocated yet */ mutex_lock (&client->ioctl_mutex);if (client->pool->size >0 && !snd_seq_write_pool_allocated (client)) {
@@ -1093,12 +1095,19 @@ static ssize_t snd_seq_write(struct file 0, 0, &client->ioctl_mutex);if (err <0 )break ; + handled++; __skip_event:/* Update pointers and counts */ count -= len; buf += len; written += len; + +/* let's have a coffee break if too many events are queued */ +if (++handled >=200 ) { +mutex_unlock (&client->ioctl_mutex); + goto repeat; + } } out:
Greg Kroah-Hartman
maintainerPATCH 315/413 ALSA: hda - Dont resume forcibly i915 HDMI/DP codec
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 4914da2fb0c89205790503f20dfdde854f3afdd8 upstream.
We apply the codec resume forcibly at system resume callback for updating and syncing the jack detection state that may have changed during sleeping. This is, however, superfluous for the codec like Intel HDMI/DP, where the jack detection is managed via the audio component notification; i.e. the jack state change shall be reported sooner or later from the graphics side at mode change.
This patch changes the codec resume callback to avoid the forcible resume conditionally with a new flag, codec->relaxed_resume, for reducing the resume time. The flag is set in the codec probe.
Although this doesn't fix the entire bug mentioned in the bugzilla entry below, it's still a good optimization and some improvements are seen.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201901
--- include/sound/hda_codec.h | 2 ++ sound/pci/hda/hda_codec.c | 8 ++++++-- sound/pci/hda/patch_hdmi.c | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-)
include/sound/hda_codec.h +2 -0
@@ -249,6 +249,8 @@ struct hda_codec { unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */ unsigned int force_pin_prefix:1; /* Add location prefix */ unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ + unsigned int relaxed_resume:1; /* don't resume forcibly for jack */ +#ifdef CONFIG_PM unsigned long power_on_acct;unsigned long power_off_acct;
sound/pci/hda/hda_codec.c +6 -2
@@ -2941,15 +2941,19 @@ static int hda_codec_runtime_resume(stru#ifdef CONFIG_PM_SLEEP static int hda_codec_force_resume (struct device *dev) { +struct hda_codec *codec =dev_to_hda_codec (dev); +bool forced_resume = !codec->relaxed_resume;int ret;/* The get/put pair below enforces the runtime resume even if the * device hasn't been used at suspend time. This trick is needed to * update the jack state change during the sleep. */ -pm_runtime_get_noresume (dev); +if (forced_resume) +pm_runtime_get_noresume (dev); ret =pm_runtime_force_resume (dev); -pm_runtime_put (dev); +if (forced_resume) +pm_runtime_put (dev);return ret; }
sound/pci/hda/patch_hdmi.c +5 -1
@@ -2291,8 +2291,10 @@ static void generic_hdmi_free(struct hdastruct hdmi_spec *spec = codec->spec;int pin_idx, pcm_idx; -if (codec_has_acomp (codec)) +if (codec_has_acomp (codec)) {snd_hdac_acomp_register_notifier (&codec->bus->core,NULL ); + codec->relaxed_resume =0 ; + }for (pin_idx =0 ; pin_idx < spec->num_pins; pin_idx++) {struct hdmi_spec_per_pin *per_pin =get_pin (spec, pin_idx);
@@ -2565,6 +2567,8 @@ static void register_i915_notifier(struc spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify;snd_hdac_acomp_register_notifier (&codec->bus->core, &spec->drm_audio_ops); +/* no need for forcible resume for jack check thanks to notifier */ + codec->relaxed_resume =1 ; }/* setup_stream ops override for HSW+ */
Greg Kroah-Hartman
maintainerPATCH 316/413 ALSA: hda/realtek - Fixed Headphone Mic cant record on Dell platform
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
commit fbc571290d9f7bfe089c50f4ac4028dd98ebfe98 upstream.
It assigned to wrong model. So, The headphone Mic can't work.
--- sound/pci/hda/patch_realtek.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +4 -1
@@ -7657,9 +7657,12 @@ static const struct snd_hda_pin_quirk al {0x12, 0x90a60130}, {0x17, 0x90170110}, {0x21, 0x03211020}), - SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, {0x14, 0x90170110}, {0x21, 0x04211020}), + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, + {0x14, 0x90170110}, + {0x21, 0x04211030}), SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, ALC295_STANDARD_PINS, {0x17, 0x21014020},
Greg Kroah-Hartman
maintainerPATCH 317/413 ALSA: hda/realtek: apply ALC891 headset fixup to one Dell machine
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 4b4e0e32e4b09274dbc9d173016c1a026f44608c upstream.
Without this patch, the headset-mic and headphone-mic don't work.
--- sound/pci/hda/patch_realtek.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/hda/patch_realtek.c +5 -0
@@ -8803,6 +8803,11 @@ static const struct snd_hda_pin_quirk al {0x18, 0x01a19030}, {0x1a, 0x01813040}, {0x21, 0x01014020}), + SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE, + {0x16, 0x01813030}, + {0x17, 0x02211010}, + {0x18, 0x01a19040}, + {0x21, 0x01014020}), SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE, {0x14, 0x01014010}, {0x18, 0x01a19020},
Greg Kroah-Hartman
maintainerPATCH 318/413 ALSA: hda/hdmi - Remove duplicated define
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit eb4177116bf568a413c544eca3f4446cb4064be9 upstream.
INTEL_GET_VENDOR_VERB is defined twice identically. Let's remove a superfluous line.
--- sound/pci/hda/patch_hdmi.c | 1 - 1 file changed, 1 deletion(-)
sound/pci/hda/patch_hdmi.c +0 -1
@@ -2418,7 +2418,6 @@ static void intel_haswell_fixup_connect_ }#define INTEL_GET_VENDOR_VERB 0xf81 -#define INTEL_GET_VENDOR_VERB 0xf81#define INTEL_SET_VENDOR_VERB 0x781#define INTEL_EN_DP12 0x02/* enable DP 1.2 features */ #define INTEL_EN_ALL_PIN_CVTS 0x01/* enable 2nd & 3rd pins and convertors */
Greg Kroah-Hartman
maintainerPATCH 319/413 ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 3140aafb22edeab0cc41f15f53b12a118c0ac215 upstream.
The recent fix for Icelake HDMI codec introduced the mapping from pin NID to the i915 gfx port number. However, it forgot the reverse mapping from the port number to the pin NID that is used in the ELD notifier callback. As a result, it's processed to a wrong widget and gives a warning like
snd_hda_codec_hdmi hdaudioC0D2: HDMI: pin nid 5 not registered
This patch corrects it with a proper reverse mapping function.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204133
--- sound/pci/hda/patch_hdmi.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
sound/pci/hda/patch_hdmi.c +19 -5
@@ -2525,18 +2525,32 @@ static int intel_pin2port(void *audio_ptreturn -1 ; } +static int intel_port2pin (struct hda_codec *codec,int port) +{ +struct hdmi_spec *spec = codec->spec; + +if (!spec->port_num) { +/* we assume only from port-B to port-D */ +if (port <1 || port >3 ) +return 0 ; +/* intel port is 1-based */ +return port +intel_base_nid (codec) -1 ; + } + +if (port <1 || port > spec->port_num) +return 0 ; +return spec->port_map[port -1 ]; +} +static void intel_pin_eld_notify (void *audio_ptr,int port,int pipe) {struct hda_codec *codec = audio_ptr;int pin_nid;int dev_id = pipe; -/* we assume only from port-B to port-D */ -if (port <1 || port >3 ) + pin_nid =intel_port2pin (codec, port); +if (!pin_nid)return ; - - pin_nid = port +intel_base_nid (codec) -1 ;/* intel port is 1-based */ -/* skip notification during system suspend (but not in runtime PM); * the state will be updated at resume */
Greg Kroah-Hartman
maintainerPATCH 320/413 ceph: fix end offset in truncate_inode_pages_range call
In reply to Greg Kroah-HartmanFrom: Luis Henriques <[email protected]>
commit d31d07b97a5e76f41e00eb81dcca740e84aa7782 upstream.
Commit e450f4d1a5d6 ("ceph: pass inclusive lend parameter to filemap_write_and_wait_range()") fixed the end offset parameter used to call filemap_write_and_wait_range and invalidate_inode_pages2_range. Unfortunately it missed truncate_inode_pages_range, introducing a regression that is easily detected by xfstest generic/130.
The problem is that when doing direct IO it is possible that an extra page is truncated from the page cache when the end offset is page aligned. This can cause data loss if that page hasn't been sync'ed to the OSDs.
While there, change code to use PAGE_ALIGN macro instead.
--- fs/ceph/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/file.c +1 -1
@@ -1007,7 +1007,7 @@ ceph_direct_read_write(struct kiocb *ioc* may block. */ truncate_inode_pages_range (inode->i_mapping, pos, - (pos+len) | (PAGE_SIZE -1 )); +PAGE_ALIGN (pos + len) -1 ); req->r_mtime = mtime; }
Greg Kroah-Hartman
maintainerPATCH 321/413 ceph: use ceph_evict_inode to cleanup inodes resource
In reply to Greg Kroah-HartmanFrom: Yan, Zheng <[email protected]>
commit 87bc5b895d94a0f40fe170d4cf5771c8e8f85d15 upstream.
remove_session_caps() relies on __wait_on_freeing_inode(), to wait for freeing inode to remove its caps. But VFS wakes freeing inode waiters before calling destroy_inode().
--- fs/ceph/inode.c | 7 +++++-- fs/ceph/super.c | 2 +- fs/ceph/super.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-)
fs/ceph/inode.c +5 -2
@@ -523,13 +523,16 @@ void ceph_free_inode(struct inode *inodekmem_cache_free (ceph_inode_cachep, ci); } -void ceph_destroy_inode (struct inode *inode) +void ceph_evict_inode (struct inode *inode) {struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_inode_frag *frag;struct rb_node *n; -dout ("destroy_inode %p ino %llx.%llx\n" , inode,ceph_vinop (inode)); +dout ("evict_inode %p ino %llx.%llx\n" , inode,ceph_vinop (inode)); + +truncate_inode_pages_final (&inode->i_data); +clear_inode (inode);ceph_fscache_unregister_inode_cookie (ci);
fs/ceph/super.c +1 -1
@@ -840,10 +840,10 @@ static int ceph_remount(struct super_blostatic const struct super_operations ceph_super_ops = { .alloc_inode = ceph_alloc_inode, - .destroy_inode = ceph_destroy_inode, .free_inode = ceph_free_inode, .write_inode = ceph_write_inode, .drop_inode = ceph_drop_inode, + .evict_inode = ceph_evict_inode, .sync_fs = ceph_sync_fs, .put_super = ceph_put_super, .remount_fs = ceph_remount,
fs/ceph/super.h +1 -1
@@ -876,7 +876,7 @@ static inline bool __ceph_have_pending_cextern const struct inode_operations ceph_file_iops;extern struct inode *ceph_alloc_inode (struct super_block *sb); -extern void ceph_destroy_inode (struct inode *inode); +extern void ceph_evict_inode (struct inode *inode);extern void ceph_free_inode (struct inode *inode);extern int ceph_drop_inode (struct inode *inode);
Greg Kroah-Hartman
maintainerPATCH 322/413 media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom()
In reply to Greg Kroah-HartmanFrom: Boris Brezillon <[email protected]>
commit 07d89227a983df957a6a7c56f7c040cde9ac571f upstream.
cfg->type can be overridden by v4l2_ctrl_fill() and the new value is stored in the local type var. Fix the tests to use this local var.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls.c +4 -5
@@ -2369,16 +2369,15 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(sv4l2_ctrl_fill (cfg->id, &name, &type, &min, &max, &step, &def, &flags); - is_menu = (cfg->type ==V4L2_CTRL_TYPE_MENU || - cfg->type ==V4L2_CTRL_TYPE_INTEGER_MENU ); + is_menu = (type ==V4L2_CTRL_TYPE_MENU || + type ==V4L2_CTRL_TYPE_INTEGER_MENU );if (is_menu)WARN_ON (step);else WARN_ON (cfg->menu_skip_mask); -if (cfg->type ==V4L2_CTRL_TYPE_MENU && qmenu ==NULL ) +if (type ==V4L2_CTRL_TYPE_MENU && !qmenu) { qmenu =v4l2_ctrl_get_menu (cfg->id); -else if (cfg->type ==V4L2_CTRL_TYPE_INTEGER_MENU && - qmenu_int ==NULL ) { + }else if (type ==V4L2_CTRL_TYPE_INTEGER_MENU && !qmenu_int) {handler_set_err (hdl, -EINVAL );return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 323/413 media: coda: Remove unbalanced and unneeded mutex unlock
In reply to Greg Kroah-HartmanFrom: Ezequiel Garcia <[email protected]>
commit 766b9b168f6c75c350dd87c3e0bc6a9b322f0013 upstream.
The mutex unlock in the threaded interrupt handler is not paired with any mutex lock. Remove it.
This bug has been here for a really long time, so it applies to any stable repo.
--- drivers/media/platform/coda/coda-bit.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/coda/coda-bit.c +0 -1
@@ -2310,7 +2310,6 @@ irqreturn_t coda_irq_handler(int irq, voif (ctx ==NULL ) {v4l2_err (&dev->v4l2_dev,"Instance released before the end of transaction\n" ); -mutex_unlock (&dev->coda_mutex);return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 324/413 media: videobuf2-core: Prevent size alignment wrapping buffer size to 0
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit defcdc5d89ced780fb45196d539d6570ec5b1ba5 upstream.
PAGE_ALIGN() may wrap the buffer size around to 0. Prevent this by checking that the aligned value is not smaller than the unaligned one.
Note on backporting to stable: the file used to be under drivers/media/v4l2-core, it was moved to the current location after 4.14.
--- drivers/media/common/videobuf2/videobuf2-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/common/videobuf2/videobuf2-core.c +4 -0
@@ -207,6 +207,10 @@ static int __vb2_buf_mem_alloc(struct vbfor (plane =0 ; plane < vb->num_planes; ++plane) {unsigned long size =PAGE_ALIGN (vb->planes[plane].length); +/* Did it wrap around? */ +if (size < vb->planes[plane].length) + goto free; + mem_priv =call_ptr_memop (vb, alloc, q->alloc_devs[plane] ? : q->dev, q->dma_attrs, size, q->dma_dir, q->gfp_flags);
Greg Kroah-Hartman
maintainerPATCH 325/413 media: videobuf2-dma-sg: Prevent size from overflowing
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit 14f28f5cea9e3998442de87846d1907a531b6748 upstream.
buf->size is an unsigned long; casting that to int will lead to an overflow if buf->size exceeds INT_MAX.
Fix this by changing the type to unsigned long instead. This is possible as the buf->size is always aligned to PAGE_SIZE, and therefore the size will never have values lesser than 0.
Note on backporting to stable: the file used to be under drivers/media/v4l2-core, it was moved to the current location after 4.14.
--- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/common/videobuf2/videobuf2-dma-sg.c +1 -1
@@ -59,7 +59,7 @@ static int vb2_dma_sg_alloc_compacted(st gfp_t gfp_flags) {unsigned int last_page =0 ; -int size = buf->size; +unsigned long size = buf->size;while (size >0 ) {struct page *pages;
Greg Kroah-Hartman
maintainerPATCH 326/413 KVM: nVMX: Dont dump VMCS if virtual APIC page cant be mapped
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 73cb85568433feadb79e963bf2efba9b3e9ae3df upstream.
... as a malicious userspace can run a toy guest to generate invalid virtual-APIC page addresses in L1, i.e. flood the kernel log with error messages.
--- arch/x86/kvm/vmx/nested.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -3
@@ -2878,9 +2878,6 @@ static void nested_get_vmcs12_pages(stru*/ vmcs_clear_bits (CPU_BASED_VM_EXEC_CONTROL ,CPU_BASED_TPR_SHADOW ); - }else { -printk ("bad virtual-APIC page address\n" ); -dump_vmcs (); } }
Greg Kroah-Hartman
maintainerPATCH 327/413 KVM: VMX: Always signal #GP on WRMSR to MSR_IA32_CR_PAT with bad value
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit d28f4290b53a157191ed9991ad05dffe9e8c0c89 upstream.
The behavior of WRMSR is in no way dependent on whether or not KVM consumes the value.
--- arch/x86/kvm/vmx/vmx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx/vmx.c +3 -2
@@ -1896,9 +1896,10 @@ static int vmx_set_msr(struct kvm_vcpu * MSR_TYPE_W);break ;case MSR_IA32_CR_PAT : +if (!kvm_pat_valid (data)) +return 1 ; +if (vmcs_config.vmentry_ctrl &VM_ENTRY_LOAD_IA32_PAT ) { -if (!kvm_pat_valid (data)) -return 1 ;vmcs_write64 (GUEST_IA32_PAT , data); vcpu->arch.pat = data;break ;
Greg Kroah-Hartman
maintainerPATCH 328/413 KVM: nVMX: Always sync GUEST_BNDCFGS when it comes from vmcs01
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 3b013a2972d5bc344d6eaa8f24fdfe268211e45f upstream.
If L1 does not set VM_ENTRY_LOAD_BNDCFGS, then L1's BNDCFGS value must be propagated to vmcs02 since KVM always runs with VM_ENTRY_LOAD_BNDCFGS when MPX is supported. Because the value effectively comes from vmcs01, vmcs02 must be updated even if vmcs12 is clean.
--- arch/x86/kvm/vmx/nested.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
arch/x86/kvm/vmx/nested.c +6 -7
@@ -2234,13 +2234,9 @@ static void prepare_vmcs02_full(struct vset_cr4_guest_host_mask (vmx); -if (kvm_mpx_supported ()) { -if (vmx->nested.nested_run_pending && - (vmcs12->vm_entry_controls &VM_ENTRY_LOAD_BNDCFGS )) -vmcs_write64 (GUEST_BNDCFGS , vmcs12->guest_bndcfgs); -else -vmcs_write64 (GUEST_BNDCFGS , vmx->nested.vmcs01_guest_bndcfgs); - } +if (kvm_mpx_supported () && vmx->nested.nested_run_pending && + (vmcs12->vm_entry_controls &VM_ENTRY_LOAD_BNDCFGS )) +vmcs_write64 (GUEST_BNDCFGS , vmcs12->guest_bndcfgs); }/*
@@ -2283,6 +2279,9 @@ static int prepare_vmcs02(struct kvm_vcpkvm_set_dr (vcpu,7 , vcpu->arch.dr7);vmcs_write64 (GUEST_IA32_DEBUGCTL , vmx->nested.vmcs01_debugctl); } +if (kvm_mpx_supported () && (!vmx->nested.nested_run_pending || + !(vmcs12->vm_entry_controls &VM_ENTRY_LOAD_BNDCFGS ))) +vmcs_write64 (GUEST_BNDCFGS , vmx->nested.vmcs01_guest_bndcfgs);vmx_set_rflags (vcpu, vmcs12->guest_rflags);/* EXCEPTION_BITMAP and CR0_GUEST_HOST_MASK should basically be the
Greg Kroah-Hartman
maintainerPATCH 329/413 KVM: VMX: Fix handling of #MC that occurs during VM-Entry
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit beb8d93b3e423043e079ef3dda19dad7b28467a8 upstream.
A previous fix to prevent KVM from consuming stale VMCS state after a failed VM-Entry inadvertantly blocked KVM's handling of machine checks that occur during VM-Entry.
Per Intel's SDM, a #MC during VM-Entry is handled in one of three ways, depending on when the #MC is recognoized. As it pertains to this bug fix, the third case explicitly states EXIT_REASON_MCE_DURING_VMENTRY is handled like any other VM-Exit during VM-Entry, i.e. sets bit 31 to indicate the VM-Entry failed.
If a machine-check event occurs during a VM entry, one of the following occurs:
- The machine-check event is handled as if it occurred before the VM entry:
...
- The machine-check event is handled after VM entry completes:
...- A VM-entry failure occurs as described in Section 26.7. The basic exit reason is 41, for "VM-entry failure due to machine-check event".
Explicitly handle EXIT_REASON_MCE_DURING_VMENTRY as a one-off case in vmx_vcpu_run() instead of binning it into vmx_complete_atomic_exit(). Doing so allows vmx_vcpu_run() to handle VMX_EXIT_REASONS_FAILED_VMENTRY in a sane fashion and also simplifies vmx_complete_atomic_exit() since VMCS.VM_EXIT_INTR_INFO is guaranteed to be fresh.
--- arch/x86/kvm/vmx/vmx.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
arch/x86/kvm/vmx/vmx.c +8 -12
@@ -6110,28 +6110,21 @@ static void vmx_apicv_post_state_restorestatic void vmx_complete_atomic_exit (struct vcpu_vmx *vmx) { -u32 exit_intr_info =0 ; -u16 basic_exit_reason = (u16 )vmx->exit_reason; - -if (!(basic_exit_reason ==EXIT_REASON_MCE_DURING_VMENTRY - || basic_exit_reason ==EXIT_REASON_EXCEPTION_NMI )) +if (vmx->exit_reason !=EXIT_REASON_EXCEPTION_NMI )return ; -if (!(vmx->exit_reason &VMX_EXIT_REASONS_FAILED_VMENTRY )) - exit_intr_info =vmcs_read32 (VM_EXIT_INTR_INFO ); - vmx->exit_intr_info = exit_intr_info; + vmx->exit_intr_info =vmcs_read32 (VM_EXIT_INTR_INFO );/* if exit due to PF check for async PF */ -if (is_page_fault (exit_intr_info)) +if (is_page_fault (vmx->exit_intr_info)) vmx->vcpu.arch.apf.host_apf_reason =kvm_read_and_reset_pf_reason ();/* Handle machine checks before interrupts are enabled */ -if (basic_exit_reason ==EXIT_REASON_MCE_DURING_VMENTRY || -is_machine_check (exit_intr_info)) +if (is_machine_check (vmx->exit_intr_info))kvm_machine_check ();/* We need to handle NMIs before interrupts are enabled */ -if (is_nmi (exit_intr_info)) { +if (is_nmi (vmx->exit_intr_info)) {kvm_before_interrupt (&vmx->vcpu); asm("int $2" );kvm_after_interrupt (&vmx->vcpu);
@@ -6534,6 +6527,9 @@ static void vmx_vcpu_run(struct kvm_vcpu vmx->idt_vectoring_info =0 ; vmx->exit_reason = vmx->fail ?0xdead :vmcs_read32 (VM_EXIT_REASON ); +if ((u16 )vmx->exit_reason ==EXIT_REASON_MCE_DURING_VMENTRY ) +kvm_machine_check (); +if (vmx->fail || (vmx->exit_reason &VMX_EXIT_REASONS_FAILED_VMENTRY ))return ;
Greg Kroah-Hartman
maintainerPATCH 330/413 KVM: VMX: check CPUID before allowing read/write of IA32_XSS
In reply to Greg Kroah-HartmanFrom: Wanpeng Li <[email protected]>
commit 4d763b168e9c5c366b05812c7bba7662e5ea3669 upstream.
Raise #GP when guest read/write IA32_XSS, but the CPUID bits say that it shouldn't exist.
--- arch/x86/kvm/vmx/vmx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx/vmx.c +8 -2
@@ -1718,7 +1718,10 @@ static int vmx_get_msr(struct kvm_vcpu *return vmx_get_vmx_msr (&vmx->nested.msrs, msr_info->index, &msr_info->data);case MSR_IA32_XSS : -if (!vmx_xsaves_supported ()) +if (!vmx_xsaves_supported () || + (!msr_info->host_initiated && + !(guest_cpuid_has (vcpu,X86_FEATURE_XSAVE ) && +guest_cpuid_has (vcpu,X86_FEATURE_XSAVES ))))return 1 ; msr_info->data = vcpu->arch.ia32_xss;break ;
@@ -1933,7 +1936,10 @@ static int vmx_set_msr(struct kvm_vcpu *return 1 ;return vmx_set_vmx_msr (vcpu, msr_index, data);case MSR_IA32_XSS : -if (!vmx_xsaves_supported ()) +if (!vmx_xsaves_supported () || + (!msr_info->host_initiated && + !(guest_cpuid_has (vcpu,X86_FEATURE_XSAVE ) && +guest_cpuid_has (vcpu,X86_FEATURE_XSAVES ))))return 1 ;/* * The only supported bit as of Skylake is bit 8, but
Greg Kroah-Hartman
maintainerPATCH 331/413 KVM: Properly check if "page" is valid in kvm_vcpu_unmap
In reply to Greg Kroah-HartmanFrom: KarimAllah Ahmed <[email protected]>
commit b614c6027896ff9ad6757122e84760d938cab15e upstream.
The field "page" is initialized to KVM_UNMAPPED_PAGE when it is not used (i.e. when the memory lives outside kernel control). So this check will always end up using kunmap even for memremap regions.
--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
@@ -1790,7 +1790,7 @@ void kvm_vcpu_unmap(struct kvm_vcpu *vcpif (!map->hva)return ; -if (map->page) +if (map->page !=KVM_UNMAPPED_PAGE )kunmap (map->page);#ifdef CONFIG_HAS_IOMEM else
Greg Kroah-Hartman
maintainerPATCH 332/413 KVM: PPC: Book3S HV: Signed extend decrementer value if not using large decrementer
In reply to Greg Kroah-HartmanFrom: Suraj Jitindar Singh <[email protected]>
commit 869537709ebf1dc865e75c3fc97b23f8acf37c16 upstream.
On POWER9 the decrementer can operate in large decrementer mode where the decrementer is 56 bits and signed extended to 64 bits. When not operating in this mode the decrementer behaves as a 32 bit decrementer which is NOT signed extended (as on POWER8).
Currently when reading a guest decrementer value we don't take into account whether the large decrementer is enabled or not, and this means the value will be incorrect when the guest is not using the large decrementer. Fix this by sign extending the value read when the guest isn't using the large decrementer.
--- arch/powerpc/kvm/book3s_hv.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kvm/book3s_hv.c +2 -0
@@ -3603,6 +3603,8 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu vcpu->arch.slb_max =0 ; dec =mfspr (SPRN_DEC ); +if (!(lpcr &LPCR_LD ))/* Sign extend if not using large decrementer */ + dec = (s32 ) dec; tb =mftb (); vcpu->arch.dec_expires = dec + tb; vcpu->cpu =-1 ;
Greg Kroah-Hartman
maintainerPATCH 333/413 KVM: PPC: Book3S HV: Clear pending decrementer exceptions on nested guest entry
In reply to Greg Kroah-HartmanFrom: Suraj Jitindar Singh <[email protected]>
commit 3c25ab35fbc8526ac0c9b298e8a78e7ad7a55479 upstream.
If we enter an L1 guest with a pending decrementer exception then this is cleared on guest exit if the guest has writtien a positive value into the decrementer (indicating that it handled the decrementer exception) since there is no other way to detect that the guest has handled the pending exception and that it should be dequeued. In the event that the L1 guest tries to run a nested (L2) guest immediately after this and the L2 guest decrementer is negative (which is loaded by L1 before making the H_ENTER_NESTED hcall), then the pending decrementer exception isn't cleared and the L2 entry is blocked since L1 has a pending exception, even though L1 may have already handled the exception and written a positive value for it's decrementer. This results in a loop of L1 trying to enter the L2 guest and L0 blocking the entry since L1 has an interrupt pending with the outcome being that L2 never gets to run and hangs.
Fix this by clearing any pending decrementer exceptions when L1 makes the H_ENTER_NESTED hcall since it won't do this if it's decrementer has gone negative, and anyway it's decrementer has been communicated to L0 in the hdec_expires field and L0 will return control to L1 when this goes negative by delivering an H_DECREMENTER exception.
--- arch/powerpc/kvm/book3s_hv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv.c +9 -2
@@ -4124,8 +4124,15 @@ int kvmhv_run_single_vcpu(struct kvm_runpreempt_enable (); -/* cancel pending decrementer exception if DEC is now positive */ -if (get_tb () < vcpu->arch.dec_expires &&kvmppc_core_pending_dec (vcpu)) +/* +* cancel pending decrementer exception if DEC is now positive, or if +* entering a nested guest in which case the decrementer is now owned +* by L2 and the L1 decrementer is provided in hdec_expires +*/ +if (kvmppc_core_pending_dec (vcpu) && + ((get_tb () < vcpu->arch.dec_expires) || + (trap ==BOOK3S_INTERRUPT_SYSCALL && +kvmppc_get_gpr (vcpu,3 ) ==H_ENTER_NESTED )))kvmppc_core_dequeue_dec (vcpu);trace_kvm_guest_exit (vcpu);
Greg Kroah-Hartman
maintainerPATCH 334/413 KVM: PPC: Book3S HV: Fix CR0 setting in TM emulation
In reply to Greg Kroah-HartmanFrom: Michael Neuling <[email protected]>
commit 3fefd1cd95df04da67c83c1cb93b663f04b3324f upstream.
When emulating tsr, treclaim and trechkpt, we incorrectly set CR0. The code currently sets:
CR0 <- 00 || MSR[TS]
but according to the ISA it should be:
CR0 <- 0 || MSR[TS] || 0This fixes the bit shift to put the bits in the correct location.
This is a data integrity issue as CR0 is corrupted.
--- arch/powerpc/kvm/book3s_hv_tm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kvm/book3s_hv_tm.c +3 -3
@@ -128,7 +128,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcp }/* Set CR0 to indicate previous transactional state */ vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr &0x0fffffff ) | - (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<28 ); + (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<29 );/* L=1 => tresume, L=0 => tsuspend */ if (instr & (1 <<21 )) {if (MSR_TM_SUSPENDED (msr))
@@ -172,7 +172,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcp/* Set CR0 to indicate previous transactional state */ vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr &0x0fffffff ) | - (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<28 ); + (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<29 ); vcpu->arch.shregs.msr &= ~MSR_TS_MASK ;return RESUME_GUEST ;
@@ -202,7 +202,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcp/* Set CR0 to indicate previous transactional state */ vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr &0x0fffffff ) | - (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<28 ); + (((msr &MSR_TS_MASK ) >>MSR_TS_S_LG ) <<29 ); vcpu->arch.shregs.msr = msr |MSR_TS_S ;return RESUME_GUEST ; }
Greg Kroah-Hartman
maintainerPATCH 335/413 KVM: x86/vPMU: refine kvm_pmu err msg when event creation failed
In reply to Greg Kroah-HartmanFrom: Like Xu <[email protected]>
commit 6fc3977ccc5d3c22e851f2dce2d3ce2a0a843842 upstream.
If a perf_event creation fails due to any reason of the host perf subsystem, it has no chance to log the corresponding event for guest which may cause abnormal sampling data in guest result. In debug mode, this message helps to understand the state of vPMC and we may not limit the number of occurrences but not in a spamming style.
--- arch/x86/kvm/pmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/pmu.c +2 -2
@@ -128,8 +128,8 @@ static void pmc_reprogram_counter(struct intr ? kvm_perf_overflow_intr : kvm_perf_overflow, pmc);if (IS_ERR (event)) { -printk_once ("kvm_pmu: event creation failed %ld\n" , -PTR_ERR (event)); +pr_debug_ratelimited ("kvm_pmu: event creation failed %ld for pmc->idx = %d\n" , +PTR_ERR (event), pmc->idx);return ; }
Greg Kroah-Hartman
maintainerPATCH 336/413 arm64: tegra: Fix AGIC register range
In reply to Greg Kroah-HartmanFrom: Jon Hunter <[email protected]>
commit ba24eee6686f6ed3738602b54d959253316a9541 upstream.
The Tegra AGIC interrupt controller is an ARM GIC400 interrupt controller. Per the ARM GIC device-tree binding, the first address region is for the GIC distributor registers and the second address region is for the GIC CPU interface registers. The address space for the distributor registers is 4kB, but currently this is incorrectly defined as 8kB for the Tegra AGIC and overlaps with the CPU interface registers. Correct the address space for the distributor to be 4kB.
--- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +1 -1
@@ -1258,7 +1258,7 @@ compatible = "nvidia,tegra210-agic"; #interrupt-cells = <3>; interrupt-controller; - reg = <0x702f9000 0x2000>, + reg = <0x702f9000 0x1000>, <0x702fa000 0x2000>; interrupts = <GIC_SPI 102 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; clocks = <&tegra_car TEGRA210_CLK_APE>;
Greg Kroah-Hartman
maintainerPATCH 337/413 arm64: irqflags: Add condition flags to inline asm clobber list
In reply to Greg Kroah-HartmanFrom: Julien Thierry <[email protected]>
commit f57065782f245ca96f1472209a485073bbc11247 upstream.
Some of the inline assembly instruction use the condition flags and need to include "cc" in the clobber list.
--- arch/arm64/include/asm/irqflags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/irqflags.h +2 -2
@@ -81,7 +81,7 @@ static inline unsigned long arch_local_s ARM64_HAS_IRQ_PRIO_MASKING) : "=&r" (flags), "+r" (daif_bits) : "r" ((unsigned long) GIC_PRIO_IRQOFF) - : "memory"); + : "cc", "memory");return flags; }
@@ -125,7 +125,7 @@ static inline int arch_irqs_disabled_fla ARM64_HAS_IRQ_PRIO_MASKING) : "=&r" (res) : "r" ((int) flags) - : "memory"); + : "cc", "memory");return res; }
Greg Kroah-Hartman
maintainerPATCH 338/413 arm64: Fix incorrect irqflag restore for priority masking
In reply to Greg Kroah-HartmanFrom: Julien Thierry <[email protected]>
commit bd82d4bd21880b7c4d5f5756be435095d6ae07b5 upstream.
When using IRQ priority masking to disable interrupts, in order to deal with the PSR.I state, local_irq_save() would convert the I bit into a PMR value (GIC_PRIO_IRQOFF). This resulted in local_irq_restore() potentially modifying the value of PMR in undesired location due to the state of PSR.I upon flag saving [1].
In an attempt to solve this issue in a less hackish manner, introduce a bit (GIC_PRIO_IGNORE_PMR) for the PMR values that can represent whether PSR.I is being used to disable interrupts, in which case it takes precedence of the status of interrupt masking via PMR.
GIC_PRIO_PSR_I_SET is chosen such that (<pmr_value> | GIC_PRIO_PSR_I_SET) does not mask more interrupts than <pmr_value> as some sections (e.g. arch_cpu_idle(), interrupt acknowledge path) requires PMR not to mask interrupts that could be signaled to the CPU when using only PSR.I.
[1] https://www.spinics.net/lists/arm-kernel/msg716956.html
--- arch/arm64/include/asm/arch_gicv3.h | 4 +- arch/arm64/include/asm/daifflags.h | 68 +++++++++++++++++++++--------------- arch/arm64/include/asm/irqflags.h | 67 ++++++++++++++--------------------- arch/arm64/include/asm/kvm_host.h | 7 ++- arch/arm64/include/asm/ptrace.h | 10 ++++- arch/arm64/kernel/entry.S | 38 +++++++++++++++++--- arch/arm64/kernel/process.c | 2 - arch/arm64/kernel/smp.c | 8 ++-- arch/arm64/kvm/hyp/switch.c | 2 - 9 files changed, 123 insertions(+), 83 deletions(-)
arch/arm64/include/asm/arch_gicv3.h +3 -1
@@ -152,7 +152,9 @@ static inline bool gic_prio_masking_enabstatic inline void gic_pmr_mask_irqs (void ) { -BUILD_BUG_ON (GICD_INT_DEF_PRI <=GIC_PRIO_IRQOFF ); +BUILD_BUG_ON (GICD_INT_DEF_PRI < (GIC_PRIO_IRQOFF | +GIC_PRIO_PSR_I_SET )); +BUILD_BUG_ON (GICD_INT_DEF_PRI >=GIC_PRIO_IRQON );gic_write_pmr (GIC_PRIO_IRQOFF ); }
arch/arm64/include/asm/daifflags.h +41 -27
96 lines not on this page · raw message
arch/arm64/include/asm/irqflags.h +27 -40
91 lines not on this page · raw message
arch/arm64/include/asm/kvm_host.h +4 -3
@@ -597,11 +597,12 @@ static inline void kvm_arm_vhe_guest_ent* will not signal the CPU of interrupts of lower priority, and the * only way to get out will be via guest exceptions. * Naturally, we want to avoid this. +* +* local_daif_mask() already sets GIC_PRIO_PSR_I_SET, we just need a +* dsb to ensure the redistributor is forwards EL2 IRQs to the CPU. */ -if (system_uses_irq_prio_masking ()) { -gic_write_pmr (GIC_PRIO_IRQON ); +if (system_uses_irq_prio_masking ())dsb (sy); - } }static inline void kvm_arm_vhe_guest_exit (void )
arch/arm64/include/asm/ptrace.h +8 -2
@@ -24,9 +24,15 @@* means masking more IRQs (or at least that the same IRQs remain masked). * * To mask interrupts, we clear the most significant bit of PMR. +* +* Some code sections either automatically switch back to PSR.I or explicitly +* require to not use priority masking. If bit GIC_PRIO_PSR_I_SET is included +* in the the priority mask, it indicates that PSR.I should be set and +* interrupt disabling temporarily does not rely on IRQ priorities. */ -#define GIC_PRIO_IRQON 0xf0 -#define GIC_PRIO_IRQOFF (GIC_PRIO_IRQON & ~0x80) +#define GIC_PRIO_IRQON 0xc0 +#define GIC_PRIO_IRQOFF (GIC_PRIO_IRQON & ~0x80) +#define GIC_PRIO_PSR_I_SET (1 << 4)/* Additional SPSR bits not exposed in the UABI */ #define PSR_IL_BIT (1 << 20)
arch/arm64/kernel/entry.S +33 -5
@@ -247,6 +247,7 @@ alternative_else_nop_endif /* * Registers that may be useful after this macro is invoked: * + * x20 - ICC_PMR_EL1 * x21 - aborted SP * x22 - aborted PC * x23 - aborted PSTATE
@@ -438,6 +439,24 @@ alternative_endif .endm #endif + .macro gic_prio_kentry_setup, tmp:req +#ifdef CONFIG_ARM64_PSEUDO_NMI + alternative_if ARM64_HAS_IRQ_PRIO_MASKING + mov \tmp, #(GIC_PRIO_PSR_I_SET | GIC_PRIO_IRQON) + msr_s SYS_ICC_PMR_EL1, \tmp + alternative_else_nop_endif +#endif + .endm + + .macro gic_prio_irq_setup, pmr:req, tmp:req +#ifdef CONFIG_ARM64_PSEUDO_NMI + alternative_if ARM64_HAS_IRQ_PRIO_MASKING + orr \tmp, \pmr, #GIC_PRIO_PSR_I_SET + msr_s SYS_ICC_PMR_EL1, \tmp + alternative_else_nop_endif +#endif + .endm + .text /*
@@ -616,6 +635,7 @@ el1_dbg: cmp x24, #ESR_ELx_EC_BRK64 // if BRK64 cinc x24, x24, eq // set bit '0' tbz x24, #0, el1_inv // EL1 only + gic_prio_kentry_setup tmp=x3 mrs x0, far_el1 mov x2, sp // struct pt_regs bl do_debug_exception
@@ -633,12 +653,10 @@ ENDPROC(el1_sync) .align 6 el1_irq: kernel_entry 1 + gic_prio_irq_setup pmr=x20, tmp=x1 enable_da_f #ifdef CONFIG_ARM64_PSEUDO_NMI -alternative_if ARM64_HAS_IRQ_PRIO_MASKING - ldr x20, [sp, #S_PMR_SAVE] -alternative_else_nop_endif test_irqs_unmasked res=x0, pmr=x20 cbz x0, 1f bl asm_nmi_enter
@@ -668,8 +686,9 @@ alternative_else_nop_endif #ifdef CONFIG_ARM64_PSEUDO_NMI /* - * if IRQs were disabled when we received the interrupt, we have an NMI - * and we are not re-enabling interrupt upon eret. Skip tracing. + * When using IRQ priority masking, we can get spurious interrupts while + * PMR is set to GIC_PRIO_IRQOFF. An NMI might also have occurred in a + * section with interrupts disabled. Skip tracing in those cases. */ test_irqs_unmasked res=x0, pmr=x20 cbz x0, 1f
@@ -798,6 +817,7 @@ el0_ia: * Instruction abort handling */ mrs x26, far_el1 + gic_prio_kentry_setup tmp=x0 enable_da_f #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off
@@ -843,6 +863,7 @@ el0_sp_pc: * Stack or PC alignment exception handling */ mrs x26, far_el1 + gic_prio_kentry_setup tmp=x0 enable_da_f #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off
@@ -877,6 +898,7 @@ el0_dbg: * Debug exception handling */ tbnz x24, #0, el0_inv // EL0 only + gic_prio_kentry_setup tmp=x3 mrs x0, far_el1 mov x1, x25 mov x2, sp
@@ -898,7 +920,9 @@ ENDPROC(el0_sync) el0_irq: kernel_entry 0 el0_irq_naked: + gic_prio_irq_setup pmr=x20, tmp=x0 enable_da_f + #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off #endif
@@ -920,6 +944,7 @@ ENDPROC(el0_irq) el1_error: kernel_entry 1 mrs x1, esr_el1 + gic_prio_kentry_setup tmp=x2 enable_dbg mov x0, sp bl do_serror
@@ -930,6 +955,7 @@ el0_error: kernel_entry 0 el0_error_naked: mrs x1, esr_el1 + gic_prio_kentry_setup tmp=x2 enable_dbg mov x0, sp bl do_serror
@@ -954,6 +980,7 @@ work_pending: */ ret_to_user: disable_daif + gic_prio_kentry_setup tmp=x3 ldr x1, [tsk, #TSK_TI_FLAGS] and x2, x1, #_TIF_WORK_MASK cbnz x2, work_pending
@@ -970,6 +997,7 @@ ENDPROC(ret_to_user) */ .align 6 el0_svc: + gic_prio_kentry_setup tmp=x1 mov x0, sp bl el0_svc_handler b ret_to_user
arch/arm64/kernel/process.c +1 -1
@@ -83,7 +83,7 @@ static void __cpu_do_idle_irqprio(void)* be raised. */ pmr =gic_read_pmr (); -gic_write_pmr (GIC_PRIO_IRQON ); +gic_write_pmr (GIC_PRIO_IRQON |GIC_PRIO_PSR_I_SET );__cpu_do_idle ();
arch/arm64/kernel/smp.c +5 -3
@@ -181,11 +181,13 @@ static void init_gic_priority_masking(voWARN_ON (!(cpuflags &PSR_I_BIT )); -gic_write_pmr (GIC_PRIO_IRQOFF ); -/* We can only unmask PSR.I if we can take aborts */ -if (!(cpuflags &PSR_A_BIT )) +if (!(cpuflags &PSR_A_BIT )) { +gic_write_pmr (GIC_PRIO_IRQOFF );write_sysreg (cpuflags & ~PSR_I_BIT , daif); + }else { +gic_write_pmr (GIC_PRIO_IRQON |GIC_PRIO_PSR_I_SET ); + } }/*
arch/arm64/kvm/hyp/switch.c +1 -1
@@ -604,7 +604,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struc* Naturally, we want to avoid this. */ if (system_uses_irq_prio_masking ()) { -gic_write_pmr (GIC_PRIO_IRQON ); +gic_write_pmr (GIC_PRIO_IRQON |GIC_PRIO_PSR_I_SET );dsb (sy); }
Greg Kroah-Hartman
maintainerPATCH 339/413 intel_th: msu: Fix unused variable warning on arm64 platform
In reply to Greg Kroah-HartmanFrom: Shaokun Zhang <[email protected]>
commit b96fb368b08f1637cbf780a6b83e36c2c5ed4ff5 upstream.
Commit ba39bd8306057 ("intel_th: msu: Switch over to scatterlist") introduced the following warnings on non-x86 architectures, as a result of reordering the multi mode buffer allocation sequence:
Quoted 10 lines
drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_alloc’:drivers/hwtracing/intel_th/msu.c:783:21: warning: unused variable ‘i’ [-Wunused-variable]int ret = -ENOMEM, i; ^ drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_free’: drivers/hwtracing/intel_th/msu.c:863:6: warning: unused variable ‘i’ [-Wunused-variable] int i; ^
Fix this compiler warning by factoring out set_memory sequences and making them x86-only.
--- drivers/hwtracing/intel_th/msu.c | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-)
drivers/hwtracing/intel_th/msu.c +27 -13
@@ -767,6 +767,30 @@ err_nomem:return -ENOMEM ; } +#ifdef CONFIG_X86 +static void msc_buffer_set_uc (struct msc_window *win,unsigned int nr_blocks) +{ +int i; + +for (i =0 ; i < nr_blocks; i++) +/* Set the page as uncached */ +set_memory_uc ((unsigned long )msc_win_block (win, i),1 ); +} + +static void msc_buffer_set_wb (struct msc_window *win) +{ +int i; + +for (i =0 ; i < win->nr_blocks; i++) +/* Reset the page to write-back */ +set_memory_wb ((unsigned long )msc_win_block (win, i),1 ); +} +#else /* !X86 */ +static inline void +msc_buffer_set_uc (struct msc_window *win,unsigned int nr_blocks) {} +static inline void msc_buffer_set_wb (struct msc_window *win) {} +#endif /* CONFIG_X86 */ +/** * msc_buffer_win_alloc() - alloc a window for a multiblock mode * @msc: MSC device
@@ -780,7 +804,7 @@ err_nomem:static int msc_buffer_win_alloc (struct msc *msc,unsigned int nr_blocks) {struct msc_window *win; -int ret = -ENOMEM , i; +int ret = -ENOMEM ;if (!nr_blocks)return 0 ;
@@ -811,11 +835,7 @@ static int msc_buffer_win_alloc(struct mif (ret <0 ) goto err_nomem; -#ifdef CONFIG_X86 -for (i =0 ; i < ret; i++) -/* Set the page as uncached */ -set_memory_uc ((unsigned long )msc_win_block (win, i),1 ); -#endif +msc_buffer_set_uc (win, ret); win->nr_blocks = ret;
@@ -860,8 +880,6 @@ static void __msc_buffer_win_free(struct*/ static void msc_buffer_win_free (struct msc *msc,struct msc_window *win) { -int i; - msc->nr_pages -= win->nr_blocks;list_del (&win->entry);
@@ -870,11 +888,7 @@ static void msc_buffer_win_free(struct m msc->base_addr =0 ; } -#ifdef CONFIG_X86 -for (i =0 ; i < win->nr_blocks; i++) -/* Reset the page to write-back */ -set_memory_wb ((unsigned long )msc_win_block (win, i),1 ); -#endif +msc_buffer_set_wb (win);__msc_buffer_win_free (msc, win);
Greg Kroah-Hartman
maintainerPATCH 340/413 signal/usb: Replace kill_pid_info_as_cred with kill_pid_usb_asyncio
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 70f1b0d34bdf03065fe869e93cc17cad1ea20c4a upstream.
The usb support for asyncio encoded one of it's values in the wrong field. It should have used si_value but instead used si_addr which is not present in the _rt union member of struct siginfo.
The practical result of this is that on a 64bit big endian kernel when delivering a signal to a 32bit process the si_addr field is set to NULL, instead of the expected pointer value.
This issue can not be fixed in copy_siginfo_to_user32 as the usb usage of the the _sigfault (aka si_addr) member of the siginfo union when SI_ASYNCIO is set is incompatible with the POSIX and glibc usage of the _rt member of the siginfo union.
Therefore replace kill_pid_info_as_cred with kill_pid_usb_asyncio a dedicated function for this one specific case. There are no other users of kill_pid_info_as_cred so this specialization should have no impact on the amount of code in the kernel. Have kill_pid_usb_asyncio take instead of a siginfo_t which is difficult and error prone, 3 arguments, a signal number, an errno value, and an address enconded as a sigval_t. The encoding of the address as a sigval_t allows the code that reads the userspace request for a signal to handle this compat issue along with all of the other compat issues.
Add BUILD_BUG_ONs in kernel/signal.c to ensure that we can now place the pointer value at the in si_pid (instead of si_addr). That is the code now verifies that si_pid and si_addr always occur at the same location. Further the code veries that for native structures a value placed in si_pid and spilling into si_uid will appear in userspace in si_addr (on a byte by byte copy of siginfo or a field by field copy of siginfo). The code also verifies that for a 64bit kernel and a 32bit userspace the 32bit pointer will fit in si_pid.
I have used the usbsig.c program below written by Alan Stern and slightly tweaked by me to run on a big endian machine to verify the issue exists (on sparc64) and to confirm the patch below fixes the issue.
/* usbsig.c -- test USB async signal delivery */
#define _GNU_SOURCE
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <endian.h>
#include <linux/usb/ch9.h>
#include <linux/usbdevice_fs.h>
static struct usbdevfs_urb urb;
static struct usbdevfs_disconnectsignal ds;
static volatile sig_atomic_t done = 0;
void urb_handler(int sig, siginfo_t *info , void *ucontext)
{
printf("Got signal %d, signo %d errno %d code %d addr: %p urb: %p\n",
sig, info->si_signo, info->si_errno, info->si_code, info->si_addr, &urb);
printf("%s\n", (info->si_addr == &urb) ? "Good" : "Bad");
}
void ds_handler(int sig, siginfo_t *info , void *ucontext)
{
printf("Got signal %d, signo %d errno %d code %d addr: %p ds: %p\n",
sig, info->si_signo, info->si_errno, info->si_code, info->si_addr, &ds);
printf("%s\n", (info->si_addr == &ds) ? "Good" : "Bad"); done = 1;
}
int main(int argc, char **argv)
{
char *devfilename;
int fd;
int rc;
struct sigaction act;
struct usb_ctrlrequest *req;
void *ptr;
char buf[80];
if (argc != 2) {
fprintf(stderr, "Usage: usbsig device-file-name\n"); return 1;
}
devfilename = argv[1];
fd = open(devfilename, O_RDWR);
if (fd == -1) {
perror("Error opening device file"); return 1;
}
act.sa_sigaction = urb_handler;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_SIGINFO;
rc = sigaction(SIGUSR1, &act, NULL);
if (rc == -1) {
perror("Error in sigaction");
return 1;
}
act.sa_sigaction = ds_handler;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_SIGINFO;
rc = sigaction(SIGUSR2, &act, NULL);
if (rc == -1) {
perror("Error in sigaction");
return 1;
}
memset(&urb, 0, sizeof(urb));
urb.type = USBDEVFS_URB_TYPE_CONTROL;
urb.endpoint = USB_DIR_IN | 0;
urb.buffer = buf;
urb.buffer_length = sizeof(buf);
urb.signr = SIGUSR1;
req = (struct usb_ctrlrequest *) buf;
req->bRequestType = USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE; req->bRequest = USB_REQ_GET_DESCRIPTOR;
req->wValue = htole16(USB_DT_DEVICE << 8);
req->wIndex = htole16(0);
req->wLength = htole16(sizeof(buf) - sizeof(*req));
rc = ioctl(fd, USBDEVFS_SUBMITURB, &urb); if (rc == -1) {
perror("Error in SUBMITURB ioctl"); return 1;
}
rc = ioctl(fd, USBDEVFS_REAPURB, &ptr);
if (rc == -1) {
perror("Error in REAPURB ioctl");
return 1;
}
memset(&ds, 0, sizeof(ds));
ds.signr = SIGUSR2;
ds.context = &ds;
rc = ioctl(fd, USBDEVFS_DISCSIGNAL, &ds); if (rc == -1) {
perror("Error in DISCSIGNAL ioctl"); return 1;
}
printf("Waiting for usb disconnect\n");
while (!done) {
sleep(1);
}
close(fd);
return 0;
}
--- drivers/usb/core/devio.c | 48 ++++++++++++++--------------- include/linux/sched/signal.h | 2 - kernel/signal.c | 69 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 86 insertions(+), 33 deletions(-)
drivers/usb/core/devio.c +24 -24
@@ -63,7 +63,7 @@ struct usb_dev_state {unsigned int discsignr;struct pid *disc_pid;const struct cred *cred; -void __user *disccontext; +sigval_t disccontext;unsigned long ifclaimed;u32 disabled_bulk_eps;bool privileges_dropped;
@@ -90,6 +90,7 @@ struct async {unsigned int ifnum;void __user *userbuffer;void __user *userurb; +sigval_t userurb_sigval;struct urb *urb;struct usb_memory *usbm;unsigned int mem_usage;
@@ -582,22 +583,19 @@ static void async_completed(struct urb * {struct async *as = urb->context;struct usb_dev_state *ps = as->ps; -struct kernel_siginfo sinfo;struct pid *pid =NULL ;const struct cred *cred =NULL ;unsigned long flags; -int signr; +sigval_t addr; +int signr, errno;spin_lock_irqsave (&ps->lock, flags);list_move_tail (&as->asynclist, &ps->async_completed); as->status = urb->status; signr = as->signr;if (signr) { -clear_siginfo (&sinfo); - sinfo.si_signo = as->signr; - sinfo.si_errno = as->status; - sinfo.si_code =SI_ASYNCIO ; - sinfo.si_addr = as->userurb; + errno = as->status; + addr = as->userurb_sigval; pid =get_pid (as->pid); cred =get_cred (as->cred); }
@@ -615,7 +613,7 @@ static void async_completed(struct urb *spin_unlock_irqrestore (&ps->lock, flags);if (signr) { -kill_pid_info_as_cred (sinfo.si_signo, &sinfo, pid, cred); +kill_pid_usb_asyncio (signr, errno, addr, pid, cred);put_pid (pid);put_cred (cred); }
@@ -1427,7 +1425,7 @@ find_memory_area(struct usb_dev_state *pstatic int proc_do_submiturb (struct usb_dev_state *ps,struct usbdevfs_urb *uurb,struct usbdevfs_iso_packet_desc __user *iso_frame_desc, -void __user *arg) +void __user *arg,sigval_t userurb_sigval) {struct usbdevfs_iso_packet_desc *isopkt =NULL ;struct usb_host_endpoint *ep;
@@ -1727,6 +1725,7 @@ static int proc_do_submiturb(struct usb_ isopkt =NULL ; as->ps = ps; as->userurb = arg; + as->userurb_sigval = userurb_sigval;if (as->usbm) {unsigned long uurb_start = (unsigned long )uurb->buffer;
@@ -1801,13 +1800,17 @@ static int proc_do_submiturb(struct usb_static int proc_submiturb (struct usb_dev_state *ps,void __user *arg) {struct usbdevfs_urb uurb; +sigval_t userurb_sigval;if (copy_from_user (&uurb, arg,sizeof (uurb)))return -EFAULT ; +memset (&userurb_sigval,0 ,sizeof (userurb_sigval)); + userurb_sigval.sival_ptr = arg; +return proc_do_submiturb (ps, &uurb, (((struct usbdevfs_urb __user *)arg)->iso_frame_desc), - arg); + arg, userurb_sigval); }static int proc_unlinkurb (struct usb_dev_state *ps,void __user *arg)
@@ -1977,7 +1980,7 @@ static int proc_disconnectsignal_compat(if (copy_from_user (&ds, arg,sizeof (ds)))return -EFAULT ; ps->discsignr = ds.signr; - ps->disccontext =compat_ptr (ds.context); + ps->disccontext.sival_int = ds.context;return 0 ; }
@@ -2005,13 +2008,17 @@ static int get_urb32(struct usbdevfs_urbstatic int proc_submiturb_compat (struct usb_dev_state *ps,void __user *arg) {struct usbdevfs_urb uurb; +sigval_t userurb_sigval;if (get_urb32 (&uurb, (struct usbdevfs_urb32 __user *)arg))return -EFAULT ; +memset (&userurb_sigval,0 ,sizeof (userurb_sigval)); + userurb_sigval.sival_int =ptr_to_compat (arg); +return proc_do_submiturb (ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, - arg); + arg, userurb_sigval); }static int processcompl_compat (struct async *as,void __user *__user *arg)
@@ -2092,7 +2099,7 @@ static int proc_disconnectsignal(structif (copy_from_user (&ds, arg,sizeof (ds)))return -EFAULT ; ps->discsignr = ds.signr; - ps->disccontext = ds.context; + ps->disccontext.sival_ptr = ds.context;return 0 ; }
@@ -2614,22 +2621,15 @@ const struct file_operations usbdev_filestatic void usbdev_remove (struct usb_device *udev) {struct usb_dev_state *ps; -struct kernel_siginfo sinfo;while (!list_empty (&udev->filelist)) { ps = list_entry(udev->filelist.next, struct usb_dev_state, list);destroy_all_async (ps);wake_up_all (&ps->wait);list_del_init (&ps->list); -if (ps->discsignr) { -clear_siginfo (&sinfo); - sinfo.si_signo = ps->discsignr; - sinfo.si_errno =EPIPE ; - sinfo.si_code =SI_ASYNCIO ; - sinfo.si_addr = ps->disccontext; -kill_pid_info_as_cred (ps->discsignr, &sinfo, - ps->disc_pid, ps->cred); - } +if (ps->discsignr) +kill_pid_usb_asyncio (ps->discsignr,EPIPE , ps->disccontext, + ps->disc_pid, ps->cred); } }
include/linux/sched/signal.h +1 -1
@@ -329,7 +329,7 @@ extern void force_sigsegv(int sig, strucextern int force_sig_info (int ,struct kernel_siginfo *,struct task_struct *);extern int __kill_pgrp_info (int sig,struct kernel_siginfo *info,struct pid *pgrp);extern int kill_pid_info (int sig,struct kernel_siginfo *info,struct pid *pid); -extern int kill_pid_info_as_cred (int ,struct kernel_siginfo *,struct pid *, +extern int kill_pid_usb_asyncio (int sig,int errno,sigval_t addr,struct pid *,const struct cred *);extern int kill_pgrp (struct pid *pid,int sig,int priv);extern int kill_pid (struct pid *pid,int sig,int priv);
kernel/signal.c +61 -8
104 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 341/413 signal: Correct namespace fixups of si_pid and si_uid
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 7a0cf094944e2540758b7f957eb6846d5126f535 upstream.
The function send_signal was split from __send_signal so that it would be possible to bypass the namespace logic based upon current[1]. As it turns out the si_pid and the si_uid fixup are both inappropriate in the case of kill_pid_usb_asyncio so move that logic into send_signal.
It is difficult to arrange but possible for a signal with an si_code of SI_TIMER or SI_SIGIO to be sent across namespace boundaries. In which case tests for when it is ok to change si_pid and si_uid based on SI_FROMUSER are incorrect. Replace the use of SI_FROMUSER with a new test has_si_pid_and_used based on siginfo_layout.
Now that the uid fixup is no longer present after expanding SEND_SIG_NOINFO properly calculate the si_uid that the target task needs to read.
[1] 7978b567d315 ("signals: add from_ancestor_ns parameter to send_signal()")
--- kernel/signal.c | 67 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 27 deletions(-)
kernel/signal.c +40 -27
@@ -1057,27 +1057,6 @@ static inline bool legacy_queue(struct sreturn (sig <SIGRTMIN ) &&sigismember (&signals->signal, sig); } -#ifdef CONFIG_USER_NS -static inline void userns_fixup_signal_uid (struct kernel_siginfo *info,struct task_struct *t) -{ -if (current_user_ns () ==task_cred_xxx (t, user_ns)) -return ; - -if (SI_FROMKERNEL (info)) -return ; - -rcu_read_lock (); - info->si_uid =from_kuid_munged (task_cred_xxx (t, user_ns), -make_kuid (current_user_ns (), info->si_uid)); -rcu_read_unlock (); -} -#else -static inline void userns_fixup_signal_uid (struct kernel_siginfo *info,struct task_struct *t) -{ -return ; -} -#endif -static int __send_signal (int sig,struct kernel_siginfo *info,struct task_struct *t,enum pid_type type,int from_ancestor_ns) {
@@ -1135,7 +1114,11 @@ static int __send_signal(int sig, struct q->info.si_code =SI_USER ; q->info.si_pid =task_tgid_nr_ns (current,task_active_pid_ns (t)); - q->info.si_uid =from_kuid_munged (current_user_ns (),current_uid ()); +rcu_read_lock (); + q->info.si_uid = +from_kuid_munged (task_cred_xxx (t, user_ns), +current_uid ()); +rcu_read_unlock ();break ;case (unsigned long )SEND_SIG_PRIV :clear_siginfo (&q->info);
@@ -1147,13 +1130,8 @@ static int __send_signal(int sig, structbreak ;default :copy_siginfo (&q->info, info); -if (from_ancestor_ns) - q->info.si_pid =0 ;break ; } - -userns_fixup_signal_uid (&q->info, t); - }else if (!is_si_special (info)) {if (sig >=SIGRTMIN && info->si_code !=SI_USER ) {/*
@@ -1197,6 +1175,28 @@ ret:return ret; } +static inline bool has_si_pid_and_uid (struct kernel_siginfo *info) +{ +bool ret = false; +switch (siginfo_layout (info->si_signo, info->si_code)) { +case SIL_KILL : +case SIL_CHLD : +case SIL_RT : + ret = true; +break ; +case SIL_TIMER : +case SIL_POLL : +case SIL_FAULT : +case SIL_FAULT_MCEERR : +case SIL_FAULT_BNDERR : +case SIL_FAULT_PKUERR : +case SIL_SYS : + ret = false; +break ; + } +return ret; +} +static int send_signal (int sig,struct kernel_siginfo *info,struct task_struct *t,enum pid_type type) {
@@ -1206,7 +1206,20 @@ static int send_signal(int sig, struct k from_ancestor_ns =si_fromuser (info) && !task_pid_nr_ns (current,task_active_pid_ns (t));#endif +if (!is_si_special (info) &&has_si_pid_and_uid (info)) { +struct user_namespace *t_user_ns; + +rcu_read_lock (); + t_user_ns =task_cred_xxx (t, user_ns); +if (current_user_ns () != t_user_ns) { +kuid_t uid =make_kuid (current_user_ns (), info->si_uid); + info->si_uid =from_kuid_munged (t_user_ns, uid); + } +rcu_read_unlock (); +if (!task_pid_nr_ns (current,task_active_pid_ns (t))) + info->si_pid =0 ; + }return __send_signal (sig, info, t, type, from_ancestor_ns); }
Greg Kroah-Hartman
maintainerPATCH 342/413 fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes.
In reply to Greg Kroah-HartmanFrom: Radoslaw Burny <[email protected]>
commit 5ec27ec735ba0477d48c80561cc5e856f0c5dfaf upstream.
Normally, the inode's i_uid/i_gid are translated relative to s_user_ns, but this is not a correct behavior for proc. Since sysctl permission check in test_perm is done against GLOBAL_ROOT_[UG]ID, it makes more sense to use these values in u_[ug]id of proc inodes. In other words:
although uid/gid in the inode is not read during test_perm, the inode logically belongs to the root of the namespace. I have confirmed this with Eric Biederman at LPC and in this thread:
https://lore.kernel.org/lkml/[email protected]
Consequences
============
Since the i_[ug]id values of proc nodes are not used for permissions checks, this change usually makes no functional difference. However, it causes an issue in a setup where:
* a namespace container is created without root user in container - hence the i_[ug]id of proc nodes are set to INVALID_[UG]ID
* container creator tries to configure it by writing /proc/sys files, e.g. writing /proc/sys/kernel/shmmax to configure shared memory limit
Kernel does not allow to open an inode for writing if its i_[ug]id are invalid, making it impossible to write shmmax and thus - configure the container.
Using a container with no root mapping is apparently rare, but we do use this configuration at Google. Also, we use a generic tool to configure the container limits, and the inability to write any of them causes a failure.
History
=======
The invalid uids/gids in inodes first appeared due to 81754357770e (fs:
Update i_[ug]id_(read|write) to translate relative to s_user_ns). However, AFAIK, this did not immediately cause any issues. The inability to write to these "invalid" inodes was only caused by a later commit 0bd23d09b874 (vfs: Don't modify inodes with a uid or gid unknown to the vfs).
Tested: Used a repro program that creates a user namespace without any mapping and stat'ed /proc/$PID/root/proc/sys/kernel/shmmax from outside. Before the change, it shows the overflow uid, with the change it's 0. The overflow uid indicates that the uid in the inode is not correct and thus it is not possible to open the file for writing.
--- fs/proc/proc_sysctl.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/proc/proc_sysctl.c +4 -0
@@ -499,6 +499,10 @@ static struct inode *proc_sys_make_inodeif (root->set_ownership) root->set_ownership (head, table, &inode->i_uid, &inode->i_gid); +else { + inode->i_uid =GLOBAL_ROOT_UID ; + inode->i_gid =GLOBAL_ROOT_GID ; + }return inode; }
Greg Kroah-Hartman
maintainerPATCH 343/413 i3c: fix i2c and i3c scl rate by bus mode
In reply to Greg Kroah-HartmanFrom: Vitor Soares <[email protected]>
commit ecc8fb54bd443bf69996d9d5ddb8d90a50f14936 upstream.
Currently the I3C framework limits SCL frequency to FM speed when dealing with a mixed slow bus, even if all I2C devices are FM+ capable.
The core was also not accounting for I3C speed limitations when operating in mixed slow mode and was erroneously using FM+ speed as the max I2C speed when operating in mixed fast mode.
--- drivers/i3c/master.c | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-)
drivers/i3c/master.c +38 -13
@@ -91,6 +91,12 @@ void i3c_bus_normaluse_unlock(struct i3cup_read (&bus->lock); } +static struct i3c_master_controller * +i3c_bus_to_i3c_master (struct i3c_bus *i3cbus) +{ + return container_of(i3cbus, struct i3c_master_controller, bus); +} +static struct i3c_master_controller *dev_to_i3cmaster (struct device *dev) { return container_of(dev, struct i3c_master_controller, dev);
@@ -565,20 +571,38 @@ static const struct device_type i3c_mast .groups = i3c_masterdev_groups, }; -int i3c_bus_set_mode (struct i3c_bus *i3cbus,enum i3c_bus_mode mode) +int i3c_bus_set_mode (struct i3c_bus *i3cbus,enum i3c_bus_mode mode, +unsigned long max_i2c_scl_rate) { - i3cbus->mode = mode; +struct i3c_master_controller *master =i3c_bus_to_i3c_master (i3cbus); -if (!i3cbus->scl_rate.i3c) - i3cbus->scl_rate.i3c =I3C_BUS_TYP_I3C_SCL_RATE ; + i3cbus->mode = mode; -if (!i3cbus->scl_rate.i2c) { -if (i3cbus->mode ==I3C_BUS_MODE_MIXED_SLOW ) - i3cbus->scl_rate.i2c =I3C_BUS_I2C_FM_SCL_RATE ; -else - i3cbus->scl_rate.i2c =I3C_BUS_I2C_FM_PLUS_SCL_RATE ; +switch (i3cbus->mode) { +case I3C_BUS_MODE_PURE : +if (!i3cbus->scl_rate.i3c) + i3cbus->scl_rate.i3c =I3C_BUS_TYP_I3C_SCL_RATE ; +break ; +case I3C_BUS_MODE_MIXED_FAST : +if (!i3cbus->scl_rate.i3c) + i3cbus->scl_rate.i3c =I3C_BUS_TYP_I3C_SCL_RATE ; +if (!i3cbus->scl_rate.i2c) + i3cbus->scl_rate.i2c = max_i2c_scl_rate; +break ; +case I3C_BUS_MODE_MIXED_SLOW : +if (!i3cbus->scl_rate.i2c) + i3cbus->scl_rate.i2c = max_i2c_scl_rate; +if (!i3cbus->scl_rate.i3c || + i3cbus->scl_rate.i3c > i3cbus->scl_rate.i2c) + i3cbus->scl_rate.i3c = i3cbus->scl_rate.i2c; +break ; +default : +return -EINVAL ; } +dev_dbg (&master->dev,"i2c-scl = %ld Hz i3c-scl = %ld Hz\n" , + i3cbus->scl_rate.i2c, i3cbus->scl_rate.i3c); +/* * I3C/I2C frequency may have been overridden, check that user-provided * values are not exceeding max possible frequency.
@@ -1966,9 +1990,6 @@ of_i3c_master_add_i2c_boardinfo(struct i/* LVR is encoded in reg[2]. */ boardinfo->lvr = reg[2 ]; -if (boardinfo->lvr &I3C_LVR_I2C_FM_MODE ) - master->bus.scl_rate.i2c =I3C_BUS_I2C_FM_SCL_RATE ; -list_add_tail (&boardinfo->node, &master->boardinfo.i2c);of_node_get (node);
@@ -2417,6 +2438,7 @@ int i3c_master_register(struct i3c_masteconst struct i3c_master_controller_ops *ops, bool secondary) { + unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE;struct i3c_bus *i3cbus =i3c_master_get_bus (master);enum i3c_bus_mode mode =I3C_BUS_MODE_PURE ;struct i2c_dev_boardinfo *i2cbi;
@@ -2466,9 +2488,12 @@ int i3c_master_register(struct i3c_maste ret = -EINVAL ; goto err_put_dev; } + +if (i2cbi->lvr &I3C_LVR_I2C_FM_MODE ) + i2c_scl_rate =I3C_BUS_I2C_FM_SCL_RATE ; } - ret =i3c_bus_set_mode (i3cbus, mode); + ret =i3c_bus_set_mode (i3cbus, mode, i2c_scl_rate);if (ret) goto err_put_dev;
Greg Kroah-Hartman
maintainerPATCH 344/413 ARM: dts: gemini: Set DIR-685 SPI CS as active low
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
commit f90b8fda3a9d72a9422ea80ae95843697f94ea4a upstream.
The SPI to the display on the DIR-685 is active low, we were just saved by the SPI library enforcing active low on everything before, so set it as active low to avoid ambiguity.
--- arch/arm/boot/dts/gemini-dlink-dir-685.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/gemini-dlink-dir-685.dts +1 -1
@@ -64,7 +64,7 @@ gpio-sck = <&gpio1 5 GPIO_ACTIVE_HIGH>; gpio-miso = <&gpio1 8 GPIO_ACTIVE_HIGH>; gpio-mosi = <&gpio1 7 GPIO_ACTIVE_HIGH>; - cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; num-chipselects = <1>; panel: display@0 {
Greg Kroah-Hartman
maintainerPATCH 345/413 drm/nouveau/i2c: Enable i2c pads & busses during preinit
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 7cb95eeea6706c790571042a06782e378b2561ea upstream.
It turns out that while disabling i2c bus access from software when the GPU is suspended was a step in the right direction with:
commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after ->fini()")
We also ended up accidentally breaking the vbios init scripts on some older Tesla GPUs, as apparently said scripts can actually use the i2c bus. Since these scripts are executed before initializing any subdevices, we end up failing to acquire access to the i2c bus which has left a number of cards with their fan controllers uninitialized. Luckily this doesn't break hardware - it just means the fan gets stuck at 100%.
This also means that we've always been using our i2c busses before initializing them during the init scripts for older GPUs, we just didn't notice it until we started preventing them from being used until init. It's pretty impressive this never caused us any issues before!
So, fix this by initializing our i2c pad and busses during subdev pre-init. We skip initializing aux busses during pre-init, as those are guaranteed to only ever be used by nouveau for DP aux transactions.
--- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c +20 -0
@@ -185,6 +185,25 @@ nvkm_i2c_fini(struct nvkm_subdev *subdev }static int +nvkm_i2c_preinit (struct nvkm_subdev *subdev) +{ +struct nvkm_i2c *i2c =nvkm_i2c (subdev); +struct nvkm_i2c_bus *bus; +struct nvkm_i2c_pad *pad; + +/* +* We init our i2c busses as early as possible, since they may be +* needed by the vbios init scripts on some cards +*/ +list_for_each_entry (pad, &i2c->pad, head) +nvkm_i2c_pad_init (pad); +list_for_each_entry (bus, &i2c->bus, head) +nvkm_i2c_bus_init (bus); + +return 0 ; +} + +static int nvkm_i2c_init (struct nvkm_subdev *subdev) {struct nvkm_i2c *i2c =nvkm_i2c (subdev);
@@ -238,6 +257,7 @@ nvkm_i2c_dtor(struct nvkm_subdev *subdevstatic const struct nvkm_subdev_func nvkm_i2c = { .dtor = nvkm_i2c_dtor, + .preinit = nvkm_i2c_preinit, .init = nvkm_i2c_init, .fini = nvkm_i2c_fini, .intr = nvkm_i2c_intr,
Greg Kroah-Hartman
maintainerPATCH 346/413 padata: use smp_mb in padata_reorder to avoid orphaned padata jobs
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
commit cf144f81a99d1a3928f90b0936accfd3f45c9a0a upstream.
Testing padata with the tcrypt module on a 5.2 kernel...
# modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
# modprobe tcrypt mode=211 sec=1...produces this splat:
INFO: task modprobe:10075 blocked for more than 120 seconds.
Not tainted 5.2.0-base+ #16
modprobe D 0 10075 10064 0x80004080
Call Trace:
? __schedule+0x4dd/0x610
? ring_buffer_unlock_commit+0x23/0x100
schedule+0x6c/0x90
schedule_timeout+0x3b/0x320
? trace_buffer_unlock_commit_regs+0x4f/0x1f0
wait_for_common+0x160/0x1a0
? wake_up_q+0x80/0x80
{ crypto_wait_req } # entries in braces added by hand
{ do_one_aead_op }
{ test_aead_jiffies }
test_aead_speed.constprop.17+0x681/0xf30 [tcrypt]
do_test+0x4053/0x6a2b [tcrypt]
? 0xffffffffa00f4000
tcrypt_mod_init+0x50/0x1000 [tcrypt]
...The second modprobe command never finishes because in padata_reorder, CPU0's load of reorder_objects is executed before the unlocking store in spin_unlock_bh(pd->lock), causing CPU0 to miss CPU1's increment:
CPU0 CPU1
padata_reorder padata_do_serial
LOAD reorder_objects // 0
INC reorder_objects // 1 padata_reorder
TRYLOCK pd->lock // failed
UNLOCK pd->lock
CPU0 deletes the timer before returning from padata_reorder and since no other job is submitted to padata, modprobe waits indefinitely.
Add a pair of full barriers to guarantee proper ordering:
CPU0 CPU1
padata_reorder padata_do_serial
UNLOCK pd->lock
smp_mb()
LOAD reorder_objects
INC reorder_objects
smp_mb__after_atomic()
padata_reorder
TRYLOCK pd->locksmp_mb__after_atomic is needed so the read part of the trylock operation
comes after the INC, as Andrea points out. Thanks also to Andrea for
help with writing a litmus test.
--- kernel/padata.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/padata.c +12 -0
@@ -267,7 +267,12 @@ static void padata_reorder(struct parall* The next object that needs serialization might have arrived to * the reorder queues in the meantime, we will be called again * from the timer function if no one else cares for it. +* +* Ensure reorder_objects is read after pd->lock is dropped so we see +* an increment from another task in padata_do_serial. Pairs with +* smp_mb__after_atomic in padata_do_serial. */ +smp_mb ();if (atomic_read (&pd->reorder_objects) && !(pinst->flags &PADATA_RESET ))mod_timer (&pd->timer, jiffies +HZ );
@@ -387,6 +392,13 @@ void padata_do_serial(struct padata_privlist_add_tail (&padata->list, &pqueue->reorder.list);spin_unlock (&pqueue->reorder.lock); +/* +* Ensure the atomic_inc of reorder_objects above is ordered correctly +* with the trylock of pd->lock in padata_reorder. Pairs with smp_mb +* in padata_reorder. +*/ +smp_mb__after_atomic (); +put_cpu ();/* If we're running on the wrong CPU, call padata_reorder() via a
Greg Kroah-Hartman
maintainerPATCH 347/413 dm zoned: fix zone state management race
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 3b8cafdd5436f9298b3bf6eb831df5eef5ee82b6 upstream.
dm-zoned uses the zone flag DMZ_ACTIVE to indicate that a zone of the backend device is being actively read or written and so cannot be reclaimed. This flag is set as long as the zone atomic reference counter is not 0. When this atomic is decremented and reaches 0 (e.g. on BIO completion), the active flag is cleared and set again whenever the zone is reused and BIO issued with the atomic counter incremented. These 2 operations (atomic inc/dec and flag set/clear) are however not always executed atomically under the target metadata mutex lock and this causes the warning:
WARN_ON(!test_bit(DMZ_ACTIVE, &zone->flags));
in dmz_deactivate_zone() to be displayed. This problem is regularly triggered with xfstests generic/209, generic/300, generic/451 and xfs/077 with XFS being used as the file system on the dm-zoned target device. Similarly, xfstests ext4/303, ext4/304, generic/209 and generic/300 trigger the warning with ext4 use.
This problem can be easily fixed by simply removing the DMZ_ACTIVE flag and managing the "ACTIVE" state by directly looking at the reference counter value. To do so, the functions dmz_activate_zone() and dmz_deactivate_zone() are changed to inline functions respectively calling atomic_inc() and atomic_dec(), while the dmz_is_active() macro is changed to an inline function calling atomic_read().
--- drivers/md/dm-zoned-metadata.c | 24 ------------------------ drivers/md/dm-zoned.h | 28 ++++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 28 deletions(-)
drivers/md/dm-zoned-metadata.c +0 -24
@@ -1594,30 +1594,6 @@ struct dm_zone *dmz_get_zone_for_reclaim }/* -* Activate a zone (increment its reference count). -*/ -void dmz_activate_zone (struct dm_zone *zone) -{ -set_bit (DMZ_ACTIVE , &zone->flags); -atomic_inc (&zone->refcount); -} - -/* -* Deactivate a zone. This decrement the zone reference counter -* and clears the active state of the zone once the count reaches 0, -* indicating that all BIOs to the zone have completed. Returns -* true if the zone was deactivated. -*/ -void dmz_deactivate_zone (struct dm_zone *zone) -{ -if (atomic_dec_and_test (&zone->refcount)) { -WARN_ON (!test_bit (DMZ_ACTIVE , &zone->flags)); -clear_bit_unlock (DMZ_ACTIVE , &zone->flags); -smp_mb__after_atomic (); - } -} - -/* * Get the zone mapping a chunk, if the chunk is mapped already. * If no mapping exist and the operation is WRITE, a zone is * allocated and used to map the chunk.
drivers/md/dm-zoned.h +24 -4
@@ -115,7 +115,6 @@ enum {DMZ_BUF ,/* Zone internal state */ -DMZ_ACTIVE ,DMZ_RECLAIM , DMZ_SEQ_WRITE_ERR, };
@@ -128,7 +127,6 @@ enum {#define dmz_is_empty (z) ((z)->wp_block == 0)#define dmz_is_offline (z) test_bit(DMZ_OFFLINE, &(z)->flags)#define dmz_is_readonly (z) test_bit(DMZ_READ_ONLY, &(z)->flags) -#define dmz_is_active (z) test_bit(DMZ_ACTIVE, &(z)->flags)#define dmz_in_reclaim (z) test_bit(DMZ_RECLAIM, &(z)->flags)#define dmz_seq_write_err (z) test_bit(DMZ_SEQ_WRITE_ERR, &(z)->flags)
@@ -188,8 +186,30 @@ void dmz_unmap_zone(struct dmz_metadataunsigned int dmz_nr_rnd_zones (struct dmz_metadata *zmd);unsigned int dmz_nr_unmap_rnd_zones (struct dmz_metadata *zmd); -void dmz_activate_zone (struct dm_zone *zone); -void dmz_deactivate_zone (struct dm_zone *zone); +/* +* Activate a zone (increment its reference count). +*/ +static inline void dmz_activate_zone (struct dm_zone *zone) +{ +atomic_inc (&zone->refcount); +} + +/* +* Deactivate a zone. This decrement the zone reference counter +* indicating that all BIOs to the zone have completed when the count is 0. +*/ +static inline void dmz_deactivate_zone (struct dm_zone *zone) +{ +atomic_dec (&zone->refcount); +} + +/* +* Test if a zone is active, that is, has a refcount > 0. +*/ +static inline bool dmz_is_active (struct dm_zone *zone) +{ +return atomic_read (&zone->refcount); +}int dmz_lock_zone_reclaim (struct dm_zone *zone);void dmz_unlock_zone_reclaim (struct dm_zone *zone);
Greg Kroah-Hartman
maintainerPATCH 348/413 xen/events: fix binding user event channels to cpus
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit bce5963bcb4f9934faa52be323994511d59fd13c upstream.
When binding an interdomain event channel to a vcpu via IOCTL_EVTCHN_BIND_INTERDOMAIN not only the event channel needs to be bound, but the affinity of the associated IRQi must be changed, too. Otherwise the IRQ and the event channel won't be moved to another vcpu in case the original vcpu they were bound to is going offline.
--- drivers/xen/events/events_base.c | 12 ++++++++++-- drivers/xen/evtchn.c | 2 +- include/xen/events.h | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/xen/events/events_base.c +10 -2
@@ -1294,7 +1294,7 @@ void rebind_evtchn_irq(int evtchn, int i }/* Rebind an evtchn so that it gets delivered to a specific cpu */ -int xen_rebind_evtchn_to_cpu (int evtchn,unsigned tcpu) +static int xen_rebind_evtchn_to_cpu (int evtchn,unsigned int tcpu) {struct evtchn_bind_vcpu bind_vcpu;int masked;
@@ -1328,7 +1328,6 @@ int xen_rebind_evtchn_to_cpu(int evtchn,return 0 ; } -EXPORT_SYMBOL_GPL (xen_rebind_evtchn_to_cpu);static int set_affinity_irq (struct irq_data *data,const struct cpumask *dest,bool force)
@@ -1342,6 +1341,15 @@ static int set_affinity_irq(struct irq_dreturn ret; } +/* To be called with desc->lock held. */ +int xen_set_affinity_evtchn (struct irq_desc *desc,unsigned int tcpu) +{ +struct irq_data *d =irq_desc_get_irq_data (desc); + +return set_affinity_irq (d,cpumask_of (tcpu), false); +} +EXPORT_SYMBOL_GPL (xen_set_affinity_evtchn); +static void enable_dynirq (struct irq_data *data) {int evtchn =evtchn_from_irq (data->irq);
drivers/xen/evtchn.c +1 -1
@@ -447,7 +447,7 @@ static void evtchn_bind_interdom_next_vcthis_cpu_write (bind_last_selected_cpu, selected_cpu);/* unmask expects irqs to be disabled */ -xen_rebind_evtchn_to_cpu (evtchn, selected_cpu); +xen_set_affinity_evtchn (desc, selected_cpu);raw_spin_unlock_irqrestore (&desc->lock, flags); }
include/xen/events.h +2 -1
@@ -3,6 +3,7 @@#define _XEN_EVENTS_H#include <linux/interrupt.h> +#include <linux/irq.h> #ifdef CONFIG_PCI_MSI #include <linux/msi.h> #endif
@@ -59,7 +60,7 @@ void evtchn_put(unsigned int evtchn);void xen_send_IPI_one (unsigned int cpu,enum ipi_vector vector);void rebind_evtchn_irq (int evtchn,int irq); -int xen_rebind_evtchn_to_cpu (int evtchn,unsigned tcpu); +int xen_set_affinity_evtchn (struct irq_desc *desc,unsigned int tcpu);static inline void notify_remote_via_evtchn (int port) {
Greg Kroah-Hartman
maintainerPATCH 349/413 9p/xen: Add cleanup path in p9_trans_xen_init
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 80a316ff16276b36d0392a8f8b2f63259857ae98 upstream.
If xenbus_register_frontend() fails in p9_trans_xen_init, we should call v9fs_unregister_trans() to do cleanup.
--- net/9p/trans_xen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/9p/trans_xen.c +7 -1
@@ -530,13 +530,19 @@ static struct xenbus_driver xen_9pfs_frostatic int p9_trans_xen_init (void ) { +int rc; +if (!xen_domain ())return -ENODEV ;pr_info ("Initialising Xen transport for 9pfs\n" );v9fs_register_trans (&p9_xen_trans); -return xenbus_register_frontend (&xen_9pfs_front_driver); + rc =xenbus_register_frontend (&xen_9pfs_front_driver); +if (rc) +v9fs_unregister_trans (&p9_xen_trans); + +return rc; }module_init (p9_trans_xen_init);
Greg Kroah-Hartman
maintainerPATCH 350/413 9p/virtio: Add cleanup path in p9_virtio_init
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit d4548543fc4ece56c6f04b8586f435fb4fd84c20 upstream.
KASAN report this:
BUG: unable to handle kernel paging request at ffffffffa0097000 PGD 3870067 P4D 3870067 PUD 3871063 PMD 2326e2067 PTE 0 Oops: 0000 [#1 CPU: 0 PID: 5340 Comm: modprobe Not tainted 5.1.0-rc7+ #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 RIP: 0010:__list_add_valid+0x10/0x70 Code: c3 48 8b 06 55 48 89 e5 5d 48 39 07 0f 94 c0 0f b6 c0 c3 90 90 90 90 90 90 90 55 48 89 d0 48 8b 52 08 48 89 e5 48 39 f2 75 19 <48> 8b 32 48 39 f0 75 3a
RSP: 0018:ffffc90000e23c68 EFLAGS: 00010246 RAX: ffffffffa00ad000 RBX: ffffffffa009d000 RCX: 0000000000000000 RDX: ffffffffa0097000 RSI: ffffffffa0097000 RDI: ffffffffa009d000 RBP: ffffc90000e23c68 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa0097000 R13: ffff888231797180 R14: 0000000000000000 R15: ffffc90000e23e78 FS: 00007fb215285540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffa0097000 CR3: 000000022f144000 CR4: 00000000000006f0 Call Trace: v9fs_register_trans+0x2f/0x60 [9pnet ? 0xffffffffa0087000 p9_virtio_init+0x25/0x1000 [9pnet_virtio do_one_initcall+0x6c/0x3cc ? kmem_cache_alloc_trace+0x248/0x3b0 do_init_module+0x5b/0x1f1 load_module+0x1db1/0x2690 ? m_show+0x1d0/0x1d0 __do_sys_finit_module+0xc5/0xd0 __x64_sys_finit_module+0x15/0x20 do_syscall_64+0x6b/0x1d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fb214d8e839 Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01
RSP: 002b:00007ffc96554278 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 000055e67eed2aa0 RCX: 00007fb214d8e839
RDX: 0000000000000000 RSI: 000055e67ce95c2e RDI: 0000000000000003
RBP: 000055e67ce95c2e R08: 0000000000000000 R09: 000055e67eed2aa0
R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
R13: 000055e67eeda500 R14: 0000000000040000 R15: 000055e67eed2aa0
Modules linked in: 9pnet_virtio(+) 9pnet gre rfkill vmw_vsock_virtio_transport_common vsock [last unloaded: 9pnet_virtio CR2: ffffffffa0097000 ---[ end trace 4a52bb13ff07b761
If register_virtio_driver() fails in p9_virtio_init, we should call v9fs_unregister_trans() to do cleanup.
--- net/9p/trans_virtio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/9p/trans_virtio.c +7 -1
@@ -767,10 +767,16 @@ static struct p9_trans_module p9_virtio_/* The standard init function */ static int __init p9_virtio_init (void ) { +int rc; +INIT_LIST_HEAD (&virtio_chan_list);v9fs_register_trans (&p9_virtio_trans); -return register_virtio_driver (&p9_virtio_drv); + rc =register_virtio_driver (&p9_virtio_drv); +if (rc) +v9fs_unregister_trans (&p9_virtio_trans); + +return rc; } static void __exit p9_virtio_cleanup(void)
Greg Kroah-Hartman
maintainerPATCH 351/413 rt2x00usb: fix rx queue hang
In reply to Greg Kroah-HartmanFrom: Soeren Moch <[email protected]>
commit 41a531ffa4c5aeb062f892227c00fabb3b4a9c91 upstream.
Since commit ed194d136769 ("usb: core: remove local_irq_save() around
->complete() handler") the handler rt2x00usb_interrupt_rxdone() is
not running with interrupts disabled anymore. So this completion handler is not guaranteed to run completely before workqueue processing starts for the same queue entry.
Be sure to set all other flags in the entry correctly before marking this entry ready for workqueue processing. This way we cannot miss error conditions that need to be signalled from the completion handler to the worker thread.
Note that rt2x00usb_work_rxdone() processes all available entries, not only such for which queue_work() was called.
This patch is similar to what commit df71c9cfceea ("rt2x00: fix order of entry flags modification") did for TX processing.
This fixes a regression on a RT5370 based wifi stick in AP mode, which suddenly stopped data transmission after some period of heavy load. Also stopping the hanging hostapd resulted in the error message "ieee80211
phy0: rt2x00queue_flush_queue: Warning - Queue 14 failed to flush". Other operation modes are probably affected as well, this just was the used testcase.
--- drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +6 -6
@@ -372,15 +372,10 @@ static void rt2x00usb_interrupt_rxdone(sstruct queue_entry *entry = (struct queue_entry *)urb->context;struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -if (!test_and_clear_bit (ENTRY_OWNER_DEVICE_DATA , &entry->flags)) +if (!test_bit (ENTRY_OWNER_DEVICE_DATA , &entry->flags))return ;/* -* Report the frame as DMA done -*/ -rt2x00lib_dmadone (entry); - -/* * Check if the received data is simply too small * to be actually valid, or if the urb is signaling * a problem.
@@ -389,6 +384,11 @@ static void rt2x00usb_interrupt_rxdone(sset_bit (ENTRY_DATA_IO_FAILED , &entry->flags);/* +* Report the frame as DMA done +*/ +rt2x00lib_dmadone (entry); + +/* * Schedule the delayed work for reading the RX status * from the device. */
Greg Kroah-Hartman
maintainerPATCH 352/413 x86/hyper-v: Zero out the VP ASSIST PAGE on allocation
In reply to Greg Kroah-HartmanFrom: Dexuan Cui <[email protected]>
commit e320ab3cec7dd8b1606964d81ae1e14391ff8e96 upstream.
The VP ASSIST PAGE is an "overlay" page (see Hyper-V TLFS's Section 5.2.1 "GPA Overlay Pages" for the details) and here is an excerpt:
"The hypervisor defines several special pages that "overlay" the guest's
Guest Physical Addresses (GPA) space. Overlays are addressed GPA but are not included in the normal GPA map maintained internally by the hypervisor. Conceptually, they exist in a separate map that overlays the GPA map.
If a page within the GPA space is overlaid, any SPA page mapped to the GPA page is effectively "obscured" and generally unreachable by the virtual processor through processor memory accesses.
If an overlay page is disabled, the underlying GPA page is "uncovered", and an existing mapping becomes accessible to the guest."
SPA = System Physical Address = the final real physical address.
When a CPU (e.g. CPU1) is onlined, hv_cpu_init() allocates the VP ASSIST PAGE and enables the EOI optimization for this CPU by writing the MSR HV_X64_MSR_VP_ASSIST_PAGE. From now on, hvp->apic_assist belongs to the special SPA page, and this CPU *always* uses hvp->apic_assist (which is shared with the hypervisor) to decide if it needs to write the EOI MSR.
When a CPU is offlined then on the outgoing CPU:
1. hv_cpu_die() disables the EOI optimizaton for this CPU, and from now on hvp->apic_assist belongs to the original "normal" SPA page;
2. the remaining work of stopping this CPU is done
3. this CPU is completely stopped.
Between 1 and 3, this CPU can still receive interrupts (e.g. reschedule IPIs from CPU0, and Local APIC timer interrupts), and this CPU *must* write the EOI MSR for every interrupt received, otherwise the hypervisor may not deliver further interrupts, which may be needed to completely stop the CPU.
So, after the EOI optimization is disabled in hv_cpu_die(), it's required that the hvp->apic_assist's bit0 is zero, which is not guaranteed by the current allocation mode because it lacks __GFP_ZERO. As a consequence the bit might be set and interrupt handling would not write the EOI MSR causing interrupt delivery to become stuck.
Add the missing __GFP_ZERO to the allocation.
Note 1: after the "normal" SPA page is allocted and zeroed out, neither the hypervisor nor the guest writes into the page, so the page remains with zeros.
Note 2: see Section 10.3.5 "EOI Assist" for the details of the EOI optimization. When the optimization is enabled, the guest can still write the EOI MSR register irrespective of the "No EOI required" value, but that's slower than the optimized assist based variant.
--- arch/x86/hyperv/hv_init.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/x86/hyperv/hv_init.c +11 -2
@@ -111,8 +111,17 @@ static int hv_cpu_init(unsigned int cpu)if (!hv_vp_assist_page)return 0 ; -if (!*hvp) - *hvp =__vmalloc (PAGE_SIZE ,GFP_KERNEL ,PAGE_KERNEL ); +/* +* The VP ASSIST PAGE is an "overlay" page (see Hyper-V TLFS's Section +* 5.2.1 "GPA Overlay Pages"). Here it must be zeroed out to make sure +* we always write the EOI MSR in hv_apic_eoi_write() *after* the +* EOI optimization is disabled in hv_cpu_die(), otherwise a CPU may +* not be stopped in the case of CPU offlining and the VM will hang. +*/ +if (!*hvp) { + *hvp =__vmalloc (PAGE_SIZE ,GFP_KERNEL | __GFP_ZERO, +PAGE_KERNEL ); + }if (*hvp) {u64 val;
Greg Kroah-Hartman
maintainerPATCH 353/413 x86/boot: Fix memory leak in default_get_smp_config()
In reply to Greg Kroah-HartmanFrom: David Rientjes <[email protected]>
commit e74bd96989dd42a51a73eddb4a5510a6f5e42ac3 upstream.
When default_get_smp_config() is called with early == 1 and mpf->feature1 is non-zero, mpf is leaked because the return path does not do early_memunmap().
Fix this and share a common exit routine.
--- arch/x86/kernel/mpparse.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/x86/kernel/mpparse.c +4 -6
@@ -546,17 +546,15 @@ void __init default_get_smp_config(unsig* local APIC has default address */ mp_lapic_addr =APIC_DEFAULT_PHYS_BASE ; -return ; + goto out; }pr_info ("Default MP configuration #%d\n" , mpf->feature1);construct_default_ISA_mptable (mpf->feature1); }else if (mpf->physptr) { -if (check_physptr (mpf, early)) { -early_memunmap (mpf,sizeof (*mpf)); -return ; - } +if (check_physptr (mpf, early)) + goto out; }else BUG ();
@@ -565,7 +563,7 @@ void __init default_get_smp_config(unsig/* * Only use the first configuration found. */ - +out:early_memunmap (mpf,sizeof (*mpf)); }
Greg Kroah-Hartman
maintainerPATCH 354/413 perf/x86/intel: Fix spurious NMI on fixed counter
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
commit e4557c1a46b0d32746bd309e1941914b5a6912b4 upstream.
If a user first sample a PEBS event on a fixed counter, then sample a non-PEBS event on the same fixed counter on Icelake, it will trigger spurious NMI. For example:
perf record -e 'cycles:p' -a
perf record -e 'cycles' -a
The error message for spurious NMI:
[June 21 15:38] Uhhuh. NMI received for unknown reason 30 on CPU 2.
[ +0.000000] Do you have a strange power saving mode enabled?
[ +0.000000] Dazed and confused, but trying to continue
The bug was introduced by the following commit:
commit 6f55967ad9d9 ("perf/x86/intel: Fix race in intel_pmu_disable_event()")
The commit moves the intel_pmu_pebs_disable() after intel_pmu_disable_fixed(), which returns immediately. The related bit of PEBS_ENABLE MSR will never be cleared for the fixed counter. Then a non-PEBS event runs on the fixed counter, but the bit on PEBS_ENABLE is still set, which triggers spurious NMIs.
Check and disable PEBS for fixed counters after intel_pmu_disable_fixed().
--- arch/x86/events/intel/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/events/intel/core.c +3 -5
@@ -2161,12 +2161,10 @@ static void intel_pmu_disable_event(stru cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx); cpuc->intel_cp_status &= ~(1ull << hwc->idx); -if (unlikely (hwc->config_base ==MSR_ARCH_PERFMON_FIXED_CTR_CTRL )) { +if (unlikely (hwc->config_base ==MSR_ARCH_PERFMON_FIXED_CTR_CTRL ))intel_pmu_disable_fixed (hwc); -return ; - } - -x86_pmu_disable_event (event); +else +x86_pmu_disable_event (event);/* * Needs to be called after x86_pmu_disable_event,
Greg Kroah-Hartman
maintainerPATCH 355/413 perf/x86/amd/uncore: Do not set ThreadMask and SliceMask for non-L3 PMCs
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit 16f4641166b10e199f0d7b68c2c5f004fef0bda3 upstream.
The following commit:
d7cbbe49a930 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events")
enables L3 PMC events for all threads and slices by writing 1's in 'ChL3PmcCfg' (L3 PMC PERF_CTL) register fields.
Those bitfields overlap with high order event select bits in the Data Fabric PMC control register, however.
So when a user requests raw Data Fabric events (-e amd_df/event=0xYYY/), the two highest order bits get inadvertently set, changing the counter select to events that don't exist, and for which no counts are read.
This patch changes the logic to write the L3 masks only when dealing with L3 PMC counters.
AMD Family 16h and below Northbridge (NB) counters were not affected.
--- arch/x86/events/amd/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/amd/uncore.c +1 -1
@@ -206,7 +206,7 @@ static int amd_uncore_event_init(struct* SliceMask and ThreadMask need to be set for certain L3 events in * Family 17h. For other events, the two fields do not affect the count. */ -if (l3_mask) +if (l3_mask &&is_llc_event (event)) hwc->config |= (AMD64_L3_SLICE_MASK |AMD64_L3_THREAD_MASK );if (event->cpu <0 )
Greg Kroah-Hartman
maintainerPATCH 356/413 perf/x86/amd/uncore: Set the thread mask for F17h L3 PMCs
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit 2f217d58a8a086d3399fecce39fb358848e799c4 upstream.
Fill in the L3 performance event select register ThreadMask bitfield, to enable per hardware thread accounting.
--- arch/x86/events/amd/uncore.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
arch/x86/events/amd/uncore.c +11 -4
@@ -202,15 +202,22 @@ static int amd_uncore_event_init(struct hwc->config = event->attr.config &AMD64_RAW_EVENT_MASK_NB ; hwc->idx =-1 ; +if (event->cpu <0 ) +return -EINVAL ; +/* * SliceMask and ThreadMask need to be set for certain L3 events in * Family 17h. For other events, the two fields do not affect the count. */ -if (l3_mask &&is_llc_event (event)) - hwc->config |= (AMD64_L3_SLICE_MASK |AMD64_L3_THREAD_MASK ); +if (l3_mask &&is_llc_event (event)) { +int thread =2 * (cpu_data (event->cpu).cpu_core_id %4 ); -if (event->cpu <0 ) -return -EINVAL ; +if (smp_num_siblings >1 ) + thread +=cpu_data (event->cpu).apicid &1 ; + + hwc->config |= (1ULL << (AMD64_L3_THREAD_SHIFT + thread) & +AMD64_L3_THREAD_MASK ) |AMD64_L3_SLICE_MASK ; + } uncore =event_to_amd_uncore (event);if (!uncore)
Greg Kroah-Hartman
maintainerPATCH 357/413 x86/stacktrace: Prevent infinite loop in arch_stack_walk_user()
In reply to Greg Kroah-HartmanFrom: Eiichi Tsukata <[email protected]>
commit cbf5b73d162b22e044fe0b7d51dcaa33be065253 upstream.
arch_stack_walk_user() checks if (fp == frame.next_fp) to prevent a infinite loop by self reference but it's not enogh for circular reference.
Once a lack of return address is found, there is no point to continue the loop, so break out.
--- arch/x86/kernel/stacktrace.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/kernel/stacktrace.c +3 -5
@@ -129,11 +129,9 @@ void arch_stack_walk_user(stack_trace_cobreak ;if ((unsigned long )fp < regs->sp)break ; -if (frame.ret_addr) { -if (!consume_entry (cookie, frame.ret_addr, false)) -return ; - } -if (fp == frame.next_fp) +if (!frame.ret_addr) +break ; +if (!consume_entry (cookie, frame.ret_addr, false))break ; fp = frame.next_fp; }
Greg Kroah-Hartman
maintainerPATCH 358/413 drm/edid: parse CEA blocks embedded in DisplayID
In reply to Greg Kroah-HartmanFrom: Andres Rodriguez <[email protected]>
commit e28ad544f462231d3fd081a7316339359efbb481 upstream.
DisplayID blocks allow embedding of CEA blocks. The payloads are identical to traditional top level CEA extension blocks, but the header is slightly different.
This change allows the CEA parser to find a CEA block inside a DisplayID block. Additionally, it adds support for parsing the embedded CTA header. No further changes are necessary due to payload parity.
This change fixes audio support for the Valve Index HMD.
--- drivers/gpu/drm/drm_edid.c | 81 ++++++++++++++++++++++++++++++++++++++------ include/drm/drm_displayid.h | 10 +++++ 2 files changed, 80 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_edid.c +70 -11
@@ -1339,6 +1339,7 @@ MODULE_PARM_DESC(edid_fixup,static void drm_get_displayid (struct drm_connector *connector,struct edid *edid); +static int validate_displayid (u8 *displayid,int length,int idx);static int drm_edid_block_checksum (const u8 *raw_edid) {
@@ -2922,16 +2923,46 @@ static u8 *drm_find_edid_extension(constreturn edid_ext; } -static u8 *drm_find_cea_extension (const struct edid *edid) -{ -return drm_find_edid_extension (edid,CEA_EXT ); -}static u8 *drm_find_displayid_extension (const struct edid *edid) {return drm_find_edid_extension (edid,DISPLAYID_EXT ); } +static u8 *drm_find_cea_extension (const struct edid *edid) +{ +int ret; +int idx =1 ; +int length =EDID_LENGTH ; +struct displayid_block *block; +u8 *cea; +u8 *displayid; + +/* Look for a top level CEA extension block */ + cea =drm_find_edid_extension (edid,CEA_EXT ); +if (cea) +return cea; + +/* CEA blocks can also be found embedded in a DisplayID block */ + displayid =drm_find_displayid_extension (edid); +if (!displayid) +return NULL ; + + ret =validate_displayid (displayid, length, idx); +if (ret) +return NULL ; + + idx +=sizeof (struct displayid_hdr ); +for_each_displayid_db (displayid, block, idx, length) { +if (block->tag ==DATA_BLOCK_CTA ) { + cea = (u8 *)block; +break ; + } + } + +return cea; +} +/* * Calculate the alternate clock for the CEA mode * (60Hz vs. 59.94Hz etc.)
@@ -3655,13 +3686,38 @@ cea_revision(const u8 *cea)static int cea_db_offsets (const u8 *cea,int *start,int *end) { -/* Data block offset in CEA extension block */ - *start =4 ; - *end = cea[2 ]; -if (*end ==0 ) - *end =127 ; -if (*end <4 || *end >127 ) -return -ERANGE ; +/* DisplayID CTA extension blocks and top-level CEA EDID +* block header definitions differ in the following bytes: +* 1) Byte 2 of the header specifies length differently, +* 2) Byte 3 is only present in the CEA top level block. +* +* The different definitions for byte 2 follow. +* +* DisplayID CTA extension block defines byte 2 as: +* Number of payload bytes +* +* CEA EDID block defines byte 2 as: +* Byte number (decimal) within this block where the 18-byte +* DTDs begin. If no non-DTD data is present in this extension +* block, the value should be set to 04h (the byte after next). +* If set to 00h, there are no DTDs present in this block and +* no non-DTD data. +*/ +if (cea[0 ] ==DATA_BLOCK_CTA ) { + *start =3 ; + *end = *start + cea[2 ]; + }else if (cea[0 ] ==CEA_EXT ) { +/* Data block offset in CEA extension block */ + *start =4 ; + *end = cea[2 ]; +if (*end ==0 ) + *end =127 ; +if (*end <4 || *end >127 ) +return -ERANGE ; + }else { +return -ENOTSUPP ; + } +return 0 ; }
@@ -5279,6 +5335,9 @@ static int drm_parse_display_id(struct dcase DATA_BLOCK_TYPE_1_DETAILED_TIMING :/* handled in mode gathering code. */ break ; +case DATA_BLOCK_CTA : +/* handled in the cea parser code. */ +break ;default :DRM_DEBUG_KMS ("found DisplayID tag 0x%x, unhandled\n" , block->tag);break ;
include/drm/drm_displayid.h +10 -0
@@ -40,6 +40,7 @@#define DATA_BLOCK_DISPLAY_INTERFACE 0x0f#define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10#define DATA_BLOCK_TILED_DISPLAY 0x12 +#define DATA_BLOCK_CTA 0x81#define DATA_BLOCK_VENDOR_SPECIFIC 0x7f
@@ -90,4 +91,13 @@ struct displayid_detailed_timing_block {struct displayid_block base; struct displayid_detailed_timings_1 timings[0]; }; + +#define for_each_displayid_db (displayid, block, idx, length) \ + for ((block) = (struct displayid_block *)&(displayid)[idx]; \ + (idx) + sizeof(struct displayid_block) <= (length) && \ + (idx) + sizeof(struct displayid_block) + (block)->num_bytes <= (length) && \ + (block)->num_bytes > 0; \ + (idx) += (block)->num_bytes + sizeof(struct displayid_block), \ + (block) = (struct displayid_block *)&(displayid)[idx]) +#endif
Greg Kroah-Hartman
maintainerPATCH 359/413 block: Allow mapping of vmalloc-ed buffers
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit b4c5875d36178e8df409bdce232f270cac89fafe upstream.
To allow the SCSI subsystem scsi_execute_req() function to issue requests using large buffers that are better allocated with vmalloc() rather than kmalloc(), modify bio_map_kern() to allow passing a buffer allocated with vmalloc().
To do so, detect vmalloc-ed buffers using is_vmalloc_addr(). For vmalloc-ed buffers, flush the buffer using flush_kernel_vmap_range(), use vmalloc_to_page() instead of virt_to_page() to obtain the pages of the buffer, and invalidate the buffer addresses with invalidate_kernel_vmap_range() on completion of read BIOs. This last point is executed using the function bio_invalidate_vmalloc_pages() which is defined only if the architecture defines ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE, that is, if the architecture actually needs the invalidation done.
--- block/bio.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
block/bio.c +27 -1
@@ -16,6 +16,7 @@#include <linux/workqueue.h> #include <linux/cgroup.h> #include <linux/blk-cgroup.h> +#include <linux/highmem.h> #include <trace/events/block.h> #include "blk.h"
@@ -1479,8 +1480,22 @@ void bio_unmap_user(struct bio *bio)bio_put (bio); } +static void bio_invalidate_vmalloc_pages (struct bio *bio) +{ +#ifdef ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE +if (bio->bi_private && !op_is_write (bio_op (bio))) { +unsigned long i, len =0 ; + +for (i =0 ; i < bio->bi_vcnt; i++) + len += bio->bi_io_vec[i].bv_len; +invalidate_kernel_vmap_range (bio->bi_private, len); + } +#endif +} +static void bio_map_kern_endio (struct bio *bio) { +bio_invalidate_vmalloc_pages (bio);bio_put (bio); }
@@ -1501,6 +1516,8 @@ struct bio *bio_map_kern(struct request_unsigned long end = (kaddr + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ;unsigned long start = kaddr >>PAGE_SHIFT ;const int nr_pages = end - start; +bool is_vmalloc =is_vmalloc_addr (data); +struct page *page;int offset, i;struct bio *bio;
@@ -1508,6 +1525,11 @@ struct bio *bio_map_kern(struct request_if (!bio)return ERR_PTR (-ENOMEM ); +if (is_vmalloc) { +flush_kernel_vmap_range (data, len); + bio->bi_private = data; + } + offset =offset_in_page (kaddr);for (i =0 ; i < nr_pages; i++) {unsigned int bytes =PAGE_SIZE - offset;
@@ -1518,7 +1540,11 @@ struct bio *bio_map_kern(struct request_if (bytes > len) bytes = len; -if (bio_add_pc_page (q, bio,virt_to_page (data), bytes, +if (!is_vmalloc) + page =virt_to_page (data); +else + page =vmalloc_to_page (data); +if (bio_add_pc_page (q, bio, page, bytes, offset) < bytes) {/* we don't support partial mappings */ bio_put (bio);
Greg Kroah-Hartman
maintainerPATCH 360/413 block: Fix potential overflow in blk_report_zones()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 113ab72ed4794c193509a97d7c6d32a6886e1682 upstream.
For large values of the number of zones reported and/or large zone sizes, the sector increment calculated with
blk_queue_zone_sectors(q) * n
in blk_report_zones() loop can overflow the unsigned int type used for the calculation as both "n" and blk_queue_zone_sectors() value are unsigned int. E.g. for a device with 256 MB zones (524288 sectors), overflow happens with 8192 or more zones reported.
Changing the return type of blk_queue_zone_sectors() to sector_t, fixes this problem and avoids overflow problem for all other callers of this helper too. The same change is also applied to the bdev_zone_sectors() helper.
--- block/blk-zoned.c | 2 +- include/linux/blkdev.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
block/blk-zoned.c +1 -1
@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(__blk_req_zone_write_ustatic inline unsigned int __blkdev_nr_zones (struct request_queue *q,sector_t nr_sectors) { -unsigned long zone_sectors =blk_queue_zone_sectors (q); +sector_t zone_sectors =blk_queue_zone_sectors (q);return (nr_sectors + zone_sectors -1 ) >>ilog2 (zone_sectors); }
include/linux/blkdev.h +2 -2
@@ -681,7 +681,7 @@ static inline bool blk_queue_is_zoned(st } } -static inline unsigned int blk_queue_zone_sectors (struct request_queue *q) +static inline sector_t blk_queue_zone_sectors (struct request_queue *q) {return blk_queue_is_zoned (q) ? q->limits.chunk_sectors :0 ; }
@@ -1429,7 +1429,7 @@ static inline bool bdev_is_zoned(structreturn false; } -static inline unsigned int bdev_zone_sectors (struct block_device *bdev) +static inline sector_t bdev_zone_sectors (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev);
Greg Kroah-Hartman
maintainerPATCH 361/413 RDMA/srp: Accept again source addresses that do not have a port number
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
commit bcef5b7215681250c4bf8961dfe15e9e4fef97d0 upstream.
The function srp_parse_in() is used both for parsing source address specifications and for target address specifications. Target addresses must have a port number. Having to specify a port number for source addresses is inconvenient. Make sure that srp_parse_in() supports again parsing addresses with no port number.
--- drivers/infiniband/ulp/srp/ib_srp.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +15 -6
@@ -3483,13 +3483,14 @@ static const match_table_t srp_opt_token* @net: [in] Network namespace. * @sa: [out] Address family, IP address and port number. * @addr_port_str: [in] IP address and port number. +* @has_port: [out] Whether or not @addr_port_str includes a port number. * * Parse the following address formats: * - IPv4: <ip_address>:<port>, e.g. 1.2.3.4:5. * - IPv6: \[<ipv6_address>\]:<port>, e.g. [1::2:3%4]:5. */ static int srp_parse_in (struct net *net,struct sockaddr_storage *sa, -const char *addr_port_str) +const char *addr_port_str,bool *has_port) {char *addr_end, *addr =kstrdup (addr_port_str,GFP_KERNEL );char *port_str;
@@ -3498,9 +3499,12 @@ static int srp_parse_in(struct net *net,if (!addr)return -ENOMEM ; port_str =strrchr (addr,':' ); -if (!port_str) -return -EINVAL ; - *port_str++ ='\0' ; +if (port_str &&strchr (port_str,']' )) + port_str =NULL ; +if (port_str) + *port_str++ ='\0' ; +if (has_port) + *has_port = port_str !=NULL ; ret =inet_pton_with_scope (net,AF_INET , addr, port_str, sa);if (ret && addr[0 ]) { addr_end = addr +strlen (addr) -1 ;
@@ -3522,6 +3526,7 @@ static int srp_parse_options(struct netchar *p;substring_t args[MAX_OPT_ARGS ];unsigned long long ull; +bool has_port;int opt_mask =0 ;int token;int ret = -EINVAL ;
@@ -3620,7 +3625,8 @@ static int srp_parse_options(struct net ret = -ENOMEM ; goto out; } - ret =srp_parse_in (net, &target->rdma_cm.src.ss, p); + ret =srp_parse_in (net, &target->rdma_cm.src.ss, p, +NULL );if (ret <0 ) {pr_warn ("bad source parameter '%s'\n" , p);kfree (p);
@@ -3636,7 +3642,10 @@ static int srp_parse_options(struct net ret = -ENOMEM ; goto out; } - ret =srp_parse_in (net, &target->rdma_cm.dst.ss, p); + ret =srp_parse_in (net, &target->rdma_cm.dst.ss, p, + &has_port); +if (!has_port) + ret = -EINVAL ;if (ret <0 ) {pr_warn ("bad dest parameter '%s'\n" , p);kfree (p);
Greg Kroah-Hartman
maintainerPATCH 362/413 RDMA/odp: Fix missed unlock in non-blocking invalidate_start
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
commit 7608bf40cf2480057ec0da31456cc428791c32ef upstream.
If invalidate_start returns with EAGAIN then the umem_rwsem needs to be unlocked as no invalidate_end will be called.
--- drivers/infiniband/core/umem_odp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/infiniband/core/umem_odp.c +9 -5
@@ -151,6 +151,7 @@ static int ib_umem_notifier_invalidate_r {struct ib_ucontext_per_mm *per_mm = container_of(mn, struct ib_ucontext_per_mm, mn); +int rc;if (mmu_notifier_range_blockable (range))down_read (&per_mm->umem_rwsem);
@@ -167,11 +168,14 @@ static int ib_umem_notifier_invalidate_rreturn 0 ; } -return rbt_ib_umem_for_each_in_range (&per_mm->umem_tree, range->start, - range->end, - invalidate_range_start_trampoline, -mmu_notifier_range_blockable (range), -NULL ); + rc =rbt_ib_umem_for_each_in_range (&per_mm->umem_tree, range->start, + range->end, + invalidate_range_start_trampoline, +mmu_notifier_range_blockable (range), +NULL ); +if (rc) +up_read (&per_mm->umem_rwsem); +return rc; } static int invalidate_range_end_trampoline(struct ib_umem_odp *item, u64 start,
Greg Kroah-Hartman
maintainerPATCH 363/413 intel_th: pci: Add Ice Lake NNPI support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 4aa5aed2b6f267592705a526f57518a5d715b769 upstream.
This adds Ice Lake NNPI support to the Intel(R) Trace Hub.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -194,6 +194,11 @@ static const struct pci_device_id intel_ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Ice Lake NNPI */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, { 0 }, };
Greg Kroah-Hartman
maintainerPATCH 364/413 PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
In reply to Greg Kroah-HartmanFrom: Dexuan Cui <[email protected]>
commit 4df591b20b80cb77920953812d894db259d85bd7 upstream.
Fix a use-after-free in hv_eject_device_work().
--- drivers/pci/controller/pci-hyperv.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/pci/controller/pci-hyperv.c +9 -6
@@ -1875,6 +1875,7 @@ static void hv_pci_devices_present(strucstatic void hv_eject_device_work (struct work_struct *work) {struct pci_eject_response *ejct_pkt; +struct hv_pcibus_device *hbus;struct hv_pci_dev *hpdev;struct pci_dev *pdev;unsigned long flags;
@@ -1885,6 +1886,7 @@ static void hv_eject_device_work(struct } ctxt; hpdev = container_of(work, struct hv_pci_dev, wrk); + hbus = hpdev->hbus;WARN_ON (hpdev->state != hv_pcichild_ejecting);
@@ -1895,8 +1897,7 @@ static void hv_eject_device_work(struct* because hbus->pci_bus may not exist yet. */ wslot =wslot_to_devfn (hpdev->desc.win_slot.slot); - pdev =pci_get_domain_bus_and_slot (hpdev->hbus->sysdata.domain,0 , - wslot); + pdev =pci_get_domain_bus_and_slot (hbus->sysdata.domain,0 , wslot);if (pdev) {pci_lock_rescan_remove ();pci_stop_and_remove_bus_device (pdev);
@@ -1904,9 +1905,9 @@ static void hv_eject_device_work(structpci_unlock_rescan_remove (); } -spin_lock_irqsave (&hpdev->hbus->device_list_lock, flags); +spin_lock_irqsave (&hbus->device_list_lock, flags);list_del (&hpdev->list_entry); -spin_unlock_irqrestore (&hpdev->hbus->device_list_lock, flags); +spin_unlock_irqrestore (&hbus->device_list_lock, flags);if (hpdev->pci_slot)pci_destroy_slot (hpdev->pci_slot);
@@ -1915,7 +1916,7 @@ static void hv_eject_device_work(struct ejct_pkt = (struct pci_eject_response *)&ctxt.pkt.message; ejct_pkt->message_type.type =PCI_EJECTION_COMPLETE ; ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; -vmbus_sendpacket (hpdev->hbus->hdev->channel, ejct_pkt, +vmbus_sendpacket (hbus->hdev->channel, ejct_pkt,sizeof (*ejct_pkt), (unsigned long )&ctxt.pkt,VM_PKT_DATA_INBAND ,0 );
@@ -1924,7 +1925,9 @@ static void hv_eject_device_work(struct/* For the two refs got in new_pcichild_device() */ put_pcichild (hpdev);put_pcichild (hpdev); -put_hvpcibus (hpdev->hbus); +/* hpdev has been freed. Do not use it any more. */ + +put_hvpcibus (hbus); }/**
Greg Kroah-Hartman
maintainerPATCH 365/413 PCI: Do not poll for PME if the device is in D3cold
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
commit 000dd5316e1c756a1c028f22e01d06a38249dd4d upstream.
PME polling does not take into account that a device that is directly connected to the host bridge may go into D3cold as well. This leads to a situation where the PME poll thread reads from a config space of a device that is in D3cold and gets incorrect information because the config space is not accessible.
Here is an example from Intel Ice Lake system where two PCIe root ports are in D3cold (I've instrumented the kernel to log the PMCSR register contents):
[ 62.971442] pcieport 0000:00:07.1: Check PME status, PMCSR=0xffff [ 62.971504] pcieport 0000:00:07.0: Check PME status, PMCSR=0xffff
Since 0xffff is interpreted so that PME is pending, the root ports will be runtime resumed. This repeats over and over again essentially blocking all runtime power management.
Prevent this from happening by checking whether the device is in D3cold before its PME status is read.
--- drivers/pci/pci.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/pci.c +7 -0
@@ -2060,6 +2060,13 @@ static void pci_pme_list_scan(struct wor*/ if (bridge && bridge->current_state !=PCI_D0 )continue ; +/* +* If the device is in D3cold it should not be +* polled either. +*/ +if (pme_dev->dev->current_state == PCI_D3cold) +continue ; +pci_pme_wakeup (pme_dev->dev,NULL ); }else {list_del (&pme_dev->list);
Greg Kroah-Hartman
maintainerPATCH 366/413 PCI: qcom: Ensure that PERST is asserted for at least 100 ms
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
commit 64adde31c8e996a6db6f7a1a4131180e363aa9f2 upstream.
Currently, there is only a 1 ms sleep after asserting PERST.
Reading the datasheets for different endpoints, some require PERST to be asserted for 10 ms in order for the endpoint to perform a reset, others require it to be asserted for 50 ms.
Several SoCs using this driver uses PCIe Mini Card, where we don't know what endpoint will be plugged in.
The PCI Express Card Electromechanical Specification r2.0, section 2.2, "PERST# Signal" specifies:
"On power up, the deassertion of PERST# is delayed 100 ms (TPVPERL) from the power rails achieving specified operating limits."
Add a sleep of 100 ms before deasserting PERST, in order to ensure that we are compliant with the spec.
--- drivers/pci/controller/dwc/pcie-qcom.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
@@ -178,6 +178,8 @@ static void qcom_ep_reset_assert(structstatic void qcom_ep_reset_deassert (struct qcom_pcie *pcie) { +/* Ensure that PERST has been asserted for at least 100 ms */ +msleep (100 );gpiod_set_value_cansleep (pcie->reset,0 );usleep_range (PERST_DELAY_US ,PERST_DELAY_US +500 ); }
Greg Kroah-Hartman
maintainerPATCH 367/413 btrfs: correctly validate compression type
In reply to Greg Kroah-HartmanFrom: Johannes Thumshirn <[email protected]>
commit aa53e3bfac7205fb3a8815ac1c937fd6ed01b41e upstream.
Nikolay reported the following KASAN splat when running btrfs/048:
[ 1843.470920] ================================================================== [ 1843.471971] BUG: KASAN: slab-out-of-bounds in strncmp+0x66/0xb0 [ 1843.472775] Read of size 1 at addr ffff888111e369e2 by task btrfs/3979
[ 1843.473904] CPU: 3 PID: 3979 Comm: btrfs Not tainted 5.2.0-rc3-default #536 [ 1843.475009] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 1843.476322] Call Trace: [ 1843.476674] dump_stack+0x7c/0xbb [ 1843.477132] ? strncmp+0x66/0xb0 [ 1843.477587] print_address_description+0x114/0x320 [ 1843.478256] ? strncmp+0x66/0xb0 [ 1843.478740] ? strncmp+0x66/0xb0 [ 1843.479185] __kasan_report+0x14e/0x192 [ 1843.479759] ? strncmp+0x66/0xb0 [ 1843.480209] kasan_report+0xe/0x20 [ 1843.480679] strncmp+0x66/0xb0 [ 1843.481105] prop_compression_validate+0x24/0x70 [ 1843.481798] btrfs_xattr_handler_set_prop+0x65/0x160 [ 1843.482509] __vfs_setxattr+0x71/0x90 [ 1843.483012] __vfs_setxattr_noperm+0x84/0x130 [ 1843.483606] vfs_setxattr+0xac/0xb0 [ 1843.484085] setxattr+0x18c/0x230 [ 1843.484546] ? vfs_setxattr+0xb0/0xb0 [ 1843.485048] ? __mod_node_page_state+0x1f/0xa0 [ 1843.485672] ? _raw_spin_unlock+0x24/0x40 [ 1843.486233] ? __handle_mm_fault+0x988/0x1290 [ 1843.486823] ? lock_acquire+0xb4/0x1e0 [ 1843.487330] ? lock_acquire+0xb4/0x1e0 [ 1843.487842] ? mnt_want_write_file+0x3c/0x80 [ 1843.488442] ? debug_lockdep_rcu_enabled+0x22/0x40 [ 1843.489089] ? rcu_sync_lockdep_assert+0xe/0x70 [ 1843.489707] ? __sb_start_write+0x158/0x200 [ 1843.490278] ? mnt_want_write_file+0x3c/0x80 [ 1843.490855] ? __mnt_want_write+0x98/0xe0 [ 1843.491397] __x64_sys_fsetxattr+0xba/0xe0 [ 1843.492201] ? trace_hardirqs_off_thunk+0x1a/0x1c [ 1843.493201] do_syscall_64+0x6c/0x230 [ 1843.493988] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 1843.495041] RIP: 0033:0x7fa7a8a7707a [ 1843.495819] Code: 48 8b 0d 21 de 2b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 be 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d ee dd 2b 00 f7 d8 64 89 01 48 [ 1843.499203] RSP: 002b:00007ffcb73bca38 EFLAGS: 00000202 ORIG_RAX: 00000000000000be [ 1843.500210] RAX: ffffffffffffffda RBX: 00007ffcb73bda9d RCX: 00007fa7a8a7707a [ 1843.501170] RDX: 00007ffcb73bda9d RSI: 00000000006dc050 RDI: 0000000000000003 [ 1843.502152] RBP: 00000000006dc050 R08: 0000000000000000 R09: 0000000000000000 [ 1843.503109] R10: 0000000000000002 R11: 0000000000000202 R12: 00007ffcb73bda91 [ 1843.504055] R13: 0000000000000003 R14: 00007ffcb73bda82 R15: ffffffffffffffff
[ 1843.505268] Allocated by task 3979: [ 1843.505771] save_stack+0x19/0x80 [ 1843.506211] __kasan_kmalloc.constprop.5+0xa0/0xd0 [ 1843.506836] setxattr+0xeb/0x230 [ 1843.507264] __x64_sys_fsetxattr+0xba/0xe0 [ 1843.507886] do_syscall_64+0x6c/0x230 [ 1843.508429] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1843.509558] Freed by task 0: [ 1843.510188] (stack is not available)
[ 1843.511309] The buggy address belongs to the object at ffff888111e369e0
which belongs to the cache kmalloc-8 of size 8
[ 1843.514095] The buggy address is located 2 bytes inside of
8-byte region [ffff888111e369e0, ffff888111e369e8)
[ 1843.516524] The buggy address belongs to the page:
[ 1843.517561] page:ffff88813f478d80 refcount:1 mapcount:0 mapping:ffff88811940c300 index:0xffff888111e373b8 compound_mapcount: 0
[ 1843.519993] flags: 0x4404000010200(slab|head)
[ 1843.520951] raw: 0004404000010200 ffff88813f48b008 ffff888119403d50 ffff88811940c300
[ 1843.522616] raw: ffff888111e373b8 000000000016000f 00000001ffffffff 0000000000000000
[ 1843.524281] page dumped because: kasan: bad access detected[ 1843.525936] Memory state around the buggy address: [ 1843.526975] ffff888111e36880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 1843.528479] ffff888111e36900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 1843.530138] >ffff888111e36980: fc fc fc fc fc fc fc fc fc fc fc fc 02 fc fc fc [ 1843.531877] ^ [ 1843.533287] ffff888111e36a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 1843.534874] ffff888111e36a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 1843.536468] ==================================================================
This is caused by supplying a too short compression value ('lz') in the test-case and comparing it to 'lzo' with strncmp() and a length of 3. strncmp() read past the 'lz' when looking for the 'o' and thus caused an out-of-bounds read.
Introduce a new check 'btrfs_compress_is_valid_type()' which not only checks the user-supplied value against known compression types, but also employs checks for too short values.
--- fs/btrfs/compression.c | 16 ++++++++++++++++ fs/btrfs/compression.h | 1 + fs/btrfs/props.c | 6 +----- 3 files changed, 18 insertions(+), 5 deletions(-)
fs/btrfs/compression.c +16 -0
@@ -42,6 +42,22 @@ const char* btrfs_compress_type2str(enumreturn NULL ; } +bool btrfs_compress_is_valid_type (const char *str,size_t len) +{ +int i; + +for (i =1 ; i <ARRAY_SIZE (btrfs_compress_types); i++) { +size_t comp_len =strlen (btrfs_compress_types[i]); + +if (len < comp_len) +continue ; + +if (!strncmp (btrfs_compress_types[i], str, comp_len)) +return true; + } +return false; +} +static int btrfs_decompress_bio (struct compressed_bio *cb); static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
fs/btrfs/compression.h +1 -0
@@ -173,6 +173,7 @@ extern const struct btrfs_compress_op btextern const struct btrfs_compress_op btrfs_zstd_compress;const char *btrfs_compress_type2str (enum btrfs_compression_type type); +bool btrfs_compress_is_valid_type (const char *str,size_t len);int btrfs_compress_heuristic (struct inode *inode,u64 start,u64 end);
fs/btrfs/props.c +1 -5
@@ -257,11 +257,7 @@ static int prop_compression_validate(conif (!value)return 0 ; -if (!strncmp ("lzo" , value,3 )) -return 0 ; -else if (!strncmp ("zlib" , value,4 )) -return 0 ; -else if (!strncmp ("zstd" , value,4 )) +if (btrfs_compress_is_valid_type (value, len))return 0 ;return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 368/413 Btrfs: fix data loss after inode eviction, renaming it, and fsync it
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit d1d832a0b51dd9570429bb4b81b2a6c1759e681a upstream.
When we log an inode, regardless of logging it completely or only that it exists, we always update it as logged (logged_trans and last_log_commit fields of the inode are updated). This is generally fine and avoids future attempts to log it from having to do repeated work that brings no value.
However, if we write data to a file, then evict its inode after all the dealloc was flushed (and ordered extents completed), rename the file and fsync it, we end up not logging the new extents, since the rename may result in logging that the inode exists in case the parent directory was logged before. The following reproducer shows and explains how this can happen:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
$ mkdir /mnt/dir $ touch /mnt/dir/foo $ touch /mnt/dir/bar
# Do a direct IO write instead of a buffered write because with a
# buffered write we would need to make sure dealloc gets flushed and # complete before we do the inode eviction later, and we can not do that # from user space with call to things such as sync(2) since that results # in a transaction commit as well. $ xfs_io -d -c "pwrite -S 0xd3 0 4K" /mnt/dir/bar
# Keep the directory dir in use while we evict inodes. We want our file # bar's inode to be evicted but we don't want our directory's inode to
# be evicted (if it were evicted too, we would not be able to reproduce # the issue since the first fsync below, of file foo, would result in a # transaction commit. $ ( cd /mnt/dir; while true; do :; done ) & $ pid=$!
# Wait a bit to give time for the background process to chdir.
$ sleep 0.1
# Evict all inodes, except the inode for the directory dir because it is
# currently in use by our background process. $ echo 2 > /proc/sys/vm/drop_caches
# fsync file foo, which ends up persisting information about the parent # directory because it is a new inode. $ xfs_io -c fsync /mnt/dir/foo
# Rename bar, this results in logging that this inode exists (inode item, # names, xattrs) because the parent directory is in the log.
$ mv /mnt/dir/bar /mnt/dir/baz
# Now fsync baz, which ends up doing absolutely nothing because of the
# rename operation which logged that the inode exists only. $ xfs_io -c fsync /mnt/dir/baz
<power failure>
$ mount /dev/sdb /mnt $ od -t x1 -A d /mnt/dir/baz 0000000
--> Empty file, data we wrote is missing.
Fix this by not updating last_sub_trans of an inode when we are logging only that it exists and the inode was not yet logged since it was loaded from disk (full_sync bit set), this is enough to make btrfs_inode_in_log() return false for this scenario and make us log the inode. The logged_trans of the inode is still always setsince that alone is used to track if names need to be deleted as part of unlink operations.
--- fs/btrfs/tree-log.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +11 -1
@@ -5420,9 +5420,19 @@ log_extents: } } +/* +* Don't update last_log_commit if we logged that an inode exists after +* it was loaded to memory (full_sync bit set). +* This is to prevent data loss when we do a write to the inode, then +* the inode gets evicted after all delalloc was flushed, then we log +* it exists (due to a rename for example) and then fsync it. This last +* fsync would do nothing (not logging the extents previously written). +*/ spin_lock (&inode->lock); inode->logged_trans = trans->transid; - inode->last_log_commit = inode->last_sub_trans; +if (inode_only !=LOG_INODE_EXISTS || + !test_bit (BTRFS_INODE_NEEDS_FULL_SYNC , &inode->runtime_flags)) + inode->last_log_commit = inode->last_sub_trans;spin_unlock (&inode->lock); out_unlock:mutex_unlock (&inode->log_mutex);
Greg Kroah-Hartman
maintainerPATCH 369/413 Btrfs: fix fsync not persisting dentry deletions due to inode evictions
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 803f0f64d17769071d7287d9e3e3b79a3e1ae937 upstream.
In order to avoid searches on a log tree when unlinking an inode, we check if the inode being unlinked was logged in the current transaction, as well as the inode of its parent directory. When any of the inodes are logged, we proceed to delete directory items and inode reference items from the log, to ensure that if a subsequent fsync of only the inode being unlinked or only of the parent directory when the other is not fsync'ed as well, does not result in the entry still existing after a power failure.
That check however is not reliable when one of the inodes involved (the one being unlinked or its parent directory's inode) is evicted, since the logged_trans field is transient, that is, it is not stored on disk, so it is lost when the inode is evicted and loaded into memory again (which is set to zero on load). As a consequence the checks currently being done by btrfs_del_dir_entries_in_log() and btrfs_del_inode_ref_in_log() always return true if the inode was evicted before, regardless of the inode having been logged or not before (and in the current transaction), this results in the dentry being unlinked still existing after a log replay if after the unlink operation only one of the inodes involved is fsync'ed.
Example:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
$ mkdir /mnt/dir $ touch /mnt/dir/foo $ xfs_io -c fsync /mnt/dir/foo
# Keep an open file descriptor on our directory while we evict inodes. # We just want to evict the file's inode, the directory's inode must not
# be evicted. $ ( cd /mnt/dir; while true; do :; done ) & $ pid=$!
# Wait a bit to give time to background process to chdir to our test
# directory. $ sleep 0.5
# Trigger eviction of the file's inode.
$ echo 2 > /proc/sys/vm/drop_caches
# Unlink our file and fsync the parent directory. After a power failure
# we don't expect to see the file anymore, since we fsync'ed the parent # directory. $ rm -f $SCRATCH_MNT/dir/foo $ xfs_io -c fsync /mnt/dir
<power failure>
$ mount /dev/sdb /mnt $ ls /mnt/dir foo $ --> file still there, unlink not persisted despite explicit fsync on dir
Fix this by checking if the inode has the full_sync bit set in its runtime flags as well, since that bit is set everytime an inode is loaded from disk, or for other less common cases such as after a shrinking truncate or failure to allocate extent maps for holes, and gets cleared after the first fsync. Also consider the inode as possibly logged only if it was last modified in the current transaction (besides having the full_fsync flag set).
--- fs/btrfs/tree-log.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +26 -2
@@ -3323,6 +3323,30 @@ int btrfs_free_log_root_tree(struct btrf }/* +* Check if an inode was logged in the current transaction. We can't always rely +* on an inode's logged_trans value, because it's an in-memory only field and +* therefore not persisted. This means that its value is lost if the inode gets +* evicted and loaded again from disk (in which case it has a value of 0, and +* certainly it is smaller then any possible transaction ID), when that happens +* the full_sync flag is set in the inode's runtime flags, so on that case we +* assume eviction happened and ignore the logged_trans value, assuming the +* worst case, that the inode was logged before in the current transaction. +*/ +static bool inode_logged (struct btrfs_trans_handle *trans, +struct btrfs_inode *inode) +{ +if (inode->logged_trans == trans->transid) +return true; + +if (inode->last_trans == trans->transid && +test_bit (BTRFS_INODE_NEEDS_FULL_SYNC , &inode->runtime_flags) && + !test_bit (BTRFS_FS_LOG_RECOVERING , &trans->fs_info->flags)) +return true; + +return false; +} + +/* * If both a file and directory are logged, and unlinks or renames are * mixed in, we have a few interesting corners: *
@@ -3356,7 +3380,7 @@ int btrfs_del_dir_entries_in_log(structint bytes_del =0 ;u64 dir_ino =btrfs_ino (dir); -if (dir->logged_trans < trans->transid) +if (!inode_logged (trans, dir))return 0 ; ret =join_running_log_trans (root);
@@ -3460,7 +3484,7 @@ int btrfs_del_inode_ref_in_log(struct btu64 index;int ret; -if (inode->logged_trans < trans->transid) +if (!inode_logged (trans, inode))return 0 ; ret =join_running_log_trans (root);
Greg Kroah-Hartman
maintainerPATCH 370/413 Btrfs: add missing inode version, ctime and mtime updates when punching hole
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 179006688a7e888cbff39577189f2e034786d06a upstream.
If the range for which we are punching a hole covers only part of a page, we end up updating the inode item but we skip the update of the inode's iversion, mtime and ctime. Fix that by ensuring we update those properties of the inode.
A patch for fstests test case generic/059 that tests this as been sent along with this fix.
--- fs/btrfs/file.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/btrfs/file.c +5 -0
@@ -2721,6 +2721,11 @@ out_only_mutex:* for detecting, at fsync time, if the inode isn't yet in the * log tree or it's there but not up to date. */ +struct timespec64 now =current_time (inode); + +inode_inc_iversion (inode); + inode->i_mtime = now; + inode->i_ctime = now; trans =btrfs_start_transaction (root,1 );if (IS_ERR (trans)) { err =PTR_ERR (trans);
Greg Kroah-Hartman
maintainerPATCH 371/413 IB/mlx5: Report correctly tag matching rendezvous capability
In reply to Greg Kroah-HartmanFrom: Danit Goldberg <[email protected]>
commit 89705e92700170888236555fe91b45e4c1bb0985 upstream.
Userspace expects the IB_TM_CAP_RC bit to indicate that the device supports RC transport tag matching with rendezvous offload. However the firmware splits this into two capabilities for eager and rendezvous tag matching.
Only if the FW supports both modes should userspace be told the tag matching capability is available.
--- drivers/infiniband/hw/mlx5/main.c | 8 ++++++-- include/rdma/ib_verbs.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/main.c +6 -2
@@ -1043,15 +1043,19 @@ static int mlx5_ib_query_device(struct i }if (MLX5_CAP_GEN (mdev, tag_matching)) { - props->tm_caps.max_rndv_hdr_size =MLX5_TM_MAX_RNDV_MSG_SIZE ; props->tm_caps.max_num_tags = (1 <<MLX5_CAP_GEN (mdev, log_tag_matching_list_sz)) -1 ; - props->tm_caps.flags =IB_TM_CAP_RC ; props->tm_caps.max_ops =1 <<MLX5_CAP_GEN (mdev, log_max_qp_sz); props->tm_caps.max_sge =MLX5_TM_MAX_SGE ; } +if (MLX5_CAP_GEN (mdev, tag_matching) && +MLX5_CAP_GEN (mdev, rndv_offload_rc)) { + props->tm_caps.flags =IB_TM_CAP_RNDV_RC ; + props->tm_caps.max_rndv_hdr_size =MLX5_TM_MAX_RNDV_MSG_SIZE ; + } +if (MLX5_CAP_GEN (dev->mdev, cq_moderation)) { props->cq_caps.max_cq_moderation_count =MLX5_MAX_CQ_COUNT ;
include/rdma/ib_verbs.h +2 -2
@@ -327,8 +327,8 @@ struct ib_rss_caps { };enum ib_tm_cap_flags { -/* Support tag matching on RC transport */ -IB_TM_CAP_RC =1 <<0 , +/* Support tag matching with rendezvous offload for RC transport */ +IB_TM_CAP_RNDV_RC =1 <<0 , };struct ib_tm_caps {
Greg Kroah-Hartman
maintainerPATCH 372/413 HID: wacom: generic: only switch the mode on devices with LEDs
In reply to Greg Kroah-HartmanFrom: Aaron Armstrong Skomra <[email protected]>
commit d8e9806005f28bbb49899dab2068e3359e22ba35 upstream.
Currently, the driver will attempt to set the mode on all devices with a center button, but some devices with a center button lack LEDs, and attempting to set the LEDs on devices without LEDs results in the kernel error message of the form:
"leds input8::wacom-0.1: Setting an LED's brightness failed (-32)"
This is because the generic codepath erroneously assumes that the BUTTON_CENTER usage indicates that the device has LEDs, the previously ignored TOUCH_RING_SETTING usage is a more accurate indication of the existence of LEDs on the device.
--- drivers/hid/wacom_sys.c | 3 +++ drivers/hid/wacom_wac.c | 2 -- drivers/hid/wacom_wac.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/hid/wacom_sys.c +3 -0
@@ -304,6 +304,9 @@ static void wacom_feature_mapping(structwacom_hid_usage_quirk (hdev, field, usage);switch (equivalent_usage) { +case WACOM_HID_WD_TOUCH_RING_SETTING : + wacom->generic_has_leds = true; +break ;case HID_DG_CONTACTMAX :/* leave touch_max as is if predefined */ if (!features->touch_max) {
drivers/hid/wacom_wac.c +0 -2
@@ -1926,8 +1926,6 @@ static void wacom_wac_pad_usage_mapping( features->device_type |=WACOM_DEVICETYPE_PAD ;break ;case WACOM_HID_WD_BUTTONCENTER : - wacom->generic_has_leds = true; -/* fall through */ case WACOM_HID_WD_BUTTONHOME :case WACOM_HID_WD_BUTTONUP :case WACOM_HID_WD_BUTTONDOWN :
drivers/hid/wacom_wac.h +1 -0
@@ -141,6 +141,7 @@#define WACOM_HID_WD_OFFSETBOTTOM (WACOM_HID_UP_WACOMDIGITIZER | 0x0d33)#define WACOM_HID_WD_DATAMODE (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)#define WACOM_HID_WD_DIGITIZERINFO (WACOM_HID_UP_WACOMDIGITIZER | 0x1013) +#define WACOM_HID_WD_TOUCH_RING_SETTING (WACOM_HID_UP_WACOMDIGITIZER | 0x1032)#define WACOM_HID_UP_G9 0xff090000#define WACOM_HID_G9_PEN (WACOM_HID_UP_G9 | 0x02)#define WACOM_HID_G9_TOUCHSCREEN (WACOM_HID_UP_G9 | 0x11)
Greg Kroah-Hartman
maintainerPATCH 373/413 HID: wacom: generic: Correct pad syncing
In reply to Greg Kroah-HartmanFrom: Aaron Armstrong Skomra <[email protected]>
commit d4b8efeb46d99a5d02e7f88ac4eaccbe49370770 upstream.
Only sync the pad once per report, not once per collection. Also avoid syncing the pad on battery reports.
--- drivers/hid/wacom_wac.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/hid/wacom_wac.c +8 -7
@@ -2117,14 +2117,12 @@ static void wacom_wac_pad_report(structbool active = wacom_wac->hid_data.inrange_state !=0 ;/* report prox for expresskey events */ -if ((wacom_equivalent_usage (field->physical) ==HID_DG_TABLETFUNCTIONKEY ) && - wacom_wac->hid_data.pad_input_event_flag) { +if (wacom_wac->hid_data.pad_input_event_flag) {input_event (input,EV_ABS ,ABS_MISC , active ?PAD_DEVICE_ID :0 );input_sync (input);if (!active) wacom_wac->hid_data.pad_input_event_flag = false; } - } static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
@@ -2700,9 +2698,7 @@ static int wacom_wac_collection(struct hif (report->type !=HID_INPUT_REPORT )return -1 ; -if (WACOM_PAD_FIELD (field) && wacom->wacom_wac.pad_input) -wacom_wac_pad_report (hdev, report, field); -else if (WACOM_PEN_FIELD (field) && wacom->wacom_wac.pen_input) +if (WACOM_PEN_FIELD (field) && wacom->wacom_wac.pen_input)wacom_wac_pen_report (hdev, report);else if (WACOM_FINGER_FIELD (field) && wacom->wacom_wac.touch_input)wacom_wac_finger_report (hdev, report);
@@ -2716,7 +2712,7 @@ void wacom_wac_report(struct hid_devicestruct wacom_wac *wacom_wac = &wacom->wacom_wac;struct hid_field *field;bool pad_in_hid_field = false, pen_in_hid_field = false, - finger_in_hid_field = false; + finger_in_hid_field = false, true_pad = false;int r;int prev_collection =-1 ;
@@ -2732,6 +2728,8 @@ void wacom_wac_report(struct hid_device pen_in_hid_field = true;if (WACOM_FINGER_FIELD (field)) finger_in_hid_field = true; +if (wacom_equivalent_usage (field->physical) ==HID_DG_TABLETFUNCTIONKEY ) + true_pad = true; }wacom_wac_battery_pre_report (hdev, report);
@@ -2755,6 +2753,9 @@ void wacom_wac_report(struct hid_device }wacom_wac_battery_report (hdev, report); + +if (true_pad && wacom->wacom_wac.pad_input) +wacom_wac_pad_report (hdev, report, field); }static int wacom_bpt_touch (struct wacom_wac *wacom)
Greg Kroah-Hartman
maintainerPATCH 374/413 HID: wacom: correct touch resolution x/y typo
In reply to Greg Kroah-HartmanFrom: Aaron Armstrong Skomra <[email protected]>
commit 68c20cc2164cc5c7c73f8012ae6491afdb1f7f72 upstream.
This affects the 2nd-gen Intuos Pro Medium and Large when using their Bluetooth connection.
--- drivers/hid/wacom_wac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_wac.c +1 -1
@@ -3712,7 +3712,7 @@ int wacom_setup_touch_input_capabilities 0, 5920, 4, 0); }input_abs_set_res (input_dev,ABS_MT_POSITION_X ,40 ); -input_abs_set_res (input_dev,ABS_MT_POSITION_X ,40 ); +input_abs_set_res (input_dev,ABS_MT_POSITION_Y ,40 );/* fall through */
Greg Kroah-Hartman
maintainerPATCH 375/413 mm: vmscan: scan anonymous pages on file refaults
In reply to Greg Kroah-HartmanFrom: Kuo-Hsin Yang <[email protected]>
commit 2c012a4ad1a2cd3fb5a0f9307b9d219f84eda1fa upstream.
When file refaults are detected and there are many inactive file pages, the system never reclaim anonymous pages, the file pages are dropped aggressively when there are still a lot of cold anonymous pages and system thrashes. This issue impacts the performance of applications with large executable, e.g. chrome.
With this patch, when file refault is detected, inactive_list_is_low() always returns true for file pages in get_scan_count() to enable scanning anonymous pages.
The problem can be reproduced by the following test program.
---8<---
void fallocate_file(const char *filename, off_t size)
{
struct stat st;
int fd;
if (!stat(filename, &st) && st.st_size >= size)
return;
fd = open(filename, O_WRONLY | O_CREAT, 0600);
if (fd < 0) {
perror("create file");
exit(1);
}
if (posix_fallocate(fd, 0, size)) {
perror("fallocate");
exit(1);
}
close(fd);
}long *alloc_anon(long size)
{
long *start = malloc(size);
memset(start, 1, size);
return start;
}long access_file(const char *filename, long size, long rounds)
{
int fd, i;
volatile char *start1, *end1, *start2;
const int page_size = getpagesize();
long sum = 0;
fd = open(filename, O_RDONLY);
if (fd == -1) {
perror("open");
exit(1);
}
/*
* Some applications, e.g. chrome, use a lot of executable file
* pages, map some of the pages with PROT_EXEC flag to simulate
* the behavior.
*/
start1 = mmap(NULL, size / 2, PROT_READ | PROT_EXEC, MAP_SHARED,
fd, 0);
if (start1 == MAP_FAILED) {
perror("mmap");
exit(1);
}
end1 = start1 + size / 2;
start2 = mmap(NULL, size / 2, PROT_READ, MAP_SHARED, fd, size / 2);
if (start2 == MAP_FAILED) {
perror("mmap");
exit(1);
}
for (i = 0; i < rounds; ++i) {
struct timeval before, after;
volatile char *ptr1 = start1, *ptr2 = start2;
gettimeofday(&before, NULL);
for (; ptr1 < end1; ptr1 += page_size, ptr2 += page_size)
sum += *ptr1 + *ptr2;
gettimeofday(&after, NULL);
printf("File access time, round %d: %f (sec)
", i,
(after.tv_sec - before.tv_sec) +
(after.tv_usec - before.tv_usec) / 1000000.0);
}
return sum;
}int main(int argc, char *argv[])
{
const long MB = 1024 * 1024;
long anon_mb, file_mb, file_rounds;
const char filename[] = "large";
long *ret1;
long ret2;
if (argc != 4) {
printf("usage: thrash ANON_MB FILE_MB FILE_ROUNDS
");
exit(0);
}
anon_mb = atoi(argv[1]);
file_mb = atoi(argv[2]);
file_rounds = atoi(argv[3]);
fallocate_file(filename, file_mb * MB);
printf("Allocate %ld MB anonymous pages
", anon_mb);
ret1 = alloc_anon(anon_mb * MB);
printf("Access %ld MB file pages
", file_mb);
ret2 = access_file(filename, file_mb * MB, file_rounds);
printf("Print result to prevent optimization: %ld
",
*ret1 + ret2);
return 0;
}---8<---
Running the test program on 2GB RAM VM with kernel 5.2.0-rc5, the program fills ram with 2048 MB memory, access a 200 MB file for 10 times. Without this patch, the file cache is dropped aggresively and every access to the file is from disk.
$ ./thrash 2048 200 10 Allocate 2048 MB anonymous pages Access 200 MB file pages File access time, round 0: 2.489316 (sec) File access time, round 1: 2.581277 (sec) File access time, round 2: 2.487624 (sec) File access time, round 3: 2.449100 (sec) File access time, round 4: 2.420423 (sec) File access time, round 5: 2.343411 (sec) File access time, round 6: 2.454833 (sec) File access time, round 7: 2.483398 (sec) File access time, round 8: 2.572701 (sec) File access time, round 9: 2.493014 (sec)
With this patch, these file pages can be cached.
$ ./thrash 2048 200 10 Allocate 2048 MB anonymous pages Access 200 MB file pages File access time, round 0: 2.475189 (sec) File access time, round 1: 2.440777 (sec) File access time, round 2: 2.411671 (sec) File access time, round 3: 1.955267 (sec) File access time, round 4: 0.029924 (sec) File access time, round 5: 0.000808 (sec) File access time, round 6: 0.000771 (sec) File access time, round 7: 0.000746 (sec) File access time, round 8: 0.000738 (sec) File access time, round 9: 0.000747 (sec)
Checked the swap out stats during the test [1], 19006 pages swapped out with this patch, 3418 pages swapped out without this patch. There are more swap out, but I think it's within reasonable range when file backed data set doesn't fit into the memory.
$ ./thrash 2000 100 2100 5 1 # ANON_MB FILE_EXEC FILE_NOEXEC ROUNDS PROCESSES Allocate 2000 MB anonymous pages active_anon: 1613644, inactive_anon: 348656, active_file: 892, inactive_file: 1384 (kB) pswpout: 7972443, pgpgin: 478615246 Access 100 MB executable file pages Access 2100 MB regular file pages File access time, round 0: 12.165, (sec) active_anon: 1433788, inactive_anon: 478116, active_file: 17896, inactive_file: 24328 (kB) File access time, round 1: 11.493, (sec) active_anon: 1430576, inactive_anon: 477144, active_file: 25440, inactive_file: 26172 (kB) File access time, round 2: 11.455, (sec) active_anon: 1427436, inactive_anon: 476060, active_file: 21112, inactive_file: 28808 (kB) File access time, round 3: 11.454, (sec) active_anon: 1420444, inactive_anon: 473632, active_file: 23216, inactive_file: 35036 (kB) File access time, round 4: 11.479, (sec) active_anon: 1413964, inactive_anon: 471460, active_file: 31728, inactive_file: 32224 (kB) pswpout: 7991449 (+ 19006), pgpgin: 489924366 (+ 11309120)
With 4 processes accessing non-overlapping parts of a large file, 30316 pages swapped out with this patch, 5152 pages swapped out without this patch. The swapout number is small comparing to pgpgin.
[1]: https://github.com/vovo/testing/blob/master/mem_thrash.c
--- mm/vmscan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/vmscan.c +3 -3
@@ -2125,7 +2125,7 @@ static void shrink_active_list(unsigned* 10TB 320 32GB */ static bool inactive_list_is_low (struct lruvec *lruvec,bool file, -struct scan_control *sc,bool actual_reclaim) +struct scan_control *sc,bool trace) {enum lru_list active_lru = file *LRU_FILE +LRU_ACTIVE ;struct pglist_data *pgdat =lruvec_pgdat (lruvec);
@@ -2151,7 +2151,7 @@ static bool inactive_list_is_low(struct* rid of the stale workingset quickly. */ refaults =lruvec_page_state_local (lruvec,WORKINGSET_ACTIVATE ); -if (file && actual_reclaim && lruvec->refaults != refaults) { +if (file && lruvec->refaults != refaults) { inactive_ratio =0 ; }else { gb = (inactive + active) >> (30 -PAGE_SHIFT );
@@ -2161,7 +2161,7 @@ static bool inactive_list_is_low(struct inactive_ratio =1 ; } -if (actual_reclaim) +if (trace) trace_mm_vmscan_inactive_list_is_low(pgdat->node_id, sc->reclaim_idx, lruvec_lru_size(lruvec, inactive_lru, MAX_NR_ZONES), inactive, lruvec_lru_size(lruvec, active_lru, MAX_NR_ZONES), active,
Greg Kroah-Hartman
maintainerPATCH 376/413 mm/nvdimm: add is_ioremap_addr and use that to check ioremap address
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
commit 9bd3bb6703d8c0a5fb8aec8e3287bd55b7341dcd upstream.
Architectures like powerpc use different address range to map ioremap and vmalloc range. The memunmap() check used by the nvdimm layer was wrongly using is_vmalloc_addr() to check for ioremap range which fails for ppc64. This result in ppc64 not freeing the ioremap mapping. The side effect of this is an unbind failure during module unload with papr_scm nvdimm driver
--- arch/powerpc/include/asm/pgtable.h | 14 ++++++++++++++ include/linux/mm.h | 5 +++++ kernel/iomem.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/pgtable.h +14 -0
@@ -140,6 +140,20 @@ static inline void pte_frag_set(mm_conte }#endif +#ifdef CONFIG_PPC64 +#define is_ioremap_addr is_ioremap_addr +static inline bool is_ioremap_addr (const void *x) +{ +#ifdef CONFIG_MMU +unsigned long addr = (unsigned long )x; + +return addr >=IOREMAP_BASE && addr <IOREMAP_END ; +#else +return false; +#endif +} +#endif /* CONFIG_PPC64 */ +#endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_PGTABLE_H */
include/linux/mm.h +5 -0
@@ -633,6 +633,11 @@ static inline bool is_vmalloc_addr(constreturn false;#endif } + +#ifndef is_ioremap_addr +#define is_ioremap_addr (x) is_vmalloc_addr(x) +#endif +#ifdef CONFIG_MMU extern int is_vmalloc_or_module_addr (const void *x);#else
kernel/iomem.c +1 -1
@@ -121,7 +121,7 @@ EXPORT_SYMBOL(memremap);void memunmap (void *addr) { -if (is_vmalloc_addr (addr)) +if (is_ioremap_addr (addr))iounmap ((void __iomem *) addr); }EXPORT_SYMBOL (memunmap);
Greg Kroah-Hartman
maintainerPATCH 377/413 libnvdimm/pfn: fix fsdax-mode namespace info-block zero-fields
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit 7e3e888dfc138089f4c15a81b418e88f0978f744 upstream.
At namespace creation time there is the potential for the "expected to be zero" fields of a 'pfn' info-block to be filled with indeterminate data. While the kernel buffer is zeroed on allocation it is immediately overwritten by nd_pfn_validate() filling it with the current contents of the on-media info-block location. For fields like, 'flags' and the 'padding' it potentially means that future implementations can not rely on those fields being zero.
In preparation to stop using the 'start_pad' and 'end_trunc' fields for section alignment, arrange for fields that are not explicitly initialized to be guaranteed zero. Bump the minor version to indicate it is safe to assume the 'padding' and 'flags' are zero. Otherwise, this corruption is expected to benign since all other critical fields are explicitly initialized.
Note The cc: stable is about spreading this new policy to as many kernels as possible not fixing an issue in those kernels. It is not until the change titled "libnvdimm/pfn: Stop padding pmem namespaces to section alignment" where this improper initialization becomes a problem. So if someone decides to backport "libnvdimm/pfn: Stop padding pmem namespaces to section alignment" (which is not tagged for stable), make sure this pre-requisite is flagged.
--- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/pfn.h | 1 + drivers/nvdimm/pfn_devs.c | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/nvdimm/dax_devs.c +1 -1
@@ -118,7 +118,7 @@ int nd_dax_probe(struct device *dev, strnvdimm_bus_unlock (&ndns->dev);if (!dax_dev)return -ENOMEM ; - pfn_sb =devm_kzalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); + pfn_sb =devm_kmalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); nd_pfn->pfn_sb = pfn_sb; rc =nd_pfn_validate (nd_pfn,DAX_SIG );dev_dbg (dev,"dax: %s\n" , rc ==0 ?dev_name (dax_dev) :"<none>" );
drivers/nvdimm/pfn.h +1 -0
@@ -28,6 +28,7 @@ struct nd_pfn_sb {__le32 end_trunc;/* minor-version-2 record the base alignment of the mapping */ __le32 align; +/* minor-version-3 guarantee the padding and flags are zero */ u8 padding[4000 ];__le64 checksum; };
drivers/nvdimm/pfn_devs.c +15 -3
@@ -412,6 +412,15 @@ static int nd_pfn_clear_memmap_errors(streturn 0 ; } +/** +* nd_pfn_validate - read and validate info-block +* @nd_pfn: fsdax namespace runtime state / properties +* @sig: 'devdax' or 'fsdax' signature +* +* Upon return the info-block buffer contents (->pfn_sb) are +* indeterminate when validation fails, and a coherent info-block +* otherwise. +*/ int nd_pfn_validate (struct nd_pfn *nd_pfn,const char *sig) {u64 checksum, offset;
@@ -557,7 +566,7 @@ int nd_pfn_probe(struct device *dev, strnvdimm_bus_unlock (&ndns->dev);if (!pfn_dev)return -ENOMEM ; - pfn_sb =devm_kzalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); + pfn_sb =devm_kmalloc (dev,sizeof (*pfn_sb),GFP_KERNEL ); nd_pfn =to_nd_pfn (pfn_dev); nd_pfn->pfn_sb = pfn_sb; rc =nd_pfn_validate (nd_pfn,PFN_SIG );
@@ -694,7 +703,7 @@ static int nd_pfn_init(struct nd_pfn *ndu64 checksum;int rc; - pfn_sb =devm_kzalloc (&nd_pfn->dev,sizeof (*pfn_sb),GFP_KERNEL ); + pfn_sb =devm_kmalloc (&nd_pfn->dev,sizeof (*pfn_sb),GFP_KERNEL );if (!pfn_sb)return -ENOMEM ;
@@ -703,11 +712,14 @@ static int nd_pfn_init(struct nd_pfn *nd sig =DAX_SIG ; else sig =PFN_SIG ; + rc =nd_pfn_validate (nd_pfn, sig);if (rc != -ENODEV )return rc;/* no info block, do init */ ; +memset (pfn_sb,0 ,sizeof (*pfn_sb)); + nd_region =to_nd_region (nd_pfn->dev.parent);if (nd_region->ro) { dev_info(&nd_pfn->dev,
@@ -760,7 +772,7 @@ static int nd_pfn_init(struct nd_pfn *ndmemcpy (pfn_sb->uuid, nd_pfn->uuid,16 );memcpy (pfn_sb->parent_uuid,nd_dev_to_uuid (&ndns->dev),16 ); pfn_sb->version_major =cpu_to_le16 (1 ); - pfn_sb->version_minor =cpu_to_le16 (2 ); + pfn_sb->version_minor =cpu_to_le16 (3 ); pfn_sb->start_pad =cpu_to_le32 (start_pad); pfn_sb->end_trunc =cpu_to_le32 (end_trunc); pfn_sb->align =cpu_to_le32 (nd_pfn->align);
Greg Kroah-Hartman
maintainerPATCH 378/413 mm/memcontrol: fix wrong statistics in memory.stat
In reply to Greg Kroah-HartmanFrom: Yafang Shao <[email protected]>
commit dd9239900e12db84c198855b262ae7796db1123b upstream.
When we calculate total statistics for memcg1_stats and memcg1_events, we use the the index 'i' in the for loop as the events index. Actually we should use memcg1_stats[i] and memcg1_events[i] as the events index.
--- mm/memcontrol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/memcontrol.c +3 -2
@@ -3530,12 +3530,13 @@ static int memcg_stat_show(struct seq_fiif (memcg1_stats[i] ==MEMCG_SWAP && !do_memsw_account ())continue ;seq_printf (m,"total_%s %llu\n" , memcg1_stat_names[i], - (u64 )memcg_page_state (memcg, i) *PAGE_SIZE ); + (u64 )memcg_page_state (memcg, memcg1_stats[i]) * +PAGE_SIZE ); }for (i =0 ; i <ARRAY_SIZE (memcg1_events); i++)seq_printf (m,"total_%s %llu\n" , memcg1_event_names[i], - (u64 )memcg_events (memcg, i)); + (u64 )memcg_events (memcg, memcg1_events[i]));for (i =0 ; i <NR_LRU_LISTS ; i++) seq_printf(m, "total_%s %llu\n", mem_cgroup_lru_names[i],
Greg Kroah-Hartman
maintainerPATCH 379/413 mm/z3fold.c: lock z3fold page before __SetPageMovable()
In reply to Greg Kroah-HartmanFrom: Henry Burns <[email protected]>
commit 810481a246089117d98e3373a3cb735c3efc1f90 upstream.
Following zsmalloc.c's example we call trylock_page() and unlock_page(). Also make z3fold_page_migrate() assert that newpage is passed in locked, as per the documentation.
--- mm/z3fold.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
mm/z3fold.c +11 -1
@@ -924,7 +924,16 @@ retry:set_bit (PAGE_HEADLESS , &page->private); goto headless; } -__SetPageMovable (page, pool->inode->i_mapping); +if (can_sleep) { +lock_page (page); +__SetPageMovable (page, pool->inode->i_mapping); +unlock_page (page); + }else { +if (trylock_page (page)) { +__SetPageMovable (page, pool->inode->i_mapping); +unlock_page (page); + } + }z3fold_page_lock (zhdr); found:
@@ -1331,6 +1340,7 @@ static int z3fold_page_migrate(struct adVM_BUG_ON_PAGE (!PageMovable (page), page);VM_BUG_ON_PAGE (!PageIsolated (page), page); +VM_BUG_ON_PAGE (!PageLocked (newpage), newpage); zhdr =page_address (page); pool =zhdr_to_pool (zhdr);
Greg Kroah-Hartman
maintainerPATCH 380/413 coda: pass the host file in vma->vm_file on mmap
In reply to Greg Kroah-HartmanFrom: Jan Harkes <[email protected]>
commit 7fa0a1da3dadfd9216df7745a1331fdaa0940d1c upstream.
Patch series "Coda updates".
The following patch series is a collection of various fixes for Coda, most of which were collected from linux-fsdevel or linux-kernel but which have as yet not found their way upstream.
This patch (of 22):
Various file systems expect that vma->vm_file points at their own file handle, several use file_inode(vma->vm_file) to get at their inode or use vma->vm_file->private_data. However the way Coda wrapped mmap on a host file broke this assumption, vm_file was still pointing at the Coda file and the host file systems would scribble over Coda's inode and private file data.
This patch fixes the incorrect expectation and wraps vm_ops->open and vm_ops->close to allow Coda to track when the vm_area_struct is destroyed so we still release the reference on the Coda file handle at the right time.
--- fs/coda/file.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-)
fs/coda/file.c +68 -2
@@ -27,6 +27,13 @@#include "coda_linux.h" #include "coda_int.h" +struct coda_vm_ops { +atomic_t refcnt; +struct file *coda_file; +const struct vm_operations_struct *host_vm_ops; +struct vm_operations_struct vm_ops; +}; +static ssize_t coda_file_read_iter (struct kiocb *iocb,struct iov_iter *to) {
@@ -61,6 +68,34 @@ coda_file_write_iter(struct kiocb *iocb,return ret; } +static void +coda_vm_open (struct vm_area_struct *vma) +{ +struct coda_vm_ops *cvm_ops = + container_of(vma->vm_ops, struct coda_vm_ops, vm_ops); + +atomic_inc (&cvm_ops->refcnt); + +if (cvm_ops->host_vm_ops && cvm_ops->host_vm_ops->open) + cvm_ops->host_vm_ops->open (vma); +} + +static void +coda_vm_close (struct vm_area_struct *vma) +{ +struct coda_vm_ops *cvm_ops = + container_of(vma->vm_ops, struct coda_vm_ops, vm_ops); + +if (cvm_ops->host_vm_ops && cvm_ops->host_vm_ops->close) + cvm_ops->host_vm_ops->close (vma); + +if (atomic_dec_and_test (&cvm_ops->refcnt)) { + vma->vm_ops = cvm_ops->host_vm_ops; +fput (cvm_ops->coda_file); +kfree (cvm_ops); + } +} +static int coda_file_mmap (struct file *coda_file,struct vm_area_struct *vma) {
@@ -68,6 +103,8 @@ coda_file_mmap(struct file *coda_file, sstruct coda_inode_info *cii;struct file *host_file;struct inode *coda_inode, *host_inode; +struct coda_vm_ops *cvm_ops; +int ret; cfi =CODA_FTOC (coda_file);BUG_ON (!cfi || cfi->cfi_magic !=CODA_MAGIC );
@@ -76,6 +113,13 @@ coda_file_mmap(struct file *coda_file, sif (!host_file->f_op->mmap)return -ENODEV ; +if (WARN_ON (coda_file != vma->vm_file)) +return -EIO ; + + cvm_ops =kmalloc (sizeof (struct coda_vm_ops ),GFP_KERNEL ); +if (!cvm_ops) +return -ENOMEM ; + coda_inode =file_inode (coda_file); host_inode =file_inode (host_file);
@@ -89,6 +133,7 @@ coda_file_mmap(struct file *coda_file, s* the container file on us! */ else if (coda_inode->i_mapping != host_inode->i_mapping) {spin_unlock (&cii->c_lock); +kfree (cvm_ops);return -EBUSY ; }
@@ -97,7 +142,29 @@ coda_file_mmap(struct file *coda_file, s cfi->cfi_mapcount++;spin_unlock (&cii->c_lock); -return call_mmap (host_file, vma); + vma->vm_file =get_file (host_file); + ret =call_mmap (vma->vm_file, vma); + +if (ret) { +/* if call_mmap fails, our caller will put coda_file so we +* should drop the reference to the host_file that we got. +*/ +fput (host_file); +kfree (cvm_ops); + }else { +/* here we add redirects for the open/close vm_operations */ + cvm_ops->host_vm_ops = vma->vm_ops; +if (vma->vm_ops) + cvm_ops->vm_ops = *vma->vm_ops; + + cvm_ops->vm_ops.open = coda_vm_open; + cvm_ops->vm_ops.close = coda_vm_close; + cvm_ops->coda_file = coda_file; +atomic_set (&cvm_ops->refcnt,1 ); + + vma->vm_ops = &cvm_ops->vm_ops; + } +return ret; }int coda_open (struct inode *coda_inode,struct file *coda_file)
@@ -207,4 +274,3 @@ const struct file_operations coda_file_o .fsync = coda_fsync, .splice_read = generic_file_splice_read, }; -
Greg Kroah-Hartman
maintainerPATCH 381/413 include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures
In reply to Greg Kroah-HartmanFrom: Drew Davenport <[email protected]>
commit 6b15f678fb7d5ef54e089e6ace72f007fe6e9895 upstream.
For architectures using __WARN_TAINT, the WARN_ON macro did not print out the "cut here" string. The other WARN_XXX macros would print "cut here" inside __warn_printk, which is not called for WARN_ON since it doesn't have a message to print.
--- include/asm-generic/bug.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/asm-generic/bug.h +4 -2
@@ -104,8 +104,10 @@ extern void warn_slowpath_null(const cha warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)#else extern __printf(1, 2) void __warn_printk(const char *fmt, ...); -#define __WARN () __WARN_TAINT(TAINT_WARN) -#define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0) +#define __WARN () do { \ + printk(KERN_WARNING CUT_HERE); __WARN_TAINT(TAINT_WARN); \ +} while (0) +#define __WARN_printf(arg...) __WARN_printf_taint(TAINT_WARN, arg) #define __WARN_printf_taint(taint, arg...) \ do { __warn_printk(arg); __WARN_TAINT(taint); } while (0)#endif
Greg Kroah-Hartman
maintainerPATCH 382/413 resource: fix locking in find_next_iomem_res()
In reply to Greg Kroah-HartmanFrom: Nadav Amit <[email protected]>
commit 49f17c26c123b60fd1c74629eef077740d16ffc2 upstream.
Since resources can be removed, locking should ensure that the resource is not removed while accessing it. However, find_next_iomem_res() does not hold the lock while copying the data of the resource.
Keep holding the lock while the data is copied. While at it, change the return value to a more informative value. It is disregarded by the callers.
--- kernel/resource.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
kernel/resource.c +10 -10
@@ -326,7 +326,7 @@ EXPORT_SYMBOL(release_resource);* * If a resource is found, returns 0 and @*res is overwritten with the part * of the resource that's within [@start..@end]; if none is found, returns -* -1 or -EINVAL for other invalid parameters. +* -ENODEV. Returns -EINVAL for invalid parameters. * * This function walks the whole tree and not just first level children * unless @first_lvl is true.
@@ -365,16 +365,16 @@ static int find_next_iomem_res(resource_break ; } -read_unlock (&resource_lock); -if (!p) -return -1 ; +if (p) { +/* copy data */ + res->start =max (start, p->start); + res->end =min (end, p->end); + res->flags = p->flags; + res->desc = p->desc; + } -/* copy data */ - res->start =max (start, p->start); - res->end =min (end, p->end); - res->flags = p->flags; - res->desc = p->desc; -return 0 ; +read_unlock (&resource_lock); +return p ?0 : -ENODEV ; } static int __walk_iomem_res_desc(resource_size_t start, resource_size_t end,
Greg Kroah-Hartman
maintainerPATCH 383/413 gpu: ipu-v3: ipu-ic: Fix saturation bit offset in TPMEM
In reply to Greg Kroah-HartmanFrom: Steve Longerbeam <[email protected]>
commit 3d1f62c686acdedf5ed9642b763f3808d6a47d1e upstream.
The saturation bit was being set at bit 9 in the second 32-bit word of the TPMEM CSC. This isn't correct, the saturation bit is bit 42, which is bit 10 of the second word.
--- drivers/gpu/ipu-v3/ipu-ic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/ipu-v3/ipu-ic.c +1 -1
@@ -251,7 +251,7 @@ static int init_csc(struct ipu_ic *ic,writel (param, base++); param = ((a[0 ] &0x1fe0 ) >>5 ) | (params->scale <<8 ) | - (params->sat <<9 ); + (params->sat <<10 );writel (param, base++); param = ((a[1] & 0x1f) << 27) | ((c[0][1] & 0x1ff) << 18) |
Greg Kroah-Hartman
maintainerPATCH 384/413 parisc: Ensure userspace privilege for ptraced processes in regset functions
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 34c32fc603311a72cb558e5e337555434f64c27b upstream.
On parisc the privilege level of a process is stored in the lowest two bits of the instruction pointers (IAOQ0 and IAOQ1). On Linux we use privilege level 0 for the kernel and privilege level 3 for user-space. So userspace should not be allowed to modify IAOQ0 or IAOQ1 of a ptraced process to change it's privilege level to e.g. 0 to try to gain kernel privileges.
This patch prevents such modifications in the regset support functions by always setting the two lowest bits to one (which relates to privilege level 3 for user-space) if IAOQ0 or IAOQ1 are modified via ptrace regset calls.
--- arch/parisc/kernel/ptrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/kernel/ptrace.c +2 -1
@@ -496,7 +496,8 @@ static void set_reg(struct pt_regs *regsreturn ;case RI (iaoq[0 ]):case RI (iaoq[1 ]): - regs->iaoq[num -RI (iaoq[0 ])] = val; +/* set 2 lowest bits to ensure userspace privilege: */ + regs->iaoq[num -RI (iaoq[0 ])] = val |3 ;return ;case RI (sar): regs->sar = val;return ;
Greg Kroah-Hartman
maintainerPATCH 385/413 parisc: Avoid kernel panic triggered by invalid kprobe
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 59a783dbc0d5fd6792aabff933055373b6dcbf2a upstream.
When running gdb I was able to trigger this kernel panic:
Kernel Fault: Code=26 (Data memory access rights trap) at addr 0000000000000060
CPU: 0 PID: 1401 Comm: gdb-crash Not tainted 5.2.0-rc7-64bit+ #1053
YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00001000000001000000000000001111 Not tainted
r00-03 000000000804000f 0000000040dee1a0 0000000040c78cf0 00000000b8d50160 r04-07 0000000040d2b1a0 000000004360a098 00000000bbbe87b8 0000000000000003 r08-11 00000000fac20a70 00000000fac24160 00000000fac1bbe0 0000000000000000 r12-15 00000000fabfb79a 00000000fac244a4 0000000000010000 0000000000000001 r16-19 00000000bbbe87b8 00000000f8f02910 0000000000010034 0000000000000000 r20-23 00000000fac24630 00000000fac24630 000000006474e552 00000000fac1aa52 r24-27 0000000000000028 00000000bbbe87b8 00000000bbbe87b8 0000000040d2b1a0 r28-31 0000000000000000 00000000b8d501c0 00000000b8d501f0 0000000003424000
sr00-03 0000000000423000 0000000000000000 0000000000000000 0000000000423000 sr04-07 0000000000000000 0000000000000000 0000000000000000 0000000000000000
IASQ: 0000000000000000 0000000000000000 IAOQ: 0000000040c78cf0 0000000040c78cf4
IIR: 539f00c0 ISR: 0000000000000000 IOR: 0000000000000060
CPU: 0 CR30: 00000000b8d50000 CR31: 00000000d22345e2
ORIG_R28: 0000000040250798
IAOQ[0]: parisc_kprobe_ss_handler+0x58/0x170
IAOQ[1]: parisc_kprobe_ss_handler+0x5c/0x170
RP(r2): parisc_kprobe_ss_handler+0x58/0x170
Backtrace: [<0000000040206ff8>] handle_interruption+0x178/0xbb8 Kernel panic - not syncing: Kernel Fault
Avoid this panic by checking the return value of kprobe_running() and skip kprobe if none is currently active.
--- arch/parisc/kernel/kprobes.c | 3 +++ 1 file changed, 3 insertions(+)
arch/parisc/kernel/kprobes.c +3 -0
@@ -133,6 +133,9 @@ int __kprobes parisc_kprobe_ss_handler(sstruct kprobe_ctlblk *kcb =get_kprobe_ctlblk ();struct kprobe *p =kprobe_running (); +if (!p) +return 0 ; +if (regs->iaoq[0 ] != (unsigned long )p->ainsn.insn+4 )return 0 ;
Greg Kroah-Hartman
maintainerPATCH 386/413 parisc: Fix kernel panic due invalid values in IAOQ0 or IAOQ1
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 10835c854685393a921b68f529bf740fa7c9984d upstream.
On parisc the privilege level of a process is stored in the lowest two bits of the instruction pointers (IAOQ0 and IAOQ1). On Linux we use privilege level 0 for the kernel and privilege level 3 for user-space. So userspace should not be allowed to modify IAOQ0 or IAOQ1 of a ptraced process to change it's privilege level to e.g. 0 to try to gain kernel privileges.
This patch prevents such modifications by always setting the two lowest bits to one (which relates to privilege level 3 for user-space) if IAOQ0 or IAOQ1 are modified via ptrace calls in the native and compat ptrace paths.
--- arch/parisc/kernel/ptrace.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
arch/parisc/kernel/ptrace.c +18 -10
@@ -167,6 +167,9 @@ long arch_ptrace(struct task_struct *chiif ((addr & (sizeof (unsigned long )-1 )) || addr >=sizeof (struct pt_regs ))break ; +if (addr ==PT_IAOQ0 || addr ==PT_IAOQ1 ) { + data |=3 ;/* ensure userspace privilege */ + } if ((addr >= PT_GR1 && addr <= PT_GR31) || addr == PT_IAOQ0 || addr == PT_IAOQ1 || (addr >= PT_FR0 && addr <= PT_FR31 + 4) ||
@@ -228,16 +231,18 @@ long arch_ptrace(struct task_struct *chistatic compat_ulong_t translate_usr_offset (compat_ulong_t offset) { -if (offset <0 ) -return sizeof (struct pt_regs ); -else if (offset <=32 *4 )/* gr[0..31] */ -return offset *2 +4 ; -else if (offset <=32 *4 +32 *8 )/* gr[0..31] + fr[0..31] */ -return offset +32 *4 ; -else if (offset <sizeof (struct pt_regs )/2 +32 *4 ) -return offset *2 +4 -32 *8 ; +compat_ulong_t pos; + +if (offset <32 *4 )/* gr[0..31] */ + pos = offset *2 +4 ; +else if (offset <32 *4 +32 *8 )/* fr[0] ... fr[31] */ + pos = (offset -32 *4 ) +PT_FR0 ; +else if (offset <sizeof (struct pt_regs )/2 +32 *4 )/* sr[0] ... ipsw */ + pos = (offset -32 *4 -32 *8 ) *2 +PT_SR0 +4 ;else -return sizeof (struct pt_regs ); + pos =sizeof (struct pt_regs ); + +return pos; } long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
@@ -281,9 +286,12 @@ long compat_arch_ptrace(struct task_stru addr =translate_usr_offset (addr);if (addr >=sizeof (struct pt_regs ))break ; +if (addr ==PT_IAOQ0 +4 || addr ==PT_IAOQ1 +4 ) { + data |=3 ;/* ensure userspace privilege */ + }if (addr >=PT_FR0 && addr <=PT_FR31 +4 ) {/* Special case, fp regs are 64 bits anyway */ - *(__u64 *) ((char *)task_regs (child) + addr) = data; + *(__u32 *) ((char *)task_regs (child) + addr) = data; ret =0 ; } else if ((addr >= PT_GR1+4 && addr <= PT_GR31+4) ||
Greg Kroah-Hartman
maintainerPATCH 387/413 powerpc/32s: fix suspend/resume when IBATs 4-7 are used
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 6ecb78ef56e08d2119d337ae23cb951a640dc52d upstream.
Previously, only IBAT1 and IBAT2 were used to map kernel linear mem. Since commit 63b2bc619565 ("powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX"), we may have all 8 BATs used for mapping kernel text. But the suspend/restore functions only save/restore BATs 0 to 3, and clears BATs 4 to 7.
Make suspend and restore functions respectively save and reload the 8 BATs on CPUs having MMU_FTR_USE_HIGH_BATS feature.
--- arch/powerpc/kernel/swsusp_32.S | 73 ++++++++++++++++++++++++++++---- arch/powerpc/platforms/powermac/sleep.S | 68 +++++++++++++++++++++++++++-- 2 files changed, 128 insertions(+), 13 deletions(-)
arch/powerpc/kernel/swsusp_32.S +65 -8
@@ -25,11 +25,19 @@ #define SL_IBAT2 0x48 #define SL_DBAT3 0x50 #define SL_IBAT3 0x58 -#define SL_TB 0x60 -#define SL_R2 0x68 -#define SL_CR 0x6c -#define SL_LR 0x70 -#define SL_R12 0x74 /* r12 to r31 */ +#define SL_DBAT4 0x60 +#define SL_IBAT4 0x68 +#define SL_DBAT5 0x70 +#define SL_IBAT5 0x78 +#define SL_DBAT6 0x80 +#define SL_IBAT6 0x88 +#define SL_DBAT7 0x90 +#define SL_IBAT7 0x98 +#define SL_TB 0xa0 +#define SL_R2 0xa8 +#define SL_CR 0xac +#define SL_LR 0xb0 +#define SL_R12 0xb4 /* r12 to r31 */ #define SL_SIZE (SL_R12 + 80) .section .data
@@ -114,6 +122,41 @@ _GLOBAL(swsusp_arch_suspend) mfibatl r4,3 stw r4,SL_IBAT3+4(r11) +BEGIN_MMU_FTR_SECTION + mfspr r4,SPRN_DBAT4U + stw r4,SL_DBAT4(r11) + mfspr r4,SPRN_DBAT4L + stw r4,SL_DBAT4+4(r11) + mfspr r4,SPRN_DBAT5U + stw r4,SL_DBAT5(r11) + mfspr r4,SPRN_DBAT5L + stw r4,SL_DBAT5+4(r11) + mfspr r4,SPRN_DBAT6U + stw r4,SL_DBAT6(r11) + mfspr r4,SPRN_DBAT6L + stw r4,SL_DBAT6+4(r11) + mfspr r4,SPRN_DBAT7U + stw r4,SL_DBAT7(r11) + mfspr r4,SPRN_DBAT7L + stw r4,SL_DBAT7+4(r11) + mfspr r4,SPRN_IBAT4U + stw r4,SL_IBAT4(r11) + mfspr r4,SPRN_IBAT4L + stw r4,SL_IBAT4+4(r11) + mfspr r4,SPRN_IBAT5U + stw r4,SL_IBAT5(r11) + mfspr r4,SPRN_IBAT5L + stw r4,SL_IBAT5+4(r11) + mfspr r4,SPRN_IBAT6U + stw r4,SL_IBAT6(r11) + mfspr r4,SPRN_IBAT6L + stw r4,SL_IBAT6+4(r11) + mfspr r4,SPRN_IBAT7U + stw r4,SL_IBAT7(r11) + mfspr r4,SPRN_IBAT7L + stw r4,SL_IBAT7+4(r11) +END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) + #if 0 /* Backup various CPU config stuffs */ bl __save_cpu_setup
@@ -279,27 +322,41 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) mtibatu 3,r4 lwz r4,SL_IBAT3+4(r11) mtibatl 3,r4 -#endif - BEGIN_MMU_FTR_SECTION - li r4,0 + lwz r4,SL_DBAT4(r11) mtspr SPRN_DBAT4U,r4 + lwz r4,SL_DBAT4+4(r11) mtspr SPRN_DBAT4L,r4 + lwz r4,SL_DBAT5(r11) mtspr SPRN_DBAT5U,r4 + lwz r4,SL_DBAT5+4(r11) mtspr SPRN_DBAT5L,r4 + lwz r4,SL_DBAT6(r11) mtspr SPRN_DBAT6U,r4 + lwz r4,SL_DBAT6+4(r11) mtspr SPRN_DBAT6L,r4 + lwz r4,SL_DBAT7(r11) mtspr SPRN_DBAT7U,r4 + lwz r4,SL_DBAT7+4(r11) mtspr SPRN_DBAT7L,r4 + lwz r4,SL_IBAT4(r11) mtspr SPRN_IBAT4U,r4 + lwz r4,SL_IBAT4+4(r11) mtspr SPRN_IBAT4L,r4 + lwz r4,SL_IBAT5(r11) mtspr SPRN_IBAT5U,r4 + lwz r4,SL_IBAT5+4(r11) mtspr SPRN_IBAT5L,r4 + lwz r4,SL_IBAT6(r11) mtspr SPRN_IBAT6U,r4 + lwz r4,SL_IBAT6+4(r11) mtspr SPRN_IBAT6L,r4 + lwz r4,SL_IBAT7(r11) mtspr SPRN_IBAT7U,r4 + lwz r4,SL_IBAT7+4(r11) mtspr SPRN_IBAT7L,r4 END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) +#endif /* Flush all TLBs */ lis r4,0x1000
arch/powerpc/platforms/powermac/sleep.S +63 -5
101 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 388/413 powerpc/mm/32s: fix condition that is always true
In reply to Greg Kroah-HartmanFrom: Andreas Schwab <[email protected]>
commit 46c2478af610efb3212b8b08f74389d69899ef70 upstream.
Move a misplaced paren that makes the condition always true.
--- arch/powerpc/mm/pgtable_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/pgtable_32.c +1 -1
@@ -360,7 +360,7 @@ void mark_initmem_nx(void)unsigned long numpages =PFN_UP ((unsigned long )_einittext) -PFN_DOWN ((unsigned long )_sinittext); -if (v_block_mapped ((unsigned long )_stext) +1 ) +if (v_block_mapped ((unsigned long )_stext +1 ))mmu_mark_initmem_nx ();else change_page_attr (page, numpages,PAGE_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 389/413 powerpc/watchpoint: Restore NV GPRs while returning from exception
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
commit f474c28fbcbe42faca4eb415172c07d76adcb819 upstream.
powerpc hardware triggers watchpoint before executing the instruction. To make trigger-after-execute behavior, kernel emulates the instruction. If the instruction is 'load something into non-volatile register', exception handler should restore emulated register state while returning back, otherwise there will be register state corruption. eg, adding a watchpoint on a list can corrput the list:
# cat /proc/kallsyms | grep kthread_create_list c00000000121c8b8 d kthread_create_list
Add watchpoint on kthread_create_list->prev:
# perf record -e mem:0xc00000000121c8c0
Run some workload such that new kthread gets invoked. eg, I just logged out from console:
list_add corruption. next->prev should be prev (c000000001214e00), \ but was c00000000121c8b8. (next=c00000000121c8b8). WARNING: CPU: 59 PID: 309 at lib/list_debug.c:25 __list_add_valid+0xb4/0xc0 CPU: 59 PID: 309 Comm: kworker/59:0 Kdump: loaded Not tainted 5.1.0-rc7+ #69 ... NIP __list_add_valid+0xb4/0xc0 LR __list_add_valid+0xb0/0xc0 Call Trace: __list_add_valid+0xb0/0xc0 (unreliable) __kthread_create_on_node+0xe0/0x260 kthread_create_on_node+0x34/0x50 create_worker+0xe8/0x260 worker_thread+0x444/0x560 kthread+0x160/0x1a0 ret_from_kernel_thread+0x5c/0x70
List corruption happened because it uses 'load into non-volatile register' instruction:
Snippet from __kthread_create_on_node:
c000000000136be8: addis r29,r2,-19
c000000000136bec: ld r29,31424(r29)
if (!__list_add_valid(new, prev, next))
c000000000136bf0: mr r3,r30
c000000000136bf4: mr r5,r28
c000000000136bf8: mr r4,r29
c000000000136bfc: bl c00000000059a2f8 <__list_add_valid+0x8>Register state from WARN_ON():
GPR00: c00000000059a3a0 c000007ff23afb50 c000000001344e00 0000000000000075
GPR04: 0000000000000000 0000000000000000 0000001852af8bc1 0000000000000000
GPR08: 0000000000000001 0000000000000007 0000000000000006 00000000000004aa
GPR12: 0000000000000000 c000007ffffeb080 c000000000137038 c000005ff62aaa00
GPR16: 0000000000000000 0000000000000000 c000007fffbe7600 c000007fffbe7370
GPR20: c000007fffbe7320 c000007fffbe7300 c000000001373a00 0000000000000000
GPR24: fffffffffffffef7 c00000000012e320 c000007ff23afcb0 c000000000cb8628
GPR28: c00000000121c8b8 c000000001214e00 c000007fef5b17e8 c000007fef5b17c0
Watchpoint hit at 0xc000000000136bec.
addis r29,r2,-19
=> r29 = 0xc000000001344e00 + (-19 << 16)
=> r29 = 0xc000000001214e00
ld r29,31424(r29)
=> r29 = *(0xc000000001214e00 + 31424)
=> r29 = *(0xc00000000121c8c0)
0xc00000000121c8c0 is where we placed a watchpoint and thus this instruction was emulated by emulate_step. But because handle_dabr_fault did not restore emulated register state, r29 still contains stale value in above register state.
--- arch/powerpc/kernel/exceptions-64s.S | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/powerpc/kernel/exceptions-64s.S +7 -2
@@ -1746,7 +1746,7 @@ handle_page_fault: addi r3,r1,STACK_FRAME_OVERHEAD bl do_page_fault cmpdi r3,0 - beq+ 12f + beq+ ret_from_except_lite bl save_nvgprs mr r5,r3 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -1761,7 +1761,12 @@ handle_dabr_fault: ld r5,_DSISR(r1) addi r3,r1,STACK_FRAME_OVERHEAD bl do_break -12: b ret_from_except_lite + /* + * do_break() may have changed the NV GPRS while handling a breakpoint. + * If so, we need to restore them with their updated values. Don't use + * ret_from_except_lite here. + */ + b ret_from_except #ifdef CONFIG_PPC_BOOK3S_64
Greg Kroah-Hartman
maintainerPATCH 390/413 powerpc/powernv/npu: Fix reference leak
In reply to Greg Kroah-HartmanFrom: Greg Kurz <[email protected]>
commit 02c5f5394918b9b47ff4357b1b18335768cd867d upstream.
Since 902bdc57451c, get_pci_dev() calls pci_get_domain_bus_and_slot(). This has the effect of incrementing the reference count of the PCI device, as explained in drivers/pci/search.c:
* Given a PCI domain, bus, and slot/function number, the desired PCI
* device is located in the list of PCI devices. If the device is
* found, its reference count is increased and this function returns a
* pointer to its data structure. The caller must decrement the
* reference count by calling pci_dev_put(). If no device is found,
* %NULL is returned.
Nothing was done to call pci_dev_put() and the reference count of GPU and NPU PCI devices rockets up.
A natural way to fix this would be to teach the callers about the change, so that they call pci_dev_put() when done with the pointer. This turns out to be quite intrusive, as it affects many paths in npu-dma.c, pci-ioda.c and vfio_pci_nvlink2.c. Also, the issue appeared in 4.16 and some affected code got moved around since then: it would be problematic to backport the fix to stable releases.
All that code never cared for reference counting anyway. Call pci_dev_put() from get_pci_dev() to revert to the previous behavior.
--- arch/powerpc/platforms/powernv/npu-dma.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/powerpc/platforms/powernv/npu-dma.c +14 -1
@@ -28,9 +28,22 @@ static DEFINE_SPINLOCK(npu_context_lock)static struct pci_dev *get_pci_dev (struct device_node *dn) {struct pci_dn *pdn =PCI_DN (dn); +struct pci_dev *pdev; -return pci_get_domain_bus_and_slot (pci_domain_nr (pdn->phb->bus), + pdev =pci_get_domain_bus_and_slot (pci_domain_nr (pdn->phb->bus), pdn->busno, pdn->devfn); + +/* +* pci_get_domain_bus_and_slot() increased the reference count of +* the PCI device, but callers don't need that actually as the PE +* already holds a reference to the device. Since callers aren't +* aware of the reference count change, call pci_dev_put() now to +* avoid leaks. +*/ +if (pdev) +pci_dev_put (pdev); + +return pdev; }/* Given a NPU device get the associated PCI device. */
Greg Kroah-Hartman
maintainerPATCH 391/413 powerpc/powernv/idle: Fix restore of SPRN_LDBAR for POWER9 stop state.
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
commit f5a9e488d62360c91c5770bd55a0b40e419a71ce upstream.
commit 10d91611f426 ("powerpc/64s: Reimplement book3s idle code in C") reimplemented book3S code to pltform/powernv/idle.c. But when doing so missed to add the per-thread LDBAR update in the core_woken path of the power9_idle_stop(). Patch fixes the same.
--- arch/powerpc/platforms/powernv/idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/idle.c +1 -1
@@ -758,7 +758,6 @@ static unsigned long power9_idle_stop(unmtspr (SPRN_PTCR , sprs.ptcr);mtspr (SPRN_RPR , sprs.rpr);mtspr (SPRN_TSCR , sprs.tscr); -mtspr (SPRN_LDBAR , sprs.ldbar);if (pls >= pnv_first_tb_loss_level) {/* TB loss */
@@ -790,6 +789,7 @@ core_woken:mtspr (SPRN_MMCR0 , sprs.mmcr0);mtspr (SPRN_MMCR1 , sprs.mmcr1);mtspr (SPRN_MMCR2 , sprs.mmcr2); +mtspr (SPRN_LDBAR , sprs.ldbar);mtspr (SPRN_SPRG3 , local_paca->sprg_vdso);
Greg Kroah-Hartman
maintainerPATCH 392/413 powerpc/powernv: Fix stale iommu table base after VFIO
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
commit 5636427d087a55842c1a199dfb839e6545d30e5d upstream.
The powernv platform uses @dma_iommu_ops for non-bypass DMA. These ops need an iommu_table pointer which is stored in dev->archdata.iommu_table_base. It is initialized during pcibios_setup_device() which handles boot time devices. However when a device is taken from the system in order to pass it through, the default IOMMU table is destroyed but the pointer in a device is not updated; also when a device is returned back to the system, a new table pointer is not stored in dev->archdata.iommu_table_base either. So when a just returned device tries using IOMMU, it crashes on accessing stale iommu_table or its members.
This calls set_iommu_table_base() when the default window is created. Note it used to be there before but was wrongly removed (see "fixes"). It did not appear before as these days most devices simply use bypass.
This adds set_iommu_table_base(NULL) when a device is taken from the system to make it clear that IOMMU DMA cannot be used past that point.
--- arch/powerpc/platforms/powernv/pci-ioda.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/platforms/powernv/pci-ioda.c +10 -0
@@ -2456,6 +2456,14 @@ static long pnv_pci_ioda2_setup_default_if (!pnv_iommu_bypass_disabled)pnv_pci_ioda2_set_bypass (pe, true); +/* +* Set table base for the case of IOMMU DMA use. Usually this is done +* from dma_dev_setup() which is not called when a device is returned +* from VFIO so do it here. +*/ +if (pe->pdev) +set_iommu_table_base (&pe->pdev->dev, tbl); +return 0 ; }
@@ -2543,6 +2551,8 @@ static void pnv_ioda2_take_ownership(strpnv_pci_ioda2_unset_window (&pe->table_group,0 );if (pe->pbus)pnv_ioda_setup_bus_dma (pe, pe->pbus); +else if (pe->pdev) +set_iommu_table_base (&pe->pdev->dev,NULL );iommu_tce_table_put (tbl); }
Greg Kroah-Hartman
maintainerPATCH 393/413 powerpc/pseries: Fix xive=off command line
In reply to Greg Kroah-HartmanFrom: Greg Kurz <[email protected]>
commit a3bf9fbdad600b1e4335dd90979f8d6072e4f602 upstream.
On POWER9, if the hypervisor supports XIVE exploitation mode, the guest OS will unconditionally requests for the XIVE interrupt mode even if XIVE was deactivated with the kernel command line xive=off. Later on, when the spapr XIVE init code handles xive=off, it disables XIVE and tries to fall back on the legacy mode XICS.
This discrepency causes a kernel panic because the hypervisor is configured to provide the XIVE interrupt mode to the guest :
kernel BUG at arch/powerpc/sysdev/xics/xics-common.c:135!
...
NIP xics_smp_probe+0x38/0x98
LR xics_smp_probe+0x2c/0x98
Call Trace:
xics_smp_probe+0x2c/0x98 (unreliable)
pSeries_smp_probe+0x40/0xa0
smp_prepare_cpus+0x62c/0x6ec
kernel_init_freeable+0x148/0x448
kernel_init+0x2c/0x148
ret_from_kernel_thread+0x5c/0x68Look for xive=off during prom_init and don't ask for XIVE in this case. One exception though: if the host only supports XIVE, we still want to boot so we ignore xive=off.
Similarly, have the spapr XIVE init code to looking at the interrupt mode negotiated during CAS, and ignore xive=off if the hypervisor only supports XIVE.
--- arch/powerpc/kernel/prom_init.c | 16 +++++++++++- arch/powerpc/sysdev/xive/spapr.c | 52 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom_init.c +15 -1
@@ -168,6 +168,7 @@ static unsigned long __prombss prom_tce_#ifdef CONFIG_PPC_PSERIES static bool __prombss prom_radix_disable; +static bool __prombss prom_xive_disable;#endif struct platform_support {
@@ -804,6 +805,12 @@ static void __init early_cmdline_parse(v }if (prom_radix_disable)prom_debug ("Radix disabled from cmdline\n" ); + + opt =prom_strstr (prom_cmd_line,"xive=off" ); +if (opt) { + prom_xive_disable = true; +prom_debug ("XIVE disabled from cmdline\n" ); + }#endif /* CONFIG_PPC_PSERIES */ }
@@ -1212,10 +1219,17 @@ static void __init prom_parse_xive_modelswitch (val) {case OV5_FEAT (OV5_XIVE_EITHER ):/* Either Available */ prom_debug ("XIVE - either mode supported\n" ); - support->xive = true; + support->xive = !prom_xive_disable;break ;case OV5_FEAT (OV5_XIVE_EXPLOIT ):/* Only Exploitation mode */ prom_debug ("XIVE - exploitation mode supported\n" ); +if (prom_xive_disable) { +/* +* If we __have__ to do XIVE, we're better off ignoring +* the command line rather than not booting. +*/ +prom_printf ("WARNING: Ignoring cmdline option xive=off\n" ); + } support->xive = true;break ;case OV5_FEAT (OV5_XIVE_LEGACY ):/* Only Legacy mode */
arch/powerpc/sysdev/xive/spapr.c +51 -1
70 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 394/413 powerpc/pseries: Fix oops in hotplug memory notifier
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
commit 0aa82c482ab2ece530a6f44897b63b274bb43c8e upstream.
During post-migration device tree updates, we can oops in pseries_update_drconf_memory() if the source device tree has an ibm,dynamic-memory-v2 property and the destination has a ibm,dynamic_memory (v1) property. The notifier processes an "update" for the ibm,dynamic-memory property but it's really an add in this scenario. So make sure the old property object is there before dereferencing it.
--- arch/powerpc/platforms/pseries/hotplug-memory.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/platforms/pseries/hotplug-memory.c +3 -0
@@ -976,6 +976,9 @@ static int pseries_update_drconf_memory(if (!memblock_size)return -EINVAL ; +if (!pr->old_prop) +return 0 ; + p = (__be32 *) pr->old_prop->value;if (!p)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 395/413 mmc: sdhci-msm: fix mutex while in spinlock
In reply to Greg Kroah-HartmanFrom: Jorge Ramirez-Ortiz <[email protected]>
commit 5e6b6651d22de109ebf48ca00d0373bc2c0cc080 upstream.
mutexes can sleep and therefore should not be taken while holding a spinlock. move clk_get_rate (can sleep) outside the spinlock protected region.
--- drivers/mmc/host/sdhci-msm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-msm.c +6 -3
@@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host);int wait_cnt =50 ; -unsigned long flags; +unsigned long flags, xo_clk =0 ;u32 config;const struct sdhci_msm_offset *msm_offset = msm_host->offset; +if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL (msm_host->xo_clk)) + xo_clk =clk_get_rate (msm_host->xo_clk); +spin_lock_irqsave (&host->lock, flags);/*
@@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_ config &=CORE_FLL_CYCLE_CNT ;if (config) mclk_freq =DIV_ROUND_CLOSEST_ULL ((host->clock *8 ), -clk_get_rate (msm_host->xo_clk)); + xo_clk);else mclk_freq =DIV_ROUND_CLOSEST_ULL ((host->clock *4 ), -clk_get_rate (msm_host->xo_clk)); + xo_clk); config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config_2);
Greg Kroah-Hartman
maintainerPATCH 396/413 eCryptfs: fix a couple type promotion bugs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 0bdf8a8245fdea6f075a5fede833a5fcf1b3466c upstream.
ECRYPTFS_SIZE_AND_MARKER_BYTES is type size_t, so if "rc" is negative that gets type promoted to a high positive value and treated as success.
--- fs/ecryptfs/crypto.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/ecryptfs/crypto.c +8 -4
@@ -1004,8 +1004,10 @@ int ecryptfs_read_and_validate_header_re rc =ecryptfs_read_lower (file_size,0 ,ECRYPTFS_SIZE_AND_MARKER_BYTES , inode); -if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) -return rc >=0 ? -EINVAL : rc; +if (rc <0 ) +return rc; +else if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) +return -EINVAL ; rc =ecryptfs_validate_marker (marker);if (!rc)ecryptfs_i_size_init (file_size, inode);
@@ -1367,8 +1369,10 @@ int ecryptfs_read_and_validate_xattr_regecryptfs_inode_to_lower (inode),ECRYPTFS_XATTR_NAME , file_size, ECRYPTFS_SIZE_AND_MARKER_BYTES); -if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) -return rc >=0 ? -EINVAL : rc; +if (rc <0 ) +return rc; +else if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES ) +return -EINVAL ; rc =ecryptfs_validate_marker (marker);if (!rc)ecryptfs_i_size_init (file_size, inode);
Greg Kroah-Hartman
maintainerPATCH 397/413 mtd: rawnand: mtk: Correct low level time calculation of r/w cycle
In reply to Greg Kroah-HartmanFrom: Xiaolei Li <[email protected]>
commit e1884ffddacc0424d7e785e6f8087bd12f7196db upstream.
At present, the flow of calculating AC timing of read/write cycle in SDR mode is that:
At first, calculate high hold time which is valid for both read and write cycle using the max value between tREH_min and tWH_min. Secondly, calculate WE# pulse width using tWP_min.
Thridly, calculate RE# pulse width using the bigger one between tREA_max and tRP_min.
But NAND SPEC shows that Controller should also meet write/read cycle time. That is write cycle time should be more than tWC_min and read cycle should be more than tRC_min. Obviously, we do not achieve that now.
This patch corrects the low level time calculation to meet minimum read/write cycle time required. After getting the high hold time, WE# low level time will be promised to meet tWP_min and tWC_min requirement, and RE# low level time will be promised to meet tREA_max, tRP_min and tRC_min requirement.
--- drivers/mtd/nand/raw/mtk_nand.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/mtk_nand.c +21 -3
@@ -500,7 +500,8 @@ static int mtk_nfc_setup_data_interface( {struct mtk_nfc *nfc =nand_get_controller_data (chip);const struct nand_sdr_timings *timings; -u32 rate, tpoecs, tprecs, tc2r, tw2r, twh, twst, trlt; +u32 rate, tpoecs, tprecs, tc2r, tw2r, twh, twst =0 , trlt =0 ; +u32 thold; timings =nand_get_sdr_timings (conf);if (IS_ERR (timings))
@@ -536,11 +537,28 @@ static int mtk_nfc_setup_data_interface( twh =DIV_ROUND_UP (twh * rate,1000000 ) -1 ; twh &=0xf ; - twst = timings->tWP_min /1000 ; +/* Calculate real WE#/RE# hold time in nanosecond */ + thold = (twh +1 ) *1000000 / rate; +/* nanosecond to picosecond */ + thold *=1000 ; + +/* +* WE# low level time should be expaned to meet WE# pulse time +* and WE# cycle time at the same time. +*/ +if (thold < timings->tWC_min) + twst = timings->tWC_min - thold; + twst =max (timings->tWP_min, twst) /1000 ; twst =DIV_ROUND_UP (twst * rate,1000000 ) -1 ; twst &=0xf ; - trlt =max (timings->tREA_max, timings->tRP_min) /1000 ; +/* +* RE# low level time should be expaned to meet RE# pulse time, +* RE# access time and RE# cycle time at the same time. +*/ +if (thold < timings->tRC_min) + trlt = timings->tRC_min - thold; + trlt =max3 (trlt, timings->tREA_max, timings->tRP_min) /1000 ; trlt =DIV_ROUND_UP (trlt * rate,1000000 ) -1 ; trlt &=0xf ;
Greg Kroah-Hartman
maintainerPATCH 398/413 mtd: spinand: read returns badly if the last page has bitflips
In reply to Greg Kroah-HartmanFrom: liaoweixiong <[email protected]>
commit b83408b580eccf8d2797cd6cb9ae42c2a28656a7 upstream.
In case of the last page containing bitflips (ret > 0), spinand_mtd_read() will return that number of bitflips for the last page while it should instead return max_bitflips like it does when the last page read returns with 0.
--- drivers/mtd/nand/spi/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/spi/core.c +1 -1
@@ -511,12 +511,12 @@ static int spinand_mtd_read(struct mtd_iif (ret == -EBADMSG ) { ecc_failed = true; mtd->ecc_stats.failed++; - ret =0 ; }else { mtd->ecc_stats.corrected += ret; max_bitflips = max_t(unsigned int, max_bitflips, ret); } + ret =0 ; ops->retlen += iter.req.datalen; ops->oobretlen += iter.req.ooblen; }
Greg Kroah-Hartman
maintainerPATCH 399/413 intel_th: msu: Remove set but not used variable last
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 9800db282dff675dd700d5985d90b605c34b5ccd upstream.
Commit aad14ad3cf3a ("intel_th: msu: Add current window tracking") added the following gcc warning:
Quoted 3 lines
drivers/hwtracing/intel_th/msu.c: In functionmsc_win_switch:drivers/hwtracing/intel_th/msu.c:1389:21: warning: variable last set but not used [-Wunused-but-set-variable]
Fix it by removing the variable.
--- drivers/hwtracing/intel_th/msu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwtracing/intel_th/msu.c +1 -2
@@ -1400,10 +1400,9 @@ static int intel_th_msc_init(struct mscstatic void msc_win_switch (struct msc *msc) { -struct msc_window *last, *first; +struct msc_window *first; first = list_first_entry(&msc->win_list, struct msc_window, entry); - last = list_last_entry(&msc->win_list, struct msc_window, entry);if (msc_is_last_win (msc->cur_win)) msc->cur_win = first;
Greg Kroah-Hartman
maintainerPATCH 400/413 intel_th: msu: Fix single mode with disabled IOMMU
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 918b8646497b5dba6ae82d4a7325f01b258972b9 upstream.
Commit 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU") switched the single mode code to use dma mapping pages obtained from the page allocator, but with IOMMU disabled, that may lead to using SWIOTLB bounce buffers and without additional sync'ing, produces empty trace buffers.
Fix this by using a DMA32 GFP flag to the page allocation in single mode, as the device supports full 32-bit DMA addressing.
--- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/intel_th/msu.c +1 -1
@@ -667,7 +667,7 @@ static int msc_buffer_contig_alloc(struc goto err_out; ret = -ENOMEM ; - page =alloc_pages (GFP_KERNEL | __GFP_ZERO, order); + page =alloc_pages (GFP_KERNEL | __GFP_ZERO |GFP_DMA32 , order);if (!page) goto err_free_sgt;
Greg Kroah-Hartman
maintainerPATCH 401/413 Bluetooth: Add SMP workaround Microsoft Surface Precision Mouse bug
In reply to Greg Kroah-HartmanFrom: Szymon Janc <[email protected]>
commit 1d87b88ba26eabd4745e158ecfd87c93a9b51dc2 upstream.
Microsoft Surface Precision Mouse provides bogus identity address when pairing. It connects with Static Random address but provides Public Address in SMP Identity Address Information PDU. Address has same value but type is different. Workaround this by dropping IRK if ID address discrepancy is detected.
Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 19
LE Connection Complete (0x01)
Status: Success (0x00)
Handle: 75
Role: Master (0x00)
Peer address type: Random (0x01)
Peer address: E0:52:33:93:3B:21 (Static)
Connection interval: 50.00 msec (0x0028)
Connection latency: 0 (0x0000)
Supervision timeout: 420 msec (0x002a)
Master clock accuracy: 0x00....
Quoted 1 line
ACL Data RX: Handle 75 flags
0x02dlen 12
SMP: Identity Address Information (0x09) len 7
Address type: Public (0x00)
Address: E0:52:33:93:3B:21Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199461
--- net/bluetooth/smp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/bluetooth/smp.c +13 -0
@@ -2579,6 +2579,19 @@ static int smp_cmd_ident_addr_info(struc goto distribute; } +/* Drop IRK if peer is using identity address during pairing but is +* providing different address as identity information. +* +* Microsoft Surface Precision Mouse is known to have this bug. +*/ +if (hci_is_identity_address (&hcon->dst, hcon->dst_type) && + (bacmp (&info->bdaddr, &hcon->dst) || + info->addr_type != hcon->dst_type)) { +bt_dev_err (hcon->hdev, +"ignoring IRK with invalid identity address" ); + goto distribute; + } +bacpy (&smp->id_addr, &info->bdaddr); smp->id_addr_type = info->addr_type;
Greg Kroah-Hartman
maintainerPATCH 402/413 dax: Fix missed wakeup with PMD faults
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit 23c84eb7837514e16d79ed6d849b13745e0ce688 upstream.
RocksDB can hang indefinitely when using a DAX file. This is due to a bug in the XArray conversion when handling a PMD fault and finding a PTE entry. We use the wrong index in the hash and end up waiting on the wrong waitqueue.
There's actually no need to wait; if we find a PTE entry while looking for a PMD entry, we can return immediately as we know we should fall back to a PTE fault (which may not conflict with the lock held).
We reuse the XA_RETRY_ENTRY to signal a conflicting entry was found. This value can never be found in an XArray while holding its lock, so it does not create an ambiguity.
--- fs/dax.c | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-)
fs/dax.c +33 -20
@@ -124,6 +124,15 @@ static int dax_is_empty_entry(void *entr }/* +* true if the entry that was found is of a smaller order than the entry +* we were looking for +*/ +static bool dax_is_conflict (void *entry) +{ +return entry ==XA_RETRY_ENTRY ; +} + +/* * DAX page cache entry locking */ struct exceptional_entry_key {
@@ -195,11 +204,13 @@ static void dax_wake_entry(struct xa_sta* Look up entry in page cache, wait for it to become unlocked if it * is a DAX entry and return it. The caller must subsequently call * put_unlocked_entry() if it did not lock the entry or dax_unlock_entry() -* if it did. +* if it did. The entry returned may have a larger order than @order. +* If @order is larger than the order of the entry found in i_pages, this +* function returns a dax_is_conflict entry. * * Must be called with the i_pages lock held. */ -static void *get_unlocked_entry (struct xa_state *xas) +static void *get_unlocked_entry (struct xa_state *xas,unsigned int order) {void *entry;struct wait_exceptional_entry_queue ewait;
@@ -210,6 +221,8 @@ static void *get_unlocked_entry(struct xfor (;;) { entry =xas_find_conflict (xas); +if (dax_entry_order (entry) < order) +return XA_RETRY_ENTRY ;if (!entry ||WARN_ON_ONCE (!xa_is_value (entry)) || !dax_is_locked (entry))return entry;
@@ -254,7 +267,7 @@ static void wait_entry_unlocked(struct xstatic void put_unlocked_entry (struct xa_state *xas,void *entry) {/* If we were the only waiter woken, wake the next one */ -if (entry) +if (entry &&dax_is_conflict (entry))dax_wake_entry (xas, entry, false); }
@@ -461,7 +474,7 @@ void dax_unlock_page(struct page *page,* overlap with xarray value entries. */ static void *grab_mapping_entry (struct xa_state *xas, -struct address_space *mapping,unsigned long size_flag) +struct address_space *mapping,unsigned int order) {unsigned long index = xas->xa_index;bool pmd_downgrade = false;/* splitting PMD entry into PTE entries? */
@@ -469,20 +482,17 @@ static void *grab_mapping_entry(struct x retry:xas_lock_irq (xas); - entry =get_unlocked_entry (xas); + entry =get_unlocked_entry (xas, order);if (entry) { +if (dax_is_conflict (entry)) + goto fallback;if (!xa_is_value (entry)) {xas_set_err (xas,EIO ); goto out_unlock; } -if (size_flag &DAX_PMD ) { -if (dax_is_pte_entry (entry)) { -put_unlocked_entry (xas, entry); - goto fallback; - } - }else {/* trying to grab a PTE entry */ +if (order ==0 ) {if (dax_is_pmd_entry (entry) && (dax_is_zero_entry (entry) ||dax_is_empty_entry (entry))) {
@@ -523,7 +533,11 @@ retry:if (entry) {dax_lock_entry (xas, entry); }else { - entry =dax_make_entry (pfn_to_pfn_t (0 ), size_flag |DAX_EMPTY ); +unsigned long flags =DAX_EMPTY ; + +if (order >0 ) + flags |=DAX_PMD ; + entry =dax_make_entry (pfn_to_pfn_t (0 ), flags);dax_lock_entry (xas, entry);if (xas_error (xas)) goto out_unlock;
@@ -594,7 +608,7 @@ struct page *dax_layout_busy_page(structif (WARN_ON_ONCE (!xa_is_value (entry)))continue ;if (unlikely (dax_is_locked (entry))) - entry =get_unlocked_entry (&xas); + entry =get_unlocked_entry (&xas,0 );if (entry) page =dax_busy_page (entry);put_unlocked_entry (&xas, entry);
@@ -621,7 +635,7 @@ static int __dax_invalidate_entry(structvoid *entry;xas_lock_irq (&xas); - entry =get_unlocked_entry (&xas); + entry =get_unlocked_entry (&xas,0 );if (!entry ||WARN_ON_ONCE (!xa_is_value (entry))) goto out; if (!trunc &&
@@ -848,7 +862,7 @@ static int dax_writeback_one(struct xa_sif (unlikely (dax_is_locked (entry))) {void *old_entry = entry; - entry =get_unlocked_entry (xas); + entry =get_unlocked_entry (xas,0 );/* Entry got punched out / reallocated? */ if (!entry ||WARN_ON_ONCE (!xa_is_value (entry)))
@@ -1509,7 +1523,7 @@ static vm_fault_t dax_iomap_pmd_fault(st* entry is already in the array, for instance), it will return * VM_FAULT_FALLBACK. */ - entry =grab_mapping_entry (&xas, mapping,DAX_PMD ); + entry =grab_mapping_entry (&xas, mapping,PMD_ORDER );if (xa_is_internal (entry)) { result =xa_to_internal (entry); goto fallback;
@@ -1658,11 +1672,10 @@ dax_insert_pfn_mkwrite(struct vm_fault *vm_fault_t ret;xas_lock_irq (&xas); - entry =get_unlocked_entry (&xas); + entry =get_unlocked_entry (&xas, order);/* Did we race with someone splitting entry or so? */ -if (!entry || - (order ==0 && !dax_is_pte_entry (entry)) || - (order ==PMD_ORDER && !dax_is_pmd_entry (entry))) { +if (!entry ||dax_is_conflict (entry) || + (order ==0 && !dax_is_pte_entry (entry))) {put_unlocked_entry (&xas, entry);xas_unlock_irq (&xas); trace_dax_insert_pfn_mkwrite_no_entry(mapping->host, vmf,
Greg Kroah-Hartman
maintainerPATCH 403/413 usb: Handle USB3 remote wakeup for LPM enabled devices correctly
In reply to Greg Kroah-HartmanFrom: Lee, Chiasheng <[email protected]>
commit e244c4699f859cf7149b0781b1894c7996a8a1df upstream.
With Link Power Management (LPM) enabled USB3 links transition to low power U1/U2 link states from U0 state automatically.
Current hub code detects USB3 remote wakeups by checking if the software state still shows suspended, but the link has transitioned from suspended U3 to enabled U0 state.
As it takes some time before the hub thread reads the port link state after a USB3 wake notification, the link may have transitioned from U0 to U1/U2, and wake is not detected by hub code.
Fix this by handling U1/U2 states in the same way as U0 in USB3 wakeup handling
This patch should be added to stable kernels since 4.13 where LPM was kept enabled during suspend/resume
--- drivers/usb/core/hub.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +5 -2
@@ -3617,6 +3617,7 @@ static int hub_handle_remote_wakeup(strustruct usb_device *hdev;struct usb_device *udev;int connect_change =0 ; +u16 link_state;int ret; hdev = hub->hdev;
@@ -3626,9 +3627,11 @@ static int hub_handle_remote_wakeup(strureturn 0 ;usb_clear_port_feature (hdev, port,USB_PORT_FEAT_C_SUSPEND ); }else { + link_state = portstatus &USB_PORT_STAT_LINK_STATE ;if (!udev || udev->state !=USB_STATE_SUSPENDED || - (portstatus &USB_PORT_STAT_LINK_STATE ) != -USB_SS_PORT_LS_U0 ) + (link_state !=USB_SS_PORT_LS_U0 && + link_state !=USB_SS_PORT_LS_U1 && + link_state !=USB_SS_PORT_LS_U2 ))return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 404/413 blk-throttle: fix zero wait time for iops throttled group
In reply to Greg Kroah-HartmanFrom: Konstantin Khlebnikov <[email protected]>
commit 3a10f999ffd464d01c5a05592a15470a3c4bbc36 upstream.
After commit 991f61fe7e1d ("Blk-throttle: reduce tail io latency when iops limit is enforced") wait time could be zero even if group is throttled and cannot issue requests right now. As a result throtl_select_dispatch() turns into busy-loop under irq-safe queue spinlock.
Fix is simple: always round up target time to the next throttle slice.
--- block/blk-throttle.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
block/blk-throttle.c +3 -6
@@ -881,13 +881,10 @@ static bool tg_with_in_iops_limit(structunsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;u64 tmp; - jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw]; + jiffy_elapsed = jiffies - tg->slice_start[rw]; -/* Slice has just started. Consider one slice interval */ -if (!jiffy_elapsed) - jiffy_elapsed_rnd = tg->td->throtl_slice; - - jiffy_elapsed_rnd =roundup (jiffy_elapsed_rnd, tg->td->throtl_slice); +/* Round up to the next throttle slice, wait time must be nonzero */ + jiffy_elapsed_rnd =roundup (jiffy_elapsed +1 , tg->td->throtl_slice);/* * jiffy_elapsed_rnd should not be a big value as minimum iops can be
Greg Kroah-Hartman
maintainerPATCH 405/413 clk: imx: imx8mm: correct audio_pll2_clk to audio_pll2_out
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit 5b933e28d8b1fbdc7fbac4bfc569f3b152c3dd59 upstream.
There is no audio_pll2_clk registered, it should be audio_pll2_out.
--- drivers/clk/imx/clk-imx8mm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/imx/clk-imx8mm.c +3 -3
@@ -325,7 +325,7 @@ static const char *imx8mm_dsi_dbi_sels[] "sys_pll2_1000m", "sys_pll3_out", "audio_pll2_out", "video_pll1_out", };static const char *imx8mm_usdhc3_sels[] = {"osc_24m" ,"sys_pll1_400m" ,"sys_pll1_800m" ,"sys_pll2_500m" , -"sys_pll3_out" ,"sys_pll1_266m" ,"audio_pll2_clk" ,"sys_pll1_100m" , }; +"sys_pll3_out" ,"sys_pll1_266m" ,"audio_pll2_out" ,"sys_pll1_100m" , };static const char *imx8mm_csi1_core_sels[] = {"osc_24m" ,"sys_pll1_266m" ,"sys_pll2_250m" ,"sys_pll1_800m" ,"sys_pll2_1000m" ,"sys_pll3_out" ,"audio_pll2_out" ,"video_pll1_out" , };
@@ -361,11 +361,11 @@ static const char *imx8mm_pdm_sels[] = { "sys_pll2_1000m", "sys_pll3_out", "clk_ext3", "audio_pll2_out", };static const char *imx8mm_vpu_h1_sels[] = {"osc_24m" ,"vpu_pll_out" ,"sys_pll1_800m" ,"sys_pll2_1000m" , -"audio_pll2_clk" ,"sys_pll2_125m" ,"sys_pll3_clk" ,"audio_pll1_out" , }; +"audio_pll2_out" ,"sys_pll2_125m" ,"sys_pll3_clk" ,"audio_pll1_out" , };static const char *imx8mm_dram_core_sels[] = {"dram_pll_out" ,"dram_alt_root" , }; -static const char *imx8mm_clko1_sels[] = {"osc_24m" ,"sys_pll1_800m" ,"osc_27m" ,"sys_pll1_200m" ,"audio_pll2_clk" , +static const char *imx8mm_clko1_sels[] = {"osc_24m" ,"sys_pll1_800m" ,"osc_27m" ,"sys_pll1_200m" ,"audio_pll2_out" ,"vpu_pll" ,"sys_pll1_80m" , };static struct clk *clks[IMX8MM_CLK_END ];
Greg Kroah-Hartman
maintainerPATCH 406/413 blk-iolatency: clear use_delay when io.latency is set to zero
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 5de0073fcd50cc1f150895a7bb04d3cf8067b1d7 upstream.
If use_delay was non-zero when the latency target of a cgroup was set to zero, it will stay stuck until io.latency is enabled on the cgroup again. This keeps readahead disabled for the cgroup impacting performance negatively.
--- block/blk-iolatency.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/blk-iolatency.c +3 -1
@@ -759,8 +759,10 @@ static int iolatency_set_min_lat_nsec(stif (!oldval && val)return 1 ; -if (oldval && !val) +if (oldval && !val) { +blkcg_clear_delay (blkg);return -1 ; + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 407/413 blkcg: update blkcg_print_stat() to handle larger outputs
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit f539da82f2158916e154d206054e0efd5df7ab61 upstream.
Depending on the number of devices, blkcg stats can go over the default seqfile buf size. seqfile normally retries with a larger buffer but since the ->pd_stat() addition, blkcg_print_stat() doesn't tell seqfile that overflow has happened and the output gets printed truncated. Fix it by calling seq_commit() w/ -1 on possible overflows.
--- block/blk-cgroup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
block/blk-cgroup.c +6 -2
@@ -1006,8 +1006,12 @@ static int blkcg_print_stat(struct seq_f } next:if (has_stats) { - off +=scnprintf (buf+off, size-off,"\n" ); -seq_commit (sf, off); +if (off < size -1 ) { + off +=scnprintf (buf+off, size-off,"\n" ); +seq_commit (sf, off); + }else { +seq_commit (sf,-1 ); + } } }
Greg Kroah-Hartman
maintainerPATCH 408/413 net: mvmdio: allow up to four clocks to be specified for orion-mdio
In reply to Greg Kroah-HartmanFrom: Josua Mayer <[email protected]>
commit 4aabed699c400810981d3dda170f05fa4d782905 upstream.
Allow up to four clocks to be specified and enabled for the orion-mdio interface, which are required by the Armada 8k and defined in armada-cp110.dtsi.
Fixes a hang in probing the mvmdio driver that was encountered on the Clearfog GT 8K with all drivers built as modules, but also affects other boards such as the MacchiatoBIN.
--- drivers/net/ethernet/marvell/mvmdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvmdio.c +1 -1
@@ -64,7 +64,7 @@struct orion_mdio_dev {void __iomem *regs; -struct clk *clk[3 ]; +struct clk *clk[4 ];/* * If we have access to the error interrupt pin (which is * somewhat misnamed as it not only reflects internal errors
Greg Kroah-Hartman
maintainerPATCH 409/413 dt-bindings: allow up to four clocks for orion-mdio
In reply to Greg Kroah-HartmanFrom: Josua Mayer <[email protected]>
commit 80785f5a22e9073e2ded5958feb7f220e066d17b upstream.
Armada 8040 needs four clocks to be enabled for MDIO accesses to work. Update the binding to allow the extra clock to be specified.
--- Documentation/devicetree/bindings/net/marvell-orion-mdio.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/net/marvell-orion-mdio.txt +1 -1
@@ -16,7 +16,7 @@ Required properties: Optional properties: - interrupts: interrupt line number for the SMI error/done interrupt -- clocks: phandle for up to three required clocks for the MDIO instance +- clocks: phandle for up to four required clocks for the MDIO instance The child nodes of the MDIO driver are the individual PHY devices connected to this MDIO bus. They must have a "reg" property given the
Greg Kroah-Hartman
maintainerPATCH 410/413 pstore: Fix double-free in pstore_mkfile() failure path
In reply to Greg Kroah-HartmanFrom: Norbert Manthey <[email protected]>
commit 4c6d80e1144bdf48cae6b602ae30d41f3e5c76a9 upstream.
The pstore_mkfile() function is passed a pointer to a struct pstore_record. On success it consumes this 'record' pointer and references it from the created inode.
On failure, however, it may or may not free the record. There are even two different code paths which return -ENOMEM -- one of which does and the other doesn't free the record.
Make the behaviour deterministic by never consuming and freeing the record when returning failure, allowing the caller to do the cleanup consistently.
--- fs/pstore/inode.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
fs/pstore/inode.c +6 -7
@@ -318,22 +318,21 @@ int pstore_mkfile(struct dentry *root, s goto fail; inode->i_mode =S_IFREG |0444 ; inode->i_fop = &pstore_file_operations; - private =kzalloc (sizeof (*private),GFP_KERNEL ); -if (!private) - goto fail_alloc; - private->record = record; -scnprintf (name,sizeof (name),"%s-%s-%llu%s" ,pstore_type_to_name (record->type), record->psi->name, record->id, record->compressed ?".enc.z" :"" ); + private =kzalloc (sizeof (*private),GFP_KERNEL ); +if (!private) + goto fail_inode; + dentry =d_alloc_name (root, name);if (!dentry) goto fail_private; + private->record = record; inode->i_size = private->total_size = size; - inode->i_private = private;if (record->time.tv_sec)
@@ -349,7 +348,7 @@ int pstore_mkfile(struct dentry *root, s fail_private:free_pstore_private (private); -fail_alloc: +fail_inode:iput (inode); fail:
stable-rc/linux-5.2.y boot: 139 boots: 1 failed, 136 passed with 1 offline, 1 untried/unknown (v5.2.2-414-ga4059e390eb8)
stable-rc/linux-5.2.y boot: 139 boots: 1 failed, 136 passed with 1 offline, 1 untried/unknown (v5.2.2-414-ga4059e390eb8)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-5.2.y/kernel/v5.2.2-414-ga4059e390eb8/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-5.2.y/kernel/v5.2.2-414-ga4059e390eb8/
Tree: stable-rc
Branch: linux-5.2.y
Git Describe: v5.2.2-414-ga4059e390eb8
Git Commit: a4059e390eb842ee95dcb0b856eee5cc422a815b
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 81 unique boards, 28 SoC families, 17 builds out of 209
Boot Failure Detected:
arm64:
defconfig:
gcc-8:
meson-gxl-s905x-nexbox-a95x: 1 failed labOffline Platforms:
arm64:
defconfig:
gcc-8
meson-gxbb-odroidc2: 1 offline lab
---
For more info write to <[email protected]>
Greg Kroah-Hartman
maintainerPATCH 411/413 phy: qcom-qmp: Correct READY_STATUS poll break condition
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
commit 885bd765963b42c380db442db7f1c0f2a26076fa upstream.
After issuing a PHY_START request to the QMP, the hardware documentation states that the software should wait for the PCS_READY_STATUS to become 1.
With the introduction of commit c9b589791fc1 ("phy: qcom: Utilize UFS reset controller") an additional 1ms delay was introduced between the start request and the check of the status bit. This greatly increases the chances for the hardware to actually becoming ready before the status bit is read.
The result can be seen in that UFS PHY enabling is now reported as a failure in 10% of the boots on SDM845, which is a clear regression from the previous rare/occasional failure.
This patch fixes the "break condition" of the poll to check for the correct state of the status bit.
Unfortunately PCIe on 8996 and 8998 does not specify the mask_pcs_ready register, which means that the code checks a bit that's always 0. So the patch also fixes these, in order to not regress these targets.
--- drivers/phy/qualcomm/phy-qcom-qmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +3 -1
@@ -1074,6 +1074,7 @@ static const struct qmp_phy_cfg msm8996_ .start_ctrl = PCS_START | PLL_READY_GATE_EN, .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, + .mask_pcs_ready = PHYSTATUS, .mask_com_pcs_ready = PCS_READY, .has_phy_com_ctrl = true,
@@ -1253,6 +1254,7 @@ static const struct qmp_phy_cfg msm8998_ .start_ctrl = SERDES_START | PCS_START, .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, + .mask_pcs_ready = PHYSTATUS, .mask_com_pcs_ready = PCS_READY, };
@@ -1547,7 +1549,7 @@ static int qcom_qmp_phy_enable(struct ph status = pcs + cfg->regs[QPHY_PCS_READY_STATUS ]; mask = cfg->mask_pcs_ready; - ret =readl_poll_timeout (status, val, !(val & mask),1 , + ret =readl_poll_timeout (status, val, val & mask,1 ,PHY_INIT_COMPLETE_TIMEOUT );if (ret) {dev_err (qmp->dev,"phy initialization timed-out\n" );
Greg Kroah-Hartman
maintainerPATCH 412/413 dm thin metadata: check if in fail_io mode when setting needs_check
In reply to Greg Kroah-HartmanFrom: Mike Snitzer <[email protected]>
commit 54fa16ee532705985e6c946da455856f18f63ee1 upstream.
Check if in fail_io mode at start of dm_pool_metadata_set_needs_check(). Otherwise dm_pool_metadata_set_needs_check()'s superblock_lock() can crash in dm_bm_write_lock() while accessing the block manager object that was previously destroyed as part of a failed dm_pool_abort_metadata() that ultimately set fail_io to begin with.
Also, update DMERR() message to more accurately describe superblock_lock() failure.
--- drivers/md/dm-thin-metadata.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/dm-thin-metadata.c +5 -2
@@ -2046,16 +2046,19 @@ int dm_pool_register_metadata_threshold(int dm_pool_metadata_set_needs_check (struct dm_pool_metadata *pmd) { -int r; +int r = -EINVAL ;struct dm_block *sblock;struct thin_disk_superblock *disk_super;pmd_write_lock (pmd); +if (pmd->fail_io) + goto out; + pmd->flags |=THIN_METADATA_NEEDS_CHECK_FLAG ; r =superblock_lock (pmd, &sblock);if (r) { -DMERR ("couldn't read superblock" ); +DMERR ("couldn't lock superblock" ); goto out; }
Greg Kroah-Hartman
maintainerPATCH 413/413 dm bufio: fix deadlock with loop device
In reply to Greg Kroah-HartmanFrom: Junxiao Bi <[email protected]>
commit bd293d071ffe65e645b4d8104f9d8fe15ea13862 upstream.
When thin-volume is built on loop device, if available memory is low, the following deadlock can be triggered:
One process P1 allocates memory with GFP_FS flag, direct alloc fails, memory reclaim invokes memory shrinker in dm_bufio, dm_bufio_shrink_scan() runs, mutex dm_bufio_client->lock is acquired, then P1 waits for dm_buffer IO to complete in __try_evict_buffer().
But this IO may never complete if issued to an underlying loop device that forwards it using direct-IO, which allocates memory using GFP_KERNEL (see: do_blockdev_direct_IO()). If allocation fails, memory reclaim will invoke memory shrinker in dm_bufio, dm_bufio_shrink_scan() will be invoked, and since the mutex is already held by P1 the loop thread will hang, and IO will never complete. Resulting in ABBA deadlock.
--- drivers/md/dm-bufio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/md/dm-bufio.c +1 -3
@@ -1599,9 +1599,7 @@ dm_bufio_shrink_scan(struct shrinker *shunsigned long freed; c = container_of(shrink, struct dm_bufio_client, shrinker); -if (sc->gfp_mask & __GFP_FS) -dm_bufio_lock (c); -else if (!dm_bufio_trylock (c)) +if (!dm_bufio_trylock (c))return SHRINK_STOP ; freed =__scan (c, sc->nr_to_scan, sc->gfp_mask);
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. 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/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.2:
12 builds: 12 pass, 0 fail
22 boots: 22 pass, 0 fail
38 tests: 38 pass, 0 failLinux version: 5.2.3-rc1-gdb628fe0e67f
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 23 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. 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/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.2:
Quoted 9 lines
12 builds: 12 pass, 0 fail 22 boots: 22 pass, 0 fail 38 tests: 38 pass, 0 failLinux version: 5.2.3-rc1-gdb628fe0e67f
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra30-cardhu-a04
Great, thanks for testing all of these and letting me know.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. 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/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Regressions detected.
Summary
------------------------------------------------------------------------
kernel: 5.2.3-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.2.y
git commit: db628fe0e67ff8c66e8c6ba76e5e4becfa75fe21
git describe: v5.2.2-414-gdb628fe0e67f
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.2-oe/build/v5.2.2-414-gdb628fe0e67f
Regressions (compared to build v5.2.2)
------------------------------------------------------------------------
x86:
kvm-unit-tests:
* vmx
TESTNAME=vmx TIMEOUT=90s ACCEL= ./x86/run x86/vmx.flat -smp 1 -cpu host,+vmx -append \"-exit_monitor_from_l2_test -ept_access* -vmx_smp* -vmx_vmcs_shadow_test\"
[ 155.670748] kvm [6062]: vcpu0, guest rIP: 0x4050cb kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x1, nop [ 155.681027] kvm [6062]: vcpu0, guest rIP: 0x408911 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x3, nop [ 155.690749] kvm [6062]: vcpu0, guest rIP: 0x40bb39 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x1, nop [ 155.700595] kvm [6062]: vcpu0, guest rIP: 0x4089b2 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x3, nop [ 158.349308] nested_vmx_exit_reflected failed vm entry 7 [ 158.363737] nested_vmx_exit_reflected failed vm entry 7 [ 158.378010] nested_vmx_exit_reflected failed vm entry 7 [ 158.392480] nested_vmx_exit_reflected failed vm entry 7 [ 158.406920] nested_vmx_exit_reflected failed vm entry 7 [ 158.421390] nested_vmx_exit_reflected failed vm entry 7 [ 158.435795] nested_vmx_exit_reflected failed vm entry 7 [ 158.450276] nested_vmx_exit_reflected failed vm entry 7 [ 158.464674] nested_vmx_exit_reflected failed vm entry 7 [ 158.479030] nested_vmx_exit_reflected failed vm entry 7 [ 161.044379] set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.
FAIL vmx (timeout; duration=90s)
kernel-config: http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/intel-corei7-64/lkft/linux-stable-rc-5.2/14/config
Full log: https://lkft.validation.linaro.org/scheduler/job/836289#L1597
No fixes (compared to build v5.2.2)
Ran 22506 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libgpiod
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* network-basic-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-fs-tests
* ltp-open-posix-tests
* kvm-unit-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 64 lines · Anders Roxell
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. 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/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Regressions detected.Summary
------------------------------------------------------------------------kernel: 5.2.3-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.2.y
git commit:db628fe0e67ff8c66e8c6ba76e5e4becfa75fe21
git describe: v5.2.2-414-gdb628fe0e67f
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.2-oe/build/v5.2.2-414-gdb628fe0e67fRegressions (compared to build v5.2.2)
------------------------------------------------------------------------x86:
kvm-unit-tests:
* vmxTESTNAME=vmx TIMEOUT=90s ACCEL= ./x86/run x86/vmx.flat -smp 1 -cpu host,+vmx -append \"-exit_monitor_from_l2_test -ept_access* -vmx_smp* -vmx_vmcs_shadow_test\"
[ 155.670748] kvm [6062]: vcpu0, guest rIP: 0x4050cb kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x1, nop [ 155.681027] kvm [6062]: vcpu0, guest rIP: 0x408911 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x3, nop [ 155.690749] kvm [6062]: vcpu0, guest rIP: 0x40bb39 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x1, nop [ 155.700595] kvm [6062]: vcpu0, guest rIP: 0x4089b2 kvm_set_msr_common: MSR_IA32_DEBUGCTLMSR 0x3, nop [ 158.349308] nested_vmx_exit_reflected failed vm entry 7 [ 158.363737] nested_vmx_exit_reflected failed vm entry 7 [ 158.378010] nested_vmx_exit_reflected failed vm entry 7 [ 158.392480] nested_vmx_exit_reflected failed vm entry 7 [ 158.406920] nested_vmx_exit_reflected failed vm entry 7 [ 158.421390] nested_vmx_exit_reflected failed vm entry 7 [ 158.435795] nested_vmx_exit_reflected failed vm entry 7 [ 158.450276] nested_vmx_exit_reflected failed vm entry 7 [ 158.464674] nested_vmx_exit_reflected failed vm entry 7 [ 158.479030] nested_vmx_exit_reflected failed vm entry 7 [ 161.044379] set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.
Quoted 4 lines
FAIL vmx (timeout; duration=90s)
kernel-config: http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/intel-corei7-64/lkft/linux-stable-rc-5.2/14/config
Full log: https://lkft.validation.linaro.org/scheduler/job/836289#L1597
Ick.
Any chance you can run 'git bisect' to find the offending patch? Or just try reverting a few, you can ignore the ppc ones, so that only leaves you 7 different commits.
Does this same test pass in 5.3-rc1?
thanks,
greg k-h
Quoted 12 lines
Quoted 12 lines
Regressions (compared to build v5.2.2)
------------------------------------------------------------------------x86:
kvm-unit-tests:
* vmxTESTNAME=vmx TIMEOUT=90s ACCEL= ./x86/run x86/vmx.flat -smp 1 -cpu host,+vmx -append \"-exit_monitor_from_l2_test -ept_access* -vmx_smp* -vmx_vmcs_shadow_test\"
[ 155.670748] kvm [6062]: vcpu0, guest rIP: 0x4050cb
...
Quoted 4 lines
Quoted 4 lines
[ 158.479030] nested_vmx_exit_reflected failed vm entry 7 [ 161.044379] set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.FAIL vmx (timeout; duration=90s)
Quoted 8 lines
Quoted 2 lines
kernel-config: http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/intel-corei7-64/lkft/linux-stable-rc-5.2/14/config
Full log: https://lkft.validation.linaro.org/scheduler/job/836289#L1597Ick.
Any chance you can run 'git bisect' to find the offending patch? Or just try reverting a few, you can ignore the ppc ones, so that only leaves you 7 different commits.
We have started 'git bisect' please allow sometime.
Quoted 1 line
Does this same test pass in 5.3-rc1?
yes.
kvm-unit-tests: vmx test getting PASS on 5.3-rc1 mainline kernel [1].
ref:
[1] https://qa-reports.linaro.org/lkft/linux-mainline-oe/tests/kvm-unit-tests/vmx
- Naresh
Quoted 4 lines
thanks,
greg k-h
Quoted 5 lines · Greg Kroah-Hartman
Any chance you can run 'git bisect' to find the offending patch? Or just try reverting a few, you can ignore the ppc ones, so that only leaves you 7 different commits.
Does this same test pass in 5.3-rc1?
Anders, are you running the same kvm-unit-tests commit that passed for 5.2.2? My suspicion is that your previous test didn't have this commit
commit 95d6d2c3228891537ee8e35d2e2984964ee0cf6b
Author: Krish Sadhukhan <[email protected]>
AuthorDate: Fri Jun 28 18:14:47 2019 -0400
Commit: Paolo Bonzini <[email protected]>
CommitDate: Thu Jul 11 14:26:53 2019 +0200
nVMX: Test Host Segment Registers and Descriptor Tables on vmentry of nested guests
since the symptoms match and the corresponding fix was made in 5.3.
I think Linaro's tests would be helped by making kvm-unit-tests.git a submodule of Linux, but I'm a bit wary since it would be the first submodule and I wouldn't know where to put it...
Paolo
Paolo,
Quoted 7 lines · Paolo Bonzini
Quoted 5 lines · Greg Kroah-Hartman
Any chance you can run 'git bisect' to find the offending patch? Or just try reverting a few, you can ignore the ppc ones, so that only leaves you 7 different commits.
Does this same test pass in 5.3-rc1?
Yes. same test pass on 5.3-rc1
kvm unit test always fetching master branch and at tip runs the latest test code on all branches mainline 5.3-rc1 and stable-rc-5.2 branch
Quoted 3 lines
Anders, are you running the same kvm-unit-tests commit that passed for 5.2.2? My suspicion is that your previous test didn't have this commit
No.
I see two extra test code commits for 5.2.3
Re-tested 5.2.2 with tip of kvm unit tests sources and vmx test FAILED [1].
Greg,
This investigation confirms it is a new test code failure on stable-rc 5.2.3
Quoted 1 line
since the symptoms match and the corresponding fix was made in 5.3.
Thanks for your findings.
Quoted 1 line
Paolo
- Naresh
[1] https://lkft.validation.linaro.org/scheduler/job/837811
Quoted 20 lines · Naresh Kamboju
Paolo,
Quoted 7 lines · Paolo Bonzini
Quoted 5 lines · Greg Kroah-Hartman
Any chance you can run 'git bisect' to find the offending patch? Or just try reverting a few, you can ignore the ppc ones, so that only leaves you 7 different commits.
Does this same test pass in 5.3-rc1?
Yes. same test pass on 5.3-rc1
kvm unit test always fetching master branch and at tip runs the latest test code on all branches mainline 5.3-rc1 and stable-rc-5.2 branchQuoted 3 lines
Anders, are you running the same kvm-unit-tests commit that passed for 5.2.2? My suspicion is that your previous test didn't have this commit
Quoted 6 lines
No.
I see two extra test code commits for 5.2.3
Re-tested 5.2.2 with tip of kvm unit tests sources and vmx test FAILED [1].Greg,
This investigation confirms it is a new test code failure on stable-rc 5.2.3
No, it only confirms that kvm-unit-tests/master fails on 5.2.*. To confirm a new failure in 5.2.3 you would need to show a test that passes on 5.2.2 and fails on 5.2.3.
As Paolo suspected, kvm-unit-tests/master fails on 5.2.* and passes if commit 95d6d2c ("nVMX: Test Host Segment Registers and Descriptor Tables on vmentry of nested guests") is reverted (from kvm-unit-tests).
The failures are quite clearly in the new test(s).
PASS: HOST_SEL_CS 8: vmlaunch succeeds
FAIL: HOST_SEL_CS 9: vmlaunch fails
FAIL: HOST_SEL_CS c: vmlaunch fails
PASS: HOST_SEL_SS 10: vmlaunch succeeds
FAIL: HOST_SEL_SS 11: vmlaunch fails
FAIL: HOST_SEL_SS 14: vmlaunch fails
PASS: HOST_SEL_DS 10: vmlaunch succeeds
FAIL: HOST_SEL_DS 11: vmlaunch fails
FAIL: HOST_SEL_DS 14: vmlaunch fails
PASS: HOST_SEL_ES 10: vmlaunch succeeds
FAIL: HOST_SEL_ES 11: vmlaunch fails
FAIL: HOST_SEL_ES 14: vmlaunch fails
PASS: HOST_SEL_FS 10: vmlaunch succeeds
FAIL: HOST_SEL_FS 11: vmlaunch fails
FAIL: HOST_SEL_FS 14: vmlaunch fails
PASS: HOST_SEL_GS 10: vmlaunch succeeds
FAIL: HOST_SEL_GS 11: vmlaunch fails
FAIL: HOST_SEL_GS 14: vmlaunch fails
PASS: HOST_SEL_TR 80: vmlaunch succeeds
FAIL: HOST_SEL_TR 81: vmlaunch fails
KVM: entry failed, hardware error 0x80000021
Quoted 4 lines · Sean Christopherson
Quoted 1 line
This investigation confirms it is a new test code failure on stable-rc 5.2.3
No, it only confirms that kvm-unit-tests/master fails on 5.2.*. To confirm a new failure in 5.2.3 you would need to show a test that passes on 5.2.2 and fails on 5.2.3.
I think he meant "a failure in new test code". :)
Paolo
Quoted 3 lines
As Paolo suspected, kvm-unit-tests/master fails on 5.2.* and passes if commit 95d6d2c ("nVMX: Test Host Segment Registers and Descriptor Tables on vmentry of nested guests") is reverted (from kvm-unit-tests).
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Sean Christopherson
Quoted 1 line
This investigation confirms it is a new test code failure on stable-rc 5.2.3
No, it only confirms that kvm-unit-tests/master fails on 5.2.*. To confirm a new failure in 5.2.3 you would need to show a test that passes on 5.2.2 and fails on 5.2.3.
I think he meant "a failure in new test code". :)
Ah, that does appear to be the case. So just to be clear, we're good, right?
Quoted 10 lines · Sean Christopherson
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Sean Christopherson
Quoted 1 line
This investigation confirms it is a new test code failure on stable-rc 5.2.3
No, it only confirms that kvm-unit-tests/master fails on 5.2.*. To confirm a new failure in 5.2.3 you would need to show a test that passes on 5.2.2 and fails on 5.2.3.
I think he meant "a failure in new test code". :)
Ah, that does appear to be the case. So just to be clear, we're good, right?
Yes. I'm happy to gather ideas on how to avoid this (i.e. 1) if a submodule would be useful; 2) where to stick it).
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · Sean Christopherson
Quoted 6 lines · Paolo Bonzini
Quoted 4 lines · Sean Christopherson
Quoted 1 line
This investigation confirms it is a new test code failure on stable-rc 5.2.3
No, it only confirms that kvm-unit-tests/master fails on 5.2.*. To confirm a new failure in 5.2.3 you would need to show a test that passes on 5.2.2 and fails on 5.2.3.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I think he meant "a failure in new test code". :)
Ah, that does appear to be the case. So just to be clear, we're good, right?
Yes. I'm happy to gather ideas on how to avoid this (i.e. 1) if a submodule would be useful; 2) where to stick it).
Hi!
First, to be clear: from LKFT perspective there are no kernel regressions here.
To your point Paolo - reporting 'fail' because of a missing kernel feature is a generic problem we see across test suites, and causes tons of pain and misery for CI people. As a general rule, I'd avoid submodules, and even branches that track specific kernels. Rather, and I don't know if it's possible in this case, but the best way to manage it from both a test author and a test runner POV is to wrap the test in kernel feature checks, kernel version checks, kernel config checks, etc. Report 'skip' if the environment in which the test is running isn't sufficient to run the test. Then, you only have to maintain one version of the test suite, users can always use the latest, and critically: all failures are actual failures.
Dan
Quoted 2 lines
Paolo
Signature · 1 line
Linaro - Kernel Validation
Quoted 11 lines · Dan Rue
To your point Paolo - reporting 'fail' because of a missing kernel feature is a generic problem we see across test suites, and causes tons of pain and misery for CI people. As a general rule, I'd avoid submodules, and even branches that track specific kernels. Rather, and I don't know if it's possible in this case, but the best way to manage it from both a test author and a test runner POV is to wrap the test in kernel feature checks, kernel version checks, kernel config checks, etc. Report 'skip' if the environment in which the test is running isn't sufficient to run the test. Then, you only have to maintain one version of the test suite, users can always use the latest, and critically: all failures are actual failures.
Note that kvm-unit-tests are not really testing new kernel features; those are covered by tools/testing/selftests/kvm. For some of these kvm-unit-tests there are some CPU features that we can check from the virtual machine, but those are easy to handle and they produce SKIP results just fine.
The problematic ones are tests that cover emulation accuracy. These are effectively bugfixes, so the failures you see _are_ actual failures. At the same time, the bugs are usually inoffensive(*), while the fixes are invasive and a bad source of cause conflicts in older Linux versions. This combines so that backporting to stable is not feasible.
Passing the host kernel version would be really ugly because 1) the tests can run on other hypervisor or emulators or even bare metal, and of course the host kernel version has no bearing if you're using userspace emulation 2) there are thousands of tests that would be littered with kernel version checks of little significance.
So this is why I suggested a submodule: using a submodule effectively ignores all tests that were added after a given Linus release, and thus all the failures for which backports are just not going to happen. However, if Sean's idea of creating a linux-M.N branch in kvm-unit-tests.git works for you, we can also do that as a stopgap measure to ease your testing.
Thanks,
Paolo
(*) if they aren't, we *do* mark them for backport!
Quoted 19 lines · Paolo Bonzini
Quoted 11 lines · Dan Rue
To your point Paolo - reporting 'fail' because of a missing kernel feature is a generic problem we see across test suites, and causes tons of pain and misery for CI people. As a general rule, I'd avoid submodules, and even branches that track specific kernels. Rather, and I don't know if it's possible in this case, but the best way to manage it from both a test author and a test runner POV is to wrap the test in kernel feature checks, kernel version checks, kernel config checks, etc. Report 'skip' if the environment in which the test is running isn't sufficient to run the test. Then, you only have to maintain one version of the test suite, users can always use the latest, and critically: all failures are actual failures.
Note that kvm-unit-tests are not really testing new kernel features; those are covered by
tools/testing/selftests/kvm. For some of these kvm-unit-tests there are some CPU features that we can check from the virtual machine, but those are easy to handle and they produce SKIP results just fine.
Quoted 5 lines
The problematic ones are tests that cover emulation accuracy. These are effectively bugfixes, so the failures you see _are_ actual failures. At the same time, the bugs are usually
inoffensive(*), while the fixes are invasive and a bad source of cause conflicts in older Linux versions. This combines so that backporting to stable is not feasible.
In this case, a fail result seems correct then. The thing we're doing that we need to fix is to run against a pinned version of kvm-unit-tests and upgrade it independently so that we can identify such failures and mark them as known issues.
Quoted 7 lines
Passing the host kernel version would be really ugly because 1) the tests can run on other hypervisor or emulators or even bare metal, and of course the host kernel version has no bearing if you're using userspace emulation 2) there are thousands of tests that would be littered with kernel version checks of little significance.
Quoted 6 lines
So this is why I suggested a submodule: using a submodule effectively ignores all tests that were added after a given Linus release, and thus all the failures for which backports are just not going to happen. However, if Sean's idea of creating a linux-M.N branch in kvm-unit-tests.git works for you, we can also do that as a stopgap measure to ease your testing.
I would still prefer to run the latest tests against all kernel versions (but better control when we upgrade it). Like I said, we can handle expected failures, and it would even help to validate backports for fixes that do get backported. I'm afraid on your behalf that snapping (and maintaining) branches per kernel branch is going to be a lot to manage.
In any case, _thank you so much_ for jumping on this and helping us run these tests. Is there anything else we can do to make this better for you?
Dan
Quoted 6 lines
Thanks,
Paolo
(*) if they aren't, we *do* mark them for backport!
Signature · 1 line
Linaro - Kernel Validation
Quoted 6 lines · Dan Rue
I would still prefer to run the latest tests against all kernel versions (but better control when we upgrade it). Like I said, we can handle expected failures, and it would even help to validate backports for fixes that do get backported. I'm afraid on your behalf that snapping (and maintaining) branches per kernel branch is going to be a lot to manage.
Having the branches would be beneficial for kernel developers as well, e.g. on multiple occasions I've spent time hunting down non-existent KVM bugs, only to realize my base kernel was stale with respect to kvm-unit-tests.
My thought was to have a mostly-unmaintained branch for each major kernel version, e.g. snapshot a working version of kvm_unit_tests when the KVM pull request for the merge window is sent, and for the most part leave it at that. I don't think it would introduce much overhead, but then again, I'm not the person who would be maintaining this :-)
Quoted 12 lines · Sean Christopherson
Quoted 6 lines · Dan Rue
I would still prefer to run the latest tests against all kernel versions (but better control when we upgrade it). Like I said, we can handle expected failures, and it would even help to validate backports for fixes that do get backported. I'm afraid on your behalf that snapping (and maintaining) branches per kernel branch is going to be a lot to manage.
Having the branches would be beneficial for kernel developers as well, e.g. on multiple occasions I've spent time hunting down non-existent KVM bugs, only to realize my base kernel was stale with respect to kvm-unit-tests.
Quoted 6 lines
My thought was to have a mostly-unmaintained branch for each major kernel version, e.g. snapshot a working version of
kvm_unit_testswhen the KVM pull request for the merge window is sent, and for the most part leave it at that. I don't think it would introduce much overhead, but then again, I'm not the person who would be maintaining this :-)
Yes, I agree. Stable backports that have fixes in kvm-unit-tests are relatively rare, so the branch would hardly move after a release is cut.
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · Sean Christopherson
Quoted 6 lines · Paolo Bonzini
Quoted 4 lines · Sean Christopherson
Quoted 1 line
This investigation confirms it is a new test code failure on stable-rc 5.2.3
No, it only confirms that kvm-unit-tests/master fails on 5.2.*. To confirm a new failure in 5.2.3 you would need to show a test that passes on 5.2.2 and fails on 5.2.3.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I think he meant "a failure in new test code". :)
Ah, that does appear to be the case. So just to be clear, we're good, right?
Yes. I'm happy to gather ideas on how to avoid this (i.e. 1) if a submodule would be useful; 2) where to stick it).
As a starting point, what about adding "stable" branches for each kernel release to kvm-unit-tests, e.g. linux-5.2.y? I assume we'd need something similar for the submodules anyways.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. 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/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all of these and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 364 pass: 364 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. 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/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted with no regressions on my system.
Cheers,
Kelsey
Greg Kroah-Hartman
maintainerQuoted 15 lines · Kelsey Skunberg
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.2.3 release. There are 413 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 Fri 26 Jul 2019 07:13:35 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.2.y
and the diffstat can be found below.
Quoted 5 lines
Quoted 3 lines
thanks,
greg k-h
Compiled and booted with no regressions on my system.
Great, thanks for testing and letting me know.
greg k-h
Built and booted on my x86_64 test system. No dmesg regressions.
Thank you
Bharath