public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PAGE_SIZE definition for MIPS XLP
@ 2013-11-18 12:51 Andrew Stubbs
  2013-11-18 13:42 ` Andreas Schwab
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andrew Stubbs @ 2013-11-18 12:51 UTC (permalink / raw)
  To: libc-ports

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

MIPS' sys/user.h currently has a constant definition for PAGE_SIZE, and 
the other related settings. This is not appropriate for XLP (and other 
MIPS?) where the actual page size is a kernel configuration option.

Apart from the general principle of not having incorrect definitions, 
the actual problem that needs to be solved is in 
sysdeps/unix/sysv/linux/ifaddrs.c in which PAGE_SIZE is used by 
preference as an optimization. Most of the other possible use cases 
prefer to call __getpagesize or use sysconf, and so are unaffected.

Clearly, keeping the constant definition is desirable on at least some 
MIPS variants, in order to keep the optimization, but not for XLP.

The attached patch makes the definition conditional, rather than 
removing it completely. It's not clear to me whether the HOST_* 
definitions are similarly affected, but other platforms that do not 
define PAGE_SIZE also choose not to define those, so I've extended the 
ifndef similarly.

I this OK to commit? Should it be solved a different way?

Testcase tst-limits does check PAGE_SIZE matches, if defined, but not in 
this case because that test case does not include sys/user.h. Should I 
create a new test case for this, or include that header in the existing 
test?

Thanks

Andrew

[-- Attachment #2: xlp-page-size.patch --]
[-- Type: text/x-patch, Size: 783 bytes --]

2013-11-18  Andrew Stubbs  <ams@codesourcery.com>

	ports/
	* sysdeps/unix/sysv/linux/mips/sys/user.h: Don't define page
	characteristics on XLP.

diff --git a/ports/sysdeps/unix/sysv/linux/mips/sys/user.h b/ports/sysdeps/unix/sysv/linux/mips/sys/user.h
index 37fc568..c0d1505 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/sys/user.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/sys/user.h
@@ -206,6 +206,7 @@ struct user {
 
 #endif
 
+#ifndef _MIPS_ARCH_XLP
 #define PAGE_SHIFT		12
 #define PAGE_SIZE		(1UL << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE-1))
@@ -214,5 +215,6 @@ struct user {
 #define HOST_TEXT_START_ADDR	(u.start_code)
 #define HOST_DATA_START_ADDR	(u.start_data)
 #define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
+#endif
 
 #endif	/* _SYS_USER_H */

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

end of thread, other threads:[~2013-11-19 20:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-18 12:51 [PATCH] PAGE_SIZE definition for MIPS XLP Andrew Stubbs
2013-11-18 13:42 ` Andreas Schwab
2013-11-19 20:56   ` Maciej W. Rozycki
2013-11-18 13:45 ` Joseph S. Myers
2013-11-18 18:21 ` Joseph S. Myers
2013-11-19  3:28 ` Andrew Pinski
2013-11-19 14:57   ` Joseph S. Myers
2013-11-19 20:19     ` Andrew Stubbs
2013-11-20 19:57   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).