Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Someone managed to compile the KERNEL 3:12 supporting MMC? #161

Closed
ezaul opened this issue Nov 18, 2013 · 24 comments
Closed

Someone managed to compile the KERNEL 3:12 supporting MMC? #161

ezaul opened this issue Nov 18, 2013 · 24 comments

Comments

@ezaul
Copy link

ezaul commented Nov 18, 2013

Someone managed to compile the KERNEL 3:12 supporting MMC? or what is the procedure to run the MMC?

Result:

U-Boot SPL 2013.10-rc2-08405-gb322f67 (Nov 18 2013 - 11:26:21)
Board: Cubieboard2
DRAM: 1024 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600

U-Boot 2013.10-rc2-08405-gb322f67 (Nov 18 2013 - 11:26:21) Allwinner Technology

CPU: Allwinner A20 (SUN7I)
Board: Cubieboard2
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
** Unrecognized filesystem type **
** File not found boot/uEnv.txt **
** File not found uEnv.txt **
** Unrecognized filesystem type **
372 bytes read in 12 ms (30.3 KiB/s)
Jumping to boot.scr

Executing script at 44000000

3667072 bytes read in 192 ms (18.2 MiB/s)
8297 bytes read in 11 ms (736.3 KiB/s)

Booting kernel from Legacy Image at 46000000 ...

Image Name: Linux-3.12.0-10088-g2d3c627
Created: 2013-11-18 11:25:25 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3667008 Bytes = 3.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK

Flattened Device Tree blob at 49000000

Booting using the fdt blob at 0x49000000
Loading Kernel Image ... OK
Using Device Tree in place at 49000000, end 49005068

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.12.0-10088-g2d3c627 (root@vbi7) (gcc version 4.7.2 (Debian 4.7.2-5) ) #2 SMP Mon Nov 18 09:25:19 BRST 2013
[ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Cubietech Cubieboard2
[ 0.000000] Memory policy: ECC disabled, Data cache writealloc
[ 0.000000] PERCPU: Embedded 5 pages/cpu @c0fac000 s6912 r0 d13568 u32768
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260624
[ 0.000000] Kernel command line: console=tty0 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1280x800p60 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait panic=10
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 1031684K/1048576K available (5002K kernel code, 591K rwdata, 1424K rodata, 474K init, 284K bss, 16892K reserved, 270336K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xf0000000 - 0xff000000 ( 240 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xef800000 ( 760 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] .text : 0xc0008000 - 0xc064eb58 (6427 kB)
[ 0.000000] .init : 0xc064f000 - 0xc06c5b00 ( 475 kB)
[ 0.000000] .data : 0xc06c6000 - 0xc0759ec0 ( 592 kB)
[ 0.000000] .bss : 0xc0759ec8 - 0xc07a1294 ( 285 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [tty0] enabled
[ 0.000672] Calibrating delay loop... 1915.28 BogoMIPS (lpj=9576448)
[ 0.060044] pid_max: default: 32768 minimum: 301
[ 0.060223] Mount-cache hash table entries: 512
[ 0.062316] CPU: Testing write buffer coherency: ok
[ 0.062641] /cpus/cpu@0 missing clock-frequency property
[ 0.062676] /cpus/cpu@1 missing clock-frequency property
[ 0.062696] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.062738] Setting up static identity map for 0x404bb3f0 - 0x404bb488
[ 0.062840] unable to find compatible sirf rstc node in dtb
[ 0.063957] CPU1: failed to boot: -38
[ 0.064006] Brought up 1 CPUs
[ 0.064019] SMP: Total of 1 processors activated.
[ 0.064033] CPU: All CPU(s) started in SVC mode.
[ 0.064689] devtmpfs: initialized
[ 0.068538] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4
[ 0.068813] pinctrl core: initialized pinctrl subsystem
[ 0.069202] regulator-dummy: no parameters
[ 0.069568] NET: Registered protocol family 16
[ 0.069966] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.072854] Serial: AMBA PL011 UART driver
[ 0.077702] bio: create slab at 0
[ 0.078773] edma-dma-engine edma-dma-engine.0: Can't allocate PaRAM dummy slot
[ 0.078819] edma-dma-engine: probe of edma-dma-engine.0 failed with error -5
[ 0.079734] SCSI subsystem initialized
[ 0.080262] usbcore: registered new interface driver usbfs
[ 0.080318] usbcore: registered new interface driver hub
[ 0.080455] usbcore: registered new device driver usb
[ 0.080871] pps_core: LinuxPPS API ver. 1 registered
[ 0.080891] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it
[ 0.080928] PTP clock support registered
[ 0.080969] EDAC MC: Ver: 3.0.0
[ 0.082070] Switched to clocksource timer
[ 0.089733] NET: Registered protocol family 2
[ 0.090401] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.090497] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.090627] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.090718] TCP: reno registered
[ 0.090742] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.090809] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.091094] NET: Registered protocol family 1
[ 0.091525] RPC: Registered named UNIX socket transport module.
[ 0.091557] RPC: Registered udp transport module.
[ 0.091571] RPC: Registered tcp transport module.
[ 0.091584] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.093754] bounce pool size: 64 pages
[ 0.102260] NFS: Registering the id_resolver key type
[ 0.102346] Key type id_resolver registered
[ 0.102362] Key type id_legacy registered
[ 0.102625] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.102654] io scheduler noop registered
[ 0.102667] io scheduler deadline registered
[ 0.102827] io scheduler cfq registered (default)
[ 0.104884] sunxi-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.151292] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.173380] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 33, base_baud = 1500000) is a U6_16550A
[ 0.659025] console [ttyS0] enabled
[ 0.662909] Serial: IMX driver
[ 0.666459] serial: Freescale lpuart driver
[ 0.670836] [drm] Initialized drm 1.1.0 20060810
[ 0.676542] sun4i-mdio 1c0b080.mdio: dummy supplies not allowed
[ 0.682523] sun4i-mdio 1c0b080.mdio: no regulator found
[ 0.687860] libphy: sun4i_mii_bus: probed
[ 0.722567] sun4i-emac 1c0b000.ethernet: using random MAC address 46:e3:18:9b:e4:cd
[ 0.732130] sun4i-emac 1c0b000.ethernet: eth0: at f006a000, IRQ 87 MAC: 46:e3:18:9b:e4:cd
[ 0.740859] VFIO - User Level meta-driver version: 0.3
[ 0.746062] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.752608] ehci-platform: EHCI generic platform driver
[ 0.757921] ehci-omap: OMAP-EHCI Host Controller driver
[ 0.763225] ehci-orion: EHCI orion driver
[ 0.767281] SPEAr-ehci: EHCI SPEAr driver
[ 0.771334] tegra-ehci: Tegra EHCI driver
[ 0.775557] usbcore: registered new interface driver usb-storage
[ 0.782347] mousedev: PS/2 mouse device common for all mice
[ 0.788744] sdhci: Secure Digital Host Controller Interface driver
[ 0.794987] sdhci: Copyright(c) Pierre Ossman
[ 0.799532] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.805741] usbcore: registered new interface driver usbhid
[ 0.811317] usbhid: USB HID core driver
[ 0.815432] TCP: cubic registered
[ 0.819289] NET: Registered protocol family 10
[ 0.824550] sit: IPv6 over IPv4 tunneling driver
[ 0.829843] Key type dns_resolver registered
[ 0.834365] Registering SWP/SWPB emulation handler
[ 0.839940] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 0.847022] Waiting for root device /dev/mmcblk0p1...

@arokux
Copy link

arokux commented Nov 18, 2013

There is no support for MMC in mainline yet, although some not yet
completely working patches exist. You could improve them.

@ezaul
Copy link
Author

ezaul commented Nov 19, 2013

For sure! I just need more information about the drive files, I even tried to graft the drive who are in kernel 3.4 Sunxi "mmc-pm", "Sunxi-host" then tried using some files from the repository "mripard-wip-soda" "Sunxi -mci.c Sunxi-mci.h "also not got success in compiling you could give me a way?

@gklipel
Copy link

gklipel commented Nov 20, 2013

arokux,

where are these patches? Could you please send us the reference?

@arokux
Copy link

arokux commented Nov 20, 2013

Hello guys,

leviathanch (IRC nickname, see CC) was working on mainlining mmc but hasn't
finished it. His work is hosted here

http://git.o2s.ch/?p=linux-sunxi.git;a=heads

@david:
Have you pushed all your code to this git repo?

Best,
Arokux

@arokux
Copy link

arokux commented Nov 21, 2013

Hi

leviathanch (IRC nickname, see CC) was working on mainlining mmc but hasn't
finished it. His work is hosted here
http://git.o2s.ch/?p=linux-sunxi.git;a=heads
Yes. That's correct.

@david:
Have you pushed all your code to this git repo?
You can find the most recent state of development within the following branch:
sunxi-mmc-for-next-plsdsif
(short for: please don't shout [at me] in finish) :-)

You can check the code out by doing a http-clone:
git clone https://git.o2s.ch/git/linux-sunxi.git

If someone can figure out, why I get a memory access timeout
it would be quiet awsome.
At least, the memory card appears to be reacting.
There is only the problem left of successfully retrieving the data.

cheers
David (aka. leviathan)

@ezaul
Copy link
Author

ezaul commented Dec 2, 2013

U-Boot SPL 2014.01-rc1-09128-gd4312a6 (Nov 30 2013 - 16:41:38)
Board: Cubieboard2
DRAM: 1024 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600

U-Boot 2014.01-rc1-09128-gd4312a6 (Nov 30 2013 - 16:41:38) Allwinner Technology

CPU: Allwinner A20 (SUN7I)
Board: Cubieboard2
I2C: ready
DRAM: 1 GiB
MMC: SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
** Unrecognized filesystem type **
** File not found boot/uEnv.txt **
** File not found uEnv.txt **
** Unrecognized filesystem type **
372 bytes read in 10 ms (36.1 KiB/s)
Jumping to boot.scr

Executing script at 44000000

3654656 bytes read in 195 ms (17.9 MiB/s)
12651 bytes read in 15 ms (823.2 KiB/s)

Booting kernel from Legacy Image at 46000000 ...

Image Name: Linux-3.13.0-rc1-50636-g8d5d332-
Created: 2013-12-02 18:28:51 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3654592 Bytes = 3.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK

Flattened Device Tree blob at 49000000

Booting using the fdt blob at 0x49000000
Loading Kernel Image ... OK
Using Device Tree in place at 49000000, end 4900616a

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.13.0-rc1-50636-g8d5d332-dirty (root@vbi7) (gcc version 4.7.2 (Debian 4.7.2-5) ) #2 SMP Mon Dec 2 16:28:48 BRST 2013
[ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Cubietech Cubieboard2
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] PERCPU: Embedded 5 pages/cpu @c0fa5000 s6976 r0 d13504 u32768
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260624
[ 0.000000] Kernel command line: console=tty0 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1280x800p60 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait panic=10
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 1031708K/1048576K available (4976K kernel code, 588K rwdata, 1412K rodata, 478K init, 284K bss, 16868K reserved, 270336K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xf0000000 - 0xff000000 ( 240 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xef800000 ( 760 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0645484 (6390 kB)
[ 0.000000] .init : 0xc0646000 - 0xc06bdb40 ( 479 kB)
[ 0.000000] .data : 0xc06be000 - 0xc0751200 ( 589 kB)
[ 0.000000] .bss : 0xc0751208 - 0xc0798514 ( 285 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [tty0] enabled
[ 0.000728] Calibrating delay loop... 1915.28 BogoMIPS (lpj=9576448)
[ 0.060044] pid_max: default: 32768 minimum: 301
[ 0.060222] Mount-cache hash table entries: 512
[ 0.063058] CPU: Testing write buffer coherency: ok
[ 0.063377] /cpus/cpu@0 missing clock-frequency property
[ 0.063409] /cpus/cpu@1 missing clock-frequency property
[ 0.063429] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.063549] Setting up static identity map for 0x404b5d70 - 0x404b5e08
[ 0.063684] unable to find compatible sirf rstc node in dtb
[ 0.076034] CPU1: Booted secondary processor
[ 0.134473] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.134587] Brought up 2 CPUs
[ 0.134635] SMP: Total of 2 processors activated.
[ 0.134648] CPU: All CPU(s) started in SVC mode.
[ 0.135425] devtmpfs: initialized
[ 0.139311] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4
[ 0.139583] pinctrl core: initialized pinctrl subsystem
[ 0.139963] regulator-dummy: no parameters
[ 0.140346] NET: Registered protocol family 16
[ 0.140749] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.144142] Serial: AMBA PL011 UART driver
[ 0.149137] bio: create slab at 0
[ 0.150296] edma-dma-engine edma-dma-engine.0: Can't allocate PaRAM dummy slot
[ 0.150344] edma-dma-engine: probe of edma-dma-engine.0 failed with error -5
[ 0.150543] reg-fixed-voltage ahci-5v.3: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/ahci_pwr_pin@0, deferring probe
[ 0.150578] platform ahci-5v.3: Driver reg-fixed-voltage requests probe deferral
[ 0.150719] vcc_3v3: 3300 mV
[ 0.151631] SCSI subsystem initialized
[ 0.152064] usbcore: registered new interface driver usbfs
[ 0.152118] usbcore: registered new interface driver hub
[ 0.152232] usbcore: registered new device driver usb
[ 0.152683] pps_core: LinuxPPS API ver. 1 registered
[ 0.152703] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it
[ 0.152740] PTP clock support registered
[ 0.152783] EDAC MC: Ver: 3.0.0
[ 0.153868] Switched to clocksource timer
[ 0.154478] Clockevents: could not switch to one-shot mode:
[ 0.154489] Clockevents: could not switch to one-shot mode: dummy_timer is not functional.
[ 0.154492] Could not switch to high resolution mode on CPU 1
[ 0.154535] dummy_timer is not functional.
[ 0.154548] Could not switch to high resolution mode on CPU 0
[ 0.161714] NET: Registered protocol family 2
[ 0.162319] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.162415] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.162546] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.162637] TCP: reno registered
[ 0.162659] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.162726] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.163015] NET: Registered protocol family 1
[ 0.163382] RPC: Registered named UNIX socket transport module.
[ 0.163407] RPC: Registered udp transport module.
[ 0.163421] RPC: Registered tcp transport module.
[ 0.163435] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.165515] bounce pool size: 64 pages
[ 0.173800] NFS: Registering the id_resolver key type
[ 0.173888] Key type id_resolver registered
[ 0.173909] Key type id_legacy registered
[ 0.174178] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.174206] io scheduler noop registered
[ 0.174220] io scheduler deadline registered
[ 0.174377] io scheduler cfq registered (default)
[ 0.176443] sunxi-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.223288] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.245296] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 33, base_baud = 1500000) is a U6_16550A
[ 0.788584] console [ttyS0] enabled
[ 0.792389] Serial: IMX driver
[ 0.796072] serial: Freescale lpuart driver
[ 0.800451] [drm] Initialized drm 1.1.0 20060810
[ 0.806666] Sunxi extensions to stmmac
[ 0.810504] Ring mode enabled
[ 0.813565] No HW DMA feature register supported
[ 0.818132] Normal descriptors
[ 0.821464] Wake-Up On Lan supported
[ 0.826199] libphy: stmmac: probed
[ 0.829615] eth0: PHY ID 00008201 at 1 IRQ 0 (stmmac-0:01) active
[ 0.835806] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.842338] ehci-platform: EHCI generic platform driver
[ 0.847673] ehci-omap: OMAP-EHCI Host Controller driver
[ 0.852955] ehci-orion: EHCI orion driver
[ 0.857040] SPEAr-ehci: EHCI SPEAr driver
[ 0.861102] tegra-ehci: Tegra EHCI driver
[ 0.865352] usbcore: registered new interface driver usb-storage
[ 0.872179] mousedev: PS/2 mouse device common for all mice
[ 0.878685] sdhci: Secure Digital Host Controller Interface driver
[ 0.884912] sdhci: Copyright(c) Pierre Ossman
[ 0.984466] [mmc]: sdc0 Probe: base:0xf0094000 irq:64 sg_cpu:f0096000(6eba4000) ret 0.
[ 0.992454] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.998741] usbcore: registered new interface driver usbhid
[ 1.004325] usbhid: USB HID core driver
[ 1.008453] TCP: cubic registered
[ 1.012321] NET: Registered protocol family 10
[ 1.017617] sit: IPv6 over IPv4 tunneling driver
[ 1.022924] Key type dns_resolver registered
[ 1.027452] Registering SWP/SWPB emulation handler
[ 1.033406] ahci-5v: 5000 mV
[ 1.036557] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 1.043604] Waiting for root device /dev/mmcblk0p1...
[ 2.485270] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 52, RTO !!
[ 2.555256] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 52, RTO !!
[ 2.925257] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 2.933311] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 2.941386] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 2.949454] [mmc]: *** sunxi_mmc_dump_errinfo(L365): smc 0 err, cmd 5, RTO !!
[ 4.794474] mmc0: new high speed SDHC card at address e624
[ 4.800328] isa bounce pool size: 16 pages
[ 4.804604] mmcblk0: mmc0:e624 SU08G 7.40 GiB
[ 4.878758] mmcblk0: p1
[ 5.089220] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 5.097412] VFS: Mounted root (ext4 filesystem) readonly on device 179:1.
[ 5.303204] devtmpfs: mounted
[ 5.306754] Freeing unused kernel memory: 476K (c0646000 - c06bd000)
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevd[ 15.668160] udevd[152]: starting version 175
. ok
[....] Synthesizing the initial hotplug events...done.
[....] Waiting for /dev to be fully populated...[ 18.974663] random: nonblocking pool is initialized
done.
[....] Setting preliminary keymap...done.
[....] Setting parameters of disc: (none). ok
[....] Activating swap...done.
[ 38.924673] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[....] Cleaning up temporary files... /tmp. ok
[....] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
done.
[....] Mounting local filesystems...done.
[....] Activating swapfile swap...done.
[....] Cleaning up temporary files.... ok
[....] Setting kernel variables ...done.
[....] Configuring network interfaces...done.
[....] Cleaning up temporary files.... ok
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
[info] Skipping font and keymap setup (handled by console-setup).
[....] Setting up console font and keymap...done.
[....] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix. ok
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting enhanced syslogd: rsyslogd. ok
speech-dispatcher disabled; edit /etc/default/speech-dispatcher
[....] Starting periodic command scheduler: cron. ok
[....] Starting system message bus: dbus. ok
[....] Starting network connection manager: NetworkManager. ok
[....] Starting bluetooth: bluetoothd rfcommCan't open RFCOMM control socket: Address family not supported by protocol
. ok
[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon. ok
saned disabled; edit /etc/default/saned
[....] PulseAudio configured for per-user sessions ... (warning).
[....] Starting GNOME Display Manager: gdm3. ok

Debian GNU/Linux 7 Cubie ttyS0

Cubie login: [ 80.922836] eth0: device MAC address de:3c:e8:fe:ba:c7
[ 80.938843] No MAC Management Counters available
[ 80.943559] stmmac_open: failed PTP initialisation
[ 80.954272] eth0: device MAC address de:3c:e8:fe:ba:c7
[ 80.970358] No MAC Management Counters available
[ 80.975102] stmmac_open: failed PTP initialisation
[ 80.980026] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

@ezaul
Copy link
Author

ezaul commented Dec 2, 2013

@ezaul
Copy link
Author

ezaul commented Dec 2, 2013

root@Cubie:# uname -a
Linux Cubie 3.13.0-rc1-50636-g8d5d332-dirty #2 SMP Mon Dec 2 16:28:48 BRST 2013 armv7l GNU/Linux
root@Cubie:
# ^C
root@Cubie:# free -m
total used free shared buffers cached
Mem: 1007 49 958 0 6 22
-/+ buffers/cache: 20 987
Swap: 0 0 0
root@Cubie:
# cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 4

Hardware : Allwinner sun7i (A20) Family
Revision : 0000
Serial : 0000000000000000

@ezaul
Copy link
Author

ezaul commented Dec 2, 2013

root@Cubie:~# fdisk -l

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
81 heads, 10 sectors/track, 19165 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000aaeff

    Device Boot      Start         End      Blocks   Id  System

/dev/mmcblk0p1 2048 15523839 7760896 83 Linux

@meriororen
Copy link

Hi ezaul, can you tell me what configuration do you use to run that?

@ezaul
Copy link
Author

ezaul commented Dec 5, 2013

Hi Meriororen

Cubieboard2
Microsd - format ext4
TTL pra debug

##U-BOOT
git clone git://github.com/linux-sunxi/u-boot-sunxi.git
make cubieboard2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8

vi boot.cmd
setenv bootargs console=tty0 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1280x800p60 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait panic=10
ext4load mmc 0 0x46000000 boot/uImage
ext4load mmc 0 0x49000000 boot/cubie2.dtb
env set fdt_high ffffffff
bootm 0x46000000 - 0x49000000

mkimage -C none -A arm -T script -d boot.cmd boot.scr

mount /dev/SDCARD /mnt

cp boot.scr /mnt/boot/
chmod 755 /mnt/boot/boot.scr

##KERNEL
git clone https://github.com/jwrdegoede/linux-sunxi.git -b sunxi-test sunxi-test

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- multi_v7_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOADADDR=0x40008000 uImage dtbs

cp arch/arm/boot/uImage /mnt/boot/
cp arch/arm/boot/dts/sun7i-a20-cubieboard2.dtb /mnt/boot/cubie2.dtb

chmod 755 /mnt/boot/uImage
chmod 755 /mnt/boot/cubie2.dtb

;-)

@meriororen
Copy link

Hi, thanks. I've figured it out. Turns out yours is the same config I use lol.

I want to run kvm on this. Right now I am debootstrapping ubuntu precise. What rootfs did you use?

@ezaul
Copy link
Author

ezaul commented Dec 5, 2013

hi so I'm using rootfs rather that I created myself KVM's what I'm waiting anxious MMC work 100% to run a KVM! I set up my. config to make it ready for virtualization but my time is short if you have any news on your KVM let me have some success step you information!

Excuse my english I'm Brazilian

@meriororen
Copy link

Hi, I see that you use Debian 7 (Wheezy?).
Right now I am stuck on error caused by bug on my rootfs (ubuntu precise). I am still looking for a good rootfs configuration.

I asked the kvm-arm maintainer guy, christoffer dall, he said he could run kvm on it, but I don't know to what extent. Didn't ask more.

Sure, I'll let everyone know when I can run kvm on it. Although, hdmi display seems not going to work any sooner.
Just have to be patient on serial console.

@ezaul
Copy link
Author

ezaul commented Dec 5, 2013

I'm using Debian Wheezy looks like I did my rootfs

##Criar ROOTFS##

mkdir chroot
cd chroot
debootstrap --foreign --arch armhf wheezy .
cp /usr/bin/qemu-arm-static usr/bin
LC_ALL=C LANGUAGE=C LANG=C chroot . /debootstrap/debootstrap --second-stage
LC_ALL=C LANGUAGE=C LANG=C chroot . dpkg --configure -a
chroot . passwd
echo Cubie > etc/hostname
cp /etc/resolv.conf etc
echo "deb http://ftp.br.debian.org/ wheezy main contrib non-free" > etc/apt/sources.list
echo "deb http://security.debian.org/ wheezy main contrib non-free" >> etc/apt/sources.list
chroot . apt-get update
chroot . apt-get dist-upgrade
chroot . apt-get install nvi
echo "T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100" >> etc/inittab

sunxi-test
cp uImage dtb /chroot
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=chroot modules_install

cd chroot
tar --exclude=qemu-arm-static -cf - . | tar -C /mnt -xvf -

see if this helps you ;)

@meriororen
Copy link

Ah, So that's why. I forgot to set getty to spawn on serial line.
I didn't know that such config necessary.

I can reach tty. However, still no network..

@meriororen
Copy link

Ok. Here's what I get :

  1. KVM works on Cubieboard2, what needs to be configured :
    a. Add architected timer description on sun7i-a20.dtsi
    b. Enable bits on config (dont forget to enable LPAE support first)
  2. What don't work :
    a. Currently, qemu does not support cortex-a7 guest (no such board!), and you can't (yet) run cortex-a15 guest on
    cortex-a7 host right now.

I am running a different kernel from the above one. I took it from Christoffer Dall's linaro git repos (linux-kvm-arm, kvm-arm-cortex-a7 branch), no mmc support yet, no display. I run the kernel and rootfs via NFS server.

@ezaul
Copy link
Author

ezaul commented Dec 13, 2013

hi Meriororen any news on KVM was watching the FEATURES (vmx|svm) and other lack of a look

processor : 0
model name : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae

how to get your cat /proc/cpuinfo

@meriororen
Copy link

Hi Ezaul,

You are referring to Intel/AMD's Virtualization Extension. ARM
virtualization extension does not have (vmx/svm) in its feature list.
Refer to ARM Architecture Reference Manual or read
http://lwn.net/Articles/557132/

Meanwhile, I have compiled a guide for running KVM on Cubieboard2. Please
go here
https://groups.google.com/forum/?fromgroups#!category-topic/cubieboard/setting-up/4EGONZMoIAU
and
try.

Right now, QEMU does not have support for A7 Guest. So we have to use
kvmtool.

Cheers.

On Fri, Dec 13, 2013 at 6:12 PM, Ezaul Zillmer notifications@github.comwrote:

hi Meriororen any news on KVM was watching the FEATURES (vmx|svm) and
other lack of a look

processor : 0
model name : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva
idivt vfpd32 lpae

how to get your cat /proc/cpuinfo


Reply to this email directly or view it on GitHubhttps://github.com//issues/161#issuecomment-30495599
.

Isa Ansharullah
aLab, inc.
Tokyo, Shibuya-ku, Yoyogi
1-42-10
Brooklyn Court 2F

@ezaul
Copy link
Author

ezaul commented Dec 16, 2013

Good morning!

Very good your stuff
we are crazy here waiting to make a cluster of 15 cubuieboard2 with virtualized cluster but by the way a lot of work still lack the person-linux sunxi round to leave for our project! year end short time to get more involved

@ezaul
Copy link
Author

ezaul commented Dec 18, 2013

Hi Meriororen

Look

[ 0.006020] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.006133] Brought up 2 CPUs
[ 0.006180] SMP: Total of 2 processors activated.
[ 0.006193] CPU: All CPU(s) started in HYP mode.
[ 0.006205] CPU: Virtualization extensions available.
[ 0.006934] devtmpfs: initialized
[ 0.010971] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4
[ 0.011325] pinctrl core: initialized pinctrl subsystem

@meriororen
Copy link

Yep. Great isn't it.

On Wed, Dec 18, 2013 at 9:00 PM, Ezaul Zillmer notifications@github.com
wrote:

Hi Meriororen
Look
[ 0.006020] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.006133] Brought up 2 CPUs
[ 0.006180] SMP: Total of 2 processors activated.
[ 0.006193] CPU: All CPU(s) started in HYP mode.
[ 0.006205] CPU: Virtualization extensions available.
[ 0.006934] devtmpfs: initialized
[ 0.010971] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4

[ 0.011325] pinctrl core: initialized pinctrl subsystem

Reply to this email directly or view it on GitHub:
#161 (comment)

@antiuser
Copy link

ezaul, what kernel version you are use? I have latest 3.13-rc4 from testing, but i cannot get SMP extention, CPU0 is starting OK, but CPU1 cannot started, SMP is turning on in kernel config

@oliv3r
Copy link
Member

oliv3r commented Jan 24, 2014

This is getting a little off topic; The question was, MMC does not work on 3:12; that's right as stated above. Using sunxi-devel with appropiate u-boot (i think hansg has one that does a little more that we haven't merged yet) for SMP etc. If a different issue persists, please open a new ticket. But please, reporting issues on development kernels isn't productive without patches. It all is often very much WiP.

@oliv3r oliv3r closed this as completed Jan 24, 2014
amery pushed a commit that referenced this issue Jul 21, 2014
This code has been working since 2012, as limiting the time between
1ms and 3ms is unlikely to do any harm.

Soothes checkpatch warning:

  WARNING: msleep < 20ms can sleep for up to 20ms;
      see Documentation/timers/timers-howto.txt
  #161: FILE: drivers/mfd/88pm805.c:161:
  +	msleep(1);

Signed-off-by: Lee Jones <lee.jones@linaro.org>
amery pushed a commit that referenced this issue Nov 1, 2014
O_DIRECT flags can be toggeled via fcntl(F_SETFL). But this value checked
twice inside ext4_file_write_iter() and __generic_file_write() which
result in BUG_ON inside ext4_direct_IO.

Let's initialize iocb->private unconditionally.

TESTCASE: xfstest:generic/036  https://patchwork.ozlabs.org/patch/402445/

#TYPICAL STACK TRACE:
kernel BUG at fs/ext4/inode.c:2960!
invalid opcode: 0000 [#1] SMP
Modules linked in: brd iTCO_wdt lpc_ich mfd_core igb ptp dm_mirror dm_region_hash dm_log dm_mod
CPU: 6 PID: 5505 Comm: aio-dio-fcntl-r Not tainted 3.17.0-rc2-00176-gff5c017 #161
Hardware name: Intel Corporation W2600CR/W2600CR, BIOS SE5C600.86B.99.99.x028.061320111235 06/13/2011
task: ffff88080e95a7c0 ti: ffff88080f908000 task.ti: ffff88080f908000
RIP: 0010:[<ffffffff811fabf2>]  [<ffffffff811fabf2>] ext4_direct_IO+0x162/0x3d0
RSP: 0018:ffff88080f90bb58  EFLAGS: 00010246
RAX: 0000000000000400 RBX: ffff88080fdb2a28 RCX: 00000000a802c818
RDX: 0000040000080000 RSI: ffff88080d8aeb80 RDI: 0000000000000001
RBP: ffff88080f90bbc8 R08: 0000000000000000 R09: 0000000000001581
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88080d8aeb80
R13: ffff88080f90bbf8 R14: ffff88080fdb28c8 R15: ffff88080fdb2a28
FS:  00007f23b2055700(0000) GS:ffff880818400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f23b2045000 CR3: 000000080cedf000 CR4: 00000000000407e0
Stack:
 ffff88080f90bb98 0000000000000000 7ffffffffffffffe ffff88080fdb2c30
 0000000000000200 0000000000000200 0000000000000001 0000000000000200
 ffff88080f90bbc8 ffff88080fdb2c30 ffff88080f90be08 0000000000000200
Call Trace:
 [<ffffffff8112ca9d>] generic_file_direct_write+0xed/0x180
 [<ffffffff8112f2b2>] __generic_file_write_iter+0x222/0x370
 [<ffffffff811f495b>] ext4_file_write_iter+0x34b/0x400
 [<ffffffff811bd709>] ? aio_run_iocb+0x239/0x410
 [<ffffffff811bd709>] ? aio_run_iocb+0x239/0x410
 [<ffffffff810990e5>] ? local_clock+0x25/0x30
 [<ffffffff810abd94>] ? __lock_acquire+0x274/0x700
 [<ffffffff811f4610>] ? ext4_unwritten_wait+0xb0/0xb0
 [<ffffffff811bd756>] aio_run_iocb+0x286/0x410
 [<ffffffff810990e5>] ? local_clock+0x25/0x30
 [<ffffffff810ac359>] ? lock_release_holdtime+0x29/0x190
 [<ffffffff811bc05b>] ? lookup_ioctx+0x4b/0xf0
 [<ffffffff811bde3b>] do_io_submit+0x55b/0x740
 [<ffffffff811bdcaa>] ? do_io_submit+0x3ca/0x740
 [<ffffffff811be030>] SyS_io_submit+0x10/0x20
 [<ffffffff815ce192>] system_call_fastpath+0x16/0x1b
Code: 01 48 8b 80 f0 01 00 00 48 8b 18 49 8b 45 10 0f 85 f1 01 00 00 48 03 45 c8 48 3b 43 48 0f 8f e3 01 00 00 49 83 7c
24 18 00 75 04 <0f> 0b eb fe f0 ff 83 ec 01 00 00 49 8b 44 24 18 8b 00 85 c0 89
RIP  [<ffffffff811fabf2>] ext4_direct_IO+0x162/0x3d0
 RSP <ffff88080f90bb58>

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: stable@vger.kernel.org
amery pushed a commit that referenced this issue Aug 27, 2016
I got this:

    kasan: GPF could be caused by NULL-ptr deref or user memory access
    general protection fault: 0000 [#1] PREEMPT SMP KASAN
    Dumping ftrace buffer:
       (ftrace buffer empty)
    CPU: 0 PID: 5505 Comm: syz-executor Not tainted 4.8.0-rc2+ #161
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    task: ffff880113415940 task.stack: ffff880118350000
    RIP: 0010:[<ffffffff8172cb32>]  [<ffffffff8172cb32>] bd_mount+0x52/0xa0
    RSP: 0018:ffff880118357ca0  EFLAGS: 00010207
    RAX: dffffc0000000000 RBX: ffffffffffffffff RCX: ffffc90000bb6000
    RDX: 0000000000000018 RSI: ffffffff846d6b20 RDI: 00000000000000c7
    RBP: ffff880118357cb0 R08: ffff880115967c68 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801188211e8
    R13: ffffffff847baa20 R14: ffff8801139cb000 R15: 0000000000000080
    FS:  00007fa3ff6c0700(0000) GS:ffff88011aa00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fc1d8cc7e78 CR3: 0000000109f20000 CR4: 00000000000006f0
    DR0: 000000000000001e DR1: 000000000000001e DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
    Stack:
     ffff880112cfd6c0 ffff8801188211e8 ffff880118357cf0 ffffffff8167f207
     ffffffff816d7a1e ffff880112a413c0 ffffffff847baa20 ffff8801188211e8
     0000000000000080 ffff880112cfd6c0 ffff880118357d38 ffffffff816dce0a
    Call Trace:
     [<ffffffff8167f207>] mount_fs+0x97/0x2e0
     [<ffffffff816d7a1e>] ? alloc_vfsmnt+0x55e/0x760
     [<ffffffff816dce0a>] vfs_kern_mount+0x7a/0x300
     [<ffffffff83c3247c>] ? _raw_read_unlock+0x2c/0x50
     [<ffffffff816dfc87>] do_mount+0x3d7/0x2730
     [<ffffffff81235fd4>] ? trace_do_page_fault+0x1f4/0x3a0
     [<ffffffff816df8b0>] ? copy_mount_string+0x40/0x40
     [<ffffffff8161ea81>] ? memset+0x31/0x40
     [<ffffffff816df73e>] ? copy_mount_options+0x1ee/0x320
     [<ffffffff816e2a02>] SyS_mount+0xb2/0x120
     [<ffffffff816e2950>] ? copy_mnt_ns+0x970/0x970
     [<ffffffff81005524>] do_syscall_64+0x1c4/0x4e0
     [<ffffffff83c3282a>] entry_SYSCALL64_slow_path+0x25/0x25
    Code: 83 e8 63 1b fc ff 48 85 c0 48 89 c3 74 4c e8 56 35 d1 ff 48 8d bb c8 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 75 36 4c 8b a3 c8 00 00 00 48 b8 00 00 00 00 00 fc
    RIP  [<ffffffff8172cb32>] bd_mount+0x52/0xa0
     RSP <ffff880118357ca0>
    ---[ end trace 13690ad962168b98 ]---

mount_pseudo() returns ERR_PTR(), not NULL, on error.

Fixes: 3684aa7 ("block-dev: enable writeback cgroup support")
Cc: Shaohua Li <shli@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: stable@vger.kernel.org
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
repojohnray pushed a commit to repojohnray/linux-sunxi-4.7.y that referenced this issue Oct 23, 2016
commit e9e5e3f upstream.

I got this:

    kasan: GPF could be caused by NULL-ptr deref or user memory access
    general protection fault: 0000 [jwrdegoede#1] PREEMPT SMP KASAN
    Dumping ftrace buffer:
       (ftrace buffer empty)
    CPU: 0 PID: 5505 Comm: syz-executor Not tainted 4.8.0-rc2+ linux-sunxi#161
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    task: ffff880113415940 task.stack: ffff880118350000
    RIP: 0010:[<ffffffff8172cb32>]  [<ffffffff8172cb32>] bd_mount+0x52/0xa0
    RSP: 0018:ffff880118357ca0  EFLAGS: 00010207
    RAX: dffffc0000000000 RBX: ffffffffffffffff RCX: ffffc90000bb6000
    RDX: 0000000000000018 RSI: ffffffff846d6b20 RDI: 00000000000000c7
    RBP: ffff880118357cb0 R08: ffff880115967c68 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801188211e8
    R13: ffffffff847baa20 R14: ffff8801139cb000 R15: 0000000000000080
    FS:  00007fa3ff6c0700(0000) GS:ffff88011aa00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fc1d8cc7e78 CR3: 0000000109f20000 CR4: 00000000000006f0
    DR0: 000000000000001e DR1: 000000000000001e DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
    Stack:
     ffff880112cfd6c0 ffff8801188211e8 ffff880118357cf0 ffffffff8167f207
     ffffffff816d7a1e ffff880112a413c0 ffffffff847baa20 ffff8801188211e8
     0000000000000080 ffff880112cfd6c0 ffff880118357d38 ffffffff816dce0a
    Call Trace:
     [<ffffffff8167f207>] mount_fs+0x97/0x2e0
     [<ffffffff816d7a1e>] ? alloc_vfsmnt+0x55e/0x760
     [<ffffffff816dce0a>] vfs_kern_mount+0x7a/0x300
     [<ffffffff83c3247c>] ? _raw_read_unlock+0x2c/0x50
     [<ffffffff816dfc87>] do_mount+0x3d7/0x2730
     [<ffffffff81235fd4>] ? trace_do_page_fault+0x1f4/0x3a0
     [<ffffffff816df8b0>] ? copy_mount_string+0x40/0x40
     [<ffffffff8161ea81>] ? memset+0x31/0x40
     [<ffffffff816df73e>] ? copy_mount_options+0x1ee/0x320
     [<ffffffff816e2a02>] SyS_mount+0xb2/0x120
     [<ffffffff816e2950>] ? copy_mnt_ns+0x970/0x970
     [<ffffffff81005524>] do_syscall_64+0x1c4/0x4e0
     [<ffffffff83c3282a>] entry_SYSCALL64_slow_path+0x25/0x25
    Code: 83 e8 63 1b fc ff 48 85 c0 48 89 c3 74 4c e8 56 35 d1 ff 48 8d bb c8 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 75 36 4c 8b a3 c8 00 00 00 48 b8 00 00 00 00 00 fc
    RIP  [<ffffffff8172cb32>] bd_mount+0x52/0xa0
     RSP <ffff880118357ca0>
    ---[ end trace 13690ad962168b98 ]---

mount_pseudo() returns ERR_PTR(), not NULL, on error.

Fixes: 3684aa7 ("block-dev: enable writeback cgroup support")
Cc: Shaohua Li <shli@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
amery pushed a commit that referenced this issue Dec 29, 2017
RDS currently doesn't check if the length of the control message is
large enough to hold the required data, before dereferencing the control
message data. This results in following crash:

BUG: KASAN: stack-out-of-bounds in rds_rdma_bytes net/rds/send.c:1013
[inline]
BUG: KASAN: stack-out-of-bounds in rds_sendmsg+0x1f02/0x1f90
net/rds/send.c:1066
Read of size 8 at addr ffff8801c928fb70 by task syzkaller455006/3157

CPU: 0 PID: 3157 Comm: syzkaller455006 Not tainted 4.15.0-rc3+ #161
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 rds_rdma_bytes net/rds/send.c:1013 [inline]
 rds_sendmsg+0x1f02/0x1f90 net/rds/send.c:1066
 sock_sendmsg_nosec net/socket.c:628 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:638
 ___sys_sendmsg+0x320/0x8b0 net/socket.c:2018
 __sys_sendmmsg+0x1ee/0x620 net/socket.c:2108
 SYSC_sendmmsg net/socket.c:2139 [inline]
 SyS_sendmmsg+0x35/0x60 net/socket.c:2134
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x43fe49
RSP: 002b:00007fffbe244ad8 EFLAGS: 00000217 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fe49
RDX: 0000000000000001 RSI: 000000002020c000 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000217 R12: 00000000004017b0
R13: 0000000000401840 R14: 0000000000000000 R15: 0000000000000000

To fix this, we verify that the cmsg_len is large enough to hold the
data to be read, before proceeding further.

Reported-by: syzbot <syzkaller-bugs@googlegroups.com>
Signed-off-by: Avinash Repaka <avinash.repaka@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
amery pushed a commit that referenced this issue Jun 7, 2018
Trivial fix to remove the following sparse warnings:

  arch/powerpc/kernel/module_32.c:112:74: warning: Using plain integer as NULL pointer
  arch/powerpc/kernel/module_32.c:117:74: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:1155:28: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:1230:20: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:1385:36: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:1752:23: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:2084:19: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:2110:32: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:2167:19: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:2183:19: warning: Using plain integer as NULL pointer
  drivers/macintosh/via-pmu.c:277:20: warning: Using plain integer as NULL pointer
  arch/powerpc/platforms/powermac/setup.c:155:67: warning: Using plain integer as NULL pointer
  arch/powerpc/platforms/powermac/setup.c:247:27: warning: Using plain integer as NULL pointer
  arch/powerpc/platforms/powermac/setup.c:249:27: warning: Using plain integer as NULL pointer
  arch/powerpc/platforms/powermac/setup.c:252:37: warning: Using plain integer as NULL pointer
  arch/powerpc/mm/tlb_hash32.c:127:21: warning: Using plain integer as NULL pointer
  arch/powerpc/mm/tlb_hash32.c:148:21: warning: Using plain integer as NULL pointer
  arch/powerpc/mm/tlb_hash32.c:44:21: warning: Using plain integer as NULL pointer
  arch/powerpc/mm/tlb_hash32.c:57:21: warning: Using plain integer as NULL pointer
  arch/powerpc/mm/tlb_hash32.c:87:21: warning: Using plain integer as NULL pointer
  arch/powerpc/kernel/btext.c:160:31: warning: Using plain integer as NULL pointer
  arch/powerpc/kernel/btext.c:167:22: warning: Using plain integer as NULL pointer
  arch/powerpc/kernel/btext.c:274:21: warning: Using plain integer as NULL pointer
  arch/powerpc/kernel/btext.c:285:31: warning: Using plain integer as NULL pointer
  arch/powerpc/include/asm/hugetlb.h:204:16: warning: Using plain integer as NULL pointer
  arch/powerpc/mm/ppc_mmu_32.c:170:21: warning: Using plain integer as NULL pointer
  arch/powerpc/platforms/powermac/pci.c:1227:23: warning: Using plain integer as NULL pointer
  arch/powerpc/platforms/powermac/pci.c:65:24: warning: Using plain integer as NULL pointer

Also use `--fix` command line option from `script/checkpatch --strict` to
remove the following:

  CHECK: Comparison to NULL could be written "!dispDeviceBase"
  #72: FILE: arch/powerpc/kernel/btext.c:160:
  +	if (dispDeviceBase == NULL)

  CHECK: Comparison to NULL could be written "!vbase"
  #80: FILE: arch/powerpc/kernel/btext.c:167:
  +	if (vbase == NULL)

  CHECK: Comparison to NULL could be written "!base"
  #89: FILE: arch/powerpc/kernel/btext.c:274:
  +	if (base == NULL)

  CHECK: Comparison to NULL could be written "!dispDeviceBase"
  #98: FILE: arch/powerpc/kernel/btext.c:285:
  +	if (dispDeviceBase == NULL)

  CHECK: Comparison to NULL could be written "strstr"
  #117: FILE: arch/powerpc/kernel/module_32.c:117:
  +		if (strstr(secstrings + sechdrs[i].sh_name, ".debug") != NULL)

  CHECK: Comparison to NULL could be written "!Hash"
  #130: FILE: arch/powerpc/mm/ppc_mmu_32.c:170:
  +	if (Hash == NULL)

  CHECK: Comparison to NULL could be written "Hash"
  #143: FILE: arch/powerpc/mm/tlb_hash32.c:44:
  +	if (Hash != NULL) {

  CHECK: Comparison to NULL could be written "!Hash"
  #152: FILE: arch/powerpc/mm/tlb_hash32.c:57:
  +	if (Hash == NULL) {

  CHECK: Comparison to NULL could be written "!Hash"
  #161: FILE: arch/powerpc/mm/tlb_hash32.c:87:
  +	if (Hash == NULL) {

  CHECK: Comparison to NULL could be written "!Hash"
  #170: FILE: arch/powerpc/mm/tlb_hash32.c:127:
  +	if (Hash == NULL) {

  CHECK: Comparison to NULL could be written "!Hash"
  #179: FILE: arch/powerpc/mm/tlb_hash32.c:148:
  +	if (Hash == NULL) {

  ERROR: space required after that ';' (ctx:VxV)
  #192: FILE: arch/powerpc/platforms/powermac/pci.c:65:
  +	for (; node != NULL;node = node->sibling) {

  CHECK: Comparison to NULL could be written "node"
  #192: FILE: arch/powerpc/platforms/powermac/pci.c:65:
  +	for (; node != NULL;node = node->sibling) {

  CHECK: Comparison to NULL could be written "!region"
  #201: FILE: arch/powerpc/platforms/powermac/pci.c:1227:
  +	if (region == NULL)

  CHECK: Comparison to NULL could be written "of_get_property"
  #214: FILE: arch/powerpc/platforms/powermac/setup.c:155:
  +		if (of_get_property(np, "cache-unified", NULL) != NULL && dc) {

  CHECK: Comparison to NULL could be written "!np"
  #223: FILE: arch/powerpc/platforms/powermac/setup.c:247:
  +		if (np == NULL)

  CHECK: Comparison to NULL could be written "np"
  #226: FILE: arch/powerpc/platforms/powermac/setup.c:249:
  +		if (np != NULL) {

  CHECK: Comparison to NULL could be written "l2cr"
  #230: FILE: arch/powerpc/platforms/powermac/setup.c:252:
  +			if (l2cr != NULL) {

  CHECK: Comparison to NULL could be written "via"
  #243: FILE: drivers/macintosh/via-pmu.c:277:
  +	if (via != NULL)

  CHECK: Comparison to NULL could be written "current_req"
  #252: FILE: drivers/macintosh/via-pmu.c:1155:
  +	if (current_req != NULL) {

  CHECK: Comparison to NULL could be written "!req"
  #261: FILE: drivers/macintosh/via-pmu.c:1230:
  +	if (req == NULL || pmu_state != idle

  CHECK: Comparison to NULL could be written "!req"
  #270: FILE: drivers/macintosh/via-pmu.c:1385:
  +			if (req == NULL) {

  CHECK: Comparison to NULL could be written "!pp"
  #288: FILE: drivers/macintosh/via-pmu.c:2084:
  +	if (pp == NULL)

  CHECK: Comparison to NULL could be written "!pp"
  #297: FILE: drivers/macintosh/via-pmu.c:2110:
  +	if (count < 1 || pp == NULL)

  CHECK: Comparison to NULL could be written "!pp"
  #306: FILE: drivers/macintosh/via-pmu.c:2167:
  +	if (pp == NULL)

  CHECK: Comparison to NULL could be written "pp"
  torvalds#315: FILE: drivers/macintosh/via-pmu.c:2183:
  +	if (pp != NULL) {

Link: https://github.com/linuxppc/linux/issues/37
Signed-off-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
repojohnray pushed a commit to repojohnray/linux-sunxi-4.7.y that referenced this issue Apr 6, 2019
[ Upstream commit afd0738 ]

One of the vmalloc stress test case triggers the kernel BUG():

  <snip>
  [60.562151] ------------[ cut here ]------------
  [60.562154] kernel BUG at mm/vmalloc.c:512!
  [60.562206] invalid opcode: 0000 [jwrdegoede#1] PREEMPT SMP PTI
  [60.562247] CPU: 0 PID: 430 Comm: vmalloc_test/0 Not tainted 4.20.0+ linux-sunxi#161
  [60.562293] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
  [60.562351] RIP: 0010:alloc_vmap_area+0x36f/0x390
  <snip>

it can happen due to big align request resulting in overflowing of
calculated address, i.e.  it becomes 0 after ALIGN()'s fixup.

Fix it by checking if calculated address is within vstart/vend range.

Link: http://lkml.kernel.org/r/20190124115648.9433-2-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
repojohnray pushed a commit to repojohnray/linux-sunxi-4.7.y that referenced this issue Apr 6, 2019
[ Upstream commit afd0738 ]

One of the vmalloc stress test case triggers the kernel BUG():

  <snip>
  [60.562151] ------------[ cut here ]------------
  [60.562154] kernel BUG at mm/vmalloc.c:512!
  [60.562206] invalid opcode: 0000 [jwrdegoede#1] PREEMPT SMP PTI
  [60.562247] CPU: 0 PID: 430 Comm: vmalloc_test/0 Not tainted 4.20.0+ linux-sunxi#161
  [60.562293] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
  [60.562351] RIP: 0010:alloc_vmap_area+0x36f/0x390
  <snip>

it can happen due to big align request resulting in overflowing of
calculated address, i.e.  it becomes 0 after ALIGN()'s fixup.

Fix it by checking if calculated address is within vstart/vend range.

Link: http://lkml.kernel.org/r/20190124115648.9433-2-urezki@gmail.com
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jwrdegoede pushed a commit to jwrdegoede/linux-sunxi that referenced this issue Aug 18, 2021
Nadav reports running into the below splat on re-enabling softirqs:

WARNING: CPU: 2 PID: 1777 at kernel/softirq.c:364 __local_bh_enable_ip+0xaa/0xe0
Modules linked in:
CPU: 2 PID: 1777 Comm: umem Not tainted 5.13.1+ linux-sunxi#161
Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/22/2020
RIP: 0010:__local_bh_enable_ip+0xaa/0xe0
Code: a9 00 ff ff 00 74 38 65 ff 0d a2 21 8c 7a e8 ed 1a 20 00 fb 66 0f 1f 44 00 00 5b 41 5c 5d c3 65 8b 05 e6 2d 8c 7a 85 c0 75 9a <0f> 0b eb 96 e8 2d 1f 20 00 eb a5 4c 89 e7 e8 73 4f 0c 00 eb ae 65
RSP: 0018:ffff88812e58fcc8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000201 RCX: dffffc0000000000
RDX: 0000000000000007 RSI: 0000000000000201 RDI: ffffffff8898c5ac
RBP: ffff88812e58fcd8 R08: ffffffff8575dbbf R09: ffffed1028ef14f9
R10: ffff88814778a7c3 R11: ffffed1028ef14f8 R12: ffffffff85c9e9ae
R13: ffff88814778a000 R14: ffff88814778a7b0 R15: ffff8881086db890
FS:  00007fbcfee17700(0000) GS:ffff8881e0300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000c0402a5008 CR3: 000000011c1ac003 CR4: 00000000003706e0
Call Trace:
 _raw_spin_unlock_bh+0x31/0x40
 io_rsrc_node_ref_zero+0x13e/0x190
 io_dismantle_req+0x215/0x220
 io_req_complete_post+0x1b8/0x720
 __io_complete_rw.isra.0+0x16b/0x1f0
 io_complete_rw+0x10/0x20

where it's clear we end up calling the percpu count release directly
from the completion path, as it's in atomic mode and we drop the last
ref. For file/block IO, this can be from IRQ context already, and the
softirq locking for rsrc isn't enough.

Just make the lock fully IRQ safe, and ensure we correctly safe state
from the release path as we don't know the full context there.

Reported-by: Nadav Amit <nadav.amit@gmail.com>
Tested-by: Nadav Amit <nadav.amit@gmail.com>
Link: https://lore.kernel.org/io-uring/C187C836-E78B-4A31-B24C-D16919ACA093@gmail.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants