Skip to contentSkip to conversation

Current BK kernel error

DISCUSSION Art Haas 3 participants 8 messages Jan 11, 2005 – Jan 21, 2005

lore
Share & tools
lore

Art Haas

author
#0 lore raw

Hi.

A pull of the current BK kernel failed to build, with an error in mm/memory.c about pte_read() not being defined. This function was added in at revsion 1.204, and the 'bk prs' with this comment:

D 1.204 05/01/04 18:48:23-08:00 [email protected][torvalds] 213 212 18/2/215 6
P mm/memory.c
C oprofile: add check_user_page_readable()

The pte_read() function is defined at include/asm-sparc64/pgtable.h for 64-bit Sparc, but is not defined for 32-bit Sparc. Anyone taken a shot at making a patch for this yet?

Art Haas

Signature · 4 lines
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
#1 lore raw
Quoted 10 lines · Art Haas

A pull of the current BK kernel failed to build, with an error in mm/memory.c about pte_read() not being defined. This function was added in at revsion 1.204, and the 'bk prs' with this comment:
D 1.204 05/01/04 18:48:23-08:00 [email protected][torvalds] 213 212 18/2/215 6
P mm/memory.c
C oprofile: add check_user_page_readable()
The pte_read() function is defined at include/asm-sparc64/pgtable.h for 64-bit Sparc, but is not defined for 32-bit Sparc. Anyone taken a shot at making a patch for this yet?

According to Bob Breuer, returning 1 always seems to work for ordinary userspace (as opposed to "unusual" programs). I've got documentation, so I'll brew up something more accurate for it over the weekend.

-- wli

#2 lore raw
In reply to Art Haas
Quoted 4 lines · William Lee Irwin III
Quoted 2 lines · Art Haas

A pull of the current BK kernel failed to build, with an error in mm/memory.c about pte_read() not being defined. This function was added

...

Quoted 9 lines
Quoted 3 lines

The pte_read() function is defined at include/asm-sparc64/pgtable.h for 64-bit Sparc, but is not defined for 32-bit Sparc. Anyone taken a shot at making a patch for this yet?

According to Bob Breuer, returning 1 always seems to work for ordinary userspace (as opposed to "unusual" programs). I've got documentation, so I'll brew up something more accurate for it over the weekend.

Yes, the easy way out is to return 1 from pte_read. To do it right we will need a combined solution for sun4c and sun4m. I think that sun4 can use the sun4c version and sun4d will share with sun4m.

For sun4c, we can use the software managed read bit:

	return pte_val(pte) & _SUN4C_PAGE_READ;

I can't test this myself, but it mirrors the pte_write functionality.

For sun4m, there is no software bit for read, so we peek at the hardware ACC field from the pte:

	return !(pte_val(pte) & 0x10);

We need a #define to go with the new usage of this bit, maybe SRMMU_NOREAD?

I have tested the sun4m solution on my SS20 and it works for me. Now, how can these be combined using the btfixup magic?

Bob

#3 lore raw
In reply to Art Haas
Quoted 3 lines · William Lee Irwin III
Quoted 3 lines

According to Bob Breuer, returning 1 always seems to work for ordinary userspace (as opposed to "unusual" programs). I've got documentation, so I'll brew up something more accurate for it over the weekend.

Quoted 4 lines · Bob Breuer

Yes, the easy way out is to return 1 from pte_read. To do it right we will need a combined solution for sun4c and sun4m. I think that sun4 can use the sun4c version and sun4d will share with sun4m.
For sun4c, we can use the software managed read bit:

Quoted 8 lines
	return pte_val(pte) & _SUN4C_PAGE_READ;
I can't test this myself, but it mirrors the pte_write functionality.
For sun4m, there is no software bit for read, so we peek at the hardware 
ACC field from the pte:
	return !(pte_val(pte) & 0x10);

We need a #define to go with the new usage of this bit, maybe SRMMU_NOREAD? I have tested the sun4m solution on my SS20 and it works for me. Now, how can these be combined using the btfixup magic?

Ship me what you've got and I'll test it on sun4c and BTFIXUP-ize it.

-- wli

#4 lore raw
In reply to Art Haas
Quoted 1 line · William Lee Irwin III
Quoted 1 line

Ship me what you've got and I'll test it on sun4c and BTFIXUP-ize it.

Quoted 1 line · Bob Breuer

Ok, how about this patch to start from?

Looks good to work with. I'll send back something probably by the end of the day tomorrow.

-- wli

#5 lore raw
In reply to Art Haas
Quoted 3 lines · William Lee Irwin III

Ship me what you've got and I'll test it on sun4c and BTFIXUP-ize it.

Ok, how about this patch to start from?

include/asm-sparc/pgtable.h +11 -0
diff -urp linux-2.6.10-bk8-clean/include/asm-sparc/pgtable.h linux-2.6.10-bk8/include/asm-sparc/pgtable.h
@@ -186,10 +186,21 @@ BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *
   * The following only work if pte_present() is true.
   * Undefined behaviour if not..
   */
+//BITFIXUPDEF_????(pte_readi)
  BTFIXUPDEF_HALF(pte_writei)
  BTFIXUPDEF_HALF(pte_dirtyi)
  BTFIXUPDEF_HALF(pte_youngi)
 
+extern int pte_read(pte_t pte) __attribute_const__;
+extern __inline__ int pte_read(pte_t pte)
+{
+#if 0 // SUN4/SUN4C
+	return pte_val(pte) & _SUN4C_PAGE_READ;
+#else // SUN4M
+	return !(pte_val(pte) & SRMMU_NOREAD);
+#endif
+}
+
  extern int pte_write(pte_t pte) __attribute_const__;
  extern __inline__ int pte_write(pte_t pte)
  {
include/asm-sparc/pgtsrmmu.h +1 -0
diff -urp linux-2.6.10-bk8-clean/include/asm-sparc/pgtsrmmu.h linux-2.6.10-bk8/include/asm-sparc/pgtsrmmu.h
@@ -73,6 +73,7 @@
  #define SRMMU_CACHE        0x80
  #define SRMMU_DIRTY        0x40
  #define SRMMU_REF          0x20
+#define SRMMU_NOREAD       0x10
  #define SRMMU_EXEC         0x08
  #define SRMMU_WRITE        0x04
  #define SRMMU_VALID        0x02 /* SRMMU_ET_PTE */
author
#6 lore raw
In reply to Art Haas
Quoted 9 lines · William Lee Irwin III
Quoted 1 line · William Lee Irwin III
Quoted 1 line

Ship me what you've got and I'll test it on sun4c and BTFIXUP-ize it.

Quoted 1 line · Bob Breuer

Ok, how about this patch to start from?

Looks good to work with. I'll send back something probably by the end of the day tomorrow.

Hi.

Has a BTFIXUP'ed patch slipped by? Still being tested/developed?

Art

Signature · 4 lines
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
#7 lore raw
In reply to Art Haas
Quoted 2 lines · William Lee Irwin III
Quoted 2 lines

Looks good to work with. I'll send back something probably by the end of the day tomorrow.

Quoted 1 line · Art Haas

Has a BTFIXUP'ed patch slipped by? Still being tested/developed?

I've been shaken up by current events. I'll get to it this weekend.

-- wli