All of lore.kernel.org
 help / color / mirror / Atom feed
* PMD_SIZE and compile errors in 2.6.7-rc1
@ 2004-05-25  0:38 Art Haas
  2004-05-25  0:52 ` William Lee Irwin III
  2004-05-25  3:40 ` Keith M Wesolowski
  0 siblings, 2 replies; 3+ messages in thread
From: Art Haas @ 2004-05-25  0:38 UTC (permalink / raw)
  To: sparclinux

Hi.

My attempts to build the 2.6.7-rc1 kernel on my SS20 fail when compiling
the mm/rmap.c file. The problem is on line 541:

540	#define CLUSTER_SIZE    (32 * PAGE_SIZE)
541	#if     CLUSTER_SIZE  > PMD_SIZE
542	#undef  CLUSTER_SIZE
543	#define CLUSTER_SIZE    PMD_SIZE
544	#endif
545	#define CLUSTER_MASK    (~(CLUSTER_SIZE - 1))

On 32-bit sparc, the PMD_SIZE macro expands to a function call, unlike
64-bit sparc where it is a plain macro expanding out to a compile-time
derviable value. So, the pre-processor gets stuck and compiling the file
fails.

The following patch changes the PMD_SIZE to macros the preprocessor can
handle, but I'm not sure about the removal of the BTFIXUP_SETHI()
wrapper and what consequences may result. The kernel is rebuilding as I
write this so the patch below is untested. Comments?

Art Haas

=== include/asm-sparc/pgtable.h 1.21 vs edited ==--- 1.21/include/asm-sparc/pgtable.h	2004-05-22 16:56:24 -05:00
+++ edited/include/asm-sparc/pgtable.h	2004-05-24 19:26:41 -05:00
@@ -113,7 +113,13 @@
 BTFIXUPDEF_INT(page_kernel)
 
 #define PMD_SHIFT       	BTFIXUP_SIMM13(pmd_shift)
-#define PMD_SIZE        	BTFIXUP_SETHI(pmd_size)
+#ifdef CONFIG_SUN4
+#define PMD_SIZE SUN4C_PMD_SIZE
+#elif SUN4C_PMD_SIZE = SRMMU_PMD_SIZE_SOFT
+#define PMD_SIZE SUN4C_PMD_SIZE
+#else
+#error "unexpected PMD_SIZE values"
+#endif
 #define PMD_MASK        	BTFIXUP_SETHI(pmd_mask)
 #define PMD_ALIGN(addr) 	pmd_align(addr)
 #define PGDIR_SHIFT     	BTFIXUP_SIMM13(pgdir_shift)

-- 
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

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

* Re: PMD_SIZE and compile errors in 2.6.7-rc1
  2004-05-25  0:38 PMD_SIZE and compile errors in 2.6.7-rc1 Art Haas
@ 2004-05-25  0:52 ` William Lee Irwin III
  2004-05-25  3:40 ` Keith M Wesolowski
  1 sibling, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2004-05-25  0:52 UTC (permalink / raw)
  To: sparclinux

On Mon, May 24, 2004 at 07:38:20PM -0500, Art Haas wrote:
> My attempts to build the 2.6.7-rc1 kernel on my SS20 fail when compiling
> the mm/rmap.c file. The problem is on line 541:
> 540	#define CLUSTER_SIZE    (32 * PAGE_SIZE)
> 541	#if     CLUSTER_SIZE  > PMD_SIZE
> 542	#undef  CLUSTER_SIZE
> 543	#define CLUSTER_SIZE    PMD_SIZE
> 544	#endif
> 545	#define CLUSTER_MASK    (~(CLUSTER_SIZE - 1))
> On 32-bit sparc, the PMD_SIZE macro expands to a function call, unlike
> 64-bit sparc where it is a plain macro expanding out to a compile-time
> derviable value. So, the pre-processor gets stuck and compiling the file
> fails.
> The following patch changes the PMD_SIZE to macros the preprocessor can
> handle, but I'm not sure about the removal of the BTFIXUP_SETHI()
> wrapper and what consequences may result. The kernel is rebuilding as I
> write this so the patch below is untested. Comments?

Hmm, preprocessor logic on the thing is probably ungood. How about this?


-- wli

Index: sparc32-2.6.7-rc1/mm/rmap.c
=================================--- sparc32-2.6.7-rc1.orig/mm/rmap.c	2004-05-24 08:50:32.354217000 -0700
+++ sparc32-2.6.7-rc1/mm/rmap.c	2004-05-24 17:50:11.082902000 -0700
@@ -537,11 +537,7 @@
  * there there won't be many ptes located within the scan cluster.  In this case
  * maybe we could scan further - to the end of the pte page, perhaps.
  */
-#define CLUSTER_SIZE	(32 * PAGE_SIZE)
-#if     CLUSTER_SIZE  >	PMD_SIZE
-#undef  CLUSTER_SIZE
-#define CLUSTER_SIZE	PMD_SIZE
-#endif
+#define CLUSTER_SIZE	min(32*PAGE_SIZE, PMD_SIZE)
 #define CLUSTER_MASK	(~(CLUSTER_SIZE - 1))
 
 static int try_to_unmap_cluster(unsigned long cursor,

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

* Re: PMD_SIZE and compile errors in 2.6.7-rc1
  2004-05-25  0:38 PMD_SIZE and compile errors in 2.6.7-rc1 Art Haas
  2004-05-25  0:52 ` William Lee Irwin III
@ 2004-05-25  3:40 ` Keith M Wesolowski
  1 sibling, 0 replies; 3+ messages in thread
From: Keith M Wesolowski @ 2004-05-25  3:40 UTC (permalink / raw)
  To: sparclinux

On Mon, May 24, 2004 at 05:52:51PM -0700, William Lee Irwin III wrote:

> Hmm, preprocessor logic on the thing is probably ungood. How about this?

I like this a lot more.  Art's approach is somewhat ugly but it
correctly points out that sparc32 no longer needs a variable PMD_SIZE
(it's always 1<<22 now).  I'll fix that part up separately.

Thanks guys.

> Index: sparc32-2.6.7-rc1/mm/rmap.c
> =================================> --- sparc32-2.6.7-rc1.orig/mm/rmap.c	2004-05-24 08:50:32.354217000 -0700
> +++ sparc32-2.6.7-rc1/mm/rmap.c	2004-05-24 17:50:11.082902000 -0700
> @@ -537,11 +537,7 @@
>   * there there won't be many ptes located within the scan cluster.  In this case
>   * maybe we could scan further - to the end of the pte page, perhaps.
>   */
> -#define CLUSTER_SIZE	(32 * PAGE_SIZE)
> -#if     CLUSTER_SIZE  >	PMD_SIZE
> -#undef  CLUSTER_SIZE
> -#define CLUSTER_SIZE	PMD_SIZE
> -#endif
> +#define CLUSTER_SIZE	min(32*PAGE_SIZE, PMD_SIZE)
>  #define CLUSTER_MASK	(~(CLUSTER_SIZE - 1))
>  
>  static int try_to_unmap_cluster(unsigned long cursor,
> -
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Keith M Wesolowski

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

end of thread, other threads:[~2004-05-25  3:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-25  0:38 PMD_SIZE and compile errors in 2.6.7-rc1 Art Haas
2004-05-25  0:52 ` William Lee Irwin III
2004-05-25  3:40 ` Keith M Wesolowski

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.