1 |
Hi, |
2 |
|
3 |
Thanks for the detailed explanation of your testing procedure! It is good |
4 |
to know what is behind a local patched driver, just in case.. :) |
5 |
|
6 |
|
7 |
Best regards, |
8 |
Natanael. |
9 |
|
10 |
On 6 August 2016 at 16:20, David Haller <gentoo@×××××××.de> wrote: |
11 |
|
12 |
> Hello, |
13 |
> |
14 |
> On Sat, 06 Aug 2016, Natanael Olaiz wrote: |
15 |
> >Thank you for your patch. It was a good example to answer my question. |
16 |
> > |
17 |
> >But about the patch itself, I see that you are commented the code for |
18 |
> >radix_tree_empty(...). In my patch I renamed it and it only usage instead, |
19 |
> >so I'm sure it's calling the same code. I don't know the expected |
20 |
> >compatibility with the kernel function implementation... But without |
21 |
> >knowing the specific code for neither the nvidia driver nor the kernel, I |
22 |
> >think the rename is safer... |
23 |
> |
24 |
> If you're in doubt or hit any trouble, yes, definitely change/adapt |
25 |
> the patch to only rename that function and use the renamed function in |
26 |
> the nvidia-driver as in your original patch. Keep/adapt the stuff |
27 |
> about kernel-versions though. That's the "safe" approach. |
28 |
> |
29 |
> That "just put it in /etc/portage/patches/..." should work tough :) |
30 |
> |
31 |
> |
32 |
> I've looked quite sharp at the code, i.e. in the nvidia code |
33 |
> |
34 |
> static bool radix_tree_empty(struct radix_tree_root *tree) |
35 |
> { |
36 |
> void *dummy; |
37 |
> return radix_tree_gang_lookup(tree, &dummy, 0, 1) == 0; |
38 |
> } |
39 |
> |
40 |
> vs. the kernel function |
41 |
> |
42 |
> static inline bool radix_tree_empty(struct radix_tree_root *root) |
43 |
> { |
44 |
> return root->rnode == NULL; |
45 |
> } |
46 |
> |
47 |
> *oik* I miss a check for root != NULL there ;) |
48 |
> |
49 |
> Anyway, it was quite clear, that the driver calls kernel-stuff at this |
50 |
> point anyway, radix_tree_gang_lookup() is a kernel function. (I love |
51 |
> to use mc for digging for stuff like this!) |
52 |
> |
53 |
> So, digging into the kernel-source I came to the conclusion that |
54 |
> calling the _kernel code_(!) |
55 |
> |
56 |
> radix_tree_gang_lookup(tree, &dummy, 0, 1); |
57 |
> |
58 |
> actually _is_ (or SHOULD BE) equivalent to the kernel code for |
59 |
> the new |
60 |
> |
61 |
> radix_tree_empty(tree); |
62 |
> |
63 |
> and the latter should be faster (unless the compiler optimizes the |
64 |
> 'radix_tree_gang_lookup(root, &dummy, 0, 1)' call away). |
65 |
> |
66 |
> All this applies if and only if the last two arguments of |
67 |
> radix_tree_gang_lookup() are 0 and 1! And yes, I did go through the |
68 |
> code of radix_tree_gang_lookup() step by step (repeatedly) until I was |
69 |
> sure enough that the code is equivalent). But I'm not a C guru. I |
70 |
> might have missed something even important. So, if more guys firm in C |
71 |
> can check this ... |
72 |
> |
73 |
> As I'm a guy generally trusting the kernel guys _a lot_ and that |
74 |
> nvidia assumedly got it right implementing 'radix_tree_empty(tree)' |
75 |
> via 'radix_tree_gang_lookup(tree, &dummy, 0, 1);' and I think those |
76 |
> two equivalent (with 0, 1 being the 3rd and 4th parameters!), I tried |
77 |
> it, and it worked. |
78 |
> |
79 |
> And Meino has not yet complained. AFAIR he's around long enough to |
80 |
> have complained by now (and circumvented problems with the patch). |
81 |
> I'll ping him on the -user ML though in a parallel mail. |
82 |
> |
83 |
> Recap: calling the kernel function in this way (via the nvidia function) |
84 |
> |
85 |
> radix_tree_gang_lookup(tree, &dummy, 0, 1); |
86 |
> |
87 |
> is IMHO equivalent to calling the kernel function |
88 |
> |
89 |
> radix_tree_empty(tree); |
90 |
> |
91 |
> and on this I based my patch on. I'm rather sure from looking at the |
92 |
> code. It worked in a short test. Meino has not complained yet. If you |
93 |
> want a "sure"/"safe" approach, go with renaming the function in the |
94 |
> nvidia-code, or wait a bit if Meino pipes up, he should've been |
95 |
> running the driver with my patch for a week by now. Or until an |
96 |
> official patch crops up. |
97 |
> |
98 |
> Or, take precautions, some other way to boot+chroot, and keep the |
99 |
> "old" driver handy or to disable it, build a binary package of the |
100 |
> previous driver, have an older kernel ready etc. pp., you know the |
101 |
> drill, don't you? |
102 |
> |
103 |
> -dnh |
104 |
> |
105 |
> -- |
106 |
> MCSE: "Microsoft Certified Stupidity enclosed" -- A. Spengler |
107 |
> |
108 |
> |