All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens.net>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Steven Price <steven.price@arm.com>,
	akpm@linux-foundation.org
Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 4/5] mm: ptdump: Support hugepd table entries
Date: Fri, 16 Apr 2021 09:29:20 +1000	[thread overview]
Message-ID: <87zgxzyvn3.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <f41a177a0fd5a71db616e586a9ec5c51102c6656.1618506910.git.christophe.leroy@csgroup.eu>

Hi Christophe,

> Which hugepd, page table entries can be at any level
> and can be of any size.
>
> Add support for them.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  mm/ptdump.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/mm/ptdump.c b/mm/ptdump.c
> index 61cd16afb1c8..6efdb8c15a7d 100644
> --- a/mm/ptdump.c
> +++ b/mm/ptdump.c
> @@ -112,11 +112,24 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr,
>  {
>  	struct ptdump_state *st = walk->private;
>  	pte_t val = ptep_get(pte);
> +	unsigned long page_size = next - addr;
> +	int level;
> +
> +	if (page_size >= PGDIR_SIZE)
> +		level = 0;
> +	else if (page_size >= P4D_SIZE)
> +		level = 1;
> +	else if (page_size >= PUD_SIZE)
> +		level = 2;
> +	else if (page_size >= PMD_SIZE)
> +		level = 3;
> +	else
> +		level = 4;
>  
>  	if (st->effective_prot)
> -		st->effective_prot(st, 4, pte_val(val));
> +		st->effective_prot(st, level, pte_val(val));
>  
> -	st->note_page(st, addr, 4, pte_val(val), PAGE_SIZE);
> +	st->note_page(st, addr, level, pte_val(val), page_size);

It seems to me that passing both level and page_size is a bit redundant,
but I guess it does reduce the impact on each arch's code?

Kind regards,
Daniel

>  
>  	return 0;
>  }
> -- 
> 2.25.0

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Axtens <dja@axtens.net>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Steven Price <steven.price@arm.com>,
	akpm@linux-foundation.org
Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 4/5] mm: ptdump: Support hugepd table entries
Date: Fri, 16 Apr 2021 09:29:20 +1000	[thread overview]
Message-ID: <87zgxzyvn3.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <f41a177a0fd5a71db616e586a9ec5c51102c6656.1618506910.git.christophe.leroy@csgroup.eu>

Hi Christophe,

> Which hugepd, page table entries can be at any level
> and can be of any size.
>
> Add support for them.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  mm/ptdump.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/mm/ptdump.c b/mm/ptdump.c
> index 61cd16afb1c8..6efdb8c15a7d 100644
> --- a/mm/ptdump.c
> +++ b/mm/ptdump.c
> @@ -112,11 +112,24 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr,
>  {
>  	struct ptdump_state *st = walk->private;
>  	pte_t val = ptep_get(pte);
> +	unsigned long page_size = next - addr;
> +	int level;
> +
> +	if (page_size >= PGDIR_SIZE)
> +		level = 0;
> +	else if (page_size >= P4D_SIZE)
> +		level = 1;
> +	else if (page_size >= PUD_SIZE)
> +		level = 2;
> +	else if (page_size >= PMD_SIZE)
> +		level = 3;
> +	else
> +		level = 4;
>  
>  	if (st->effective_prot)
> -		st->effective_prot(st, 4, pte_val(val));
> +		st->effective_prot(st, level, pte_val(val));
>  
> -	st->note_page(st, addr, 4, pte_val(val), PAGE_SIZE);
> +	st->note_page(st, addr, level, pte_val(val), page_size);

It seems to me that passing both level and page_size is a bit redundant,
but I guess it does reduce the impact on each arch's code?

Kind regards,
Daniel

>  
>  	return 0;
>  }
> -- 
> 2.25.0

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Axtens <dja@axtens.net>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Steven Price <steven.price@arm.com>,
	akpm@linux-foundation.org
Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 4/5] mm: ptdump: Support hugepd table entries
Date: Fri, 16 Apr 2021 09:29:20 +1000	[thread overview]
Message-ID: <87zgxzyvn3.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <f41a177a0fd5a71db616e586a9ec5c51102c6656.1618506910.git.christophe.leroy@csgroup.eu>

Hi Christophe,

> Which hugepd, page table entries can be at any level
> and can be of any size.
>
> Add support for them.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  mm/ptdump.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/mm/ptdump.c b/mm/ptdump.c
> index 61cd16afb1c8..6efdb8c15a7d 100644
> --- a/mm/ptdump.c
> +++ b/mm/ptdump.c
> @@ -112,11 +112,24 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr,
>  {
>  	struct ptdump_state *st = walk->private;
>  	pte_t val = ptep_get(pte);
> +	unsigned long page_size = next - addr;
> +	int level;
> +
> +	if (page_size >= PGDIR_SIZE)
> +		level = 0;
> +	else if (page_size >= P4D_SIZE)
> +		level = 1;
> +	else if (page_size >= PUD_SIZE)
> +		level = 2;
> +	else if (page_size >= PMD_SIZE)
> +		level = 3;
> +	else
> +		level = 4;
>  
>  	if (st->effective_prot)
> -		st->effective_prot(st, 4, pte_val(val));
> +		st->effective_prot(st, level, pte_val(val));
>  
> -	st->note_page(st, addr, 4, pte_val(val), PAGE_SIZE);
> +	st->note_page(st, addr, level, pte_val(val), page_size);

It seems to me that passing both level and page_size is a bit redundant,
but I guess it does reduce the impact on each arch's code?

Kind regards,
Daniel

>  
>  	return 0;
>  }
> -- 
> 2.25.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-04-15 23:29 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 17:18 [PATCH v1 0/5] Convert powerpc to GENERIC_PTDUMP Christophe Leroy
2021-04-15 17:18 ` Christophe Leroy
2021-04-15 17:18 ` Christophe Leroy
2021-04-15 17:18 ` Christophe Leroy
2021-04-15 17:18 ` [PATCH v1 1/5] mm: pagewalk: Fix walk for hugepage tables Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 22:43   ` Daniel Axtens
2021-04-15 22:43     ` Daniel Axtens
2021-04-15 22:43     ` Daniel Axtens
2021-04-15 22:43     ` Daniel Axtens
2021-04-16  5:48     ` Christophe Leroy
2021-04-16  5:48       ` Christophe Leroy
2021-04-16  5:48       ` Christophe Leroy
2021-04-16  5:48       ` Christophe Leroy
2021-04-15 17:18 ` [PATCH v1 2/5] mm: ptdump: Fix build failure Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18 ` [PATCH v1 3/5] mm: ptdump: Provide page size to notepage() Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 23:12   ` Daniel Axtens
2021-04-15 23:12     ` Daniel Axtens
2021-04-15 23:12     ` Daniel Axtens
2021-04-15 23:12     ` Daniel Axtens
2021-04-16  5:19     ` Christophe Leroy
2021-04-16  5:19       ` Christophe Leroy
2021-04-16  5:19       ` Christophe Leroy
2021-04-16  5:19       ` Christophe Leroy
2021-04-16  9:28   ` Steven Price
2021-04-16  9:28     ` Steven Price
2021-04-16  9:28     ` Steven Price
2021-04-16  9:28     ` Steven Price
2021-04-16 10:38     ` Christophe Leroy
2021-04-16 10:38       ` Christophe Leroy
2021-04-16 10:38       ` Christophe Leroy
2021-04-16 10:38       ` Christophe Leroy
2021-04-16 10:51       ` Steven Price
2021-04-16 10:51         ` Steven Price
2021-04-16 10:51         ` Steven Price
2021-04-16 10:51         ` Steven Price
2021-04-16 11:08         ` Christophe Leroy
2021-04-16 11:08           ` Christophe Leroy
2021-04-16 11:08           ` Christophe Leroy
2021-04-16 11:08           ` Christophe Leroy
2021-04-16 13:00           ` Steven Price
2021-04-16 13:00             ` Steven Price
2021-04-16 13:00             ` Steven Price
2021-04-16 13:00             ` Steven Price
2021-04-16 14:40             ` Christophe Leroy
2021-04-16 14:40               ` Christophe Leroy
2021-04-16 14:40               ` Christophe Leroy
2021-04-16 14:40               ` Christophe Leroy
2021-04-16 15:04               ` Christophe Leroy
2021-04-16 15:04                 ` Christophe Leroy
2021-04-16 15:04                 ` Christophe Leroy
2021-04-16 15:15                 ` Christophe Leroy
2021-04-16 15:15                   ` Christophe Leroy
2021-04-16 15:15                   ` Christophe Leroy
2021-04-16 16:00                   ` Steven Price
2021-04-16 16:00                     ` Steven Price
2021-04-16 16:00                     ` Steven Price
2021-04-19 13:14         ` Christophe Leroy
2021-04-19 13:14           ` Christophe Leroy
2021-04-19 13:14           ` Christophe Leroy
2021-04-19 13:14           ` Christophe Leroy
2021-04-19 14:00           ` Steven Price
2021-04-19 14:00             ` Steven Price
2021-04-19 14:00             ` Steven Price
2021-04-19 14:00             ` Steven Price
2021-04-19 16:41             ` Christophe Leroy
2021-04-19 16:41               ` Christophe Leroy
2021-04-19 16:41               ` Christophe Leroy
2021-04-19 16:41               ` Christophe Leroy
2021-04-15 17:18 ` [PATCH v1 4/5] mm: ptdump: Support hugepd table entries Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 23:29   ` Daniel Axtens [this message]
2021-04-15 23:29     ` Daniel Axtens
2021-04-15 23:29     ` Daniel Axtens
2021-04-16  5:25     ` Christophe Leroy
2021-04-16  5:25       ` Christophe Leroy
2021-04-16  5:25       ` Christophe Leroy
2021-04-15 17:18 ` [PATCH v1 5/5] powerpc/mm: Convert powerpc to GENERIC_PTDUMP Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy
2021-04-15 17:18   ` Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgxzyvn3.fsf@dja-thinkpad.axtens.net \
    --to=dja@axtens.net \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=steven.price@arm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.