Bug 139359 - Checking for remap_pfn_range() no longer works
Summary: Checking for remap_pfn_range() no longer works
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Kernel (show other bugs)
Version: Alpha 4
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-15 15:07 UTC by Stefan Dirsch
Modified: 2006-01-17 11:59 UTC (History)
3 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Patch for segfault of modpost (713 bytes, patch)
2005-12-21 19:19 UTC, Takashi Iwai
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Dirsch 2005-12-15 15:07:40 UTC
Date: Thu, 15 Dec 2005 16:02:23 +0100
From: Stefan Dirsch <sndirsch@suse.de>
To: research@suse.de
Subject: Re: [Research] remap_page_range no longer available?

On Thu, Dec 15, 2005 at 03:26:07PM +0100, Stefan Dirsch wrote:
> On Thu, Dec 15, 2005 at 01:02:04PM +0100, Stefan Dirsch wrote:
> > Hi
> > 
> > Looks like the nvidia kernel module cannot be compiled any longer for
> > BETA (i386/x86_64) distribution.
> > 
> > /usr/src/packages/BUILD/obj/bigsmp/1.0-8174/nv.c: In function 'nv_kern_mmap':
> > /usr/src/packages/BUILD/obj/bigsmp/1.0-8174/nv.c:1980: error: implicit declaration of function 'remap_page_range'
> > 
> > This does *not* happen for STABLE (i386/x86_64). I wonder what's the
> > difference between STABLE and BETA here. 
> > 
> > # sndirsch@shannon:/work/SRC/BETA/all> ls
> > flex  gcc  glibc  ipsec-tools  xgl
> > 
> > Using STABLE glibc-devel package within a BETA build did *not* help.
> > 
> > Any ideas what's wrong here (besides that NVIDIA is evil)?
>
> Forget about remap_page_range. The check for remap_pfn_range, which
> should be prefered (I think remap_page_range is no longer used since a
> longer time), fails in BETA.
>
> + gcc -D__KERNEL__ -nostdinc -isystem /usr/lib/gcc/i586-suse-linux/4.1.0/include -Werror -Wimplicit-function-declaration -I/usr/src/linux/include
+-I/usr/src/linux/include/asm/mach-default -c conftest13540.c
> cc1: warnings being treated as errors
> In file included from /usr/src/linux/include/asm/mpspec.h:5,
>                  from /usr/src/linux/include/asm/smp.h:18,
>                  from /usr/src/linux/include/linux/irq.h:13,
>                  from /usr/src/linux/include/asm/hardirq.h:6,
>                  from /usr/src/linux/include/linux/hardirq.h:7,
>                  from /usr/src/linux/include/linux/interrupt.h:11,
>                  from /usr/src/linux/include/linux/rcuref.h:36,
>                  from /usr/src/linux/include/linux/fs.h:12,
>                  from /usr/src/linux/include/linux/mm.h:15,
>                  from conftest13540.c:1:
> /usr/src/linux/include/asm/mpspec_def.h:78: warning: 'packed' attribute ignored for field of type 'unsigned char[5u]'
>
> Whereas it still works in STABLE:
>
> + gcc -D__KERNEL__ -nostdinc -isystem /usr/lib/gcc/i586-suse-linux/4.1.0/include -Werror -Wimplicit-function-declaration -I/usr/src/linux/include
+-I/usr/src/linux/include/asm/mach-default -c conftest13361.c
>
> Looks like gcc in BETA is more strict now.

Of course I could simply remove the "-Werror" for us and maybe
convince NVIDIA to do the same for the next release. But I think it
would be better to fix this warning in the kernel sources or adjust
gcc to no longer complain about this. What do you think?

Best regards,
Stefan
Comment 1 Stefan Dirsch 2005-12-15 15:10:46 UTC
/usr/src/linux/include/asm/mpspec_def.h:
   [...]
74 struct mpc_config_bus
75 {
76        unsigned char mpc_type;
77        unsigned char mpc_busid;
78         unsigned char mpc_bustype[6] __attribute((packed));
79 };

Richard, what do you think?
Comment 2 Richard Biener 2005-12-15 15:18:24 UTC
It's unfortunate ;)  The attribute is ignored, because it doesn't make any difference if it is there or not.  But the warning is stupid in this case.  I'll report/fix upstream.
Comment 3 Stefan Dirsch 2005-12-15 15:20:55 UTC
Date: Thu, 15 Dec 2005 16:15:07 +0100
From: Takashi Iwai <tiwai@suse.de>
To: research@suse.de
Subject: Re: [Research] remap_page_range no longer available?

> Of course I could simply remove the "-Werror" for us and maybe
> convince NVIDIA to do the same for the next release. But I think it
> would be better to fix this warning in the kernel sources or adjust
> gcc to no longer complain about this. What do you think?

Sure, better to fix the compile warnings.  The __attribute((packed))
there looks superfluous to me.

Takashi
Comment 4 Stefan Dirsch 2005-12-15 15:25:37 UTC
Ok. Then it makes sense to assign this to you, Richard. Thanks for the quick reply!
Comment 5 Stefan Dirsch 2005-12-21 10:39:58 UTC
Rudi added a workaround to nvidia-gfx package for now.

NVIDIA_kernel-1.0-8174-1438624.diff.txt:
diff -ru usr/src/nv/conftest.sh usr/src/nv.1438624/conftest.sh
--- usr/src/nv/conftest.sh      2005-11-23 03:22:31.000000000 +0100
+++ usr/src/nv.1438624/conftest.sh      2005-12-20 15:43:27.287128500 +0100
@@ -25,6 +25,13 @@
 -nostdinc -isystem $ISYSTEM \
 -Werror -Wimplicit-function-declaration"
 
+touch conftest$$.c
+$CC -Wno-attributes -c conftest$$.c > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+    CFLAGS="$CFLAGS -Wno-attributes"
+fi
+rm -f conftest$$.*
+
 if [ "$OUTPUT" != "$SOURCES" ]; then
     CFLAGS="$CFLAGS -I$OUTPUT/include2 -I$OUTPUT/include \
 -I$HEADERS -I$HEADERS/asm/mach-default"

Rudi, where does the patch come from? I couldn't find it on http://www.nvnews.net/vbulletin/showthread.php?t=61052.
Comment 6 Stefan Dirsch 2005-12-21 10:40:50 UTC
Rudi, see my previous comment.
Comment 7 Ruediger Oertel 2005-12-21 11:16:21 UTC
it's from http://www.nvnews.net/vbulletin/showthread.php?t=61874
Comment 8 Ruediger Oertel 2005-12-21 11:20:56 UTC
the bad part about it is, that it helps for remap_page_range, but the build
fails shortly afterwards:

  LD [M]  /usr/src/packages/BUILD/obj/default/1.0-8174/nvidia.o
  Building modules, stage 2.
  MODPOST
Warning: could not find /usr/src/packages/BUILD/obj/default/1.0-8174/.nv-kernel.o.cmd for /usr/src/packages/BUILD/obj/default/1.0-8174/nv-kernel.o
/bin/sh: line 1: 20809 Segmentation fault      scripts/mod/modpost -m -a -i /usr/src/linux-2.6.15-rc6-2-obj/x86_64/default/Module.symvers -s /dev/null /usr/
src/packages/BUILD/obj/default/1.0-8174/nvidia.o
make[3]: *** [__modpost] Error 139

(same segfault on x86 and x86_64).
Comment 9 Stefan Dirsch 2005-12-21 12:08:22 UTC
modpost broken? I see a similar failure (new!) for the ati-fglrx package ...
Comment 10 Takashi Iwai 2005-12-21 19:17:52 UTC
It looks like a bug in modpost.  The patch below seems to work.
Comment 11 Takashi Iwai 2005-12-21 19:19:31 UTC
Created attachment 61609 [details]
Patch for segfault of modpost
Comment 12 Stefan Dirsch 2006-01-02 06:33:38 UTC
Takashi submitted the modpost patch to our kernel CVS. It's included by SuSE's kernel-of-the-day.
Comment 13 Richard Biener 2006-01-09 13:38:33 UTC
Not a "bug" in gcc according to upstream, more like a kernel issue.  Not working on it, so re-assigning.
Comment 14 Lars Marowsky-Bree 2006-01-10 15:14:46 UTC
As per comment #12, I'm assuming this is solved then.

Takashi, please make sure the fix goes upstream too!
Comment 15 Stefan Dirsch 2006-01-10 15:18:57 UTC
No, comments #8-12 discuss a different bug.
Comment 16 Lars Marowsky-Bree 2006-01-10 15:31:28 UTC
Well, then, comment #5 still seems to indicate this is fixed?
Comment 17 Stefan Dirsch 2006-01-10 16:15:41 UTC
No, the patch of comment #5 has not been integrated in the released proprietary nvidia driver.
Comment 18 Lars Marowsky-Bree 2006-01-17 11:59:05 UTC
The attribute has been removed upstream and thus in our latest kernels. Just ignoring bugs for long enough makes them magically better! Whee. ;-)