BenV's notes

Software

P4-Clockfuck

by on Sep.03, 2009, under Software

You know what’s really annoying?

Try this:

root@Uil:/sys/devices/system/cpu/cpu0/cpufreq:0>echo ondemand > scaling_governor
root@Uil:/sys/devices/system/cpu/cpu0/cpufreq:0>dmesg
[1325843.712549] ondemand governor failed, too long transition latency of HW, fallback to performance governor

Apparently this is caused by the p4-clockmod module.
You know, this piece of junk:

p4-clockmod

p4-clockmod


Also known as “CONFIG_X86_P4_CLOCKMOD“.

The reason?
Well, the ondemand and the conservative governors want to be able to switch to a different speed before their calculations become invalid.
The p4-clockmod thing apparently makes the latency of switching so BIG that it becomes impossible. Or so they think.
Which leaves only the sucky powersave and performance governors. (and of course userspace).

The kernel menuconfig help states:

This driver should be only used in exceptional
circumstances when very low power is needed because it causes severe
slowdowns and noticeable latencies. Normally Speedstep should be used
instead.

Lovely. I’ll keep that in mind, thanks.
*enables CONFIG_X86_ACPI_CPUFREQ instead*

Note that when they’re both compiled in (as opposed to modules) the retarded thing seems to go for the clockmod. Just great.

1 Comment :, , more...

Phpbb wtf

by on Sep.01, 2009, under Software

Today, phpbb decided to fuck with me.
Or with lotjuh that is. She went to our forum, blank page.
I went there to check, works fine for me. Meh. Probably firefox fucking up as usual.
She tries lynx. Blank.
She tries telnet….

benv@janeman:~:1>telnet forum.handofhades.eu 80
Trying 80.69.76.81...
Connected to forum.handofhades.eu.
Escape character is '^]'.
GET / HTTP/1.0
Host: forum.handofhades.eu

HTTP/1.1 200 OK
Date: Tue, 01 Sep 2009 07:50:04 GMT
Server: Apache/2.2.12 (Unix) mod_ssl/2.2.12 OpenSSL/0.9.8h DAV/2 PHP/5.2.10 SVN/1.4.6
X-Powered-By: PHP/5.2.10
Content-Length: 0
Connection: close
Content-Type: text/html

Connection closed by foreign host.

What. the Fuck.

So, I check the server logs. Nothing.
NOTHING!!!!

Restarted apache. Nothing (surprise!)

Started php myself on index.php. Nothing.
Strace on php to try to figure out what the fuck.
And then I get a glimpse of where it goes wrong when I see it enter a cache dir.
The cache dir has tons of stuff, but most of them look like these:

-rw------- 1 www www 316 2009-08-23 18:42 sql_a10522de103f7e26c0338f4a3982efe0.php
-rw------- 1 www www 316 2009-08-24 21:38 sql_a12f21b584712a564d6bde0b3f733ef2.php
-rw------- 1 www www 316 2009-08-23 00:46 sql_a1386e2adab2812fb0a9076cfbb0fa1a.php
-rw------- 1 www www 316 2009-08-24 11:22 sql_a14603b084ca6516a8f591651a4f0286.php
-rw------- 1 www www 316 2009-08-24 23:02 sql_a1aaa40aaac9978cb292881202667264.php
-rw------- 1 www www 316 2009-08-24 18:23 sql_a1cb1e3ad6332900edb533b9e2a904e4.php
-rw------- 1 www www 316 2009-08-30 18:56 sql_a1cbb2008b00faafb8957bafc7082453.php
-rw------- 1 www www 316 2009-08-22 12:36 sql_a1d2e08e3641f1b8f7c03ceda2e78981.php
-rw------- 1 www www 316 2009-08-24 15:58 sql_a1eac242296c2e713f78618b8b49ad15.php

You get the point.


root@blue:/www/vhosts/forum.handofhades.eu/cache# rm sql_*.php

Fixed. Piece of cancer. Thanks for telling me…

Leave a Comment : more...

Xen and Power Saving

by on Sep.01, 2009, under Software

Or more specific: CPU frequency scaling.

On my laptop this is one of the first things I enabled to make my battery last longer.
Now that we’re going to put a server in a rack where they will bill us depending on the amount of power consumed, this sounds like a welcome thing to have enabled.

Our latest Xen install has Xen 3.4, on which they’ve enabled it by default. Isn’t that nice?
So basically, if your processor etc is good enough to support it, you can mess around with it using the xenpm tool.

For instance we can check the parameters for CPU 0 like this:

root@xenbro:~# xenpm get-cpufreq-para 0
cpu id : 0
affected_cpus : *0 1 2 3
cpuinfo frequency : max [2600000] min [800000] cur [800000]
scaling_driver :
scaling_avail_gov : userspace performance powersave ondemand
current_governor : ondemand
ondemand specific :
sampling_rate : max [10000000] min [10000] cur [20000]
up_threshold : 80
scaling_avail_freq : 2600000 1900000 1400000 *800000
scaling frequency : max [2600000] min [800000] cur [800000]

As you can see, it’s very much like the whole cpufreq ordeal. It has an ondemand governor, a powersave one, etc. Right now this CPU is using the ondemand governor, which will ramp up the clock when demand increases.
However, since this is a quad core and not a real quad processor machine we can only change the governor for all 4 cores at the same time, not for individual ones. (would be cool to have 1 core burning away power while the rest idles by….).

Anyway, the xenpm tool allows us to monitor and change various aspects of this.
For instance this will do a little benchmark and show the processor states during the benchmark.

root@xenbro:~# xenpm start 10
Timeout set to 10 seconds
Start sampling, waiting for CTRL-C or SIGINT or SIGALARM signal ...
Elapsed time (ms): 10003

CPU0: Residency(ms) Avg Res(ms)
C0 49 ( 0.50%) 0.04
C1 9953 (99.50%) 7.19

Avg freq 800000 KHz

CPU1: Residency(ms) Avg Res(ms)
C0 13 ( 0.14%) 0.07
C1 9989 (99.86%) 48.49

Avg freq 800000 KHz

CPU2: Residency(ms) Avg Res(ms)
C0 83 ( 0.83%) 0.21
C1 9919 (99.17%) 25.05

Avg freq 800000 KHz

CPU3: Residency(ms) Avg Res(ms)
C0 28 ( 0.28%) 0.10
C1 9973 (99.72%) 33.92

Avg freq 800000 KHz

As you can see my processor is mostly idle.
State C0 is the most active state, C1 is sleeping with use of the HLT instruction.
Your processor can have many more states, like my laptop which has 4.

Anyway, I put the change to ondemand governor in my /etc/rc.d/rc.local, so let’s hope it helps.

To read some more about the details of this stuff you can check out the Xenpm wiki page.

4 Comments :, , more...

Minor annoyance about linux

by on Aug.31, 2009, under Morons, Software

So I’m working on a little info script (check out Infoscreen) so I can have a nice overview
of my server when I look at console number one without having to log in etc.

Simple question:
“Where in /proc can I find a list of IP addresses with corresponding interfaces?”

Simple answer:
Try /proc/net/if_inet6!

wouter@wouter-laptop:~:0>cat /proc/net/if_inet6
00000000000000000000000000000001 01 80 10 80 lo
20010888148d0000022100fffe221352 04 40 00 00 wlan1
fe80000000000000022100fffe221352 04 40 20 80 wlan1

… that’s great…. but I really wanted the IPv4 addresses as well.
“/proc/net/if_inet4” or “/proc/net/if_inet”? Noooooo….

Conclusion: KANKER LINUX!

Obviously I can get the address by calling ‘ip addr show‘, ‘ifconfig‘ or a heap of other solution involving calling ioctl on sockets or using the netlink interface… but seriously, blegh.

The most retarded thing is that pretty much every other statistic about my network devices is there… including active connections and whatnot, but ipv4 addresses? Nooooo….. *RAAH*

Leave a Comment :, , , , more...

New server, day 2. DomU and networking.

by on Aug.29, 2009, under Software

Another day, another time for fun!

Since we got Xen up and running yesterday, it’s now time for actually having some fun with it.
The goals are:

  1. Getting xend started automagically when booting without destroying my network connection
  2. Getting a domU up and running with a network connection
  3. Getting an internal network between the domUs and dom0, shielded from the big bad internet.

(continue reading…)

Leave a Comment :, , , , , more...

New server, slackware64 and Xen 3.4

by on Aug.29, 2009, under Hardware, Software

You read it right, time for fun!

First we build ourselves a nice cute little server in a 2U rack case made by Chenbro (sounds like Xenbro to me ;)).
Inside we stash a quad core Phenom X2 810, 2 western digital 1TB disks from the “green” series and of course 8GB of DDR1333.
Could be faster, but this should do for not too much coin. (about 600 euros).
(continue reading…)

10 Comments :, , , more...

PDF printing and Cups (The Cups Drama ™ Part 2!)

by on Aug.25, 2009, under Software

Here we are today, trying to do a very simple thing. Print a stupid little PDF document so our customers can pay their bills.
Easy huh? Especially after the previous cups drama?

So we fire up xpdf on the document, hit the print icon, lpr, GO!
*time passes*
Mhm, what is it now?
*check http://localhost:631*
Nope, no document there, seems like it was handled by the printer.
*check cups error_log*
Heaps of garbage there.

Remember that we had this issue left in our previous cups story? Something about PDF printing causing issues? (continue reading…)

Leave a Comment :, , , more...

dos2unix

by on Aug.21, 2009, under Morons, Software

Another annoying thing: morons that save their files with dos line endings.
Also known as “I’ve got motherfucking ^M in my file, AAAIIEEEEYGGrrgrll“.
I usually find out about this when bash complains about stuff like this:

benv@janeman:~$ ./bla.pl
-bash: ./bla.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

(HAAAAAT!!!)

Solution:

benv@janeman:~$ vim kankerfile
:set fileformat=unix
:wq

(Don’t confuse fileformat with filetype, one is used for encoding, the other for things as syntax highlighting)

Solution 2:

benv@janeman:~$ dos2unix kankerfile

I never use this since I never have that piece of cancer called dos2unix, but some distros do.

Solution 3:

sed -ie 's/\r//g' bla.pl

That should fix it. On to the “let’s trash my home directory with my fancy new perl script that I just converted” 😉

Leave a Comment :, , more...

Installing rrdtool 1.3/1.4 on Slackware

by on Aug.21, 2009, under Software

This keeps bugging me.
Configure fails to build rrdtool because xrender is referenced in the cairo.pc pkg-config file.
The error looks like this:

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of pangocairo. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libpangocairo-1.0 and its header files. If
you have not installed pangocairo, you can get it either from its original home on

http://ftp.gnome.org/pub/GNOME/sources/pango/1.17

You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of pangocairo is 1.17.

LIBS=-lm -lglib-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
LDFLAGS=
CPPFLAGS= -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include

----------------------------------------------------------------------------
configure: error: Please fix the library issues listed above and try again.

However, it doesn’t need it at all. The doc/rrdbuild.txt describes this problem for Opensolaris, but it goes for Slackware as well.

Solution:

root@janeman# perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc

Now it -will- run through configure. Thanks. (yeah yeah, it’s hidden in the docs somewhere).

Leave a Comment :, more...

configure/autoconf and paths

by on Aug.21, 2009, under Software

Of course you’re already thrilled by my slackbuild.pl script, but this one thing keeps popping up.
How do I get configure to get my system paths right without giving it a line that’s 2389472389 arguments long?
Simple, install a site config.
A what?!

It’s a tiny little shell script that takes the configure options and barfs out some prefixes and stuff based on the options presented to it.
So when I tell it prefix=/usr, it will decide that sysconfdir=/etc instead of sysconfdir=/usr/etc.

You can get my my version here:
[Download not found]

Now the important tidbit. In order for configure to automagically use this script, you wil need to set the environment variable CONFIG_SITE.
Personally I do this through a profile file. Download the config.site script, put it in /etc and put the profile file in /etc/profile.d. Logout/login, done.
Oh, here’s the profile file:
[Download not found]

Now if everything worked out allright, running configure should start with something like this:

benv@janeman:/usr/src/coolprogram-1.0$ ./configure
configure: loading site script /etc/config.site
prefix=/usr
sysconfdir=/etc
bindir=/usr/bin
sbindir=/usr/sbin
includedir=/usr/include
libdir=/usr/lib64
libexecdir=/usr/libexec
datadir=/usr/share
mandir=/usr/share/man
infodir=/usr/share/info
localstatedir=/var
sharedstatedir=/var/cache
lispdir=/usr/share/emacs/site-lisp

Wonderful isn’t it? 🙂

Leave a Comment :, , , more...