Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: X crashing so oftenly
Date: Wed, 09 Aug 2006 14:15:30
Message-Id: ebcqhd$plk$4@sea.gmane.org
In Reply to: [gentoo-amd64] X crashing so oftenly by jai kumar
1 jai kumar <jaikumar1004_in@××××××××.in> posted
2 20060808150529.47884.qmail@×××××××××××××××××××××.com, excerpted below, on
3 Tue, 08 Aug 2006 16:05:28 +0100:
4
5 > sometimes while doing
6 > "ctrl+alt+f1(for teminal tty0)" my X server crash down and restart
7 > again. I did google for the same but didn't find any matching answer.
8
9 I won't attempt a direct troubleshoot as my hardware is rather different,
10 but FWIW here's some generally related info.
11
12 Due to the nature of video hardware and how it interacts with the kernel
13 and X, it's really a wonder that VT-switching works at all, in most cases,
14 so it's not a wonder that it would be unstable at times.
15
16 The kernel has one set of video drivers, normally tho not always simply
17 text-mode console drivers, with DRM/DRI drivers to facilitate video memory
18 access for some video chips (and used in X mode, not the CLI), while X has
19 another set. Because xorg is designed not just for Linux, but to be run on
20 other *ix as well, it must maintain a measure of separation from the Linux
21 kernel, all the while trying to drive video as efficiently as possible.
22 In effect, while in X, X controls the video with its own video drivers and
23 with help from the kernel's DRI/DRM, but with the kernel's console mode
24 video drivers essentially disabled. Switching between X and a text mode
25 VT then becomes an /incredibly/ complex job whereby the X drivers must
26 suspend all their super-efficient direct video memory access and other
27 fancy stuff, and the kernel must reactivate its text mode drivers. It's
28 technically one of the most complex operations the computer is called upon
29 to do, involving extremely delicate timing issues subject to all sorts of
30 race conditions and two different software packages, xorg and the kernel,
31 both extremely complex on their own and evolving independently of each
32 other, plus various combinations of hardware, various pieces of which have
33 their own bugs and idiosyncrasies which must be worked around or risk
34 triggering a crash. Even worse, because of the nature of the hardware
35 involved, unlike the situation with most user space applications, when X
36 crashes, there's a real chance of taking down the kernel with it, or at
37 least corrupting the video subsystem such that the only way to work with
38 the system is entirely blind, or remotely, even when the kernel does
39 remain responsive.
40
41 As I said, it's /really/ a wonder that it works at all, even more so that
42 it can be made trouble-free enough in most instances to actually be
43 usable, and to cause complaints when it does /not/ work reliably.
44
45 This doesn't pertain directly to your issue, but the solution should.
46 Sometime in the early xorg series, I believe about xorg 6.8, the first
47 release with new code after the transfer from xfree, it became impossible
48 with my Radeon to switch to VT at all -- it would /always/ hang,
49 corrupting video to the point where the system was unusable (I have only
50 one system, so remote access is out of the question). I could shut down X
51 safely, work in the VTs as desired, and restart X, but I couldn't switch
52 to other VTs while X remained running, without a crash. I had to get used
53 to either shutting down X, or working from a terminal window (konsole, in
54 my case), avoiding the VT switch from X. The next release fixed the
55 problem, and I was again able to use VTs at will, but it was during that
56 episode that I read up on things enough to understand the issues, as laid
57 out above.
58
59 In the immediate term, it's possible/likely you'll have to work with a
60 similar workaround, using terminal windows or shutting down X, not trying
61 the VTs with X running. It's inconvenient, but once you retrain yourself
62 not to hit the VT-switch keys, workable.
63
64 Meanwhile, another solution that may or may not work for you, and if it
65 works, may or may not be something you can live with. The kernel also has
66 graphics mode framebuffer video drivers. These can give you a higher
67 resolution in your VTs, 1024x768, 1280x1024, even higher, and are thus
68 often favored by those preferring to work in a CLI most of the time.
69 When these are used in CLI mode, one doesn't use the regular X drivers for
70 their hardware, but instead, the framebuffer drivers. Most of the time,
71 this means less efficient acceleration in X mode, particularly 3D/OpenGL,
72 but depending on the specific framebuffer driver and hardware used, some
73 acceleration is possible, so you aren't forced into unaccelerated
74 compatibility mode, at least. I've never used this mode so can't go into
75 much detail on it, but from my understanding, it means you use the same
76 resolution in both CLI/VT and X modes, and therefore, that
77 resolution-switching in X is disabled -- you have just the single
78 resolution to work with. Whether the lower level of acceleration and
79 single resolution limitation are acceptable to you or not I can't say, but
80 it /should/ eliminate the VT switching issue, because it's then the kernel
81 driver in direct control even within X -- aside from a few simple
82 optimizations possible at the framebuffer level, all the X driver does is
83 forward the video stuff to the kernel framebuffer driver, thus avoiding
84 the complexities of handing off control of the video hardware when
85 switching.
86
87 We're actually fairly lucky on Linux and amd64, as for some
88 hardware/OS platforms, the framebuffer drivers are all that X supports.
89 (From what I've read, X's drivers for the Radeon video hardware commonly
90 found in Apple's PowerPC arch are of this nature, framebuffer driver
91 support only.)
92
93 Back when the X/VT switch wasn't working for me, I contemplated going
94 framebuffer, particularly as I would have enjoyed the higher CLI/VT
95 resolution and don't do all that much 3D/OpenGL stuff (I'm not a big
96 gamer, the biggest driver of demand in the area), but two things put me
97 off from trying. One, I DO use X's resolution switching fairly
98 frequently, and didn't want to lose that. Two, the inconvenience of
99 reading up on and learning to configure both the kernel and X's
100 framebuffer drivers, along with the possibility that they didn't support
101 dual monitors at all. I don't know if that's supported by the framebuffer
102 drivers or not, but that would certainly make the configuration more
103 complex, and I had no intention of giving up my dual 21" monitors,
104 1600x1200 stacked for 1600x2400 total resolution, just to get working VT
105 switching back. Together, those factors were enough to discourage me from
106 pursuing the idea any further, but it might be something you'd find easier
107 to live with.
108
109 --
110 Duncan - List replies preferred. No HTML msgs.
111 "Every nonfree program has a lord, a master --
112 and if you use the program, he is your master." Richard Stallman
113
114 --
115 gentoo-amd64@g.o mailing list