LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-13-2019, 03:36 PM   #1
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 14.2 + Multilib
Posts: 1,437

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Eek ! NVidia 410.xx and Kernel 4.4.169+ and get_user_pages


All --

I built 4.4.170 on my Slackware 14.2 box without issue.

I was running 4.4.167 before I booted 4.4.170

I tried running NVIDIA-Linux-x86_64-410.93.run and it failed to compile because the definition of get_user_pages( ) has changed between Linux 4.4.167 and 4.4.170.

I googled the error without any luck.

This is the definition of get_user_pages( ) in Linux 4.4.167:

Code:
# less /usr/src/linux-4.4.167.kjh/include/linux/mm.h

<<snip>> ( line 1200 )
long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
                    unsigned long start, unsigned long nr_pages,
                    int write, int force, struct page **pages,
                    struct vm_area_struct **vmas);
And this is the definition of get_user_pages( ) in Linux 4.4.170:

Code:
# less /usr/src/linux-4.4.170.kjh/include/linux/mm.h
<<snip>> ( line 1200 )
long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
                    unsigned long start, unsigned long nr_pages,
                    unsigned int gup_flags, struct page **pages,
                    struct vm_area_struct **vmas);
These are the lines from /var/log/nvidia-installer.log

Code:
   In file included from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-linux.h:21:0,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:15:
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c: In function 'os_lock_user_pages'
:
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:120:48: warning: passing argument
 6 of 'get_user_pages' makes pointer from integer without a cast [-Wint-conversion]
                                page_count, write, force, user_pages, NULL);
                                                   ^
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-mm.h:44:70: note: in definition of ma
cro 'NV_GET_USER_PAGES'
            get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
                                                                         ^
   In file included from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-pgprot.h:17:0,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-linux.h:20,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:15:
   /usr/src/linux-4.4.170.kjh/include/linux/mm.h:1200:6: note: expected 'struct page **' but argument is of type 'NvBool {aka unsigned char}'
    long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
         ^
   In file included from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-linux.h:21:0,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:15:
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:120:55: warning: passing argument 7 of 'get_user_pages' from incompatible pointer type [-Wincompatible-pointer-types]
                                page_count, write, force, user_pages, NULL);
                                                          ^
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-mm.h:44:77: note: in definition of macro 'NV_GET_USER_PAGES'
            get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
                                                                                ^
   In file included from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-pgprot.h:17:0,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-linux.h:20,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:15:
   /usr/src/linux-4.4.170.kjh/include/linux/mm.h:1200:6: note: expected 'struct vm_area_struct **' but argument is of type 'struct page **'
    long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
         ^
   In file included from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-linux.h:21:0,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:15:
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-mm.h:44:9: error: too many arguments to function 'get_user_pages'
            get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
            ^
            ^
   /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:119:11: note: in expansion of macro 'NV_GET_USER_PAGES'
        ret = NV_GET_USER_PAGES((unsigned long)address,
              ^
   In file included from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-pgprot.h:17:0,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/common/inc/nv-linux.h:20,
                    from /tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.c:15:
   /usr/src/linux-4.4.170.kjh/include/linux/mm.h:1200:6: note: declared here
    long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
         ^
   /usr/src/linux-4.4.170.kjh/scripts/Makefile.build:277: recipe for target '/tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.o' failed
   make[3]: *** [/tmp/selfgz3548/NVIDIA-Linux-x86_64-410.93/kernel/nvidia/os-mlock.o] Error 1
I tried against 4.4.169 and got the same error.

I didn't build 4.4.168 so I reverted to Linux 4.4.167 and NVidia 410.93 and the NVidia Blob built without issues.

Note: I and still using Pat's kernel-headers-4.4.157-x86-1

This is a Q I asked a while back ... opinions on upgrading the Slackware kernel-headers with kernel headers for the running kernel and didn't get an answer.

Should I upgrade the Kernel Headers ?

If so, does anyone have a Kernel Headers SlackBuild ?

Ideas ?

Thanks !

-- kjh

Last edited by kjhambrick; 01-13-2019 at 03:39 PM. Reason: Spelling and Grammar
 
Old 01-15-2019, 03:09 AM   #2
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 836

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
The kernel headers that are released in the kernel-headers-x.x.x-whatever package are the headers used for building the toolchain (glibc & co) and reside in /usr/include/
Now if you get a kernel-headers- package as an update in Slackware, that means you can use it and upgrade them and you won't break anything, it's been checked "upstairs" and maybe glibc&stuff already recompiled to match them.
Overwriting them on your own with the headers from your running kernel is not advised, unless you want to reinstall / recompile parts of your Linux system.
Just for reference, this Gentoo article is the shortest/simplest I could find ATM:
https://wiki.gentoo.org/wiki/Linux-headers
 
2 members found this post helpful.
Old 01-15-2019, 12:44 PM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,632

Rep: Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389Reputation: 3389
Have a look at my post here where I linked to several posts of Pat's about kernel headers.

Simply put, he always upgrades the kernel headers and never runs into any issues with it. Back in the 2.x days, there were possibilities of breakage, but it seems to be highly unlikely now. I only upgrade headers when I use a pre-built package that has them available (like from Pat or dusk), otherwise I just run my own kernels and leave the existing headers in place.

As for a kernel headers SlackBuild, if there isn't one in the source tree, you can use an excerpt from 55020's dusk.SlackBuild to easily create your own SlackBuild for it (it will need minor tweaking to set things for your environment).

Code:
#------------------------------------------------------------------------------
PRGNAM=kernel-headers
#------------------------------------------------------------------------------

PKG=$TMP/package-$PRGNAM
rm -rf $PKG
mkdir -p $PKG
cd $CWD/linux-stable

$NICE make headers_install INSTALL_HDR_PATH=$PKG/usr
find $PKG/usr -type f -name '.*' -delete

mkdir -p $PKG/install
cat $CWD/$SLKARCH/$PRGNAM-slack-desc > $PKG/install/slack-desc

cd $PKG
$NICE $CWD/makepkg -l y -c y $OUTPUT/$PRGNAM-$SLKVER-$SLKARCH-$SLKBUILD$SLKTAG.${PKGTYPE:-txz}
 
2 members found this post helpful.
Old 01-15-2019, 04:23 PM   #4
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 14.2 + Multilib
Posts: 1,437

Original Poster
Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Thanks for the replies all'Y'all ...

I am not ignoring you

I need to do some research before I stick my foot in my mouth ( or before I poke my eye out with a sharp retort )

Here is where I am headed ...

I KNOW that the Kernel Devs have changed the argument list for get_user_pages( ) after 4.4.157 and before 4.4.169

Rhetorical Q: What good does it do to update /usr/include/mm.h ( the Shared Memory library API header ) if get_user_pages( ) is a member of some C-Library that is still based on the old argument list.

On my plate is to find out where get_user_pages() and the other functions in mm.h, etc are made available to the Linker.

If they're linked via glibc then I am in a pickle ... I had better stop playing with Kernels ...

Or am I barking up the wrong tree ???

I can't find mm.h anywhere under /usr/include/ on my Slackware 14.2 System with the Official 4.4.157 Kernel Headers ...

Anyhow, I am up to 'there' with Projects at work but I sure am itching to find out.

-- kjh
 
Old 01-16-2019, 01:03 AM   #5
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 836

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
@kjhambrick

I just answered your question(s):
Quote:
Note: I and still using Pat's kernel-headers-4.4.157-x86-1

This is a Q I asked a while back ... opinions on upgrading the Slackware kernel-headers with kernel headers for the running kernel and didn't get an answer.

Should I upgrade the Kernel Headers ?

If so, does anyone have a Kernel Headers SlackBuild ?
And even if bassmadrigal & Patrick (the links bassmadrigal provided) state that you won't break anything if you upgrade the kernel headers, I'd still advise to not do that, because theoretically there's a possibility to mess things up. Again, I take bassmadrigal's & Patrick's statements and experience as true&granted, as I trust them and also because I never attempted such a thing myself, knowing that I might break things.
Here is the official kernel doc I couldn't find and used that Gentoo wiki instead:
https://www.kernel.org/doc/Documenta...rs_install.txt

There's a confusion about the term "kernel headers" because some distributions (Debian? - Raspbian for sure) strip the kernel source tree of source files and only leave the headers, then pack the resulting tree in a package called kernel headers for distribution purposes. This is useful for compiling kernel modules, where usually you don't need the kernel source files but only the headers. The resulting kernel headers package is smaller (around 100MB or less) and easier to download compared to the whole kernel source tree. Slackware does not provide such a package / solution.

You can do whatever you like in your /usr/src/linux-x.x.x/include/ folders, take a big spoon and mix headers & co up, the worst case scenarios would be a module/kernel build failure or a boot failure if the module/kernel was successfully built with mixed headers but broken.
Since you only spotted the difference in mm.h , I'd take a minimally invasive approach and only change that header file first, inspect it first to make sure it's not heavily modified in the newer release - include section - some new/different headers.
 
1 members found this post helpful.
Old 01-16-2019, 01:27 AM   #6
Gordie
Member
 
Registered: Aug 2007
Location: Nolalu, Ontario, Canada
Posts: 471

Rep: Reputation: 164Reputation: 164
There is a SlackBuild for kernel headers in the directory tree of current. Maybe it can be of use?

https://mirrors.slackware.com/slackw...ers.SlackBuild
 
1 members found this post helpful.
Old 01-16-2019, 01:52 AM   #7
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 836

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Quote:
Originally Posted by Gordie View Post
There is a SlackBuild for kernel headers in the directory tree of current. Maybe it can be of use?

https://mirrors.slackware.com/slackw...ers.SlackBuild
Those are the kernel headers generated by the kernel make headers_install target and residing in /usr/include, the ones I advised not to mess up with:
Code:
  make headers_install ARCH=${HEADERS_ARCH} INSTALL_HDR_PATH=$PKG/usr
  cd $PKG/usr/include
Again:
https://www.kernel.org/doc/Documenta...rs_install.txt
 
1 members found this post helpful.
Old Yesterday, 12:18 PM   #8
Ilgar
Member
 
Registered: Jan 2005
Location: Istanbul, Turkey
Distribution: Slackware64 14.2, Slackwarearm-current
Posts: 998

Rep: Reputation: 123Reputation: 123
I doubt that changing the headers would solve the issue. The driver code makes calls using an old API, so it should not link against the running (new) kernel's binaries. Even if you could force it to, I would expect segfault at first call.

I don't know how practical it is to patch the Nvidia code. If you can do that, a quick Google search reveals how old code can be ported to the new format (you can also follow it through the patches applied to gup.c).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
get_user_pages() linux kernel animesh Linux - Kernel 1 04-08-2014 11:23 AM
Automatically my static ip changes to 169.254.169.254 Arunkumar Goge Linux - Networking 2 04-01-2013 06:19 PM
get_user_pages question nakul.k1 Linux - Kernel 1 09-15-2010 04:07 PM
The nvidia driver 169.09 was working fine, until I upgraded it to 169.12 dv502 Linux - General 1 03-22-2008 06:09 AM
why aio_setup_ring() using get_user_pages()? zdz97 Linux - Kernel 0 02-28-2007 03:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration