Linux 3.16 LTS Kernel for Odroid C2

Moderators: odroid, mdrjr

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby meveric » Fri Mar 09, 2018 8:27 am

once the Kernel is "stable" it will most likely work out of the box on Dietpi.
As I provide the Kernel for Dietpi it will simply update from Kernel 3.14 to 3.16 once it's "official".
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 8781
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby tobetter » Tue Mar 13, 2018 3:18 pm

Linux 3.16 kernel source is uploaded to here:
https://github.com/hardkernel/linux/com ... c2-v3.16.y

For native build on C2, please do these command
Code: Select all
$ git clone https://github.com/hardkernel/linux.git -b odroidc2-v3.16.y
$ cd linux                                                                                                                   
$ make odroidc2_defconfig                                                                                                   
$ make -j4                                                                                                                   
tobetter
 
Posts: 2197
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Tue Mar 13, 2018 4:59 pm

Thank you for the official branch.
I've just downloaded and built it.

All the official WiFi modules and Bluetooth dongle are working fine.
USB 720p webcam and USB-GPS are okay too.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby rooted » Tue Mar 13, 2018 5:24 pm

Great work @tobetter and especially @scpcom.
User avatar
rooted
 
Posts: 4950
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Fri Mar 16, 2018 7:22 pm

We've tested the following items.
- Board identification: OK
- Power off and Wake up using GPIO key: OK
- HDMI PHY Manual setting: OK
- How to turn off your monitor: OK
- Setting max cpu frequency and cores: OK
- handling dvfs and vcck domain: OK
- Thermal policy: The final table is applied, so it looks ok. I think it will be better to put stress & aging test to make sure.
- ADC/I2C/GPIO/GPIO IRQ/UART + wiringPi Test : OK
- Watchdog Timer reset test: OK

General Linux guide on our WiKi pages.
* How-to boot Linux over NFS
- (Ubuntu Minimal) OK
* How-to boot Linux over TFTP (W.I.P.)
- (Ubuntu Minimal) OK
* Board Identification
- (Ubuntu Minimal) OK
* Tips for Custom Boot Logo
- (Ubuntu Mate) OK (except applying custom resolution)
* Blue LED off
- (Ubuntu Mate) OK
* DDR clock adjustment by updating boot
- (Ubuntu Mate) OK
* How to set max cpu frequency and cores
- (Ubuntu Mate) clock frequency 2016, 1896 Fail, 1752 OK
* Watchdog on Linux/Ubuntu
- (Ubuntu Mate) OK
* boot.ini Configuration on Linux/Ubuntu
- (Ubuntu Mate) OK
* How to turn off your monitor
- (Ubuntu Mate) OK

Kodi 17.6
Adjust Display refresh rate (Kodi)
- (Ubuntu Mate) OK
HDMI Passthrough (Kodi)
- (Ubuntu Mate) OK

We found some issues to be fixed.
When I set 1080i, I get a huge kernel panic. (I'm in a panic, too. :-O)
3.5" Touch driver doesn't work.
KVM/ARM doesn't work (Message: Restoring 288 IRQs, but kernel supports max 256)

We believe we can fix those issues within a couple weeks.

We also need to check the crashoverride's great c2play and c2enc projects functionality later once we fix the known issues.
Anything else we missed?
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby mad_ady » Fri Mar 16, 2018 7:27 pm

Boom Bonnet/HiFi Schield, RTC Clock shield, USB UVC webcam?
Netconsole patches?
If I have time I would like to try it out as well on a dev board.
User avatar
mad_ady
 
Posts: 3841
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Fri Mar 16, 2018 7:36 pm

Right. I forgot to mention the I2S related products like HiFi-Shield 1,2 and Boon Bonnet.
They didn't work at all and we have to merge/port the related drivers.

RTC Clock shield worked fine.
USB-UVC camera worked too.

Yes! we need your help for implementing the Netconsole absolutely. :D
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby mad_ady » Fri Mar 16, 2018 10:16 pm

I'll have a look then. The old patch should work fine or with minimal changes.
User avatar
mad_ady
 
Posts: 3841
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby mad_ady » Mon Mar 19, 2018 6:11 pm

I've compiled and booted your kernel. Netconsole works out of the box. The patches must have been merged already. Otherwise, it looks ok, but I haven't done much testing.
User avatar
mad_ady
 
Posts: 3841
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Mon Mar 19, 2018 6:46 pm

Thank you for the confirmation. :D
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Mon Mar 19, 2018 7:30 pm

We've tested crashoverride's c2play and c2enc on Kernel 3.16.
c2enc had no issue. The HW encoder worked well.

But c2play didn't work from time to time.
We used this 1080p/60fps sample video to test it.
http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4
When it didn't work we could see this error message.
Code: Select all
odroid@odroid64:~/Videos$ c2play-x11 bbb_sunflower_1080p_60fps_normal.mp4
added device: /dev/input/event6
added device: /dev/input/event5
added device: /dev/input/mouse1
added device: /dev/input/event4
added device: /dev/input/event3
added device: /dev/input/event2
added device: /dev/input/event1
added device: /dev/input/mouse0
added device: /dev/input/event0
added device: /dev/input/mice
Device: /dev/input/event6
bustype=0, vendor=0, product=0, version=0
name=lircd
InputDevice entering running state.
Device: /dev/input/event5
bustype=0, vendor=0, product=0, version=0
name=MCE IR Keyboard/Mouse (meson-ir)
InputDevice entering running state.
Device: /dev/input/mouse1
EVIOCGBIT failed.
Device: /dev/input/event4
bustype=25, vendor=0, product=0, version=0
name=meson-ir
InputDevice entering running state.
Device: /dev/input/event3
bustype=25, vendor=5812, product=1793, version=1
name=vt-input
InputDevice entering running state.
Device: /dev/input/event2
bustype=16, vendor=7054, product=3308, version=1
name=cec_input
InputDevice entering running state.
Device: /dev/input/event1
bustype=3, vendor=1133, product=50475, version=273
name=Logitech USB Receiver
InputDevice entering running state.
Device: /dev/input/mouse0
EVIOCGBIT failed.
Device: /dev/input/event0
bustype=3, vendor=1133, product=50475, version=273
name=Logitech USB Receiver
InputDevice entering running state.
Device: /dev/input/mice
EVIOCGBIT failed.
Using input device: lircd
Using input device: MCE IR Keyboard/Mouse (meson-ir)
Using input device: meson-ir
Using input device: vt-input
Using input device: cec_input
Using input device: Logitech USB Receiver
Using input device: Logitech USB Receiver
X11Window: width=1920, height=1080
EGL: major=1, minor=4
EGL: Vendor=ARM
EGL: Version=1.4 Linux-r6p1-01rel0
EGL: ClientAPIs=OpenGL_ES
EGL: Extensions=EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_swap_buffers_with_damage EGL_EXT_swap_buffers_with_damage EGL_KHR_lock_surface EGL_KHR_lock_surface2 EGL_EXT_create_context_robustness EGL_ANDROID_blob_cache EGL_KHR_create_context EGL_KHR_partial_update EGL_KHR_create_context_no_error
EGL: ClientExtensions=EGL_EXT_client_extensions EGL_EXT_platform_base EGL_KHR_platform_x11


X11Window: xwin = 58720258
mmap failed: Operation not permitted
eglGetError failed: 0x3003
terminate called after throwing an instance of 'Exception'
Aborted


It's time to invite crashoverride for helping us.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby crashoverride » Tue Mar 20, 2018 5:41 am

I will investigate the issue. Testing will be performed using the most recent Ubuntu 16.04 image with the kernel compiled using the C2 instead of cross compiling. I will also be testing using the "next" branch of C2. These details will only be important if there is an issue reproducing the error.
crashoverride
 
Posts: 3542
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby crashoverride » Tue Mar 20, 2018 10:34 am

I was able to reproduce the issue. The output of GDB is as follows:
Code: Select all
#0  0x0000007fb6653528 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x0000007fb66549e0 in __GI_abort () at abort.c:89
#2  0x0000007fb68c76d8 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/aarch64-linux-gnu/libstdc++.so.6
#3  0x0000007fb68c5424 in ?? () from /usr/lib/aarch64-linux-gnu/libstdc++.so.6
#4  0x0000007fb68c5470 in std::terminate() ()
   from /usr/lib/aarch64-linux-gnu/libstdc++.so.6
#5  0x0000007fb68c56f4 in __cxa_throw ()
   from /usr/lib/aarch64-linux-gnu/libstdc++.so.6
#6  0x000000000046a5d4 in Egl::CheckError () at ../../src/UI/Egl.cpp:28
#7  0x000000000046b3e4 in X11AmlWindow::X11AmlWindow (this=0x4fdbb0)
    at ../../src/UI/X11/X11Window.cpp:306
#8  0x000000000040e200 in __gnu_cxx::new_allocator<X11AmlWindow>::construct<X11AmlWindow> (this=0x7ffffff0f8, __p=0x4fdbb0)
    at /usr/include/c++/5/ext/new_allocator.h:120
#9  0x000000000040d78c in std::allocator_traits<std::allocator<X11AmlWindow> >::construct<X11AmlWindow> (__a=..., __p=0x4fdbb0)
    at /usr/include/c++/5/bits/alloc_traits.h:530
#10 0x000000000040c764 in std::_Sp_counted_ptr_inplace<X11AmlWindow, std::allocator<X11AmlWindow>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(std::allocator<X11AmlWindow>) (this=0x4fdba0, __a=...)
    at /usr/include/c++/5/bits/shared_ptr_base.h:522
---Type <return> to continue, or q <return> to quit---


This shows the error originates here:
https://github.com/OtherCrashOverride/c2play/blob/5bf7d1a009ed544a4f33dd2a08a702990d82f5d4/src/UI/X11/X11Window.cpp#L303-L307
Code: Select all
   EGLBoolean success = eglMakeCurrent(eglDisplay, surface, surface, context);
   if (success != EGL_TRUE)
   {
      Egl::CheckError();
   }


The error seen does not originate from c2play.
Code: Select all
mmap failed: Operation not permitted


This indicates that the issue is either in libMali.so or in the Mali kernel driver (the latter is most likely). Due to this, it also affects other GLES programs. Once the error occurs, it appears to consistently happen.
Code: Select all
odroid@odroid64:~$ glmark2-es2
mmap failed: Operation not permitted
Error: eglMakeCurrent failed with error: 0x3003
Error: CanvasGeneric: Invalid EGL state
Error: main: Could not initialize canvas
crashoverride
 
Posts: 3542
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby crashoverride » Tue Mar 20, 2018 11:05 am

Further investigation using strace shows that its "/dev/ump" that is failing:
Code: Select all
[pid 10332] openat(AT_FDCWD, "/dev/ump", O_RDWR) = 5


Code: Select all
[pid 10332] mmap(NULL, 1921024, PROT_READ|PROT_WRITE, MAP_SHARED, 5, 0x4515d410000) = -1 EPERM (Operation not permitted)


[edit]
The last argument to mmap is "offset". The value in the call is likely invalid.
http://man7.org/linux/man-pages/man2/mmap.2.html
crashoverride
 
Posts: 3542
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Tue Mar 20, 2018 11:24 am

Thank you for the deep investigation.
Something could be wrong with the mmap/ump related drivers. :(
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby crashoverride » Wed Mar 21, 2018 7:33 am

I have investigated further and formed a theory. It appears the UMP driver was designed for 32bit use. The C2 implementation has been patched, but there are still some internal casts and calculations that assume 32bit operation. With the change to 3.16 there are likely some kernel structures interfaces that break 32bit assumptions. I theorize this is the heart of the UMP issue.

The bases for this was conclusion was starting from a "clean" UMP driver from ARM's GPL provided source. As the compiler produced errors and warning, I investigated the source code area where they were seen and compared the ARM source to the current C2 source. Manually patching the ARM source code did not yield a working UMP driver, though.

This issue affects all OpenGLES applications. This can be verified by running glmark2-es2 four times. The first three attempts work, the final attempt fails with the "mmap error".

Resolving this issue will likely either require 1) reviewing the UMP driver source for 32bit assumption or 2) removing UMP use and transitioning to DMABUF. Since libMali is closed source, I can not form a recommendation for which approach is better.
crashoverride
 
Posts: 3542
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Thu Mar 22, 2018 5:09 am

pwm_ctrl seems to be not working.
module is loaded but dont see /sys/devices/platform/pwm-ctrl
Last edited by Khem on Thu Mar 22, 2018 2:17 pm, edited 1 time in total.
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby crashoverride » Thu Mar 22, 2018 12:01 pm

I spent more time investigating UMP. After some manual patching to ensure 64bit calculations, the issue still persists. I then enabled full logging from the driver and added some additional debug info. However, I was unable to observe any incorrect operation of the UMP driver.

The error returned (-EPERM) does not appear to originate from the UMP driver. It appears to originate instead from the kernel. Furthermore, the issue happens consistently on the fourth run and persists after that. The implication is that issue is related to the kernel's internal housekeeping since it persists past open/close of UMP and regardless of process termination. This can be confirmed by stopping the X server after the issue appears (all instances of UMP are now closed) and then starting it again. This may indicate an error in the kernel or a change in expected behavior from previous versions.

I do not have the tools or resource to investigate beyond this point. Those researching further should conduct tests of both the DMA API and MMAP independent of UMP.
crashoverride
 
Posts: 3542
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Fri Mar 23, 2018 3:20 am

has someone tried 3.5inch LCD with 3.16 kernel ?
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby mad_ady » Fri Mar 23, 2018 3:34 am

@odroid mentioned about a week ago that the driver wasn't ported yet.
User avatar
mad_ady
 
Posts: 3841
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby tobetter » Fri Mar 23, 2018 9:43 am

Khem wrote:has someone tried 3.5inch LCD with 3.16 kernel ?

The patches are merged into 3.16 branch,
https://github.com/hardkernel/linux/com ... cf8c79a6aa
https://github.com/hardkernel/linux/com ... 866bc48cb8
tobetter
 
Posts: 2197
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Fri Mar 23, 2018 12:21 pm

@Khem
You will find pwm ctrl at /sys/devices/pwm-ctrl/

@all
If you compare /sys/devices from 3.14 with 3.16 you will see many devices moved from /sys/devices/platform/ to /sys/devices/
To get the old behaviour we could patch this:
Code: Select all
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 500436f9b..059eeeee7 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -138,7 +138,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
    }
 
    dev->dev.of_node = of_node_get(np);
-   dev->dev.parent = parent;
+   dev->dev.parent = parent ? : &platform_bus;
 
    if (bus_id)
       dev_set_name(&dev->dev, "%s", bus_id);
@@ -293,7 +293,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
    /* setup generic device info */
    dev->dev.coherent_dma_mask = ~0;
    dev->dev.of_node = of_node_get(node);
-   dev->dev.parent = parent;
+   dev->dev.parent = parent ? : &platform_bus;
    dev->dev.platform_data = platform_data;
    if (bus_id)
       dev_set_name(&dev->dev, "%s", bus_id);
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Sat Mar 24, 2018 7:45 am

@scpcom thanks for info. I think its ok to keep current behavior. It would be good to document it though
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby daggs » Sat Mar 24, 2018 5:12 pm

Greetings,

I've tried to test this branch but i've couldn't even compile it, after some investigating the issue was found, the source of the problem is the usage of $(PWD) in this file: https://github.com/hardkernel/linux/blo ... ali/Kbuild
PWD is a env var which is used represent the current folder of the active shell.
note that no other Kbuild is using PWD.
but there are more than one way to execute a makefile, the following is the most trivial one:
Code: Select all
$ cd /path/to/folder
$ make

but the following is another valid way that is used a lot too.
Code: Select all
$ cd /path/to/folder1
$ make -C /path/to/folder

the latter form will fail this branch compile wise
I tried to debug it but for some reason it won't work.
I'll try to give it another crack later today if I'll have time.
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby daggs » Sun Mar 25, 2018 12:45 am

fixed, my small contribution can be found in the attached patch.
unrelated, what is supported and can be considered stable?
Attachments
patch.rar
(2.64 KiB) Downloaded 10 times
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby tobetter » Sun Mar 25, 2018 1:57 am

daggs wrote:fixed, my small contribution can be found in the attached patch.
unrelated, what is supported and can be considered stable?

Thank you for the change.
When I looked at Kbuild error, it was fine after removing all '$(PWD)' in Kbuild like this.
Code: Select all
--- a/drivers/gpu/arm/mali/Kbuild
+++ b/drivers/gpu/arm/mali/Kbuild
@@ -38,7 +38,7 @@ ifeq ($(wildcard $(srctree)/$(src)/linux/license/gpl/*),)
     endif
     $(error Linux Device integration is incompatible with non-GPL license)
 else
-    ccflags-y += -I$(PWD)/$(src)/linux/license/gpl
+    ccflags-y += -I$(src)/linux/license/gpl
 endif
 
 ifeq ($(USING_GPU_UTILIZATION), 1)
@@ -151,7 +151,7 @@ mali-y += \
        platform/meson_bu/platform_gx.o \
        platform/meson_bu/scaling.o     
 
-ifneq ($(wildcard $(PWD)/$(src)/linux/mali_slp_global_lock.c),)
+ifneq ($(wildcard $(src)/linux/mali_slp_global_lock.c),)
        mali-y += linux/mali_slp_global_lock.o
 endif
tobetter
 
Posts: 2197
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby daggs » Sun Mar 25, 2018 2:47 am

tobetter wrote:
daggs wrote:fixed, my small contribution can be found in the attached patch.
unrelated, what is supported and can be considered stable?

Thank you for the change.
When I looked at Kbuild error, it was fine after removing all '$(PWD)' in Kbuild like this.
Code: Select all
--- a/drivers/gpu/arm/mali/Kbuild
+++ b/drivers/gpu/arm/mali/Kbuild
@@ -38,7 +38,7 @@ ifeq ($(wildcard $(srctree)/$(src)/linux/license/gpl/*),)
     endif
     $(error Linux Device integration is incompatible with non-GPL license)
 else
-    ccflags-y += -I$(PWD)/$(src)/linux/license/gpl
+    ccflags-y += -I$(src)/linux/license/gpl
 endif
 
 ifeq ($(USING_GPU_UTILIZATION), 1)
@@ -151,7 +151,7 @@ mali-y += \
        platform/meson_bu/platform_gx.o \
        platform/meson_bu/scaling.o     
 
-ifneq ($(wildcard $(PWD)/$(src)/linux/mali_slp_global_lock.c),)
+ifneq ($(wildcard $(src)/linux/mali_slp_global_lock.c),)
        mali-y += linux/mali_slp_global_lock.o
 endif


PWD is used all over the place, that patch cannot logically solve the issue, there is a grep for example that fails.
multiple cds too
daggs
 
Posts: 219
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby tobetter » Sun Mar 25, 2018 5:08 am

daggs wrote:PWD is used all over the place, that patch cannot logically solve the issue, there is a grep for example that fails.
multiple cds too

I know, it's just part of change I made. All "$(PWD)" in the Makefile have to be removed. Here is my full change.
https://github.com/tobetter/linux/commi ... d81ff24d8c
tobetter
 
Posts: 2197
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Sun Mar 25, 2018 7:45 am

Removing all PWD breaks debian build and others like this:
Code: Select all
cd /path/to/folder
make -C /path/to/folder O=/path/to/folder/debian/build/build_arm64_none_c2/.


Instead of removing $(PWD) we should replace it with $(srctree)
linux-3.14.y-amlogic-gpu_arm_Kbuild-use-srctree.patch
This should work wit all build types.
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby tobetter » Sun Mar 25, 2018 8:39 am

scpcom wrote:Removing all PWD breaks debian build and others like this:
Code: Select all
cd /path/to/folder
make -C /path/to/folder O=/path/to/folder/debian/build/build_arm64_none_c2/.


Instead of removing $(PWD) we should replace it with $(srctree)
linux-3.14.y-amlogic-gpu_arm_Kbuild-use-srctree.patch
This should work wit all build types.

This makes sense more and has been merged into the branch.
https://github.com/hardkernel/linux/com ... 75ed682e5a

I've tested with these commands.
Code: Select all
$ mkdir build && cd build
$ make ARCH=arm64 CROSS_COMPILE=${CROSS_COMPILE} -C ../linux odroidc2_defconfig
$ make ARCH=arm64 CROSS_COMPILE=${CROSS_COMPILE} -C ../linux
tobetter
 
Posts: 2197
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Tue Mar 27, 2018 1:16 pm

scpcom wrote:Removing all PWD breaks debian build and others like this:
Code: Select all
cd /path/to/folder
make -C /path/to/folder O=/path/to/folder/debian/build/build_arm64_none_c2/.


Instead of removing $(PWD) we should replace it with $(srctree)
linux-3.14.y-amlogic-gpu_arm_Kbuild-use-srctree.patch
This should work wit all build types.


See this patch for 3.14 here https://github.com/hardkernel/linux/com ... 18280338a4
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Wed Mar 28, 2018 8:51 am

@khem
Yes, I know this patch. But some more parts were needed to fix make with "O="
With additional patch from March 24 it works.

PS: Currently I am investigating the mmap error (-EPERM) with UMP/GLES discussed above.
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Wed Mar 28, 2018 9:06 am

We've been trying to solve the mmap issue too. But it is really hard to trace a root cause.
If we find any clue, we will share it immediately.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Wed Mar 28, 2018 12:11 pm

Yes it was not easy to follow the kernel jumping from function to function: sys_mmap -> mmap_pgoff -> vm_mmap_pgoff -> do_mmap_pgoff -> mmap_region -> ump_file_mmap -> _ump_ukk_map_mem ..... :-)
I did some customized debugging.

The mmap error (-EPERM) comes from here:
https://github.com/hardkernel/linux/blo ... ap.c#L1598
https://github.com/hardkernel/linux/blo ... /fs.h#L488

On 3.14 there is no mapping_map_writable(), mapping->i_mmap_writable gets handled somewhere else
https://github.com/hardkernel/linux/blo ... ap.c#L1582

I also found a possible solution for this, but I need to test the patch before I upload it.
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Wed Mar 28, 2018 1:03 pm

Great! Very impressive analysis.
Thank you for the nice news.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Wed Mar 28, 2018 3:37 pm

Here it is:
linux-3.16.y-amlogic-gpu_arm_fix_mmap_permissions.patch

I could run glmark2-es2 and c2play (with bbb_sunflower_1080p_60fps_normal.mp4) repeating many times without any crash.
Maybe someone could do a longer stress test, I will do more testing also this evening.
Last edited by scpcom on Thu Mar 29, 2018 8:55 am, edited 1 time in total.
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Thu Mar 29, 2018 1:02 am

scpcom wrote:Her it is:
linux-3.16.y-amlogic-gpu_arm_fix_mmap_permissions.patch

I could run glmark2-es2 and c2play (with bbb_sunflower_1080p_60fps_normal.mp4) repeating many times without any crash.
Maybe someone could do a longer stress test, I will do more testing also this evening.


@scpcom should VM_SHARED flag be checked before calling mapping_map_writable(file->f_mapping)
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Thu Mar 29, 2018 1:25 am

I don't think we need to check this, because VM_SHARED will be always set before:
https://github.com/hardkernel/linux/blo ... nux.c#L507
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Thu Mar 29, 2018 6:26 am

@scpcom I see yes thanks.
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby Khem » Thu Mar 29, 2018 7:34 am

3.16.56 is out see https://cdn.kernel.org/pub/linux/kernel ... og-3.16.56
we are on 3.16.55 maybe a merge is in order ?
Khem
 
Posts: 19
Joined: Sun Feb 18, 2018 2:11 pm
Location: San Jose, CA, US
languages_spoken: english, hindi, german
ODROIDs: Odroid-C2

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby tobetter » Thu Mar 29, 2018 8:38 am

Khem wrote:3.16.56 is out see https://cdn.kernel.org/pub/linux/kernel ... og-3.16.56
we are on 3.16.55 maybe a merge is in order ?

I am holding the "3.16.56" patches to release in this week, been delayed due to OpenGL issue.
tobetter
 
Posts: 2197
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby moon.linux » Thu Mar 29, 2018 12:35 pm

@scpcon: thanks for your patch here are the results at my end.

Code: Select all
root@odroid64:/home/odroid# cat glmark,txt
=======================================================
    glmark2 2014.03+git20150611.fa71af2d
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-450 MP
    GL_VERSION:    OpenGL ES 2.0
=======================================================
[build] use-vbo=false: FPS: 135 FrameTime: 7.407 ms
[build] use-vbo=true: FPS: 152 FrameTime: 6.579 ms
[texture] texture-filter=nearest: FPS: 161 FrameTime: 6.211 ms
[texture] texture-filter=linear: FPS: 159 FrameTime: 6.289 ms
[texture] texture-filter=mipmap: FPS: 161 FrameTime: 6.211 ms
[shading] shading=gouraud: FPS: 139 FrameTime: 7.194 ms
[shading] shading=blinn-phong-inf: FPS: 137 FrameTime: 7.299 ms
[shading] shading=phong: FPS: 129 FrameTime: 7.752 ms
[shading] shading=cel: FPS: 122 FrameTime: 8.197 ms
[bump] bump-render=high-poly: FPS: 99 FrameTime: 10.101 ms
[bump] bump-render=normals: FPS: 162 FrameTime: 6.173 ms
[bump] bump-render=height: FPS: 155 FrameTime: 6.452 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 118 FrameTime: 8.475 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 82 FrameTime: 12.195 ms
[pulsar] light=false:quads=5:texture=false: FPS: 165 FrameTime: 6.061 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 69 FrameTime: 14.493 ms
[desktop] effect=shadow:windows=4: FPS: 129 FrameTime: 7.752 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 41 FrameTime: 24.390 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 64 FrameTime: 15.625 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 45 FrameTime: 22.222 ms
[ideas] speed=duration: FPS: 118 FrameTime: 8.475 ms
[jellyfish] <default>: FPS: 118 FrameTime: 8.475 ms
[terrain] <default>: Unsupported
[shadow] <default>: FPS: 122 FrameTime: 8.197 ms
[refract] <default>: FPS: 38 FrameTime: 26.316 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 161 FrameTime: 6.211 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 139 FrameTime: 7.194 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 164 FrameTime: 6.098 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 148 FrameTime: 6.757 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 124 FrameTime: 8.065 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 148 FrameTime: 6.757 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 148 FrameTime: 6.757 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 146 FrameTime: 6.849 ms
=======================================================
                                  glmark2 Score: 124
=======================================================


With one error.
Code: Select all
Error: SceneTerrain requires Vertex Texture Fetch support, but GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is 0


Edited:
Also c2paly-x11 playing bbb_sunflower_1080p_60fps_normal.mp4 smoothly
moon.linux
 
Posts: 1085
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Thu Mar 29, 2018 4:01 pm

The error is normal since the current Mali OpenGL-ES doesn't support the Vertex Texture Fetch.
I could see the same issue with Kernel 3.14 too. Please ignore it.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby moon.linux » Thu Mar 29, 2018 10:45 pm

@scpcon
Along with your patch we need to fix randomize the mmap arch64 feature,
so here are some patchs to address them, please feel free to test them.

I have kept running glmark2-es2 --run-forever with no issue.
Also run the c2play-x11 bbb_sunflower_1080p_60fps_normal.mp4 and their also no issue for me.
Attachments
mmap.tar.gz
mmap randomize
(4.88 KiB) Downloaded 30 times
moon.linux
 
Posts: 1085
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Fri Mar 30, 2018 8:46 am

I applied the mmap randomize patches and looked at the addresses flying around.
It does exactly what is expected: 18 bits of the address get randomized.
There were no issues.
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby crashoverride » Fri Mar 30, 2018 2:56 pm

I think we should avoid any unnecessary out-of-tree patches. This makes it far more difficult and time consuming to merge future in-tree updates that touch the same areas of code (mm).
crashoverride
 
Posts: 3542
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby scpcom » Sat Mar 31, 2018 12:23 am

The GLES related mmap patch only changes the ump driver code, so it does never raise merge problems.

The randomize mmap patches are touching code inside mm and arch/arm64/mm. This is what we should discuss separately.
My goal was to keep the 3.16 code as intact as possible. I also know from another project, that any custom patch can make it harder to maintain. On the other hand we get a bit (literally 10 bits) more security.

EDIT: Sorry, I just looked at the code again: The patches do not give us extra security. Here is a snippet of untouched 3.16 code:
Code: Select all
# arch/arm64/include/asm/page.h
#define PAGE_SHIFT              12

# arch/arm64/include/asm/elf.h
#define STACK_RND_MASK                  (test_thread_flag(TIF_32BIT) ? \
                                                0x7ff >> (PAGE_SHIFT - 12) : \
                                                0x3ffff >> (PAGE_SHIFT - 12))

# arch/arm64/mm/mmap.c
rnd = (unsigned long)get_random_int() & STACK_RND_MASK;

So we have already 18 bits (11 bits in compat) randomized.
scpcom
 
Posts: 50
Joined: Thu Jun 23, 2016 8:07 am
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Tue Apr 03, 2018 12:47 pm

We've updated Kernel to 3.16.56 from 3.16.55 with some bug fixes.
3.5inch & 3.2inch TFT LCD boards and HiFi-Shield series are working now.
The GPU crash fix is also included.

Refer the recent commits.
https://github.com/hardkernel/linux/commits/odroidc2-v3.16.y

Feel free to test it and get back to us.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby moon.linux » Tue Apr 03, 2018 1:24 pm

Amlogic also integrated the random mmap patch for 3.14.x.

https://github.com/LibreELEC/linux-amlo ... 485d8adc07
moon.linux
 
Posts: 1085
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: Linux 3.16 LTS Kernel for Odroid C2

Unread postby odroid » Tue Apr 03, 2018 1:34 pm

@moon.linux,
The patch was useless as @scpcom explained.
We have to avoid any unnecessary patch as @crashoverride mentioned.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

PreviousNext

Return to Projects

Who is online

Users browsing this forum: Sebas_Ledesma and 1 guest