Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262391AbVERWoV (ORCPT ); Wed, 18 May 2005 18:44:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262385AbVERWoV (ORCPT ); Wed, 18 May 2005 18:44:21 -0400 Received: from hqemgate01.nvidia.com ([216.228.112.170]:36420 "EHLO HQEMGATE01.nvidia.com") by vger.kernel.org with ESMTP id S262347AbVERWn4 (ORCPT ); Wed, 18 May 2005 18:43:56 -0400 Date: Wed, 18 May 2005 17:43:53 -0500 From: Terence Ripperda To: Linux Kernel Mailing List Cc: tripperda@nvidia.com Subject: problems with 2.6.12 and ioremap/iounmap Message-ID: <20050518224353.GL2596@hygelac> Reply-To: Terence Ripperda Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline X-Accept-Language: en X-Operating-System: Linux hrothgar 2.6.7 User-Agent: Mutt/1.5.6+20040907i X-OriginalArrivalTime: 18 May 2005 22:44:01.0584 (UTC) FILETIME=[161CEB00:01C55BFB] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7188 Lines: 124 --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, I'm looking into a customer issue where they hit a kernel BUG when starting X with our driver (attached logfile). This only occurs with 2.6.12 kernels. this appears to be the 'vmalloc guard page causing change_page_attr problems' bug. at one point, iounmap subtracted the guard page before calling change_page_attr, but I see this was reverted as part of a recent cleanup. in this case, we're remapping a single page of the extended pci config space. note that in the log RAX is the the physical address 00000000e00001e3, but the stack indicates that __change_page_attr was called with address ffff8100e0001000 and pfn 00000000000e0001. from looking at the implementation in 2.6.12-pre4, I'm not clear how the guard page is accounted for in iounmap. in vmalloc.c, the guard page is subtracted from the vm_struct in remove_vm_area (which calls unmap_vm_area). but iounmap in ioremap.c calls unmap_vm_area directly rather than calling remove_vm_area, so the guard page is never subtracted and the wrong size is passed to change_page_attr. is the intent that iounmap should call remove_vm_area rather than unmap_vm_area (with additional changes to not unlink the vma itself)? or that the guard page should be removed by unmap_ rather than remove_? when debugging this issue, I also ran into problems with iounmap using virt_to_page on a pci IO region. this problem went away when I tried calling change_page_attr_addr with the virtual address instead. but perhaps iounmap should be calling ioremap_change_attr rather than change_page_attr directly. I'll run some additional tests and send out a patch. Thanks, Terence --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="lho-nvidia.log" nvidia: module license 'NVIDIA' taints kernel. ACPI: PCI Interrupt 0000:02:00.0[A] -> Link [LNK3] -> GSI 19 (level, high) -> IRQ 185 PCI: Setting latency timer of device 0000:02:00.0 to 64 NVRM: loading NVIDIA Linux x86_64 NVIDIA Kernel Module 1.0-7174 Tue Mar 22 06:45:40 PST 2005 ----------- [cut here ] --------- [please bite here ] --------- Kernel BUG at "arch/x86_64/mm/pageattr.c":154 invalid operand: 0000 [1] PREEMPT SMP CPU 3 Modules linked in: nvidia eeprom i2c_nforce2 smsc47b397 i2c_sensor i2c_isa i2c_core snd_pcm_oss snd_mixer_oss snd_emu10k1 snd_rawmidi snd_ac97_codec snd_pcm snd_page_alloc snd_util_mem snd_hwdep Pid: 6087, comm: X Tainted: P 2.6.12-rc3 RIP: 0010:[] {__change_page_attr+724} RSP: 0018:ffff81015c0ffad8 EFLAGS: 00010282 RAX: 00000000e00001e3 RBX: 8000000000000163 RCX: 0000000000000000 RDX: 0000000000000054 RSI: 00000000000e0001 RDI: ffff81000000f000 RBP: 8000000000000163 R08: 03fffffffffff000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8100e0001000 R13: ffff8100010002a0 R14: ffff81000000c800 R15: 0000000000000002 FS: 00002aaaab493b80(0000) GS:ffffffff8049fac0(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00000000008d0540 CR3: 000000015c5b4000 CR4: 00000000000006e0 Process X (pid: 6087, threadinfo ffff81015c0fe000, task ffff81009fede330) Stack: ffff8100e0001000 00000000000e0001 0000000000000000 0000000000000001 ffffffff7fffffff ffffffff80121a8c 0000000000000000 0000000000000163 8000000000000163 ffff810002c66c80 Call Trace:{change_page_attr_addr+140} {iounmap+459} {:nvidia:os_unmap_kernel_space+9} {:nvidia:_nv001628rm+42} {:nvidia:_nv002102rm+208} {:nvidia:_nv002113rm+255} {:nvidia:_nv002071rm+100} {:nvidia:_nv004369rm+371} {:nvidia:_nv002114rm+64} {:nvidia:_nv003530rm+141} {:nvidia:_nv003486rm+275} {:nvidia:_nv003113rm+126} {:nvidia:_nv004360rm+100} {:nvidia:_nv004193rm+142} {:nvidia:_nv001209rm+118} {:nvidia:_nv001214rm+471} {:nvidia:rm_init_adapter+107} {:nvidia:nv_kern_open+826} {chrdev_open+457} {dentry_open+315} {filp_open+62} {get_unused_fd+219} {sys_open+76} {system_call+126} Code: 0f 0b 7c ab 36 80 ff ff ff ff 9a 00 41 8b 45 00 f6 c4 08 74 RIP {__change_page_attr+724} RSP <6>note: X[6087] exited with preempt_count 1 scheduling while atomic: X/0x00000001/6087 Call Trace:{schedule+122} {flush_cpu_workqueue+467} {autoremove_wake_function+0} {__down+152} {default_wake_function+0} {__down_failed+53} {proc_destroy_inode+0} {:nvidia:.text.lock.os_interface+5} {:nvidia:_nv001740rm+12} {:nvidia:rm_free_unused_clients+105} {:nvidia:nv_kern_ctl_close+146} {:nvidia:nv_kern_close+252} {__fput+98} {filp_close+126} {put_files_struct+115} {do_exit+403} {do_unblank_screen+119} {die+69} {do_invalid_op+145} {__change_page_attr+724} {do_flush_tlb_all+0} {error_exit+0} {__change_page_attr+724} {__change_page_attr+809} {change_page_attr_addr+140} {iounmap+459} {:nvidia:os_unmap_kernel_space+9} {:nvidia:_nv001628rm+42} {:nvidia:_nv002102rm+208} {:nvidia:_nv002113rm+255} {:nvidia:_nv002071rm+100} {:nvidia:_nv004369rm+371} {:nvidia:_nv002114rm+64} {:nvidia:_nv003530rm+141} {:nvidia:_nv003486rm+275} {:nvidia:_nv003113rm+126} {:nvidia:_nv004360rm+100} {:nvidia:_nv004193rm+142} {:nvidia:_nv001209rm+118} {:nvidia:_nv001214rm+471} {:nvidia:rm_init_adapter+107} {:nvidia:nv_kern_open+826} {chrdev_open+457} {dentry_open+315} {filp_open+62} {get_unused_fd+219} {sys_open+76} {system_call+126} --IJpNTDwzlM2Ie8A6-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/