Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 84131 - XFree86 needs a global variable for Pagesize and Pagemask
XFree86 needs a global variable for Pagesize and Pagemask
Status: CLOSED DUPLICATE of bug 90396
Product: Red Hat Raw Hide
Classification: Retired
Component: XFree86 (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Mike A. Harris
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2003-02-12 11:59 EST by Mike A. Harris
Modified: 2007-03-27 00:00 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-21 13:51:45 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike A. Harris 2003-02-12 11:59:15 EST
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()
# define DRM_PAGE_SIZE 4096

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 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 12:01:50 EST
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
Comment 2 Mike A. Harris 2003-05-13 05:22:17 EDT

*** This bug has been marked as a duplicate of 90396 ***
Comment 3 Red Hat Bugzilla 2006-02-21 13:51:45 EST
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

Note You need to log in before you can comment on or make changes to this bug.