{"id":1750,"date":"2016-05-31T07:06:31","date_gmt":"2016-05-31T06:06:31","guid":{"rendered":"http:\/\/rglinuxtech.com\/?p=1750"},"modified":"2016-05-31T07:06:31","modified_gmt":"2016-05-31T06:06:31","slug":"nvidia-possible-kernel-4-7-fix-for-361-45-11-and-367-18","status":"publish","type":"post","link":"https:\/\/rglinuxtech.com\/?p=1750","title":{"rendered":"NVIDIA &#8211; Possible Kernel 4.7 Fix for 361.45.11 and 367.18.."},"content":{"rendered":"<p>Thanks to <em><strong>juston_li<\/strong><\/em> on the NVIDIA Devtalk forum, there is specific detail of the changes needed for Kernel 4.7 compatibility..<\/p>\n<p>Details are at\u00a0\u00a0 <a href=\"https:\/\/devtalk.nvidia.com\/default\/topic\/938665\/linux\/linux-4-7-rc1-367-18-build-errors\/\" target=\"_blank\">https:\/\/devtalk.nvidia.com\/default\/topic\/938665\/linux\/linux-4-7-rc1-367-18-build-errors\/<\/a><\/p>\n<p>The first issue is interesting, as it is due to a Kernel Dev. deciding to introduce a new variable &#8211; <span style=\"font-family: arial,helvetica,sans-serif;\"><strong>radix_tree_empty<\/strong><\/span> &#8211; in Kernel 4.7-rc1, that happens to have the same name as one already used by NVIDIA..\u00a0\u00a0\u00a0\u00a0 Rather than change Kernel code, I decided to change the NVIDIA variable name instead..<\/p>\n<p>So..\u00a0 In <strong><span style=\"font-family: courier new,courier;\">NVxxxx\/kernel\/nvidia-uvm\/uvm8_gpu.c<\/span><\/strong> and <span style=\"font-family: courier new,courier;\"><strong>NVxxxx\/kernel\/nvidia-uvm\/uvm_linux.h<\/strong><\/span> I changed the variable name from <span style=\"font-family: arial,helvetica,sans-serif;\"><strong>radix_tree_empty<\/strong><\/span> to <span style=\"font-family: arial,helvetica,sans-serif;\"><strong>radix_tree_is_empty<\/strong><\/span><\/p>\n<p>There was some concern that changing the NVIDIA code may affect some of their binary executables, but I have tested this modification on a live system, and it all appears to work OK..<\/p>\n<p>For driver <strong>361.45.11<\/strong>, this is the only change needed, as this driver does not include any of the <strong>nvidia-drm<\/strong> code.<\/p>\n<p>For driver <strong>367.18<\/strong> and Kernel 4.7, the changes to remove the (redundant) <strong><em>dev<\/em><\/strong> parameter, as shown in the article, are also necessary, and these need to be kernel-version dependant if the driver will also be run on Kernel 4.6 and earlier..\u00a0\u00a0\u00a0 To enable the kernel version test to occur, I had to add <strong><span style=\"font-family: courier new,courier;\">#include &lt;linux\/version.h&gt;<\/span><\/strong> to both <span style=\"font-family: courier new,courier;\"><strong>nvidia-drm-fb.c<\/strong><\/span> and <span style=\"font-family: courier new,courier;\"><strong>nvidia-drm-gem.c<\/strong><\/span>..<\/p>\n<p>As an example, for\u00a0<span style=\"font-family: courier new,courier;\"><strong>nvidia-drm-fb.c<\/strong><\/span>\u00a0 I changed the code around line 113 from:<\/p>\n<pre><span style=\"font-family: courier new,courier;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<strong> gem = drm_gem_object_lookup(dev, file, cmd-&gt;handles[0]);<\/strong><\/span>\r\n<span style=\"font-family: courier new,courier;\">to:<\/span>\r\n<strong><span style=\"font-family: courier new,courier;\">#if LINUX_VERSION_CODE &gt;= KERNEL_VERSION(4, 7, 0)<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 gem = drm_gem_object_lookup(file, cmd-&gt;handles[0]);<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier;\">#else<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 gem = drm_gem_object_lookup(dev, file, cmd-&gt;handles[0]);<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier;\">#endif<\/span><\/strong><\/pre>\n<p>&#8230;and made the same change to <strong><span style=\"font-family: courier new,courier;\">nvidia-drm-gem.c<\/span><\/strong>, around line 408..<\/p>\n<p>With these changes, both drivers compiled\/loaded OK with Kernel 4.7-rc1, and 4.6.0..<\/p>\n<p><em>Robert Gadsdon.\u00a0\u00a0 May 30, 2016.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thanks to juston_li on the NVIDIA Devtalk forum, there is specific detail of the changes needed for Kernel 4.7 compatibility.. Details are at\u00a0\u00a0 https:\/\/devtalk.nvidia.com\/default\/topic\/938665\/linux\/linux-4-7-rc1-367-18-build-errors\/ The first issue is interesting, as it is due to a Kernel Dev. deciding to introduce a new variable &#8211; radix_tree_empty &#8211; in Kernel 4.7-rc1, that happens to have the same name as <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/rglinuxtech.com\/?p=1750\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,6,11,14,15,18,19,20],"tags":[1371,1374,161,1366,1370,1372,1373],"class_list":["post-1750","post","type-post","status-publish","format-standard","hentry","category-compilation","category-crash-and-burn","category-hacks","category-kernel","category-linux-2","category-nvidia","category-opinion","category-performance-2","tag-367-18","tag-compile-success","tag-fix","tag-kernel-4-7-rc1","tag-nvidia-361-45-11","tag-nvidia-drm","tag-radix_tree_empty"],"_links":{"self":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1750"}],"version-history":[{"count":1,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1750\/revisions"}],"predecessor-version":[{"id":1751,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1750\/revisions\/1751"}],"wp:attachment":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}