Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 12-07-10, 08:00 AM   #1
goeran
Registered User
 
Join Date: Dec 2010
Location: Sweden
Posts: 4
Default Emacs makes the X server busy

Some time ago, my emacs became very slow. It varies HOW slow, but sometimes it writes maybe one line per second when paging through a file.

Running top I see that the Xorg process gets very busy when this happens, using close to 100% of the CPU. I've not seen the behavior when using other programs than emacs, though I don't use too many different applications. But plain terminals, firefox, and some others behave normally. Programs actually using some graphics power, like movie players or 3D games, also behave normally. So far, I have only found this problem with emacs. The emacs process itself does not use particularly much of the cpu, only the X server process Xorg.

This happens on a Fedora system. I'm using the packaging of Nvidia drivers from RPM Fusion. The system has a mix of packages from different releases, a few quite old. (Like fedora-release, as you can see in the attatched log.) But when it comes to X server and related packages and libraries, I believe I'm using current Fedora 14 packages. In particular, I've done a "lsof" of the running Xorg process, and checked the packages of all files it had mapped. My emacs package is also up-to-date.

The problems started when I upgraded to a new kernel version and new Nvidia drivers. The last Nvidia driver I used before this started was 195.36.31 and the one I upgraded to was 256.53. I've since tried later versions, and am currently running 260.19.21, but the problem is still here.

Switching to the open nv driver instead, keeping everything else equal, removes the problem. Exactly what conclusions can be drawn from this, I'm not sure. I also don't know how to analyze the problem further. Can I somehow get information from the X server and Nvidia driver about exactly what it is doing with all these CPU cycles?
Attached Files
File Type: gz nvidia-bug-report.log.gz (63.3 KB, 51 views)
goeran is offline   Reply With Quote
Old 12-08-10, 12:41 PM   #2
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: Emacs makes the X server busy

Try connecting Emacs to the X server through xscope. It's a little bit of a pain to set up, but it should make it obvious what protocol Emacs is sending. Alternatively, you can force Emacs to use a TCP connection to the server by setting DISPLAY=localhost:0 and then using Wireshark to trace the traffic on the loopback network interface. You may need to manually start X without the "-nolisten tcp" option for that to work.
AaronP is offline   Reply With Quote
Old 12-08-10, 05:43 PM   #3
goeran
Registered User
 
Join Date: Dec 2010
Location: Sweden
Posts: 4
Default Re: Emacs makes the X server busy

xscope was a good tool! I didn't know about it. But it comes with Fedora, so I could easily install and try it.

It felt slightly harder than normal to make the X server really loaded using it. I guess xscope added some delays. But after a little while I managed to get the server up to around 80-90 percent CPU usage, and I have a log from that. Although it compresses well, it's a bit too large to attach here, so I put it on my FTP server instead: ftp://ftp.uddeborg.se/pub/xscope.log.bz2

The highest load is at the end of the session.

Since I don't know very much about the X protocol, I'm not sure if anything in this log is out of the ordinary. I actually understand even less than I would have expected. For example, KeyPress events have a "detail". But that "detail" isn't the key I pressed as I would have expected. Another observation is that there is a request at 606.16 for which there is no reply before 606.51. That is 0.35 seconds which sounds a long time for a "system call". But maybe it is normal, and I just don't know why.

As I said, I don't really know what to conclude. Maybe you or someone else here can make more out of it?
goeran is offline   Reply With Quote
Old 12-09-10, 03:02 PM   #4
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: Emacs makes the X server busy

Not all requests have replies, so sometimes request with no reply are fine. The real thing to look for is whether emacs is spamming the server with requests, or if the high load seems to correspond to specific requests, or whether they're unrelated. It might be best to watch the xscope output in a terminal while you're using emacs to see how they're related.

Looking at the log, I see lots of normal-looking rendering requests. I also see lots of RenderAddGlyphs requests, so I wonder if emacs is overflowing the glyph cache and falling back to slower rendering methods. You can try flushing the glyph cache by toggling it off and back on again:
Code:
nvidia-settings -a GlyphCache=0; nvidia-settings -a GlyphCache=1
You can also try flushing the pixmap cache the same way:
Code:
nvidia-settings -a PixmapCache=0; nvidia-settings -a PixmapCache=1
AaronP is offline   Reply With Quote
Old 12-13-10, 09:31 AM   #5
goeran
Registered User
 
Join Date: Dec 2010
Location: Sweden
Posts: 4
Default Re: Emacs makes the X server busy

I had figured out that it was ok for some requests to not have replies. Maybe my English could be clearer. But what I wanted to say was that the 206.16 request had to wait UNTIL 606.51 to get a reply. I thought those two were connected, and I thought a reply time of 0.35 seemed a bit long.

I've tried to look at the xscope output in an xterm. But I can't see any specific events delaying. During the time emacs is slowly redrawing its window(s), there is a constant stream of output from xscope. It makes very short stops at times, but it is faster than I can read all the time, so I can't say exactly where.

Flushing the glyph cache as you suggested POSSIBLY made emacs run quicker for a little while. It is hard to say for sure. The slowness isn't constant, and I might have been imagining, but it did look like it helped for some short time. Not very long, just a fraction of a minute. Has there been any changes on the driver side in this area which could explain the problems? (The same emacs worked fine with older driver versions.)

I couldn't see any effect at all of flushing the pixmap cache.

Do you have even more suggestions I could try to figure out what is going wrong?
goeran is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:13 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©1998 - 2014, nV News.