Bug 12267

Summary: WARNING: ioremap on starting X with intel driver and multi-display
Product: Memory Management Reporter: Dionisus Torimens (djtm)
Component: OtherAssignee: Andrew Morton (akpm)
Status: CLOSED CODE_FIX    
Severity: normal CC: jbarnes
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.28-rc9 Subsystem:
Regression: --- Bisected commit-id:

Description Dionisus Torimens 2008-12-21 04:53:07 UTC
Latest working kernel version:
Latest failing kernel version: 2.6.28-rc9
Distribution: Ubuntu
Hardware Environment: Acer Extensa 5220
Software Environment: Xorg 7.4~5ubuntu3
Problem Description:
When I start X, this error appears in dmesg.
X usually crashes sometime later then.

For my logs see http://bugs.freedesktop.org/show_bug.cgi?id=18496

for other reports http://kerneloops.org/search.php?filter=2.6.28-rc8-git1&search=__ioremap_caller

The warning looks like this:
[28556.214595] WARNING: at arch/x86/mm/ioremap.c:226 __ioremap_caller+0x331/0x380()
[28556.214598] Modules linked in: i915 rfkill_input sbs sbshc fan vfat fat ext2 fuse pwc snd_usb_audio snd_usb_lib compat_ioctl32 videodev v4l1_compat snd_hwdep pcmcia arc4 ecb b43 mac80211 cfg80211 input_polldev snd_hda_intel snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss psmouse serio_raw snd_seq_midi sg snd_rawmidi snd_seq_midi_event sr_mod usbhid hid dvb_usb_dtt200u dvb_usb dvb_core ati_remote cdrom snd_seq snd_timer snd_seq_device tifm_7xx1 tifm_core yenta_socket rsrc_nonstatic nsc_ircc snd soundcore ssbsnd_page_alloc irda uhci_hcd ac crc_ccitt battery video thermal button acer_wmi rfkill led_class evdev wmi
[28556.214641] Pid: 25199, comm: Xorg Tainted: G        W  2.6.28-rc9 #80
[28556.214643] Call Trace:
[28556.214650]  [<ffffffff81039baf>] warn_on_slowpath+0x5f/0x90
[28556.214654]  [<ffffffff8102927c>] ? change_page_attr_set_clr+0xdc/0x380
[28556.214657]  [<ffffffff810297c2>] ? _set_memory_uc+0x22/0x30
[28556.214660]  [<ffffffff81027f5d>] ? ioremap_change_attr+0x2d/0x50
[28556.214663]  [<ffffffff810282b1>] __ioremap_caller+0x331/0x380
[28556.214673]  [<ffffffffa036bcd8>] ? i915_gem_entervt_ioctl+0x2b8/0x5a0 [i915]
[28556.214676]  [<ffffffff81028446>] ioremap_wc+0x26/0x30
[28556.214682]  [<ffffffffa036bcd8>] i915_gem_entervt_ioctl+0x2b8/0x5a0 [i915]
[28556.214686]  [<ffffffff81201b8a>] drm_ioctl+0x10a/0x320
[28556.214693]  [<ffffffffa003b6bc>] ? acpi_video_get_brightness+0x2f/0x7a [video]
[28556.214699]  [<ffffffffa036ba20>] ? i915_gem_entervt_ioctl+0x0/0x5a0 [i915]
[28556.214703]  [<ffffffff810c2a4d>] vfs_ioctl+0x7d/0xa0
[28556.214705]  [<ffffffff810c2ae4>] do_vfs_ioctl+0x74/0x480
[28556.214709]  [<ffffffff810ce440>] ? mntput_no_expire+0x20/0x170
[28556.214712]  [<ffffffff810b4740>] ? __fput+0x180/0x200
[28556.214714]  [<ffffffff810c2f89>] sys_ioctl+0x99/0xa0
[28556.214718]  [<ffffffff8100c38b>] system_call_fastpath+0x16/0x1b
[28556.214720] ---[ end trace a6d99db49965d955 ]---
Comment 1 Anonymous Emailer 2008-12-21 09:06:30 UTC
Reply-To: akpm@linux-foundation.org

On Sun, 21 Dec 2008 04:53:07 -0800 (PST) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=12267
> 
>            Summary: WARNING: ioremap on starting X with intel driver and
>                     multi-display
>            Product: Memory Management
>            Version: 2.5
>      KernelVersion: 2.6.28-rc9
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Other
>         AssignedTo: akpm@osdl.org
>         ReportedBy: djtm@gmx.net
>                 CC: jbarnes@virtuousgeek.org
> 
> 
> Latest working kernel version:
> Latest failing kernel version: 2.6.28-rc9
> Distribution: Ubuntu
> Hardware Environment: Acer Extensa 5220
> Software Environment: Xorg 7.4~5ubuntu3
> Problem Description:
> When I start X, this error appears in dmesg.
> X usually crashes sometime later then.
> 
> For my logs see http://bugs.freedesktop.org/show_bug.cgi?id=18496
> 
> for other reports
>
> http://kerneloops.org/search.php?filter=2.6.28-rc8-git1&search=__ioremap_caller
> 
> The warning looks like this:
> [28556.214595] WARNING: at arch/x86/mm/ioremap.c:226

We seem to be getting a lot of reports like this?
Comment 2 Arjan van de Ven 2008-12-22 00:27:07 UTC
On Sun, 21 Dec 2008 09:05:55 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> > for other reports
> >
> http://kerneloops.org/search.php?filter=2.6.28-rc8-git1&search=__ioremap_caller
> > 
> > The warning looks like this:
> > [28556.214595] WARNING: at arch/x86/mm/ioremap.c:226
> 
> We seem to be getting a lot of reports like this?

it's a case of having 2 drivers using the same resource at a time
Linus said it's valid, but the patch below (already sent before) should
fix it:

From 1cc2effbb8ce20c2874022d1f141927d9684b705 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 13 Dec 2008 09:12:18 -0800
Subject: [PATCH] resource: Don't warn for driver originated resource structures

Some drivers (vesafb) only map/reserve a portion of a resource.
If then some other driver comes in and maps the whole resource,
the current code WARN_ON's. This is not the intent of the checks
in iomem_map_sanity_check(); rather these checks want to
warn when crossing *hardware* resources only.

This patch skips BUSY resources as suggested by Linus.

Note: having two drivers talk to the same hardware at the same
time is obviously not optimal behavior, but that's a separate story.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 kernel/resource.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 4337063..e633106 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -853,6 +853,15 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size)
 		if (PFN_DOWN(p->start) <= PFN_DOWN(addr) &&
 		    PFN_DOWN(p->end) >= PFN_DOWN(addr + size - 1))
 			continue;
+		/*
+		 * if a resource is "BUSY", it's not a hardware resource
+		 * but a driver mapping of such a resource; we don't want
+		 * to warn for those; some drivers legitimately map only
+		 * partial hardware resources. (example: vesafb)
+		 */
+		if (p->flags & IORESOURCE_BUSY)
+			continue;
+
 		printk(KERN_WARNING "resource map sanity check conflict: "
 		       "0x%llx 0x%llx 0x%llx 0x%llx %s\n",
 		       (unsigned long long)addr,
-- 
1.6.0.4
Comment 3 Ingo Molnar 2008-12-22 01:08:53 UTC
* Arjan van de Ven <arjan@infradead.org> wrote:

> On Sun, 21 Dec 2008 09:05:55 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > > for other reports
> > >
> http://kerneloops.org/search.php?filter=2.6.28-rc8-git1&search=__ioremap_caller
> > > 
> > > The warning looks like this:
> > > [28556.214595] WARNING: at arch/x86/mm/ioremap.c:226
> > 
> > We seem to be getting a lot of reports like this?
> 
> it's a case of having 2 drivers using the same resource at a time Linus 
> said it's valid, but the patch below (already sent before) should fix 
> it:

i queued up your patch for v2.6.29 a week ago - should it perhaps also be 
marked as Cc: stable? (we can still do it - it's at the tail of the 
tip/core/resources topic branch)

	Ingo
Comment 4 Dionisus Torimens 2008-12-22 02:55:47 UTC
The patch doesn't apply for me, but I've pasted the changes and I will test it now...
Comment 5 Dionisus Torimens 2008-12-22 03:35:38 UTC
It works. No warnings in current git with Arjan's modification (manually applied). I therefore resolve this bug.