blackmagic-10.8.4a4 won't build for kernel 4.9

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Calvin Walmsley

  • Posts: 1
  • Joined: Fri Jan 20, 2017 6:01 am

blackmagic-10.8.4a4 won't build for kernel 4.9

PostFri Jan 20, 2017 6:19 am

Hello,

blackmagic-10.8.4a4 and blackmagic-io-10.8.4a4 fail to compile with DKMS on Linux kernel 4.9, which was released in mid-December and is now available in Debian unstable (sid). The compilation failure is due to a relatively simple change (commit 768ae309a96103ed02eb1e111e838c87854d8b51) to the get_user_pages and get_user_pages_remote functions.

Here's some simple patches to resolve the issue. I built the modified code successfully in Linux 4.9.0-1-amd64 #1 SMP Debian 4.9.2-2 (2017-01-12) x86_64 GNU/Linux, and confirmed that my Intensity Pro 4K appears to work properly.

Code: Select all
diff -Naur ./blackmagic_lib.c /usr/src/blackmagic-10.8.4a4/blackmagic_lib.c
--- ./blackmagic_lib.c   2017-01-19 20:33:03.761221314 -0500
+++ /usr/src/blackmagic-10.8.4a4/blackmagic_lib.c   2017-01-19 20:36:35.075101131 -0500
@@ -662,7 +662,12 @@
       write = 0;
    
    down_read(&current_task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+      if (current_task == current)
+         ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0 , pages, NULL);
+      else
+         ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
       if (current_task == current)
          ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write, 0, pages, NULL);
       else

Code: Select all
diff -Naur ./bm_mm.c /usr/src/blackmagic-io-10.8.4a4/bm_mm.c
--- ./bm_mm.c   2017-01-19 20:33:03.769221561 -0500
+++ /usr/src/blackmagic-io-10.8.4a4/bm_mm.c   2017-01-19 20:37:55.746770949 -0500
@@ -103,7 +103,12 @@
       return false;
 
    down_read(&task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+      if (task == current)
+         ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+      else
+         ret = get_user_pages_remote(task, task->mm, (unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
       if (task == current)
          ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write, 0, umem->pages, NULL);
       else

(Sorry if this is in the wrong place. I noticed that the earlier incompatibility in this function was also posted here in thread 49626.)
Offline

Nicholas Gill

Blackmagic Design

  • Posts: 169
  • Joined: Mon May 04, 2015 10:28 pm

Re: blackmagic-10.8.4a4 won't build for kernel 4.9

PostMon Jan 23, 2017 3:55 am

Hi Calvin,

Thanks for the detailed report, I have created a ticket so that this can be addressed.

Please note that these are primarily user forums; any enquiries requiring a response from Blackmagic Design are probably best directed to either Blackmagic Design Support for general enquiries, or Blackmagic Design Developer Support (the email address is in the DeckLink SDK manual in section "1.2  Overview") for enquiries relating to any of the Blackmagic Design SDKs and Protocols.

I'm pleased that you have a workaround while the ticket is addressed.

Sincerely,

-nick
Offline

Jon Morre

  • Posts: 2
  • Joined: Tue Feb 07, 2017 12:41 pm

Re: blackmagic-10.8.4a4 won't build for kernel 4.9

PostWed Feb 08, 2017 12:47 pm

Thank you very much for this fix - it worked perfectly!
Offline

Daniel Tufvesson

  • Posts: 274
  • Joined: Sun Sep 18, 2016 11:03 am
  • Location: Stockholm, Sweden

Re: blackmagic-10.8.4a4 won't build for kernel 4.9

PostThu Feb 16, 2017 8:04 pm

Thank you Calvin! Terrific fix!
Shoot - BMCC | BMPCC | BMPCC4K | BMVA | GH5
Edit - Resolve Studio 18.1 | Debian Linux 12 | i7-3930K CPU | X79 MB | 32GB RAM | GTX1080 GPU | Speed Editor
Monitor - Decklink SDI, SDI Duo, SDI 4K, Intensity Pro
danieltufvesson.com/makeresolvedeb

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 13 guests