|Summary:||XFree86 needs a global variable for Pagesize and Pagemask|
|Product:||[Retired] Red Hat Raw Hide||Reporter:||Mike A. Harris <mharris>|
|Component:||XFree86||Assignee:||Mike A. Harris <mharris>|
|Status:||CLOSED DUPLICATE||QA Contact:||David Lawrence <dkl>|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2006-02-21 18:51:45 UTC||Type:||---|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
|Cloudforms Team:||---||Target Upstream Version:|
Description Mike A. Harris 2003-02-12 16:59:15 UTC
The X server has various places where compile-time pagesize is hard coded per architecture, which is a broken design because many architectures can have their native pagesize changed by a kernel recompile. Also, parts of the code contain a hard coded 4k pagesize for all non explicitly specified architectures. An example from radeon_dri.c: #if defined(__alpha__) # define DRM_PAGE_SIZE 8192 #elif defined(__ia64__) # define DRM_PAGE_SIZE getpagesize() #else # define DRM_PAGE_SIZE 4096 #endif The above code is totally bogus, because alpha doesn't necessarily have an 8Kb pagesize. ia64 is somewhat correct, but replaces a constant macro with a function call, which may have unnecessary overhead in some areas perhaps. The final else clause though is the ugly one. It assumes any non-alpha, non-ia64 uses 4Kb pagesize. I've patched current 18.104.22.1681 sources with a Debian patch to fix the Radeon and R128 DRI code to runtime detect pagesize, however there are various places in the X server code which make similar broken pagesize assumptions in the code. IMHO this would be best handled by 2 global variables in the X server - one for pagesize, and another for pagemask. The immediate thought would be adding to common/xf86Globals.c 2 new video driver visible variables: long xf86Pagesize, xf86Pagemask; Then using setconf(_SC_PAGESIZE) to get the native pagesize at runtime. setconf() is conforming to POSIX and SuSv2, however some platforms might not have it. In those cases, getpagesize() might be able to be used on such platforms, however it is labeled as "legacy" on the manpage, and some platforms might not have it. I think the safest/sanest approach is to 'assume' that setconf(_SC_PAGESIZE) will work on all platforms, and simply fix bugs that come up when an architecture is found that does not support setconf(), either by using an alternative runtime method, or worst case would be to special case such OS/arch combinations with hard coded pagesize. This approach would certainly be no worse than the ugly hard coded pagesize assumptions scattered here and there in the DRM/DRI and possibly elsewhere.
Comment 1 Mike A. Harris 2003-02-12 17:01:50 UTC
Note: this is a personal TODO item that I am tracking in bugzilla for XFree86 development. It is not a Red Hat specific defect, pertains mostly to DRI/DRM only, and is not something to be tracked as a defect specific to our final release. It is for future XFree86 development improvements.
Comment 2 Mike A. Harris 2003-05-13 09:22:17 UTC
*** This bug has been marked as a duplicate of 90396 ***
Comment 3 Red Hat Bugzilla 2006-02-21 18:51:45 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.