# Mouse skipping around in KDE during compile

## timmy!

Well, what the title says really. Every time I do an emerge (or specifically, during the compile), there are periods when my mouse just totally spazzes out and moves all over the place, clicking randomly and jumping around, very similar to when you have a bad driver in windows. It only lasts for a few seconds and then goes back to normal, but this happens a few times each compile, and in those few seconds it can (and does) completely b0rk up my desktop (closed windows/panel, even randomly changes settings or webpages!).

I'm running KDE 3.3.1, xorg-x11-6.8.0-r3 and the 2.6.9-gentoo-r6 kernel. It only seems to have happened since I upgraded from my 2.4 kernel.

Any help?

PS. I'm a complete n00b so apologies if I'm being stupid!

----------

## jkt

 :Smile: , try to add PORTAGE_NICENESS=3 to your /etc/make.conf. CONFIG_PREEMPT=y in kernel's config could help you, too (albeit there are some flames about it).

The reason is quite simple - if the machine gets busy running some extremely intensive process (which compiling of course is), the responsiveness gets worse.

----------

## timmy!

Why would it suddenly happen in 2.6 when it didn't in 2.4 though?

The other thing is, and I find this quite hard to explain, is the way that it doesn't feel "sluggish" like you'd expect if the machine was under heavy load; the pointer actually moves too far and too fast, in that the distance it moves for a given movement of the mouse is more under this weird movement than it is regularly. If that makes any sense  :Smile: 

----------

## jkt

who knows  :Smile: . Do you have CONFIG_PREEMPT=y?

----------

## timmy!

Nope. I'm having major troubles with getting ALSA to work with my usb MP3+ soundcard so I'll set it and recompile (for the 4th or 5th time today! Agh! Why do HOWTOs that work for everyone else never work for me?!).

----------

## jkt

give CONFIG_PREEMPT a try, it could help you.

----------

## Ian Goldby

I've been having a problem that sounds exactly the same today, while I've been encoding a lot of mp3 files. It's not a preempt thing at all, nor a niceness issue. It's much more like the phantom mouse in Windows where the mouse will suddenly move across the screen all on its own. I've never seen this problem before, but recently I switched from the mm kernel sources to the latest ck source. Since then I've had all sorts of problems with bad responsivity, mouse going bezerk and the clock losing time badly.

As I write, I'm compiling the latest mm-sources kernel. Since I was running an old mm-sources kernel before, I want to see if that improves matters. However, it may be nothing to do with the kernel, or it may be a kernel configuration option I've changed rather than the specific patchset.

----------

## jkt

so the problem is not that the mouse moves in steps (it is not smooth as the cursor cannot follow the real mouse pointer position)? the mouse is moving in strange ways?

----------

## Ian Goldby

Well, that's what happened to me (except there were no phantom clicks I was aware of), and it sounds like what Timmy is describing:

 *timmy! wrote:*   

> my mouse just totally spazzes out and moves all over the place, clicking randomly and jumping around

 

----------

## bollucks

Check your hard drive settings. It sounds related to the disk activity of a compile.

Changing to 2.6 sometimes you lose the dma settings you think you have. Make sure generic dma thingy is disabled in the config and check that dma is actually working on your hard disk.

----------

## blueillusion

this sounds like the problem i had. I had 2 types of chipsets compiled into my kernel, one was a via, and my mobo is using nforce2. I took out the via chipset and the mouse jerkyness went away.

----------

## dtor

Look into drivers/input/mouse/psmouse-base.c, locate the fragment below (psmouse_interrupt()) and change HZ/2 to 5*HZ, it should help with jumps.

```

        if (psmouse->state == PSMOUSE_ACTIVATED &&

            psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) {

                printk(KERN_WARNING "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n",

                       psmouse->name, psmouse->phys, psmouse->pktcnt);

                psmouse->pktcnt = 0;

        }

```

Also make sure that your hard drive has DMA on.

----------

## timmy!

 *Ian Goldby wrote:*   

> It's much more like the phantom mouse in Windows where the mouse will suddenly move across the screen all on its own.
> 
> ... Since then I've had all sorts of problems with bad responsivity, mouse going bezerk and the clock losing time badly.

 

That's it exactly -- I forgot to mention about the clock losing time (it was insane: losing about half an hour per 3-4 hours of uptime), but that happened to me too. I've since set up NTP and completely forgotten about it (although, and this is for another thread, but every time NTP syncs itself, my screen goes blank for a few seconds. VERY annoying, has anyone else had this?).

I'll check DMA next time I'm booted into Gentoo.

dtor: I'm using a USB cordless trackball -- I assume that settings relating to a psmouse won't work there? Or will they?

Cheers!

----------

## dtor

Is your mouse plugged to straight to USB port or are you using USB-to-PS2 conveter?

----------

## timmy!

Nope, the receiver goes straight into a mobo USB port.

----------

## Ian Goldby

 *bollucks wrote:*   

> Check your hard drive settings. It sounds related to the disk activity of a compile.
> 
> Changing to 2.6 sometimes you lose the dma settings you think you have. Make sure generic dma thingy is disabled in the config and check that dma is actually working on your hard disk.

 

That's very likely indeed.

Currently I have in Device Drivers>ATA/ATAPI/MFM/RLL support:

generic/default IDE chipset support

PCI IDE chipset support

Sharing PCI IDE chipset support

Generic PCI bus-master DMA support

Use PCI DMA by default when available

I don't see the Intel i810 listed, so I assumed I needed generic support only.

Is this wrong?

I'll look into hdparm - I need to find a HOWTO.

----------

## Ian Goldby

 *timmy! wrote:*   

> I've since set up NTP and completely forgotten about it (although, and this is for another thread, but every time NTP syncs itself, my screen goes blank for a few seconds. VERY annoying, has anyone else had this?).

  Yes, I had this too. I thought Xfree had gone pop, just as I was getting to the end of a long compile. I was glad I waited a few moments to discover I hadn't lost everything in my X session.

----------

## timmy!

Oh; maybe the screen thing is compile related then? Did you ever find out what caused it?

See this thread: https://forums.gentoo.org/viewtopic.php?p=1818203#1818203

----------

## John5788

whats output of `hdparm -i /dev/hdx`

----------

## lucindrea

 *timmy! wrote:*   

> Nope. I'm having major troubles with getting ALSA to work with my usb MP3+ soundcard so I'll set it and recompile (for the 4th or 5th time today! Agh! Why do HOWTOs that work for everyone else never work for me?!).

 

hehe try the 4th attempt at the shellscript during a stage 1 install ( what i'm doing right now ) ...

oh and i run into the same problems with the howto's , but i found out somthing , by the time you figure it all out , you end up knowing more about it then the guy who wrote the how to  :Wink: 

----------

## timmy!

```

bash-2.05b# hdparm -i /dev/hdb

/dev/hdb:

 Model=Maxtor 6E040L0, FwRev=NAR61EA0, SerialNo=E10L2XTN

 Config={ Fixed }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57

 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16

 CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=80293248

 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6

 AdvancedPM=yes: disabled (255) WriteCache=enabled

 Drive conforms to: (null):

 * signifies the current active mode

```

I'm no expert but it looks like DMA is on?

----------

## jkt

yep, DMA seems to be on.

`hdparm -t /dev/hdb` several times, it'll show you your hard drive's speed. and it's likely that the mouse will start to behave odly. you can simulate disk load for example by `dd if=/dev/hdb of=/dev/null bs=1M count=1024`

----------

## timmy!

Tried that, with block sizes right up to 16Mb, but everything's still as smooth as the proverbial baby's butt! I don't get why this is happening!

It's not drive access speeds, because that didn't work.

It happens in the middle of a compile (I don't really know the compile process well enough to be able to tell exactly when).

It's not just a slowing down of the cursor, it's a complete screwing-up of it: for example if I move the mouse exactly horizontally to the left, the cursor will go diagonally up-right, then down, then right, then left and then click!

Help!

----------

## Ian Goldby

I've just fixed a major DMA-not-working problem on my machine. It remains to be seen whether this makes any difference to the mouse.

----------

## jkt

could you try with ps2 mouse?

----------

