Bug 18028 - SIS(0): Unable to map IO aperture. Invalid argument (22)
SIS(0): Unable to map IO aperture. Invalid argument (22)
Status: RESOLVED FIXED
Product: xorg
Classification: Unclassified
Component: Driver/SiS
unspecified
x86 (IA32) Linux (All)
: medium normal
Assigned To: Thomas Winischhofer
Xorg Project Team
:
: 18559 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-12 04:39 UTC by Peter
Modified: 2012-08-30 18:17 UTC (History)
2 users (show)

See Also:


Attachments
Xorg.0.log.bz2 (6.40 KB, application/octet-stream)
2008-10-12 04:39 UTC, Peter
no flags Details
Patch against xf86-video-sis-0.10.4 (2.58 KB, patch)
2012-08-16 06:36 UTC, Jan Lindemann
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Peter 2008-10-12 04:39:51 UTC
Created attachment 19601 [details]
Xorg.0.log.bz2

After I finish my kde-4 session it fails to start kdm login window, and seems that the reason for that is that X dies. The last lines of from kdm:

Oct 12 15:35:10 localhost kdm: :0[13613]: pam_unix(kde:session): session closed for user peter
Oct 12 15:35:11 localhost kdm: :0[13758]: IO Error in XOpenDisplay
Oct 12 15:35:11 localhost kdm[13604]: Display :0 cannot be opened
Oct 12 15:35:11 localhost kdm[13604]: Unable to fire up local display :0; disabling.

The last lines in Xorg.0.log are:
(EE) SIS(0): Unable to map IO aperture. Invalid argument (22)
(EE) SIS(0): **************************************************
(EE) SIS(0):                       ERROR:
(EE) SIS(0): Could not map MMIO area
(EE) SIS(0):                   END OF MESSAGE
(EE) SIS(0): **************************************************
(EE) SIS(0): **************************************************
(EE) SIS(0):                       ERROR:
(EE) SIS(0): SiSMapMem() failed
(EE) SIS(0):                   END OF MESSAGE
(EE) SIS(0): **************************************************

Fatal server error:
AddScreen/ScreenInit failed for driver 0


My hardware is:
01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] 65x/M650/740 PCI/AGP VGA Display Adapter

And software installed:
x11-drivers/xf86-video-sis: 0.10.0
x11-libs/libpciaccess: 0.10.3
x11-base/xorg-server: 1.5.1
kernel: 2.6.26-gentoo-r1
Comment 1 Andrés Becerra Sandoval 2009-01-06 08:29:35 UTC
I confirm this bug, my versions are:


x11-drivers/xf86-video-sis: 0.10.0
x11-libs/libpciaccess: 0.10.5
x11-base/xorg-server: 1.5.2
kernel: 2.6.28-gentoo

I created an alternative configuration with the xf86-video-vesa driver and kdm{3.5.10,4.1.3} is  not crashing with it.



Comment 2 Andrés Becerra Sandoval 2009-09-26 08:56:15 UTC
The bug is still present with:

x11-drivers/xf86-video-sis: 0.10.1
x11-libs/libpciaccess: 0.10.6
x11-base/xorg-server: 1.5.3
kernel: 2.6.31-gentoo

The kernel has (sis) drm support compiled. The problem is the same.

Comment 3 Andrés Becerra Sandoval 2009-09-26 09:26:15 UTC
(In reply to comment #2)

With x11-drivers/xf86-video-sis-0.10.2 the problem persists.
 

Comment 4 Brice Goglin 2010-03-15 08:16:05 UTC
*** Bug 18559 has been marked as a duplicate of this bug. ***
Comment 5 Forester 2011-01-29 10:15:40 UTC
Hi,

I have the same issue with Debian Squeeze RC2:
  Linux 2.6.32-5-686
  xserver-xorg 1:7.5+8
  xserver-xorg-video-sis 1:0.10.3-1
  kdm 4:4.4.5-7

I don't have the issue with Debian Lenny 5.0.8:
  Linux 2.6.26-2-686
  xserver-xorg 1:7.3+20
  xserver-xorg-video-sis 1:0.10.0-1
  kdm 4:3.5.9.dfsg.1-6+lenny1

This suggests to me regression (oops !) but not where that might be.

I have seen the same issue reported for other distributions so, alas, this is
not one the good folks on the Debian project are likely to address.

The good folks over on the KDE project were quick to label it an SEP
(https://bugs.kde.org/show_bug.cgi?id=176945), which suprises me:
KDE is free software so I can switch to another desktop for free,
whereas I can't say the same for my hardware.

This issue was first reported by Peter (and by Sandoval over on the KDE bug
tracker) over two years ago.  There is still no resolution.

I can report the issue persists with the SIS 0.10.3 driver but comes as no
suprise.  Compare my Lenny with Peter's Gentoo and the version numbers suggest
that, if regression is the problem, then it lies between KDE 3.5.9 and 3.5.10.

Not that I would condone the SIS driver crashing but it hasn't.  If anything
has crashed then it is the X-server.  KDM is still running and reports:
    X server for display :0 terminated unexpectedly
    Unable to fire up local display :0: ;disabling

If I have more than one X-session (by using KDE/KDM to 'switch' sessions),
logging out from the first does not bring down the others.  KDM is able to
fire up (re-use) local display :1, :2 and :3 if needs be but not :0.

The X-servers logs for other displays do not show the error.  They end with:
  (WW) SIS(0): xf86UnMapVidMem: cannot find regions for [0x7f........,0x1000]
  (WW) SIS(0): xf86UnMapVidMem: cannot find regions for [0x7f........,0x400000]

These lines also occur with display :0, just before the crash.

Display :0 is not broken: startx from the tty console will reuse display :0
and fire up an new KDE session.  Likewise /etc/init.d/kdm restart will reuse
display :0 and fire up a new login screen.

I can also report that if I install gdm (or xdm) and use that instead of kdm,
there is no crash on exit from KDE-4.  This suggests there is something that
KDM does that may not be quite right and that all that is amiss with the SIS
driver is that it not quite as robust as we might like.  Isn't all software ?

Naturally, I don't get this on machines that don't have a SIS video chip set.
I do get this on all machines with a SIS video chip set regardless of whether
I install a i386 or amd64 version of Debian.
Comment 6 Bryan Henderson 2011-03-19 19:47:36 UTC
I have debugged this.  Well, I can't explain exactly how it happens, but I did find a bug in the area and fixed it, and then the symptom disappeared.

The bug is that sis_driver.c maps the video controller into memory with libpciaccess function pci_device_map_range() as the server generation starts, and then tries to unmap it using the old xf86UnMapVidMem() as the server generation ends.  The latter recognizes that the range requested wasn't mapped with the xf86MapVidMem() facility, so fails.  The fact that the unmap didn't happen apparently prevents the subsequent map for the next server generation from succeeding.

There is conditional compilation in the mapping code (SISMapMem() in src/sis_driver.c) to use libpciaccess when the server was built with libpciaccess and the old native mapper when it wasn't.  Apparently, whoever added the libpciaccess option for mapping didn't add the corresponding libpciaccess option to the unmap side (SisUnmapMem()).
Comment 7 Peter 2011-03-22 07:34:38 UTC
Bryan, although description is really clear, could you attach patch, please?
Comment 8 Jan Lindemann 2012-08-16 06:36:28 UTC
Created attachment 65629 [details] [review]
Patch against xf86-video-sis-0.10.4

(In reply to comment #7)
> Bryan, although description is really clear, could you attach patch, please?
The attached patch follows Bryans reasoning, mostly doing

  s/xf86UnMapVidMem(pScrn->scrnIndex/pci_device_unmap_range(pSiS->PciInfo/

in SisUnmapMem(), and it fixes the problem for me.
Comment 9 Julien Cristau 2012-08-30 18:17:37 UTC
patch applied, thanks