Re: [PATCH] slub: Fix sysfs duplicate filename creation when slub_debug=O

2017-11-11 Thread Miles Chen
On Fri, 2017-11-10 at 10:02 -0600, Christopher Lameter wrote: > On Fri, 10 Nov 2017, Miles Chen wrote: > > > By checking disable_higher_order_debug & (slub_debug & > > SLAB_NEVER_MERGE), we can detect if a cache is unmergeable but become > > mergeable because

Re: [RFC/PATCH v3] arm64: define MODULES_VADDR by module_alloc_base

2017-10-19 Thread Miles Chen
On Tue, 2017-10-17 at 15:43 +0100, Will Deacon wrote: > On Wed, Aug 30, 2017 at 07:46:33PM +0800, Miles Chen wrote: > > After the kernel ASLR, the module virtual address is moved to > > [module_alloc_base, module_alloc_base + MODULES_VSIZE). > > However, the MODULES_VADDR

Re: [RFC PATCH] of: make MAX_RESERVED_REGIONS configurable

2018-11-25 Thread Miles Chen
On Sat, 2018-11-24 at 14:56 -0600, Rob Herring wrote: > On Wed, Nov 21, 2018 at 8:51 PM Miles Chen wrote: > > > > On Wed, 2018-11-21 at 10:39 -0600, Rob Herring wrote: > > > On Wed, Nov 21, 2018 at 2:11 AM wrote: > > > > > > > > From: Miles Chen

Re: [RFC PATCH] of: make MAX_RESERVED_REGIONS configurable

2018-11-21 Thread Miles Chen
On Wed, 2018-11-21 at 10:39 -0600, Rob Herring wrote: > On Wed, Nov 21, 2018 at 2:11 AM wrote: > > > > From: Miles Chen > > > > When we use more than 32 entries in /resered-memory, > > there will be an error message: "not enough space all

Re: [RFC PATCH] of: make MAX_RESERVED_REGIONS configurable

2018-11-27 Thread Miles Chen
On Mon, 2018-11-26 at 09:33 +0800, Miles Chen wrote: > On Sat, 2018-11-24 at 14:56 -0600, Rob Herring wrote: > > On Wed, Nov 21, 2018 at 8:51 PM Miles Chen wrote: > > > > > > On Wed, 2018-11-21 at 10:39 -0600, Rob Herring wrote: > > > >

[PATCH] arm64: kaslr: print PHYS_OFFSET in dump_kernel_offset()

2018-12-12 Thread Miles Chen
ed by: echo c > /proc/sysrq-trigger [ 11.996161] SMP: stopping secondary CPUs [ 11.996732] Kernel Offset: 0x252220 from 0xff800800 [ 11.996881] PHYS_OFFSET: 0xffeb4000 Signed-off-by: Miles Chen Tested-by: Miles Chen --- arch/arm64/kernel/setup.c | 1 + 1 file ch

Re: [PATCH] arm64: kaslr: print PHYS_OFFSET in dump_kernel_offset()

2018-12-13 Thread Miles Chen
On Thu, 2018-12-13 at 19:15 +0100, Ard Biesheuvel wrote: > On Thu, 13 Dec 2018 at 19:12, Will Deacon wrote: > > > > [+Ard because I'll basically go with his preference on this one] > > > > On Wed, Dec 12, 2018 at 06:56:49PM +0800, Miles Chen wrote: > > &g

[PATCH] arm64: trap illegal translations in __virt_to_phys()

2019-01-07 Thread Miles Chen
esult: stack addresses: kernel BUG() symbol addresses: kernel warning message Maybe we should trap all non-linear address translations in the future. Signed-off-by: Miles Chen --- arch/arm64/mm/physaddr.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/mm/physaddr.c b/arch/

Re: [PATCH] arm64: trap illegal translations in __virt_to_phys()

2019-01-07 Thread Miles Chen
On Mon, 2019-01-07 at 15:00 +, Mark Rutland wrote: > On Mon, Jan 07, 2019 at 07:21:20PM +0800, Miles Chen wrote: > > Current __virt_to_phys() only print warning messages for non-linear > > addresses. It's hard to catch all warnings by those messages. > > Why? Are yo

[PATCH] tools/vm/page_owner: use page_owner_sort in the use example

2019-01-03 Thread Miles Chen
The example in comment does not useable because the output binary is named "page_owner_sort", not "sort". Also add a reference to Documentation/vm/page_owner.rst Signed-off-by: Miles Chen --- tools/vm/page_owner_sort.c | 4 +++- 1 file changed, 3 insertions(+), 1 delet

Re: [PATCH v3] mm/page_owner: use kvmalloc instead of kmalloc

2018-10-29 Thread Miles Chen
On Mon, 2018-10-29 at 09:17 +0100, Michal Hocko wrote: > On Mon 29-10-18 09:07:08, Michal Hocko wrote: > [...] > > Besides that, the following doesn't make much sense to me. It simply > > makes no sense to use vmalloc for sub page allocation regardless of > > HIGHMEM. > > OK, it is still early mor

Re: [PATCH v3] mm/page_owner: use kvmalloc instead of kmalloc

2018-10-29 Thread Miles Chen
On Tue, 2018-10-30 at 07:06 +0100, Michal Hocko wrote: > On Tue 30-10-18 09:29:10, Miles Chen wrote: > > On Mon, 2018-10-29 at 09:17 +0100, Michal Hocko wrote: > > > On Mon 29-10-18 09:07:08, Michal Hocko wrote: > > > [...] > > > > Besides that, the foll

Re: [PATCH v3] mm/page_owner: use kvmalloc instead of kmalloc

2018-10-31 Thread Miles Chen
On Tue, 2018-10-30 at 09:15 +0100, Michal Hocko wrote: > On Tue 30-10-18 14:55:51, Miles Chen wrote: > [...] > > It's a real problem when using page_owner. > > I found this issue recently: I'm not able to read page_owner information > > during a overnight test.

Re: [PATCH v3] mm/page_owner: use kvmalloc instead of kmalloc

2018-10-31 Thread Miles Chen
On Wed, 2018-10-31 at 11:15 +0100, Michal Hocko wrote: > On Wed 31-10-18 16:47:17, Miles Chen wrote: > > On Tue, 2018-10-30 at 09:15 +0100, Michal Hocko wrote: > > > On Tue 30-10-18 14:55:51, Miles Chen wrote: > > > [...] > > > > It's a real problem

Re: [PATCH v3] mm/page_owner: use kvmalloc instead of kmalloc

2018-11-01 Thread Miles Chen
On Wed, 2018-10-31 at 12:41 +0100, Michal Hocko wrote: > On Wed 31-10-18 18:19:42, Miles Chen wrote: > > On Wed, 2018-10-31 at 11:15 +0100, Michal Hocko wrote: > > > On Wed 31-10-18 16:47:17, Miles Chen wrote: > > > > On Tue, 2018-10-30 at 09:15 +0100, Michal Hocko wr

Re: [PATCH] mm/page_owner: use vmalloc instead of kmalloc

2018-10-26 Thread Miles Chen
On Thu, 2018-10-25 at 11:44 -0700, Joe Perches wrote: > On Fri, 2018-10-26 at 02:34 +0800, miles.c...@mediatek.com wrote: > > From: Miles Chen > > > > The kbuf used by page owner is allocated by kmalloc(), > > which means it can use only normal memory and there mi

Re: [PATCH] mm/page_owner: use vmalloc instead of kmalloc

2018-10-26 Thread Miles Chen
On Thu, 2018-10-25 at 12:27 -0700, Matthew Wilcox wrote: > On Fri, Oct 26, 2018 at 02:34:41AM +0800, miles.c...@mediatek.com wrote: > > The kbuf used by page owner is allocated by kmalloc(), > > which means it can use only normal memory and there might > > be a "out of memory" issue when we're out

[PATCH] net: untag pointer in sockptr_is_kernel

2020-08-11 Thread Miles Chen
From: Miles Chen sockptr_is_kernel() uses (sockptr.kernel >= TASK_SIZE) to tell if the pointer is kernel space or user space. When user space uses the "top byte ignored" feature such as HWAsan, we must untag the pointer before checking against TASK_SIZE. sockptr_is_kernel() will

RE: [PATCH] net: untag pointer in sockptr_is_kernel

2020-08-12 Thread Miles Chen
On Tue, 2020-08-11 at 11:44 +, David Laight wrote: > > On Tue, Aug 11, 2020 at 06:27:04PM +0800, Miles Chen wrote: > > > From: Miles Chen > > > > > > sockptr_is_kernel() uses (sockptr.kernel >= TASK_SIZE) to tell > > > if the pointer is ker

Re: [PATCH] net: untag pointer in sockptr_is_kernel

2020-08-12 Thread Miles Chen
a ("net: optimize the sockptr_t for unified kernel/user address spaces") has been reverted, so I will not sent patch v2 for this build error. Miles > url: > https://github.com/0day-ci/linux/commits/Miles-Chen/net-untag-pointer-in-sockptr_is_kernel/20200811-18303 > bas

[PATCH] proc: use untagged_addr() for pagemap_read addresses

2020-08-03 Thread Miles Chen
When we try to visit the pagemap of a tagged userspace pointer, we find that the start_vaddr is not correct because of the tag. To fix it, we should untag the usespace pointers in pagemap_read(). Signed-off-by: Miles Chen --- fs/proc/task_mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2

Re: [PATCH v2] proc: use untagged_addr() for pagemap_read addresses

2020-12-03 Thread Miles Chen
On Thu, 2020-12-03 at 11:30 +, Catalin Marinas wrote: > On Fri, Nov 27, 2020 at 01:07:38PM +0800, Miles Chen wrote: > > Cc: Will Deacon > > That should be w...@kernel.org. ok, I will fix it and submit v3 > > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.

Re: [PATCH v2] proc: use untagged_addr() for pagemap_read addresses

2020-12-03 Thread Miles Chen
On Thu, 2020-12-03 at 11:45 +, Vincenzo Frascino wrote: > Hi Miles, > > On 11/27/20 5:07 AM, Miles Chen wrote: > > When we try to visit the pagemap of a tagged userspace pointer, we find > > that the start_vaddr is not correct because of the tag. > > To fix it, w

[PATCH v3] proc: use untagged_addr() for pagemap_read addresses

2020-12-03 Thread Miles Chen
test/stressapptest/blob/master/src/os.cc#L158 Cc: Andrew Morton Cc: Alexey Dobriyan Cc: Andrey Konovalov Cc: Alexander Potapenko Cc: Vincenzo Frascino Cc: Andrey Ryabinin Cc: Catalin Marinas Cc: Dmitry Vyukov Cc: Marco Elver Cc: Will Deacon Cc: Eric W. Biederman Cc: Song Bao Hua (Barry

RE: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses

2020-11-25 Thread Miles Chen
On Thu, 2020-11-26 at 07:16 +, Song Bao Hua (Barry Song) wrote: > > > -Original Message- > > From: Miles Chen [mailto:miles.c...@mediatek.com] > > Sent: Monday, November 23, 2020 7:39 PM > > To: Alexey Dobriyan ; Andrew Morton > > > > Cc: l

Re: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses

2020-11-26 Thread Miles Chen
On Tue, 2020-11-24 at 12:32 -0600, Eric W. Biederman wrote: > Miles Chen writes: > > > When we try to visit the pagemap of a tagged userspace pointer, we find > > that the start_vaddr is not correct because of the tag. > > To fix it, we should untag the usespace

Re: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses

2020-11-26 Thread Miles Chen
On Thu, 2020-11-26 at 11:10 +, Catalin Marinas wrote: > Hi Miles, > > Could you please cc me and Andrey Konovalov on future versions of this > patch (if any)? > > On Mon, 23 Nov 2020 at 08:47, Miles Chen wrote: > > When we try to visit the pagemap of a tagged us

[PATCH v2] proc: use untagged_addr() for pagemap_read addresses

2020-11-26 Thread Miles Chen
pptest/stressapptest/blob/master/src/os.cc#L158 Cc: Andrew Morton Cc: Alexey Dobriyan Cc: Andrey Konovalov Cc: Alexander Potapenko Cc: Vincenzo Frascino Cc: Andrey Ryabinin Cc: Catalin Marinas Cc: Dmitry Vyukov Cc: Marco Elver Cc: Will Deacon Cc: Eric W. Biederman Cc: Song Bao Hua (Barry Son

[RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses

2020-11-22 Thread Miles Chen
int len; unsigned long end; ... } ... } [1] https://github.com/stressapptest/stressapptest/blob/master/src/os.cc#L158 Signed-off-by: Miles Chen --- fs/proc/task_mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/proc/ta

Re: [PATCH] arm64/mm: fix virtual address boundary check

2016-02-24 Thread Miles Chen
On Wed, 2016-02-24 at 16:19 +, Catalin Marinas wrote: > On Thu, Feb 25, 2016 at 12:01:48AM +0800, miles.c...@mediatek.com wrote: > > From: Miles Chen > > > > The MODULES_VADDR is not the lowest possible > > kernel virtual address. TASK_SIZE_64 may be la

[PATCH] lib/stackdepot: fix obsolete comments

2019-08-15 Thread Miles Chen
e_stack() is removed in commit 56d8f079c51a ("lib/stackdepot: Remove obsolete functions") Cc: Thomas Gleixner Cc: Alexander Potapenko Cc: Josh Poimboeuf Cc: Greg Kroah-Hartman Cc: Kate Stewart Signed-off-by: Miles Chen --- lib/stackdepot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 delet

[PATCH] shmem: fix obsolete comment in shmem_getpage_gfp()

2019-08-16 Thread Miles Chen
ype sgp, gfp_t gfp, struct vm_area_struct *vma, struct vm_fault *vmf, vm_fault_t *fault_type); Signed-off-by: Miles Chen --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 2bed4761f279..fed9ebea316c 10

[RESEND PATCH v4] checkpatch: add several Kconfig default value tests

2019-08-27 Thread Miles Chen
efault y if PPC_POWERNV default !EXPERT => no change default EXPERT => no change Change since v1: discourage default n$ discourage default "[ynm]" discourage default \!?EXPERT Change since v2: (Joe has provided the whole patch and I just post it) test Kconfig in a single block print prec

[PATCH] psi: put NULL char correctly in psi_write()

2019-09-12 Thread Miles Chen
ize=32 [ 9965.715096] 123456789|123456789|123456789|1 (print 31 chars) %sh: write error: Invalid argument Signed-off-by: Miles Chen --- kernel/sched/psi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 6e52b67b420e..517e3719027

[PATCH] mm/page_owner: fix incorrect looping in __set_page_owner_handle()

2019-10-04 Thread Miles Chen
0) } Cc: Andrew Morton Cc: Vlastimil Babka Cc: Michal Hocko Signed-off-by: Miles Chen Fixes: 7e2f2a0cd17c ("mm, page_owner: record page owner for each subpage") --- mm/page_owner.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c in

Re: [PATCH] mm/page_owner: fix incorrect looping in __set_page_owner_handle()

2019-10-04 Thread Miles Chen
On Fri, 2019-10-04 at 09:57 +0200, Vlastimil Babka wrote: > On 10/4/19 9:37 AM, Miles Chen wrote: > > In __set_page_owner_handle(), we should loop over page > > [0...(1 << order) - 1] and setup their page_owner structures. > > > > Currently, __set_page_owner_handl

[PATCH] mm: slub: print_hex_dump() with DUMP_PREFIX_OFFSET

2019-09-20 Thread Miles Chen
le Linux kernel. $ git grep 'DUMP_PREFIX_ADDRESS' | cut -f1 -d"/" | sort | uniq -c 3 arch 140 drivers 12 fs 1 include 5 lib 2 mm Signed-off-by: Miles Chen --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 8834563cdb4b..

[PATCH v2] mm: slub: print the offset of fault addresses

2019-09-25 Thread Miles Chen
useful 2. print the offset of the fault address Cc: Christoph Lameter Cc: Matthew Wilcox Cc: David Rientjes Signed-off-by: Miles Chen --- mm/slub.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 42c1b3af3c98..21d26cd3e3bc 100644 --- a/mm/sl

Re: [PATCH] mm: slub: print_hex_dump() with DUMP_PREFIX_OFFSET

2019-09-22 Thread Miles Chen
On Sat, 2019-09-21 at 02:08 -0700, David Rientjes wrote: > On Fri, 20 Sep 2019, Miles Chen wrote: > > > Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), > > The use DUMP_PREFIX_OFFSET instead of DUMP_PREFIX_ADDRESS with > > print_h

Re: [PATCH] mm: slub: print_hex_dump() with DUMP_PREFIX_OFFSET

2019-09-22 Thread Miles Chen
On Sat, 2019-09-21 at 09:00 -0700, Matthew Wilcox wrote: > On Sat, Sep 21, 2019 at 02:08:59AM -0700, David Rientjes wrote: > > On Fri, 20 Sep 2019, Miles Chen wrote: > > > > > Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), > >

[PATCH] mm: fix outdated comment in page_get_anon_vma()

2019-10-17 Thread Miles Chen
Replace DESTROY_BY_RCU with SLAB_TYPESAFE_BY_RCU because SLAB_DESTROY_BY_RCU has been renamed to SLAB_TYPESAFE_BY_RCU by commit 5f0d5a3ae7cf ("mm: Rename SLAB_DESTROY_BY_RCU to SLAB_TYPESAFE_BY_RCU") Signed-off-by: Miles Chen --- mm/rmap.c | 7 --- 1 file changed, 4 insert

Re: [PATCH v2] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-26 Thread Miles Chen
On Fri, 2019-07-26 at 14:55 +0200, Michal Hocko wrote: > On Fri 26-07-19 14:49:33, Michal Hocko wrote: > > On Fri 26-07-19 10:12:47, Miles Chen wrote: > > > This patch is sent to report an use after free in mem_cgroup_iter() > > > after merging commit: be2657752e9e &qu

[PATCH v3] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-26 Thread Miles Chen
root_mem_cgroup.nodeinfo.iter in invalidate_reclaim_iterators(). Change since v1: Add a comment to explain why we need to handle root_mem_cgroup separately. Rename invalid_root to invalidate_root. Change since v2: add fix tag Fixes: 5ac8fb31ad2e ("mm: memcontrol: convert reclaim iterator to sim

Re: [PATCH v2] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-26 Thread Miles Chen
On Sat, 2019-07-27 at 07:47 +0800, Miles Chen wrote: > On Fri, 2019-07-26 at 14:55 +0200, Michal Hocko wrote: > > On Fri 26-07-19 14:49:33, Michal Hocko wrote: > > > On Fri 26-07-19 10:12:47, Miles Chen wrote: > > > > This patch is sent to report an use

Re: [PATCH] mm/slub: use WARN_ON() for some slab errors

2019-01-21 Thread Miles Chen
On Mon, 2019-01-21 at 22:02 +, Christopher Lameter wrote: > On Mon, 21 Jan 2019, miles.c...@mediatek.com wrote: > > > From: Miles Chen > > > > When debugging with slub.c, sometimes we have to trigger a panic in > > order to get the coredump file. To do that

Re: [PATCH v2] mm/slub: introduce SLAB_WARN_ON_ERROR

2019-01-28 Thread Miles Chen
On Mon, 2019-01-28 at 17:41 -0800, David Rientjes wrote: > On Thu, 24 Jan 2019, miles.c...@mediatek.com wrote: > > > From: Miles Chen > > > > When debugging slab errors in slub.c, sometimes we have to trigger > > a panic in order to get the cor

Re: [PATCH v2] mm/slub: introduce SLAB_WARN_ON_ERROR

2019-01-28 Thread Miles Chen
On Tue, 2019-01-29 at 05:46 +, Christopher Lameter wrote: > On Mon, 28 Jan 2019, Andrew Morton wrote: > > > > When debugging slab errors in slub.c, sometimes we have to trigger > > > a panic in order to get the coredump file. Add a debug option > > > SLAB_WARN_ON_ERROR to toggle WARN_ON() when

Re: [PATCH v2] mm/slub: introduce SLAB_WARN_ON_ERROR

2019-01-29 Thread Miles Chen
On Tue, 2019-01-29 at 19:46 +, Christopher Lameter wrote: > On Tue, 29 Jan 2019, Miles Chen wrote: > > > a) classic slub issue. e.g., use-after-free, redzone overwritten. It's > > more efficient to report a issue as soon as slub detects it. (comparing > > to moni

[PATCH] arm64: mm: make CONFIG_ZONE_DMA32 configurable

2019-05-27 Thread Miles Chen
CONFIG_NUMA=y and CONFIG_ZONE_DMA32=n. arch/arm64/mm/init.c:195:17: error: use of undeclared identifier 'ZONE_DMA32' max_zone_pfns[ZONE_DMA32] = PFN_DOWN(max_zone_dma_phys()); Signed-off-by: Miles Chen --- arch/arm64/Kconfig | 3 ++- arch/arm64/mm/init.c | 2 ++ 2 fil

Re: [RFC PATCH v2] mm: slub: print kernel addresses in slub debug messages

2019-08-09 Thread Miles Chen
On Thu, 2019-08-08 at 19:46 -0700, Matthew Wilcox wrote: > On Fri, Aug 09, 2019 at 09:08:37AM +0800, miles.c...@mediatek.com wrote: > > Possible approaches are: > > 1. stop printing kernel addresses > > 2. print with %pK, > > 3. print with %px. > > No. The point of obscuring kernel addresses is t

Re: [RFC PATCH v2] mm: slub: print kernel addresses in slub debug messages

2019-08-12 Thread Miles Chen
On Fri, 2019-08-09 at 07:26 -0700, Matthew Wilcox wrote: > On Fri, Aug 09, 2019 at 10:11:58PM +0800, Miles Chen wrote: > > On Thu, 2019-08-08 at 19:46 -0700, Matthew Wilcox wrote: > > > On Fri, Aug 09, 2019 at 09:08:37AM +0800, miles.c...@mediatek.com wrote: > > > >

[PATCH v3] checkpatch: add several Kconfig default value tests

2019-07-31 Thread Miles Chen
ERT default "y" if PPC_POWERNV => default y if PPC_POWERNV default !EXPERT => no change default EXPERT => no change Change since v1: discourage default n$ discourage default "[ynm]" discourage default \!?EXPERT Change since v2: test Kconfig in a single block print prec

Re: linux-next: build warning after merge of the akpm-current tree

2019-07-31 Thread Miles Chen
On Thu, 2019-08-01 at 08:15 +0200, Michal Hocko wrote: > On Thu 01-08-19 15:51:30, Stephen Rothwell wrote: > > Hi Miles, > > > > On Wed, 31 Jul 2019 14:28:04 +0800 Miles Chen > > wrote: > > > > > > On Wed, 2019-07-31 at 16:11 +1000, Stephen Rothw

Re: linux-next: build warning after merge of the akpm-current tree

2019-07-31 Thread Miles Chen
On Thu, 2019-08-01 at 16:39 +1000, Stephen Rothwell wrote: > Hi Miles, > > On Thu, 1 Aug 2019 14:30:03 +0800 Miles Chen wrote: > > > > It's the first time that I receive a build warning after the patch has > > been merged to -mm tree. The build warning had been

[PATCH v2] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-25 Thread Miles Chen
root_mem_cgroup.nodeinfo.iter in invalidate_reclaim_iterators(). Change since v1: Add a comment to explain why we need to handle root_mem_cgroup separately. Rename invalid_root to invalidate_root. Cc: Johannes Weiner Signed-off-by: Miles Chen --- mm/memcontrol.c | 38

Re: [PATCH v2] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-26 Thread Miles Chen
Hi Johannes, I post patch v2 with proper comment you mentioned. (I am not sure if I can copy your acked-by to patch v2 directly) Miles On Fri, 2019-07-26 at 10:12 +0800, Miles Chen wrote: > This patch is sent to report an use after free in mem_cgroup_iter() > after merging commit: be2657

[PATCH] arm64: mm: print hexadecimal EC value in mem_abort_decode()

2019-08-06 Thread Miles Chen
eption class = DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x0046 CM = 0, WnR = 1 Cc: Mark Rutland Cc: Anshuman Khandual Cc: James Morse Signed-off-by: Miles Chen --- arch/arm64/mm/fault.c | 4 ++-- 1 file changed, 2 inser

Re: [PATCH v2] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-29 Thread Miles Chen
On Mon, 2019-07-29 at 12:06 -0400, Johannes Weiner wrote: > On Fri, Jul 26, 2019 at 10:12:47AM +0800, Miles Chen wrote: > > This patch is sent to report an use after free in mem_cgroup_iter() > > after merging commit: be2657752e9e "mm: memcg: fix use after free in

[PATCH v4] mm: memcontrol: fix use after free in mem_cgroup_iter()

2019-07-29 Thread Miles Chen
code easier to read Fixes: 5ac8fb31ad2e ("mm: memcontrol: convert reclaim iterator to simple css refcounting") Cc: Johannes Weiner Cc: Michal Hocko Signed-off-by: Miles Chen --- mm/memcontrol.c | 39 +-- 1 file changed, 29 insertions(+), 10 deletion

Re: linux-next: build warning after merge of the akpm-current tree

2019-07-30 Thread Miles Chen
On Wed, 2019-07-31 at 16:11 +1000, Stephen Rothwell wrote: > Hi all, > > After merging the akpm-current tree, today's linux-next build (powerpc > ppc64_defconfig) produced this warning: > > mm/memcontrol.c: In function 'invalidate_reclaim_iterators': > mm/memcontrol.c:1160:11: warning: suggest pa

Re: [PATCH] arm64: mm: print hexadecimal EC value in mem_abort_decode()

2019-08-06 Thread Miles Chen
On Tue, 2019-08-06 at 13:34 +0100, Mark Rutland wrote: > On Tue, Aug 06, 2019 at 07:29:48PM +0800, Miles Chen wrote: > > This change prints the hexadecimal EC value in mem_abort_decode(), > > which makes it easier to lookup the corresponding EC in > > the ARM Architec

[PATCH v2] arm64: mm: print hexadecimal EC value in mem_abort_decode()

2019-08-06 Thread Miles Chen
T (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x0046 CM = 0, WnR = 1 Change since v1: print "EC" instead of "Exception class" print EC in fixwidth Cc: Mark Rutland Cc: Anshuman Khandual Cc: James Morse Signed-

Re: [PATCH v2] arm64: mm: print hexadecimal EC value in mem_abort_decode()

2019-08-07 Thread Miles Chen
On Thu, 2019-08-08 at 11:19 +0530, Anshuman Khandual wrote: > > On 08/07/2019 06:03 AM, Miles Chen wrote: > > This change prints the hexadecimal EC value in mem_abort_decode(), > > which makes it easier to lookup the corresponding EC in > > the ARM Architecture Refere

[PATCH v3] arm64: mm: print hexadecimal EC value in mem_abort_decode()

2019-08-07 Thread Miles Chen
ed the suggestion in v1 add reviewed-by tag from Anshuman in v2 Acked-by: Mark Rutland Reviewed-by: Anshuman Khandual Cc: Mark Rutland Cc: Anshuman Khandual Cc: James Morse Signed-off-by: Miles Chen --- arch/arm64/mm/fault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --g

Re: [PATCH v2] arm64: mm: print hexadecimal EC value in mem_abort_decode()

2019-08-07 Thread Miles Chen
On Thu, 2019-08-08 at 11:51 +0530, Anshuman Khandual wrote: > > On 08/08/2019 11:31 AM, Miles Chen wrote: > > On Thu, 2019-08-08 at 11:19 +0530, Anshuman Khandual wrote: > >> > >> On 08/07/2019 06:03 AM, Miles Chen wrote: > >>> This change prints th

[PATCH] checkpatch: avoid default n

2019-07-03 Thread Miles Chen
This change reports a warning when "default n" is used. I have seen several "remove default n" patches, so I think it might be helpful to add this test in checkpatch. tested: WARNING: 'default n' is the default value, no need to write it explicitly. + defaul

Re: [PATCH] checkpatch: avoid default n

2019-07-03 Thread Miles Chen
On Wed, 2019-07-03 at 01:42 -0700, Joe Perches wrote: > On Wed, 2019-07-03 at 16:30 +0800, Miles Chen wrote: > > This change reports a warning when "default n" is used. > > > > I have seen several "remove default n" patches, so I think > > it

Re: [PATCH] checkpatch: avoid default n

2019-07-03 Thread Miles Chen
On Wed, 2019-07-03 at 08:37 -0700, Joe Perches wrote: > On Wed, 2019-07-03 at 17:03 +0800, Yingjoe Chen wrote: > > On Wed, 2019-07-03 at 01:42 -0700, Joe Perches wrote: > > > On Wed, 2019-07-03 at 16:30 +0800, Miles Chen wrote: > > > > This change reports a wa

[PATCH v2] checkpatch: add several Kconfig default value tests

2019-07-04 Thread Miles Chen
ead of default "[ynm]" + default "y" if PPC_POWERNV Change since v1: discourage default n$ discourage default "[ynm]" discourage default \!?EXPERT Cc: Joe Perches Cc: Yingjoe Chen Signed-off-by: Miles Chen --- scripts/checkpatch.pl | 21

Re: [PATCH v2] checkpatch: add several Kconfig default value tests

2019-07-04 Thread Miles Chen
On Thu, 2019-07-04 at 11:49 -0700, Joe Perches wrote: > On Thu, 2019-07-04 at 17:40 +0800, Miles Chen wrote: > > This change adds 3 Kconfig default value tests: > [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -300

[PATCH v3] checkpatch: add several Kconfig default value tests

2019-07-04 Thread Miles Chen
efault y if PPC_POWERNV default !EXPERT => no change default EXPERT => no change Change since v1: discourage default n$ discourage default "[ynm]" discourage default \!?EXPERT Change since v2: (Joe has provided the whole patch and I just post it) test Kconfig in a single block p

Re: [PATCH v3] checkpatch: add several Kconfig default value tests

2019-07-19 Thread Miles Chen
On Fri, 2019-07-05 at 11:16 +0800, Miles Chen wrote: > This change adds 3 Kconfig default value tests. Hi Joe, I was wondering if this patch looks good to you? Miles > > 1. discourage default n cases: > e.g., > default n > > 2. discourage default "[ynm]" cases:

Re: [PATCH] arm64: trap illegal translations in __virt_to_phys()

2019-01-08 Thread Miles Chen
On Tue, 2019-01-08 at 12:14 +, Mark Rutland wrote: > On Tue, Jan 08, 2019 at 11:24:43AM +0800, Miles Chen wrote: > > On Mon, 2019-01-07 at 15:00 +, Mark Rutland wrote: > > > On Mon, Jan 07, 2019 at 07:21:20PM +0800, Miles Chen wrote: > > > > Current __vir

[PATCH] arm64: setup min_low_pfn

2019-03-20 Thread Miles Chen
/0x1068 __alloc_pages_nodemask+0xd4/0xcb8 shmem_alloc_page+0x7c/0xa0 shmem_alloc_and_acct_page+0x124/0x1e8 shmem_getpage_gfp.isra.7+0x118/0x878 shmem_write_begin+0x38/0x68 Signed-off-by: Miles Chen --- arch/arm64/mm/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/mm/init.c b/arch

[PATCH] mm/memblock.c: remove unnecessary log and clean up

2017-01-17 Thread Miles Chen
There is no variable named flags in memblock_add() and memblock_reserve() so remove it from the log messages. This patch also cleans up the type casting for phys_addr_t by using %pa to print them. Signed-off-by: Miles Chen --- mm/memblock.c | 54

Re: [PATCH] checkpatch: update $logFunctions

2017-01-15 Thread Miles Chen
On Fri, 2017-01-13 at 00:14 -0800, Joe Perches wrote: > On Fri, 2017-01-13 at 15:38 +0800, miles.c...@mediatek.com wrote: > > From: Miles Chen > > > > Currently checkpatch.pl does not recognize printk_deferred* functions as > > log functions and complains about the lin

[PATCH] dma-debug: add comment for failed to check map error

2017-01-16 Thread Miles Chen
Add comment for failed to check map error to help driver developers. Signed-off-by: Miles Chen --- lib/dma-debug.c | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 8971370..60c57ec 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -1155,6

Re: [PATCH v2] arm64: use is_vmalloc_addr

2017-02-13 Thread Miles Chen
On Mon, 2017-02-13 at 06:20 +0100, Andreas Färber wrote: > Hi, > > Am 09.02.2017 um 12:45 schrieb Miles Chen: > > To is_vmalloc_addr() to check if an address is a vmalloc address > > "Use ..."? Yes, it should be "Use". I'll send another patch to fix

[PATCH v3] arm64: use is_vmalloc_addr

2017-02-13 Thread Miles Chen
Use is_vmalloc_addr() to check if an address is a vmalloc address instead of checking VMALLOC_START and VMALLOC_END manually. Signed-off-by: Miles Chen --- arch/arm64/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm

[PATCH] arm64: dump: hide kernel pointers

2017-02-27 Thread Miles Chen
... Signed-off-by: Miles Chen --- arch/arm64/mm/dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index ca74a2a..e055ecf 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c @@ -253,8 +253,8 @@ static void note_page

[PATCH] arm64: use linux/sizes.h for constants

2017-02-08 Thread Miles Chen
Use linux/size.h to improve code readability. Signed-off-by: Miles Chen --- arch/arm64/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index a3a2816..aaac783 100644 --- a/arch/arm64/kernel

[PATCH] arm64: use is_vmalloc_addr

2017-02-08 Thread Miles Chen
To is_vmalloc_addr() to check if an address is a vmalloc address instead of checking VMALLOC_START and VMALLOC_END manually. Signed-off-by: Miles Chen --- arch/arm64/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm

[PATCH] mm: cleanups for printing phys_addr_t and dma_addr_t

2017-02-08 Thread Miles Chen
cleanup rest of dma_addr_t and phys_addr_t type casting in mm use %pad for dma_addr_t use %pa for phys_addr_t Signed-off-by: Miles Chen --- mm/dmapool.c | 16 mm/vmalloc.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index

Re: [PATCH] arm64: use is_vmalloc_addr

2017-02-09 Thread Miles Chen
e system] > > url: > https://github.com/0day-ci/linux/commits/Miles-Chen/arm64-use-is_vmalloc_addr/20170209-103100 > base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git > for-next/core > config: arm64-defconfig (attached as .config) > compiler: aarch

[PATCH v2] arm64: use is_vmalloc_addr

2017-02-09 Thread Miles Chen
To is_vmalloc_addr() to check if an address is a vmalloc address instead of checking VMALLOC_START and VMALLOC_END manually. Signed-off-by: Miles Chen --- arch/arm64/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm

[PATCH 3/4] arm64: dts: mt8173: add mediatek,infracfg to iommu

2020-07-02 Thread Miles Chen
Add mediatek,infracfg to iommu node. Signed-off-by: Miles Chen --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi index 70b1ffcab7f0..a6f14f68ef7e 100644 --- a/arch

[PATCH 1/4] dt-bindings: mediatek: add mediatek,infracfg phandle

2020-07-02 Thread Miles Chen
Add a description for mediatek,infracfg. We can check if 4GB mode is enable by reading it instead of checking the unexported symbol "max_pfn". This is a step towards building mtk_iommu as a kernel module. Cc: Yong Wu Signed-off-by: Miles Chen --- Documentation/devicetree/bind

[PATCH 2/4] arm64: dts: mt2712: add mediatek,infracfg to iommu

2020-07-02 Thread Miles Chen
Add mediatek,infracfg to iommu node. Signed-off-by: Miles Chen --- arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi index db17d0a4ed57..0749b0f4834c 100644 --- a

[PATCH 4/4] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-02 Thread Miles Chen
/136 Cc: Mike Rapoport Cc: David Hildenbrand Cc: Yong Wu Cc: Yingjoe Chen Cc: Christoph Hellwig Signed-off-by: Miles Chen --- drivers/iommu/mtk_iommu.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu

Re: [PATCH] Fix unwind_frame for clang-built kernels

2020-06-18 Thread Miles Chen
e pin > this down, even if we had to change LLVM. Just providing additional > context for folks on the thread. > > This should also have a reported by tag from Miles, in v2. > > Reported-by: Miles Chen > > Miles mentioned to me that he tested it, but maybe Miles can confirm >

[RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-26 Thread Miles Chen
: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Signed-off-by: Miles Chen --- Change since v3 - use lore.kernel.org links - move "change since..." after "---" Change since v2: - determine compatible string by m4u_plat - rebase to next-20200720 - add "---"

[PATCH] mm/memblock: export max_pfn for kernel modules

2020-06-03 Thread Miles Chen
max_pfn is uesd to get the highest pfn in the system. Drivers like drivers/iommu/mtk_iommu.c checks max_pfn to see if it should enable its "4GB mode". This patch exports the max_pfn symbol, so we can build the driver as a kernel module. Signed-off-by: Miles Chen --- mm/memblock.c | 1

Re: [PATCH] mm/memblock: export max_pfn for kernel modules

2020-06-03 Thread Miles Chen
On Wed, 2020-06-03 at 20:06 +0300, Mike Rapoport wrote: > On Thu, Jun 04, 2020 at 12:11:32AM +0800, Miles Chen wrote: > > max_pfn is uesd to get the highest pfn in the system. Drivers like > > drivers/iommu/mtk_iommu.c checks max_pfn to see if it should enable > > its &quo

Re: [PATCH] mm/memblock: export max_pfn for kernel modules

2020-06-03 Thread Miles Chen
On Wed, 2020-06-03 at 18:16 +0200, David Hildenbrand wrote: > On 03.06.20 18:11, Miles Chen wrote: > > max_pfn is uesd to get the highest pfn in the system. Drivers like > > drivers/iommu/mtk_iommu.c checks max_pfn to see if it should enable > > its "4GB mode".

[PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB

2020-06-04 Thread Miles Chen
To build this driver as a kernel module, we cannot use the unexported symbol "max_pfn" to setup enable_4GB. Use totalram_pages() instead to setup enable_4GB. Suggested-by: Mike Rapoport Signed-off-by: Miles Chen Cc: David Hildenbrand Cc: Yong Wu Cc: Chao Hao --- drivers/iommu/m

Re: [PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB

2020-06-04 Thread Miles Chen
On Thu, 2020-06-04 at 10:25 +0200, David Hildenbrand wrote: > On 04.06.20 10:01, Miles Chen wrote: > > To build this driver as a kernel module, we cannot use > > the unexported symbol "max_pfn" to setup enable_4GB. > > > > Use totalram_pages() instead to se

[PATCH] dm: replace strncpy() with strscpy()

2020-05-15 Thread Miles Chen
Replace strncpy() with strscpy() to guarantee a NULL-terminated string. Detected by Coverity. Signed-off-by: Miles Chen --- drivers/md/dm-ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index ac83f5002ce5..4dc3658e3351

Re: [RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-29 Thread Miles Chen
On Thu, 2020-08-27 at 20:27 +0100, Robin Murphy wrote: > On 2020-08-27 06:31, Yong Wu wrote: > > On Wed, 2020-08-26 at 16:56 +0800, Miles Chen wrote: > >> In previous discussion [1] and [2], we found that it is risky to > >> use max_pfn or totalram_pages to

Re: [PATCH v5] iommu/mediatek: check 4GB mode by reading infracfg

2020-09-04 Thread Miles Chen
On Fri, 2020-09-04 at 11:42 +0200, Joerg Roedel wrote: > On Mon, Aug 31, 2020 at 06:56:39PM +0800, Miles Chen wrote: > > In previous discussion [1] and [2], we found that it is risky to > > use max_pfn or totalram_pages to tell if 4GB mode is enabled. > > > > Check 4

[RESEND PATCHv5] iommu/mediatek: check 4GB mode by reading infracfg

2020-09-04 Thread Miles Chen
: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Cc: Joerg Roedel Reviewed-by: Matthias Brugger Signed-off-by: Miles Chen --- Change since v4 - remove unnecessary data->enable_4GB = false, since it is kzalloc()ed. Change since v3 - use lore.kernel.org links - move "change since..

  1   2   >