Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Patch nvidia-drivers-331.17 for gentoo-sources-3.11.*
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Chopstix
n00b
n00b


Joined: 20 Oct 2012
Posts: 20

PostPosted: Sun Oct 27, 2013 10:43 pm    Post subject: Patch nvidia-drivers-331.17 for gentoo-sources-3.11.* Reply with quote

The problem:
Code:
 * Gentoo supports kernels which are supported by NVIDIA
 * which are limited to the following kernels:
 * <sys-kernel/gentoo-sources-3.11
 * <sys-kernel/vanilla-sources-3.11
 *
 * You are free to utilize epatch_user to provide whatever
 * support you feel is appropriate, but will not receive
 * support as a result of those changes.
 *
 * Do not file a bug report about this.


The assumption:
You have already keyworded and emerged >=sys-kernel/gentoo-sources-3.11.6 and used eselect to select the new kernel.

The solution:
Code:
mkdir -p /etc/portage/patches/x11-drivers/nvidia-drivers-331.17/


Paste this into /etc/portage/patches/x11-drivers/nvidia-drivers-331.17/kernel.patch :
Code:
--- a/kernel/nv-linux.h 2013-10-27 23:23:30.290956283 +0100
+++ b/kernel/nv-linux.h 2013-10-27 23:25:11.366952961 +0100
@@ -956,7 +956,11 @@
 #endif

 #if !defined(NV_VMWARE)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+#define NV_NUM_PHYSPAGES                get_num_physpages()
+#else
 #define NV_NUM_PHYSPAGES                num_physpages
+#endif
 #define NV_GET_CURRENT_PROCESS()        current->tgid
 #define NV_IN_ATOMIC()                  in_atomic()
 #define NV_LOCAL_BH_DISABLE()           local_bh_disable()

Go ahead and emerge nvidia-drivers.


Last edited by Chopstix on Mon Oct 28, 2013 11:07 am; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Advocate
Advocate


Joined: 29 May 2005
Posts: 4564
Location: Saint Amant, Acadiana

PostPosted: Mon Oct 28, 2013 2:00 am    Post subject: Reply with quote

Chopstix,

great job!

Unfortunately ... many folks have posted it before, including myself ... and mine wasn't the first ... :oops:

Google
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Chopstix
n00b
n00b


Joined: 20 Oct 2012
Posts: 20

PostPosted: Mon Oct 28, 2013 9:23 am    Post subject: Reply with quote

Yes, I traced the original post to this nvidia devtalk forum post, and saw some mention of it here too, but I also saw many posts that people couldn't get the patch to apply, so I re-made the patch to work with the latest versions available, thereby saving some people time and denying them the pleasure of learning how the diff and patch commands work, and how to integrate those with ebuilds... oh why did I do it :P
Back to top
View user's profile Send private message
witul
n00b
n00b


Joined: 10 Feb 2009
Posts: 5

PostPosted: Mon Oct 28, 2013 10:47 pm    Post subject: Reply with quote

Why we have to patch manually almost all versions?
Back to top
View user's profile Send private message
Chopstix
n00b
n00b


Joined: 20 Oct 2012
Posts: 20

PostPosted: Tue Oct 29, 2013 6:39 pm    Post subject: Reply with quote

The error message explains it: nvidia does not officially support the >=3.11 kernel yet.
Back to top
View user's profile Send private message
platojones
Veteran
Veteran


Joined: 23 Oct 2002
Posts: 1533
Location: Just over the horizon

PostPosted: Tue Oct 29, 2013 10:42 pm    Post subject: Reply with quote

witul wrote:
Why we have to patch manually almost all versions?


To expand on what Chopstix said: The Gentoo dev who supports the nvidia-drivers has adopted the policy that Gentoo supports only what Nvidia officially supports. And Nvidia doesn't officially support the 3.11 kernels yet. That seems very reasonable to me, from a Gentoo dev perspective, otherwise, he's signed up for constantly digging up patches and handling all of the potential bugs that get filed for running the drivers with an unsupported kernel. That's also why he added the ability for users to easily apply their own patches to the ebuild, using Gentoo's brilliant ebuild patch mechanism.

So, it's no big deal...when Nvidia releases the drivers to support the 3.11 kernels, we get them. Until then, we just use the simple user patch mechanism.
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1715
Location: Mannheim, Germany

PostPosted: Sat Nov 02, 2013 8:18 pm    Post subject: Reply with quote

Gnah :(

For me the patch fails:

Code:

die "Failed Patch: ${patchname}!";


Completely ~amd64 here, so I wonder why?
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
megaflow
n00b
n00b


Joined: 11 Mar 2005
Posts: 59
Location: Maasmechelen

PostPosted: Sat Nov 02, 2013 10:12 pm    Post subject: Reply with quote

try this patch
https://devtalk.nvidia.com/cmd/default/download-comment-attachment/59607/

and this link is to the site why u need this patch

https://devtalk.nvidia.com/default/topic/628864/unix-graphics-announcements-and-news/num_physpages-and-support-for-3-11-and-later-kernels/
_________________
----------------------------
Dell System XPS L702X/0XN71K,Intel(R) Core(TM) i7-2720QM
Back to top
View user's profile Send private message
Chopstix
n00b
n00b


Joined: 20 Oct 2012
Posts: 20

PostPosted: Sat Nov 02, 2013 11:50 pm    Post subject: Reply with quote

Megaflow are you suggesting he ditch portage and use the installer? Bad advice. How can someone who doesn't know how to apply a simple patch know how to clean his system from the nvidia installer when he decides to move back to portage...

Martux either provide more info on why it failed, or patch it yourself, it's simple.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1122

PostPosted: Sun Nov 03, 2013 12:36 am    Post subject: Reply with quote

@megaflow
very thanks! I have posted a notice at
https://bugs.gentoo.org/show_bug.cgi?id=447566#c175

@Chopstix
you just put the one of the three patches you guess for example at:
/etc/portage/patches/x11-drivers/nvidia-drivers-325.15/get_num_physpages_325-331.patch
The portage tree nvidia ebuild has epatch_user active!
_________________
fun2gen2
Back to top
View user's profile Send private message
Chopstix
n00b
n00b


Joined: 20 Oct 2012
Posts: 20

PostPosted: Sun Nov 03, 2013 11:42 am    Post subject: Reply with quote

I assumed they wouldn't be compatible.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1122

PostPosted: Sun Nov 03, 2013 12:06 pm    Post subject: Reply with quote

Chopstix wrote:
I assumed they wouldn't be compatible.

If any patch is not compatible there is a very,very high chance it
simply doesn't patch and emerge errors out the build process.

Just try :)
_________________
fun2gen2
Back to top
View user's profile Send private message
megaflow
n00b
n00b


Joined: 11 Mar 2005
Posts: 59
Location: Maasmechelen

PostPosted: Sun Nov 03, 2013 12:33 pm    Post subject: Reply with quote

@Chopstix
i try the patch myself before posting it.
I assumed u know how to use epatch , to patch it

i stumble on the patch by a problem with world of warcraft using all my system memory. and make my system run very slow
so i made a quike response on this tread
sorry for that
_________________
----------------------------
Dell System XPS L702X/0XN71K,Intel(R) Core(TM) i7-2720QM
Back to top
View user's profile Send private message
Chopstix
n00b
n00b


Joined: 20 Oct 2012
Posts: 20

PostPosted: Sun Nov 03, 2013 1:49 pm    Post subject: Reply with quote

I meant I thought the patch provided by nvidia would not work with portage only with nvidia's installer, which is why I assumed megaflow was encouraging Martux to ditch portage and use nvidia's installer.
Back to top
View user's profile Send private message
Wallsandfences
Apprentice
Apprentice


Joined: 29 Mar 2010
Posts: 163

PostPosted: Sun Nov 03, 2013 6:30 pm    Post subject: Reply with quote

I'm not sure what your experiences are, but I have the same problem with the patch:
Code:
 *   /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/temp/kernel.patch.out
 * ERROR: x11-drivers/nvidia-drivers-331.17::gentoo failed (prepare phase):
 *   Failed Patch: kernel.patch!
 *
 * Call stack:
 *     ebuild.sh, line   93:  Called src_prepare
 *   environment, line 4234:  Called epatch_user
 *   environment, line 1650:  Called epatch
 *   environment, line 1623:  Called die
 * The specific snippet of code:
 *               die "Failed Patch: ${patchname}!";


Rüdiger
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1715
Location: Mannheim, Germany

PostPosted: Sun Nov 03, 2013 6:42 pm    Post subject: Reply with quote

It just worked for me with the patch from the nvidia-site, megaflow provided earlier.
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
Wallsandfences
Apprentice
Apprentice


Joined: 29 Mar 2010
Posts: 163

PostPosted: Sun Nov 03, 2013 7:01 pm    Post subject: Reply with quote

this is with megaflow's patch...
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1715
Location: Mannheim, Germany

PostPosted: Sun Nov 03, 2013 7:03 pm    Post subject: Reply with quote

Hm, you did an
Code:

mkdir -p /etc/portage/patches/x11-drivers/nvidia-drivers-331.17/

first?
Also made sure, you're only using the one appropriate patch, namely the get_num_physpages_325-331.patch one?
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
Wallsandfences
Apprentice
Apprentice


Joined: 29 Mar 2010
Posts: 163

PostPosted: Sun Nov 03, 2013 8:19 pm    Post subject: Reply with quote

Code:
 cat /etc/portage/patches/x11-drivers/nvidia-drivers-331.17/kernel.patch
This patch will work on installers for the following versions of the
NVIDIA Linux driver:

325.15
331.13
331.17

It will not apply cleanly against older 325 drivers, but can be made to
work with some minor changes.

--- /dev/null
+++ kernel/patch-get_num_physpages.h
@@ -0,0 +1,10 @@
+#define NV_PATCH_get_num_physpages_DESCRIPTION \
+"This patch adds support for kernels such as Linux 3.11, which use the "\
+"get_num_physpages() function instead of the num_physpages variable to "\
+"report the number of physical pages. In order to avoid compatibility "\
+"problems that would otherwise result from differences between what "\
+"the removed num_physpages variable reported versus what is reported "\
+"by get_num_physpages(), the driver will fall back to a different memory "\
+"allocation strategy on systems where num_phsypages is not available, when "\
+"the amount of system memory matches or exceeds the upper bound of a given "\
+"GPU's physical address space.\n"

--- kernel/Makefile
+++ kernel/Makefile
@@ -125,6 +125,7 @@ COMPILE_TESTS = \
    file_operations \
    sg_init_table \
    pci_get_domain_bus_and_slot \
+   get_num_physpages \
    efi_enabled \
    dom0_kernel_present \
    drm_available \

--- kernel/conftest.sh
+++ kernel/conftest.sh
@@ -1676,6 +1676,30 @@ compile_test() {
             fi
         ;;
 
+        get_num_physpages)
+            #
+            # Determine if the get_num_physpages() function is
+            # present.
+            #
+            echo "$CONFTEST_PREAMBLE
+            #include <linux/mm.h>
+            void conftest_get_num_physpages(void) {
+                get_num_physpages(NULL);
+            }" > conftest$$.c
+
+            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            rm -f conftest$$.c
+
+            if [ -f conftest$$.o ]; then
+                echo "#undef NV_GET_NUM_PHYSPAGES_PRESENT" | append_conftest "functions"
+                rm -f conftest$$.o
+                return
+            else
+                echo "#define NV_GET_NUM_PHYSPAGES_PRESENT" | append_conftest "functions"
+                return
+            fi
+        ;;
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1122

PostPosted: Sun Nov 03, 2013 9:51 pm    Post subject: Reply with quote

That is a corrupted patch file. Ca 60percentage of the original.
A patch typically should not end with a '+' sign.
_________________
fun2gen2
Back to top
View user's profile Send private message
Wallsandfences
Apprentice
Apprentice


Joined: 29 Mar 2010
Posts: 163

PostPosted: Mon Nov 04, 2013 8:57 pm    Post subject: Reply with quote

Yeah, you were right, the file wasn't complete. It works now.

Rüdiger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum