public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] s390/pgtable: misc small improvements
@ 2024-04-25 13:05 Claudio Imbrenda
  2024-04-25 13:05 ` [PATCH v1 1/2] s390/pgtable: switch read and write softbits for puds Claudio Imbrenda
  2024-04-25 13:05 ` [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE Claudio Imbrenda
  0 siblings, 2 replies; 6+ messages in thread
From: Claudio Imbrenda @ 2024-04-25 13:05 UTC (permalink / raw)
  To: linux-kernel, linux-s390
  Cc: hca, gor, agordeev, svens, gerald.schaefer, borntraeger

This series has two small improvements for the s390 page tables.

The first aligns the layout of large puds with that of large pmds;
there is no reason for the large pud read and write softbits to be
swapped compared to large pmds.

The second introduces _REGION3_ENTRY_HARDWARE_BITS_LARGE, for
completeness, which is a bitmask of the hardware bits for large puds.

Claudio Imbrenda (2):
  s390/pgtable: switch read and write softbits for puds
  s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE

 arch/s390/include/asm/pgtable.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/2] s390/pgtable: switch read and write softbits for puds
  2024-04-25 13:05 [PATCH v1 0/2] s390/pgtable: misc small improvements Claudio Imbrenda
@ 2024-04-25 13:05 ` Claudio Imbrenda
  2024-04-26  8:50   ` Heiko Carstens
  2024-04-25 13:05 ` [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE Claudio Imbrenda
  1 sibling, 1 reply; 6+ messages in thread
From: Claudio Imbrenda @ 2024-04-25 13:05 UTC (permalink / raw)
  To: linux-kernel, linux-s390
  Cc: hca, gor, agordeev, svens, gerald.schaefer, borntraeger

There is no reason for the read and write softbits to be swapped in the
puds compared to pmds. They are different only because the softbits for
puds were introduced at the same time when the softbits for pmds were
swapped.

The current implementation is not wrong per se, since the macros are
defined correctly; only the documentation does not reflect reality.

With this patch, the read and write softbits for large pmd and large
puds will have the same layout, and will match the existing
documentation.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 arch/s390/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 60950e7a25f5..3da2995fd196 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -266,8 +266,8 @@ static inline int is_module_addr(void *addr)
 #define _REGION3_ENTRY_DIRTY	0x2000	/* SW region dirty bit */
 #define _REGION3_ENTRY_YOUNG	0x1000	/* SW region young bit */
 #define _REGION3_ENTRY_LARGE	0x0400	/* RTTE-format control, large page  */
-#define _REGION3_ENTRY_READ	0x0002	/* SW region read bit */
-#define _REGION3_ENTRY_WRITE	0x0001	/* SW region write bit */
+#define _REGION3_ENTRY_WRITE	0x0002	/* SW region write bit */
+#define _REGION3_ENTRY_READ	0x0001	/* SW region read bit */
 
 #ifdef CONFIG_MEM_SOFT_DIRTY
 #define _REGION3_ENTRY_SOFT_DIRTY 0x4000 /* SW region soft dirty bit */
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE
  2024-04-25 13:05 [PATCH v1 0/2] s390/pgtable: misc small improvements Claudio Imbrenda
  2024-04-25 13:05 ` [PATCH v1 1/2] s390/pgtable: switch read and write softbits for puds Claudio Imbrenda
@ 2024-04-25 13:05 ` Claudio Imbrenda
  2024-04-26  8:57   ` Heiko Carstens
  1 sibling, 1 reply; 6+ messages in thread
From: Claudio Imbrenda @ 2024-04-25 13:05 UTC (permalink / raw)
  To: linux-kernel, linux-s390
  Cc: hca, gor, agordeev, svens, gerald.schaefer, borntraeger

For completeness, introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE,
containing the hardware bits used for large puds.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 arch/s390/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 3da2995fd196..5c0f840eee2a 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -262,6 +262,7 @@ static inline int is_module_addr(void *addr)
 #define _REGION3_ENTRY		(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
 #define _REGION3_ENTRY_EMPTY	(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID)
 
+#define _REGION3_ENTRY_HARDWARE_BITS_LARGE	0xffffffff8000073cUL
 #define _REGION3_ENTRY_ORIGIN_LARGE ~0x7fffffffUL /* large page address	     */
 #define _REGION3_ENTRY_DIRTY	0x2000	/* SW region dirty bit */
 #define _REGION3_ENTRY_YOUNG	0x1000	/* SW region young bit */
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] s390/pgtable: switch read and write softbits for puds
  2024-04-25 13:05 ` [PATCH v1 1/2] s390/pgtable: switch read and write softbits for puds Claudio Imbrenda
@ 2024-04-26  8:50   ` Heiko Carstens
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Carstens @ 2024-04-26  8:50 UTC (permalink / raw)
  To: Claudio Imbrenda
  Cc: linux-kernel, linux-s390, gor, agordeev, svens, gerald.schaefer,
	borntraeger

On Thu, Apr 25, 2024 at 03:05:54PM +0200, Claudio Imbrenda wrote:
> There is no reason for the read and write softbits to be swapped in the
> puds compared to pmds. They are different only because the softbits for
> puds were introduced at the same time when the softbits for pmds were
> swapped.
> 
> The current implementation is not wrong per se, since the macros are
> defined correctly; only the documentation does not reflect reality.
> 
> With this patch, the read and write softbits for large pmd and large
> puds will have the same layout, and will match the existing
> documentation.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  arch/s390/include/asm/pgtable.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE
  2024-04-25 13:05 ` [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE Claudio Imbrenda
@ 2024-04-26  8:57   ` Heiko Carstens
  2024-04-26  9:22     ` Claudio Imbrenda
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Carstens @ 2024-04-26  8:57 UTC (permalink / raw)
  To: Claudio Imbrenda
  Cc: linux-kernel, linux-s390, gor, agordeev, svens, gerald.schaefer,
	borntraeger

On Thu, Apr 25, 2024 at 03:05:55PM +0200, Claudio Imbrenda wrote:
> For completeness, introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE,
> containing the hardware bits used for large puds.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  arch/s390/include/asm/pgtable.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index 3da2995fd196..5c0f840eee2a 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
> @@ -262,6 +262,7 @@ static inline int is_module_addr(void *addr)
>  #define _REGION3_ENTRY		(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
>  #define _REGION3_ENTRY_EMPTY	(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID)
>  
> +#define _REGION3_ENTRY_HARDWARE_BITS_LARGE	0xffffffff8000073cUL

_REGION_ENTRY_HARDWARE_BITS is missing too. :)

And this definition also raises the question if the definition of
_SEGMENT_ENTRY_HARDWARE_BITS_LARGE should be changed so it also includes
the table type bits, which it probably should.

These masks are really a bit randomly defined and assume that the
ACCF-Validity control bit is never set, and therefore the ACC bitfield can
be assumed to be software bits (and they are used as such for format 1
segment table entries).

But the ACCF bit is also a hardware bit in any case... oh well.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE
  2024-04-26  8:57   ` Heiko Carstens
@ 2024-04-26  9:22     ` Claudio Imbrenda
  0 siblings, 0 replies; 6+ messages in thread
From: Claudio Imbrenda @ 2024-04-26  9:22 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: linux-kernel, linux-s390, gor, agordeev, svens, gerald.schaefer,
	borntraeger

On Fri, 26 Apr 2024 10:57:14 +0200
Heiko Carstens <hca@linux.ibm.com> wrote:

> On Thu, Apr 25, 2024 at 03:05:55PM +0200, Claudio Imbrenda wrote:
> > For completeness, introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE,
> > containing the hardware bits used for large puds.
> > 
> > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> > ---
> >  arch/s390/include/asm/pgtable.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> > index 3da2995fd196..5c0f840eee2a 100644
> > --- a/arch/s390/include/asm/pgtable.h
> > +++ b/arch/s390/include/asm/pgtable.h
> > @@ -262,6 +262,7 @@ static inline int is_module_addr(void *addr)
> >  #define _REGION3_ENTRY		(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_LENGTH)
> >  #define _REGION3_ENTRY_EMPTY	(_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID)
> >  
> > +#define _REGION3_ENTRY_HARDWARE_BITS_LARGE	0xffffffff8000073cUL  
> 
> _REGION_ENTRY_HARDWARE_BITS is missing too. :)

right, I will fix it

> 
> And this definition also raises the question if the definition of
> _SEGMENT_ENTRY_HARDWARE_BITS_LARGE should be changed so it also includes
> the table type bits, which it probably should.

tbh I agree

> 
> These masks are really a bit randomly defined and assume that the
> ACCF-Validity control bit is never set, and therefore the ACC bitfield can
> be assumed to be software bits (and they are used as such for format 1
> segment table entries).
> 
> But the ACCF bit is also a hardware bit in any case... oh well.

probably the ACCF bit should also be marked as hardware bit (I had
actually thought about it, but we don't do it for segments and I wanted
it to be consistent)

I'll send a v2 with:

segment table type bits
ACCF bit (both for segments and region3
_REGION3_ENTRY_HARDWARE_BITS

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-26  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 13:05 [PATCH v1 0/2] s390/pgtable: misc small improvements Claudio Imbrenda
2024-04-25 13:05 ` [PATCH v1 1/2] s390/pgtable: switch read and write softbits for puds Claudio Imbrenda
2024-04-26  8:50   ` Heiko Carstens
2024-04-25 13:05 ` [PATCH v1 2/2] s390/pgtable: introduce _REGION3_ENTRY_HARDWARE_BITS_LARGE Claudio Imbrenda
2024-04-26  8:57   ` Heiko Carstens
2024-04-26  9:22     ` Claudio Imbrenda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox