# Oh, the latency!

## dochawk

I thought that this had been solved a couple of years ago . . .

I'm putting Gentoo on this machine because FreeBSD can't run flash 9 well enough for the kids favorite sites.

X isn't up yet; I'm still on the console.

With system load around 3 as I emerge, I'm seeing a latency of about a second from the keyboard!  This can be either switching consoles, at the command line, or within nano.

This has historically been a noticeable difference between FreeBSD and linux under X, with linux getting choppy at a load of a few, while FreeBSD remained responsive at several dozen.  But I don't think I've ever noticed it at the command line before.  Also, I had understood this to be fixed in the linux kernel a couple ofyears ago.

Is there anything I can do about this?

hawk, who needs to be able to play nethack while he waits.

----------

## frenkel

Is DMA working correctly? Most people experiencing these kind of lag aren't using DMA or using a non-preemptive kernel.

----------

## dochawk

I'm using the default preemption option from the kernel (well, whatever my sources preempt to)

I have no idea how to check dma . . . (/proc/dma simply says "4: cascade")

It's an Athlon-XP 2700 with 256MB DDR on a genericish motherboard with appollow/via chipset.  (Probably VIA).

thanks

hawk

----------

## PaulBredbury

 *dochawk wrote:*   

> I'm using the default preemption option from the kernel (well, whatever my sources preempt to)

 

That tells us exactly nothing. Anyway, configure your kernel, and then recompile it.

----------

## frenkel

 *dochawk wrote:*   

> I'm using the default preemption option from the kernel (well, whatever my sources preempt to)
> 
> I have no idea how to check dma . . . (/proc/dma simply says "4: cascade")
> 
> It's an Athlon-XP 2700 with 256MB DDR on a genericish motherboard with appollow/via chipset.  (Probably VIA).
> ...

 

If you're using the older ide stuff (not libata) hdparm /dev/hd? should give you info about dma. Also check the output of: dmesg | grep DMA

----------

## dochawk

I started by configuring & compiling.

The preemption model is "Voluntary Kernel Preemption (Desktop)".  The description of "Preemptible kernel" sounded like it was overkill. (but I'm recompiling to it as I type).

It refuses to turn on Disk DMA (HDIO_SET_DMA failed: operation not permitted) with hdparm (as root).

I have DMA engine support turned on as I recompile, but it doesn't look applicable.

hawk

----------

## dochawk

also,dmesg includes the line, "powernow-k8: Processor cuuid 681 not supported"

hawk

----------

## dochawk

 *frenkel wrote:*   

> 
> 
> If you're using the older ide stuff (not libata) hdparm /dev/hd? should give you info about dma. Also check the output of: dmesg | grep DMA

 

I have  "enhanced IDE/MFM/RLL, Include IDE/ata-2 disk supporrt, use multi-mode by default, and Include ide/atapi cdrom support"

I haven't seen a libata option.

the grep of DMMA yeilds

DMA  0-4096

DMA zone: 32 pages used for memmap, 0 pages reserved, 4964 pages, LIFO batch:0

which means absolutely nothing to me   :Smile: 

hawk

----------

## eccerr0r

Make sure you enable the IDE options for VIA chipsets, like Via82CXXX.

You can use libata instead, with PATA_VIA; but it sounds like it'd be easier to simply enable VIA82CXXX... enabling libata requires a bit of work to make sure it works.

----------

## bendy

libata is under the sata options when you configure your kernel.  It is now possible to get the kernels sata subsystem ("libata") to handle your older ide drives, but this is a complication you don't want at the moment.

Could you post the output of the lspci command?  This will confirm what chipset you have.  Then you need to make sure that you have enabled support for this chipset under Device Drivers - ATA/ATAPI/MFM/RLL Support in your kernel config.

Also, what Timer Frequency do you have in the kernel config under Processor type and features?

----------

## frenkel

 *dochawk wrote:*   

> I started by configuring & compiling.
> 
> The preemption model is "Voluntary Kernel Preemption (Desktop)".  The description of "Preemptible kernel" sounded like it was overkill. (but I'm recompiling to it as I type).
> 
> It refuses to turn on Disk DMA (HDIO_SET_DMA failed: operation not permitted) with hdparm (as root).
> ...

 

If you get operation not permitted, you didn't compile support for your ide chipset, and so, the kernel can't use DMA (it doesn't know how).

Can you install pciutils and paste the output of lspci here? That way we can find out what chipset you have, and what options you need to select to support it.

 *bendy wrote:*   

> Also, what Timer Frequency do you have in the kernel config under Processor type and features?

 

This doesn't really matter as much as not having DMA does. Lets first get DMA working and see how the latency is then...

----------

## energyman76b

 *dochawk wrote:*   

> I started by configuring & compiling.
> 
> The preemption model is "Voluntary Kernel Preemption (Desktop)".  The description of "Preemptible kernel" sounded like it was overkill. (but I'm recompiling to it as I type).
> 
> It refuses to turn on Disk DMA (HDIO_SET_DMA failed: operation not permitted) with hdparm (as root).
> ...

 

you don't need DMA engine support. No desktop does.

You need to enable the right driver for your mainboard (and disable generic drivers). Forget libata/sata.

After that, everything will be much better.

----------

## dochawk

Hmm.  After several hours, the latency issue just disappeared.  I had compiled and installed a new kernel, but not rebooted.      In noticed once X was up that X would freeze for a second or two on launching a new xterm, but aside from that, it's gone.

And now the lag seems gone entirely, and the drives are coming up with dma on (I haven't turned it on for hda, but I don't want to do *anything* that might provoke that drive  :Smile: .

Also, the problem with lilo solved itself, too . . . (lilo was using 305 even though hdb had been specified)

Thanks

hawk, still scratching his head

----------

