Daily blurbs Nov. 2005


daily blurbs

28 Nov 2005 (Mon)

22:45:58 # Life A quick hack to view diffs with docdiff, when you are using subversion. I had a need to preview what's changed in a file, and the file was under subversion version control. The following is a snippet that I came up with. Creates a HTML docdiff for the current buffer in emacs, and invokes mozilla-firefox to view the change. Nice.

(defun svndocdiff-current ()
  "Invoke svn docdiff for the current buffer,
and run mozilla-firefox -remote openfile(filename)
to preview the diff"
  (let* ((currentname 
	  (buffer-file-name (current-buffer)))
	  (concat default-directory
		   (buffer-file-name (current-buffer)))
	  "/usr/bin/docdiff --html %s %s > %s")
	  "mozilla-firefox -remote 'openfile(%s)'")
	  (concat default-directory
     (format diff-command 
     "*svndocdiff*" "*svndocdiff-err*")
     (format mozilla-command-line
     "*svndocdiff*" "*svndocdiff-err*")))

23 Nov 2005 (Wed)

12:58:35 # Life coreutils major change impacting a lot of packages. I seem to be getting more reports on pbuilder failing weirdly. I also noticed cowdancer no longer seems to be working. cowdancer debugging time, again. First, I noticed that cp has changed behavior and cowdancer testsuite was failing to set up a test lab. cp -al 1/ 2/ used to create directory 2/ from 1/, but it now fails complaining that 2/ no longer exists. cp -al 1/ 2 will do what I wanted to do. The main problem was that with 5.3.0 (which was uploaded on 12 Nov), stat --format changed behavior, and that broke cow-shell. According to the NEWS, in new feature(!) section.

With stat, a specified format is no longer automatically newline terminated. If you want a newline at the end of your output, append `\n' to the format string.

Of course, what is worse, older stat doesn't handle \n. and this is going to be a source of compatibility hacks.

$ stat . --format "%d\n"

Hey guys, this is meant to be a set of core utilities that people tend to rely on their behavior...

It took me a bit of time to find out, since the solution was to conflict with apt-move, I almost missed it. 339136.

18 Nov 2005 (Fri)

22:51:16 # Life Hello ptrace, on ppc. I've started playing with ptrace on my ibook. It is a bit different from what I have seen on x86 machines. First, the test sample that I have had hanging around in my source tree didn't build. It told me there was no PTRACE_GETREGS symbol. This means that I won't be able to read contents of a register, which sounds like a bad news when capturing system calls. I made a bit of research. Following the header files, by including linux/user.h, asm/user.h asm-ppc/user.h asm/page.hlinux/ptrace.h asm/ptrace.hasm-ppc/ptrace.h are included. PTRACE_GETREGS is not defined anywhere. Looking at ppc64 for comparison, it is different but also did not define PTRACE_GETREGS (PPC_PTRACE_GETREGS is defined, which is a bit of an added mystery). Kernel side source is at arch/ppc/kernel/ptrace.c function sys_ptrace. Looking at that, PTRACE_GETREGS wasn't handled in the switch statement. In arch/ppc64/kernel/ptrace.c, PPC_PTRACE_GETREGS is defined and it seems to be implementing a PPC_PTRACE_GETREGS which looks like functionally what I'm looking for. Looking at that code, it looks really trivial to add that feature, I wonder why it's not there. I don't think ppc32 is overshadowed enough by ppc64 that development could be halted.

13 Nov 2005 (Sun)

09:40:15 # Life Tokyo Area Debian Meeting was held last night. It was the '10th' meeting (12th in non-geek terms) There was discussion about dpkg-statoverride and DWN translation. Main questions and discussion topic follow.

20:56:08 # Life ibookg4 does suspend and resume fine. I didn't really configure anything, but I noticed that when I close the lid on my ibookg4, it suspends; and when I open it up, it resumes. I am using 2.6.14. Amazing. Nice laptop, heh. Update: Phil Kern and Wouter Verhelst commented that suspend/resume doesn't really function when USB devices are plugged in. I didn't have anything plugged in today, that will need to be investigated later...

eth0: suspending, WakeOnLan disabled
radeonfb (0000:00:10.0): suspending to state: 3...
uninorth-agp: disabling AGP on device 0000:00:10.0
uninorth-agp: disabling AGP on bridge 0000:00:0b.0
radeonfb (0000:00:10.0): resuming from state: 3...
PCI: Enabling device 0000:00:10.0 (0000 -> 0003)
radeon: PAD_CTLR_STRENGTH doesn't stabilize !
agpgart: Putting AGP V2 device at 0000:00:0b.0 into 4x mode
agpgart: Putting AGP V2 device at 0000:00:10.0 into 4x mode
PCI: Enabling device 0001:10:1b.0 (0000 -> 0002)
PCI: Enabling device 0001:10:1b.1 (0000 -> 0002)
PCI: Enabling device 0001:10:1b.2 (0000 -> 0002)
ehci_hcd 0001:10:1b.2: park 0
ehci_hcd 0001:10:1b.2: USB 2.0 restarted, EHCI 1.00, driver 10 Dec 2004
eth0: resuming
PHY ID: 4061e4, addr: 0
hda: Enabling Ultra DMA 5
hdc: Enabling MultiWord DMA 2
adb: starting probe task...
adb devices: [2]: 2 c9 [3]: 3 1 [7]: 7 1f
ADB keyboard at 2, handler 1
ADB mouse at 3, handler set to 4 (trackpad)
adb: finished probe task...
agpgart: Putting AGP V2 device at 0000:00:0b.0 into 4x mode
agpgart: Putting AGP V2 device at 0000:00:10.0 into 4x mode
[drm] Loading R200 Microcode

9 Nov 2005 (Wed)

18:50:58 # Life oprofiling debuild. referring to Red Hat Magazine article for rpm, I tried doing similar with Debian debuild. Rough information is available, but since Debian does not come with debug infos per default, really meaningful result is not easy to get at. To obtain a vmlinux file, I can invoke make vmlinux from the kernel build directory that I invoked make-kpkg. I am not sure how I can use make-kpkg to obtain a debug kernel. On my amd64 box, csum_partial_copy_generic is taking a large chunk of time. arch/x86_64/lib/csum-copy.S. I tried getting the call graph using -c option, but it didn't give me a meaningful answer, maybe I'm missing something.

CPU: AMD64 processors, speed 2193.7 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a unit mask
of 0x00 (No unit mask) count 860000
  samples|      %|
    11587 35.6940 /home/dancer/shared/git/linux-2.6/vmlinux
     3971 12.2328 /usr/bin/perl
          samples|      %|
             2981 75.0693 /usr/lib/libperl.so.5.8.7
              649 16.3435 /lib/libc-2.3.5.so
              292  7.3533 /lib/ld-2.3.5.so
               43  1.0829 /lib/libpthread-2.3.5.so
                2  0.0504 /lib/libdl-2.3.5.so
                1  0.0252 /usr/bin/perl
                1  0.0252 /lib/libm-2.3.5.so
                1  0.0252 /lib/libnss_compat-2.3.5.so
                1  0.0252 /usr/lib/perl/5.8.7/auto/POSIX/POSIX.so
     3926 12.0941 /usr/lib/gcc/x86_64-linux-gnu/4.0.2/cc1
          samples|      %|


$ opreport -t 1 -l ~/shared/git/linux-2.6/vmlinux
CPU: AMD64 processors, speed 2193.7 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a unit mask of 0x00 (No unit mask) count 860000
samples  %        symbol name
2575     22.2232  csum_partial_copy_generic
833       7.1891  __down_interruptible
410       3.5384  timer_interrupt
309       2.6668  do_wp_page
274       2.3647  free_pages_bulk
244       2.1058  get_user_pages
242       2.0885  vsnprintf
234       2.0195  __handle_mm_fault
198       1.7088  vma_adjust
196       1.6916  shrink_zone
182       1.5707  do_mlock
170       1.4672  generic_file_aio_write_nolock
162       1.3981  ioread16_rep
157       1.3550  mlock_fixup
153       1.3204  sort
151       1.3032  sys_mincore
148       1.2773  error_exit
140       1.2083  invalidate_inodes

18:53:35 # Life assembly output for x86_64. I compiled a C program which just gives out 'hello world', and analyzed the gcc assembly output. I suppose subq/addq for rsp is for int parameter; or it could be an ABI requirement. It is surprising that pointer is movl'd to edi (32-bit) for the puts parameter. To set eax=0 (for the return value), xorl (32-bit) is used. I wonder what happens to the higher 32-bits. Maybe it's time to seek for the CPU reference.

        .string "Hello world"
        .p2align 4,,15
        subq    $8, %rsp
        movl    $.LC0, %edi
        call    puts
        xorl    %eax, %eax
        addq    $8, %rsp

21:43:34 # Life Christian Aichinger commented on the previous blog entries about amd64 assembly output, and vmlinux. Apparently, on amd64, int is 32-bits. I've tested with sizeof, and apparently so. And as for vmlinux, it was a hot topic that I've been missing some discussion in debian-devel. Time to delve in.

$ realcsh.c
REAL csh:  printf("%i %i %i %i\n",sizeof (short), sizeof (int), sizeof (long), sizeof (long long));
realcshMJmQzq: In function 'main':
realcshMJmQzq:8: warning: format '%i' expects type 'int', but argument 2 has type 'long unsigned int'
realcshMJmQzq:8: warning: format '%i' expects type 'int', but argument 3 has type 'long unsigned int'
realcshMJmQzq:8: warning: format '%i' expects type 'int', but argument 4 has type 'long unsigned int'
realcshMJmQzq:8: warning: format '%i' expects type 'int', but argument 5 has type 'long unsigned int'
2 4 8 8

3 Nov 2005 (Thu)

13:41:11 # Life cvs-commitinfo for cvs on alioth. After searching and googling and testing, I finally figured out how to do CVS log message mails. In commitinfo file, add a line with DEFAULT /usr/bin/cvs-mailcommit --mailto mail-address --from mail-address --diff --full --root %r --dir %p %{sVv}. There are many different ways to write it, but most examples on the web were wrong, since apparently --cvs option no longer works with newer cvs releases.

1 Nov 2005 (Tue)

09:05:07 # Life pbuilder hacking. 336081 is weird, in that something that should be output on the stderr is mixed in the diff.gz output. Weird.

Junichi Uekawa

$Id: 200511.html.en,v 1.13 2005/11/28 14:00:47 dancer Exp $