Skip to contentSkip to conversation

laptop-mode-2.6.0 version 5

PATCH Hugang 3 participants 8 messages Jan 2, 2004 – Mar 29, 2004 6 messages not in the archive Block layer

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Hugang

author
#6 lore raw

Organization: Beijing Soul
X-Mailer: Sylpheed version 0.9.8claws (GTK+ 1.2.10; powerpc-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Quoted 6 lines · On Thu, 1 Jan 2004 19:35:45 +0100 Jens Axboe <[email protected]> wrote:

Patch is obviously bogus, just look at the comm definition in sched.h:

	char comm[16];

IO submission must happen in process context, so we also know that current is valid.

You are right. But why add this patch, My laptop not crash when I enable block dump, So I try to find where is the Bug. Final, The bug is in sector_t, I was enable CONFIG_LBD, So sector_t is u64, So We have to change the code when enable CONFIG_LBD.

I'd like the 2.4 style so add count number into printf.

Here is the patch fix it
+
+ if (unlikely(block_dump)) {
+ char b[BDEVNAME_SIZE];
+ printk("%s(%d): %s block %llu/%u on %s\n",

+           current->comm, current->pid,
+           (rw & WRITE) ? "WRITE" : (rw == READA ? "READA" : "READ"),
+           (u64)bio->bi_sector, count, bdevname(bio->bi_bdev,b));

+ }
+

I think, also have this bug in 2.4.23, here is the patch for it, Hope can helpful.

drivers/block/ll_rw_blk.c (working copy) renamed from drivers/block/ll_rw_blk.c (revision 4) +1 -1
Index: linux-2.4.23/drivers/block/ll_rw_blk.c
===================================================================
@@ -1298,7 +1298,7 @@
                wake_up(&bh->b_wait);
 
        if (block_dump)
-               printk(KERN_DEBUG "%s: %s block %lu/%u on %s\n", current->comm, rw == WRITE ? "WRITE" : "READ", bh->b_rsector, count, kdevname(bh->b_rdev));
+               printk(KERN_DEBUG "%s: %s block %llu/%u on %s\n", current->comm, rw == WRITE ? "WRITE" : "READ", (u64)bh->b_rsector, count, kdevname(bh->b_rdev));
 
        put_bh(bh);
        switch (rw) {
Signature · 3 lines
Hu Gang / Steve
RLU#          : 204016 [1999] (Registered Linux user)
GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc
#7 lore raw
Quoted 11 lines · Hugang

Organization: Beijing Soul
X-Mailer: Sylpheed version 0.9.8claws (GTK+ 1.2.10; powerpc-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Quoted 2 lines · On Thu, 1 Jan 2004 19:35:45 +0100 Jens Axboe <[email protected]> wrote:

Patch is obviously bogus, just look at the comm definition in sched.h:

Quoted 7 lines
Quoted 4 lines
	char comm[16];

IO submission must happen in process context, so we also know that current is valid.

You are right. But why add this patch, My laptop not crash when I enable block dump, So I try to find where is the Bug. Final, The bug

I dunno, I can't possibly tell since you haven't given any info about this crash. Where does it crash, do you have an oops? All I could say from your report + patch is that it wasn't valid. There's just no way for current->comm to be NULL, so your patch couldn't possibly have made a difference.

Quoted 6 lines

is in sector_t, I was enable CONFIG_LBD, So sector_t is u64, So We have to change the code when enable CONFIG_LBD.

I'd like the 2.4 style so add count number into printf.

Here is the patch fix it

Review

Quoted 8 lines
(quoted diff) +8 -0
+
+   if (unlikely(block_dump)) {
+       char b[BDEVNAME_SIZE];
+       printk("%s(%d): %s block %llu/%u on %s\n",
+           current->comm, current->pid,
+           (rw & WRITE) ? "WRITE" : (rw == READA ? "READA" : "READ"),
+           (u64)bio->bi_sector, count, bdevname(bio->bi_bdev,b));
+   }

It's best to keep the line as minimal as possible, count isn't really very interesting. What is interesting is process, offset (for finding the file, if you need to), and data direction.

drivers/block/ll_rw_blk.c (working copy) line 1301

Quoted 11 lines

I think, also have this bug in 2.4.23, here is the patch for it, Hope can helpful.
Index: linux-2.4.23/drivers/block/ll_rw_blk.c
===================================================================

drivers/block/ll_rw_blk.c (working copy) renamed from drivers/block/ll_rw_blk.c (revision 4) +1 -1
@@ -1298,7 +1298,7 @@
                wake_up(&bh->b_wait);
 
        if (block_dump)
-               printk(KERN_DEBUG "%s: %s block %lu/%u on %s\n", current->comm, rw == WRITE ? "WRITE" : "READ", bh->b_rsector, count, kdevname(bh->b_rdev));
+               printk(KERN_DEBUG "%s: %s block %llu/%u on %s\n", current->comm, rw == WRITE ? "WRITE" : "READ", (u64)bh->b_rsector, count, kdevname(bh->b_rdev));

2.4 stock doesn't have 64-bit sectors, please consult (again) the canonical source (include file). There's no need to cast.

Signature · 1 line
Jens Axboe
author
#8 lore raw
Quoted 5 lines · On Fri, 2 Jan 2004 12:27:33 +0100 Jens Axboe <[email protected]> wrote:

I dunno, I can't possibly tell since you haven't given any info about this crash. Where does it crash, do you have an oops? All I could say from your report + patch is that it wasn't valid. There's just no way for current->comm to be NULL, so your patch couldn't possibly have made a difference.

Attached file is the crashed dmesg, When I disable CONFIG_LBD, the problem not found any more.

thanks.

Signature · 3 lines
Hu Gang / Steve
RLU#          : 204016 [1999] (Registered Linux user)
GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc

Total memory = 256MB; using 512kB for hash table (at c0280000)
Linux version 2.6.0-test11-wli-3 ([email protected]) (gcc version 2.95.4 20011002 (Debian prerelease)) #13 Fri Jan 2 19:24:29 CST 2004 Found Uninorth memory controller & host bridge, revision: 210
Mapped at 0xfdf3c000
Found a Intrepid mac-io controller, rev: 0, mapped at 0xfdebc000
Processor NAP mode on idle enabled.
PowerMac motherboard: PowerBook G4 12"
Found UniNorth PCI host bridge at 0xf0000000. Firmware bus number: 0->0
Found UniNorth PCI host bridge at 0xf2000000. Firmware bus number: 0->0
Found UniNorth PCI host bridge at 0xf4000000. Firmware bus number: 0->0
PMU driver 2 initialized for Core99, firmware: 0c
On node 0 totalpages: 65536
DMA zone: 65536 pages, LIFO batch:256
Normal zone: 0 pages, LIFO batch:1
HighMem zone: 0 pages, LIFO batch:1
Building zonelist for node : 0
Kernel command line: root=/dev/hda13 ro
PowerMac using OpenPIC irq controller
OpenPIC Version 1.2 (4 CPUs and 64 IRQ sources) at fc66e000
OpenPIC timer frequency is 4.166666 MHz
PID hash table entries: 2048 (order 11: 16384 bytes)
GMT Delta read from XPRAM: 0 minutes, DST: off
time_init: decrementer frequency = 33.280357 MHz
Console: colour dummy device 80x25
Memory: 250880k available (1472k kernel code, 928k data, 144k init, 0k highmem)
AGP special page: 0xcffff000
Calibrating delay loop... 530.84 BogoMIPS
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
NET: Registered protocol family 16
PCI: Probing PCI hardware
Registering openpic with sysfs...
Using unsupported 1024x768 NVDA,Display-A at 94004000, depth=8, pitch=1024
fb0: Open Firmware frame buffer device on /pci@f0000000/NVDA,Parent@10/NVDA,Display-A@0
ikconfig 0.7 with /proc/config*
Initializing Cryptographic API
Console: switching to colour frame buffer device 128x48
pty: 256 Unix98 ptys configured
Generic RTC Driver v1.07
MacIO PCI driver attached to Intrepid chipset
PowerMac Z8530 serial driver version 2.0
tty00 at 0xd10c1020 (irq = 22) is a Z8530 ESCC
tty01 at 0xd10c8000 (irq = 23) is a Z8530 ESCC
Macintosh non-volatile memory driver v1.0
input: Macintosh mouse button emulation
apm_emu: APM Emulation 0.5 initialized.
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
PCI: Enabling device 0002:02:0d.0 (0000 -> 0002)
ide0: Found Apple UniNorth ATA-6 controller, bus ID 3
Probing IDE interface ide0...
hda: TOSHIBA MK4021GAS, ATA DISK drive
hda: Enabling Ultra DMA 5
Using anticipatory io scheduler
ide0 at 0xd10d0000-0xd10d0007,0xd10d0160 on irq 39
ide1: Found Apple KeyLargo ATA-3 controller, bus ID 0
Probing IDE interface ide1...
hdc: MATSHITADVD-R UJ-815, ATAPI CD/DVD-ROM drive
hdc: MDMA, cycleTime: 120, accessTime: 90, recTime: 30
hdc: Set MDMA timing for mode 2, reg: 0x00011d26
hdc: Enabling MultiWord DMA 2
ide1 at 0xd10d3000-0xd10d3007,0xd10d3160 on irq 24
hda: max request size: 128KiB
adb: starting probe task...
adb devices: [2]: 2 c3 [3]: 3 1 [7]: 7 1f
ADB keyboard at 2, handler 1
Detected ADB keyboard, type ANSI.
input: ADB keyboard on adb2:2.c3/input
input: ADB Powerbook buttons on adb7:7.1f/input
ADB mouse at 3, handler set to 4 (trackpad)
input: ADB mouse on adb3:3.01/input
adb: finished probe task...
hda: 78140160 sectors (40007 MB), CHS=65535/16/63, UDMA(100)
hda: [mac] hda1 hda2 hda3 hda4 hda5 hda6 hda7 hda8 hda9 hda10 hda11 hda12 hda13 hda14
Console: switching to colour frame buffer device 128x48
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP: routing cache hash table of 2048 buckets, 16Kbytes
TCP: Hash tables configured (established 16384 bind 16384)
NET: Registered protocol family 1
EXT3-fs: INFO: recovery required on readonly filesystem.
EXT3-fs: write access will be enabled during recovery.
kjournald starting. Commit interval 5 seconds
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 144k init 4k chrp 8k prep
Adding 524280k swap on /dev/hda10. Priority:-1 extents:1
EXT3 FS on hda13, internal journal
sungem.c:v0.98 8/24/03 David S. Miller ([email protected])
eth0: Sun GEM (PCI) 10/100/1000BaseT Ethernet 00:0a:95:7f:e0:de
eth0: Found BCM5221 PHY
drivers/usb/core/usb.c: registered new driver usbfs
drivers/usb/core/usb.c: registered new driver hub
drivers/usb/core/usb.c: registered new driver hid
drivers/usb/input/hid-core.c: v2.0:USB HID core driver
ohci1394: $Rev: 1045 $ Ben Collins <[email protected]>
PCI: Enabling device 0002:02:0e.0 (0000 -> 0002)
ohci1394_0: Unexpected PCI resource length of 1000!
ohci1394_0: OHCI-1394 1.1 (PCI): IRQ=[40] MMIO=[f5000000-f50007ff] Max Packet=[2048]
Found KeyWest i2c on "mac-io", 1 channel, stepping: 4 bits
Found KeyWest i2c on "uni-n", 2 channels, stepping: 4 bits
ieee1394: Host added: ID:BUS[0-00:1023] GUID[000a95fffe7fe0de]
registering 0-0035
Linux agpgart interface v0.100 (c) Dave Jones
agpgart: Detected Apple UniNorth 2 chipset
agpgart: Maximum main memory to use for agp memory: 204M
agpgart: configuring for size idx: 4
agpgart: AGP aperture is 16M @ 0x0
ohci_hcd: 2003 Oct 13 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
ohci_hcd: block sizes: ed 64 td 64
PCI: Enabling device 0001:01:18.0 (0000 -> 0002)
ohci_hcd 0001:01:18.0: OHCI Host Controller
ohci_hcd 0001:01:18.0: irq 27, pci mem d139a000
ohci_hcd 0001:01:18.0: new USB bus registered, assigned bus number 1
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
PCI: Enabling device 0001:01:19.0 (0000 -> 0002)
ohci_hcd 0001:01:19.0: OHCI Host Controller
ohci_hcd 0001:01:19.0: irq 28, pci mem d13a2000
ohci_hcd 0001:01:19.0: new USB bus registered, assigned bus number 2
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
PCI: Enabling device 0001:01:1a.0 (0000 -> 0002)
ohci_hcd 0001:01:1a.0: OHCI Host Controller
ohci_hcd 0001:01:1a.0: irq 29, pci mem d13a4000
ohci_hcd 0001:01:1a.0: new USB bus registered, assigned bus number 3
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
hub 1-0:1.0: new USB device on port 2, assigned address 2
device-mapper: 4.0.0-ioctl (2003-06-04) initialised: [email protected]
found reiserfs format "3.6" with standard journal
Reiserfs journal params: device dm-3, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 600, max trans age 30
reiserfs: checking transaction log (dm-3) for (dm-3)
Using r5 hash to sort names
found reiserfs format "3.6" with standard journal
Reiserfs journal params: device dm-0, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 600, max trans age 30
reiserfs: checking transaction log (dm-0) for (dm-0)
Using r5 hash to sort names
found reiserfs format "3.6" with standard journal
Reiserfs journal params: device dm-4, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 600, max trans age 30
reiserfs: checking transaction log (dm-4) for (dm-4)
Using r5 hash to sort names
found reiserfs format "3.6" with standard journal
Reiserfs journal params: device dm-5, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 600, max trans age 30
reiserfs: checking transaction log (dm-5) for (dm-5)
Using r5 hash to sort names
eth0: Link is up at 100 Mbps, full-duplex.
eth0: Pause is disabled
NET: Registered protocol family 17
process `named' is using obsolete setsockopt SO_BSDCOMPAT
process `lwresd' is using obsolete setsockopt SO_BSDCOMPAT
process `named' is using obsolete setsockopt SO_BSDCOMPAT
process `lwresd' is using obsolete setsockopt SO_BSDCOMPAT
nfs warning: mount version older than kernel
hda: Set PIO timing for mode 4, reg: 0x00758000

Oops: kernel access of bad area, sig: 11 [#1]
NIP: C00AB674 LR: C00AC2A0 SP: C0729A10 REGS: c0729960 TRAP: 0301    Not tainted

MSR: 00001032 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 0003E740, DSISR: 40000000
TASK = cfd810c0[378] 'bash' Last syscall: 195
GPR00: C0729A58 C0729A10 CFD810C0 0003E740 FFFFFFFE C0194C30 00000000 0000000A
GPR08: FFFFFFFF 0003E740 C00AC254 00000006 22028024

Call trace:
 [c0018d50] printk+0x98/0x1a4
 [c00d2c50] submit_bio+0x110/0x130
 [c005ac38] submit_bh+0x1b4/0x1d0
 [c00586d8] __bread_slow+0xa0/0xfc
 [c0058a04] __bread+0x20/0x30
 [d14da4fc] search_by_key+0xa8/0x1e0c [reiserfs]
 [d14c26d0] reiserfs_read_locked_inode+0x68/0x110 [reiserfs]
 [d14c2820] reiserfs_iget+0x68/0xb8 [reiserfs]
 [d14bd61c] reiserfs_lookup+0x88/0x100 [reiserfs]
 [c0063da0] real_lookup+0x8c/0x14c
 [c0064110] do_lookup+0x68/0xd0
 [c00643f0] link_path_walk+0x278/0x908
 [c0064ddc] path_lookup+0x17c/0x190
 [c0064fd4] __user_walk+0x44/0x70
 [c005fb5c] vfs_stat+0x20/0x5c

init(1): dirtied page
init(1): dirtied page

#9 lore raw
Quoted 11 lines · Hugang
Quoted 5 lines · On Fri, 2 Jan 2004 12:27:33 +0100 Jens Axboe <[email protected]> wrote:

I dunno, I can't possibly tell since you haven't given any info about this crash. Where does it crash, do you have an oops? All I could say from your report + patch is that it wasn't valid. There's just no way for current->comm to be NULL, so your patch couldn't possibly have made a difference.

Attached file is the crashed dmesg, When I disable CONFIG_LBD, the problem not found any more.

Ah there you go, then it's just the missing cast to u64. It has nothing to do with current->comm at all. The compiler should have warned you about this error, did it not?

The dump printk() needs to be changed anyways, the rw deciphering is not correct. Something like this is more appropriate:

	if (unlikely(block_dump)) {
		char b[BDEVNAME_SIZE];

		printk("%s(%d): %s block %Lu on %s\n", current->comm,
			current->pid, (rw & WRITE) ? "WRITE" : "READ",
			(u64) bio->bi_sector, bdevname(bio->bi_bdev, b));
	}
Signature · 1 line
Jens Axboe
#10 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jens" == Jens Axboe <[email protected]> writes:

Jens> The dump printk() needs to be changed anyways, the rw Jens> deciphering is not correct. Something like this is more Jens> appropriate:

Jens> if (unlikely(block_dump)) {
Jens> char b[BDEVNAME_SIZE];
Jens> printk("%s(%d): %s block %Lu on %s\n", current->comm, current-> pid, (rw & WRITE) ? "WRITE" : "READ",
Jens> (u64) bio->bi_sector, bdevname(bio->bi_bdev, b));
Jens> }

Please cast to (unsigned long long) not (u64) because on 64-bit architectures u64 is unsigned long, and you'll get a compiler warning.

#11 lore raw
Quoted 6 lines · Peter Chubb
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jens" == Jens Axboe <[email protected]> writes:

Jens> The dump printk() needs to be changed anyways, the rw Jens> deciphering is not correct. Something like this is more Jens> appropriate:

Quoted 8 lines

Jens> if (unlikely(block_dump)) {
Jens> char b[BDEVNAME_SIZE];
Jens> printk("%s(%d): %s block %Lu on %s\n", current->comm, current-> pid, (rw & WRITE) ? "WRITE" : "READ",
Jens> (u64) bio->bi_sector, bdevname(bio->bi_bdev, b));
Jens> }

Please cast to (unsigned long long) not (u64) because on 64-bit architectures u64 is unsigned long, and you'll get a compiler warning.

Yeah Andrew noted the same thing, my bad.

Signature · 1 line
Jens Axboe
#12 lore raw
In reply to Peter Chubb
Quoted 6 lines · Peter Chubb
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jens" == Jens Axboe <[email protected]> writes:

Jens> The dump printk() needs to be changed anyways, the rw Jens> deciphering is not correct. Something like this is more Jens> appropriate:

Quoted 8 lines

Jens> if (unlikely(block_dump)) {
Jens> char b[BDEVNAME_SIZE];
Jens> printk("%s(%d): %s block %Lu on %s\n", current->comm, current-> pid, (rw & WRITE) ? "WRITE" : "READ",
Jens> (u64) bio->bi_sector, bdevname(bio->bi_bdev, b));
Jens> }

Please cast to (unsigned long long) not (u64) because on 64-bit architectures u64 is unsigned long, and you'll get a compiler warning.

Yeah Andrew noted the same thing, my bad.

Signature · 1 line
Jens Axboe
#13 lore raw
In reply to Jens Axboe
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jens" == Jens Axboe <[email protected]> writes:

Jens> The dump printk() needs to be changed anyways, the rw Jens> deciphering is not correct. Something like this is more Jens> appropriate:

Jens> if (unlikely(block_dump)) {
Jens> char b[BDEVNAME_SIZE];
Jens> printk("%s(%d): %s block %Lu on %s\n", current->comm, current-> pid, (rw & WRITE) ? "WRITE" : "READ",
Jens> (u64) bio->bi_sector, bdevname(bio->bi_bdev, b));
Jens> }

Please cast to (unsigned long long) not (u64) because on 64-bit architectures u64 is unsigned long, and you'll get a compiler warning.