jjkeijser / mpss

Manycore Processor Software Stack
23 stars 11 forks source link

error: initialization from incompatible pointer type #5

Open TheCrimsonLady opened 1 year ago

TheCrimsonLady commented 1 year ago

Hi,

I recently got a Xeon Phi 5110P and I'm now trying to get a working setup for tinkering. Since I mainly use Debian as my Distro of choice, wanted to try to get a working setup with it as host OS, but the notes (they were explicitly called that by the author) I found did not quite work for me due to compile errors. Then found your website here https://jjkeijser.github.io/mpss/xeon-phi-mpss-ubuntu.html and tried to adapt it to my Debian 10 and later 9 install. However, when I get to the make step, the compile fails on micscif/micscif_rma.c with the error "initialization from incompatible pointer type [-Werror=incompatible-pointer-types]". I'll attach the whole error report. To me it sounds more like a programming error than, say, a wrong kernel version.

Do you have any idea how to fix this?

compile-error.txt

jjkeijser commented 1 year ago

first of all, it's been over 2 years that I looked at this code. It's not a programming error, but a kernel incompatibility. In kernel 4.18 we have

void (*invalidate_range_start)(struct mmu_notifier *mn,
                       struct mm_struct *mm,
                       unsigned long start, unsigned long end);

Whereas in 4.19 it's

 * If blockable argument is set to false then the callback cannot
 * sleep and has to return with -EAGAIN. 0 should be returned
 * otherwise.
 *
 */
int (*invalidate_range_start)(struct mmu_notifier *mn,
                   struct mm_struct *mm,
                   unsigned long start, unsigned long end,
                   bool blockable);

so the return type was changed and a parameter was added; the micscif_rma.c code needs to reflect this. However, I currently do not have access to a host with a Xeon Phi to test it on, so I cannot make this change.

my suggestion is to update the function scif_mmu_notifier_invalidate_range_start to

 113 static int scif_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
 114                        struct mm_struct *mm,
 115                        unsigned long start, unsigned long end, bool blockable)
 116 {
 117     struct endpt *ep;
 118     struct rma_mmu_notifier *mmn;
 119     mmn = container_of(mn, struct rma_mmu_notifier, ep_mmu_notifier);
 120     ep = mmn->ep;
 121     micscif_rma_destroy_tcw(mmn, ep, true, (uint64_t)start, (uint64_t)(end - start));
 122     pr_debug("%s start=%lx, end=%lx\n", __func__, start, end);
 123     return 0;
 124 }

(plus you need to update the function definition earlier in the file). No guarantees that this will work, of course, but the compilation error should be gone now.