si_meminfo() calls nr_blockdev_pages() that grabs bdev_lock, but it is
not safe to grab the lock from the hardirq context (the lock is never
taken with an _irqsave variant in block_dev.c). When taken from an
inappropriate context it easily causes the following deadlock:
- - - -
=================================
[ INFO: inconsistent lock state ]
3.2.0+ #1
---------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
(bdev_lock){?.+...}, at: [<ffffffff810f1017>] nr_blockdev_pages+0x17/0x70
{HARDIRQ-ON-W} state was registered at:
[<ffffffff81061b20>] mark_irqflags+0x140/0x1b0
[<ffffffff81062f03>] __lock_acquire+0x4c3/0x9c0
[<ffffffff810639c6>] lock_acquire+0x96/0xc0
[<ffffffff8131c58c>] _raw_spin_lock+0x2c/0x40
[<ffffffff810f1017>] nr_blockdev_pages+0x17/0x70
[<ffffffff81089ba8>] si_meminfo+0x38/0x60
[<ffffffff81675493>] eventpoll_init+0x11/0xa1
[<ffffffff8165eb40>] do_one_initcall+0x7a/0x12e
[<ffffffff8165ec8e>] kernel_init+0x9a/0x114
[<ffffffff8131e934>] kernel_thread_helper+0x4/0x10
irq event stamp: 135250
hardirqs last enabled at (135247): [<ffffffff81009897>] default_idle+0x27/0x50
hardirqs last disabled at (135248): [<ffffffff8131e1ab>] apic_timer_interrupt+0x6b/0x80
softirqs last enabled at (135250): [<ffffffff8103814e>] _local_bh_enable+0xe/0x10
softirqs last disabled at (135249): [<ffffffff81038665>] irq_enter+0x65/0x80
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(bdev_lock);
<Interrupt>
lock(bdev_lock);
*** DEADLOCK ***
no locks held by swapper/0/0.
- - - -
The patch fixes the issue by using totalram_pages instead of
si_meminfo().
p.s.
Note that VMEVENT_EATTR_NR_SWAP_PAGES type calls si_swapinfo(), which
has a very similar problem. But there is no easy way to fix it.
Do we have any use case for the VMEVENT_EATTR_NR_SWAP_PAGES event? If
not, I'd vote for removing it and thus keeping things simple.
Otherwise we would have two options:
1. Modify swap accounting for vmevent (either start grabbing
_irqsave variant of swapfile.c's swap_lock, or try to
make the accounting atomic);
2. Start using kthreads for vmevent_sample().
Signed-off-by: Anton Vorontsov <anton.vorontsov(a)linaro.org>
---
The patch is for git://github.com/penberg/linux.git vmevent/core.
mm/vmevent.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/vmevent.c b/mm/vmevent.c
index 2342752..1375f9d 100644
--- a/mm/vmevent.c
+++ b/mm/vmevent.c
@@ -51,18 +51,18 @@ static bool vmevent_match(struct vmevent_watch *watch,
static void vmevent_sample(struct vmevent_watch *watch)
{
struct vmevent_watch_event event;
- struct sysinfo si;
int n = 0;
memset(&event, 0, sizeof(event));
event.nr_free_pages = global_page_state(NR_FREE_PAGES);
- si_meminfo(&si);
- event.nr_avail_pages = si.totalram;
+ event.nr_avail_pages = totalram_pages;
#ifdef CONFIG_SWAP
if (watch->config.event_attrs & VMEVENT_EATTR_NR_SWAP_PAGES) {
+ struct sysinfo si;
+
si_swapinfo(&si);
event.nr_swap_pages = si.totalswap;
}
--
1.7.7.6
Caught this build failure:
CC mm/vmevent.o
mm/vmevent.c:17:6: error: expected identifier or '(' before numeric constant
mm/vmevent.c:18:1: warning: no semicolon at end of struct or union [enabled by default]
mm/vmevent.c: In function 'vmevent_sample':
mm/vmevent.c:84:36: error: expected identifier before numeric constant
make[1]: *** [mm/vmevent.o] Error 1
make: *** [mm/] Error 2
This is because linux/swap.h defines nr_swap_pages to 0L, and so things
break.
Fix this by undefinding it back, as we don't use it anyway.
Signed-off-by: Anton Vorontsov <anton.vorontsov(a)linaro.org>
---
The patch is for git://github.com/penberg/linux.git vmevent/core.
mm/vmevent.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/mm/vmevent.c b/mm/vmevent.c
index 37d2c5f..2342752 100644
--- a/mm/vmevent.c
+++ b/mm/vmevent.c
@@ -6,6 +6,7 @@
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/swap.h>
+#undef nr_swap_pages /* This is defined to a constant for SWAP=n case */
#define VMEVENT_MAX_FREE_THRESHOD 100
--
1.7.7.6
=== Highlights ===
* My LWN summary of the Android upstreaming interest group meeting from
Linaro Connect was published: https://lwn.net/Articles/484196/
* Chased down an issue w/ serial triggered resume from suspend on
Pandaboard. Working with PaulW & KevinH to narrow down the issue, as it
seems to depend on a combination of uboot, kernel config, and boot
options.
* Did some initial testing w/ Rafael's wakelock patches using Android.
Behavior is not totally what I expect, but some of the Android wakelock
code is shifting (early suspend is being dropped) so I'm not sure if I
have a ideal match between userland and kernel with which to compare.
* Sent out patches to reduce timekeeping lock hold times. Got a bit of
feedback from Ingo, which I integrated in. Also did some increased
testing which found a few bugs in my new code. Also in testing my work,
found and chased down some older timekeeping bugs that had been
introduced upstream over the last few years. This took a good chunk of
time this week.
* Meetings: Ran Android-subteam meeting over email, Phone call with
Zach, Lunch with Deepak.
* Managed to reproduce an issue I saw earlier in the month with the
lowmemory killer in staging.
* Some internal items ate most of a day.
=== Plans ===
* Continue working with PaulW and KevinH to sort out alarmtiemr work
* Need to really get focused on fadvise volatile work
=== Issues ===
* NA
== Linus Walleij linusw ==
=== Highlights ===
* Presented the pin control subsystem at the Embedded
Linux Conference in San Francisco.
* Discussed pin control at Linaro Connect, discussed
pin control at Embedded Linux Conference.
Wrote a bunch of patches refactoring the subsystem to
be closer to what we agreed, Stephen will do the
heavy lifting though.
* Wrote and finalized a presentation for the Embedded
Systems Conference pertaining to the platform perimeter
including GPIO, pin control, device tree ... etc.
* Reviewed and merged a whole bunch of patches from
Stephen Warren @nVidia who gladly stepped in and
offered to write the code we needed to get pin control
to where we want it for v3.4. Dong Aishen is doing a
great job in helping out with code review here.
* Dummy pin controls implemented as default fallback
for devices not provided with any controllers.
* Sent pinctrl fixes to Torvalds for v3.3-rc4.
* Collected a number of ux500 fixes and requested
the ARM SoC maintainers to pull them in. Had to
back off U9540 support but will reiterate.
* Samuel Ortiz merged the DB8500 PRCMU update
to the MFD tree.
* Wrote mail to Greg & LKML about system controllers
after discussion at ARM SoC maintainers summit.
Seems the need may be there and we could create
drivers/scm the day we have something that would
live there.
=== Plans ===
* Accumulate pinctrl patches for kernel v3.4 merge
window.
* Drive generalization of Nomadik GPIO
by using the pinctrl framework.
drivers/gpio/gpio-nomadik.c
* Test the PL08x patches on the Ericsson Research
PB11MPCore and submit platform data for using
pl08x DMA on that platform.
* Look into other Ux500 stuff in need of mainlining...
like
- Ux500 clocks
- the HWMON stuff.
=== Issues ===
* Ux500 mainlining or improvements (such as device
tree) having second priority.
* Sorry for long report covering much time, it's covering
some of my vacation that is why...
Thanks,
Linus Walleij
Hi guys,
Once I duplicated linaro-ubuntu-desktop image into SD card following the
instruction on linaro website and it works fine. Now I need to patch the
kernel so that I compiled the patched kernel and copy the kernel image into
/boot of SD card but my pandaboard doesn't boot up. Below is more detail
steps I did so please let me know what I did wrong. Also if you have an
instruction, then it also might be really helpful.
1. I'm using PandaBoard ES. To start the board, I just dd
linaro-ubuntu-desktop image to SD card following these steps (
http://releases.linaro.org/images/):
# These values will change based on your system
$ SDCARD=/dev/ #sdcard could be something sdb or mmcblk0
$ IMGFILE=overo-nano.img
$ gunzip ${IMGFILE}.gz
$ dd bs=64k if=${IMGFILE} of=${SDCARD}
Then the linaro ubuntu works on the PandaBoard ES well. In detail, the
version of this ubuntu 12.02 and kernel version is 3.1.1-8-linaro-lt-omap.
2. Next, I cloned your git repository(git://
git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc.git) to get kernel
including remoteproc patch. Since there's no .config file I just copy the
config file of 3.2-rc4 on here (
http://elinux.org/Panda_How_to_kernel_3_2_rcx) wihch is the version
matching the kernel version on your git repository. And then I compile the
kernel and modules to get an uImage and install modules with commands below
(also explains http://elinux.org/Panda_How_to_kernel_3_2_rcx), and copy
uImage to /boot on SD card and modules /rootfs/lib/ on SD card. I used
arm-linux-gnueabi-gcc rather than arm-none-linux-gnueabi-gcc.
Then compile like so:
make ARCH=arm
CROSS_COMPILE=Path_to_your/arm-2010q1/bin/arm-none-linux-gnueabi- uImage
Then compile the modules like so:
make ARCH=arm
CROSS_COMPILE=/home/kenm/Panda/arm-2010q1/bin/arm-none-linux-gnueabi-
modules
"Install" the modules to somewhere convenient:
make ARCH=arm
CROSS_COMPILE=/home/kenm/Panda/arm-2010q1/bin/arm-none-linux-gnueabi-
INSTALL_MOD_PATH=../testlib_omap modules_install
3. Then I put SD card to the Panda Board but it's suspending with the
booting logs below.
U-Boot SPL 2011.12-rc1 (Mar 01 2012 - 20:03:59)
Texas Instruments OMAP4460 ES1.1
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img
U-Boot 2011.12-rc1 (Mar 01 2012 - 20:03:59)
CPU : OMAP4460 ES1.1
Board: OMAP4 Panda
I2C: ready
DRAM: 1 GiB
WARNING: Caches not enabled
MMC: OMAP SD/MMC: 0
Using default environment
In: serial
Out: serial
Err: serial
Net: No ethernet found.
Hit any key to stop autoboot: 0
reading uEnv.txt
** Unable to read "uEnv.txt" from mmc 0:1 **
reading boot.scr
514 bytes read
Loaded script from boot.scr
Running bootscript from mmc0 ...
## Executing script at 82000000
reading uImage
3249584 bytes read
reading uInitrd
1877535 bytes read
reading board.dtb
340 bytes read
## Booting kernel from Legacy Image at 80200000 ...
Image Name: Linux-3.2.0-rc4-00248-gb835c0f-d
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3249520 Bytes = 3.1 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 81600000 ...
Image Name: initramfs
Image Type: ARM Linux RAMDisk Image (uncompressed)
Data Size: 1877471 Bytes = 1.8 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 815f0000
Booting using the fdt blob at 0x815f0000
Loading Kernel Image ... OK
OK
reserving fdt memory region: addr=9d000000 size=3000000
Using Device Tree in place at 815f0000, end 815f3153
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Do you have any guess what I have missed or didn't do something? Any of
your advise would be more than welcome. Thanks for your patches, and I
really appreciate your consideration and help.
Thanks,
Jaeyeon
=== Pinctrl ===
* Mainly focused on help reviewing pinctrl core rework patches(near 30
patches recently submitted by Stephen Warren and Linus Walleij)
for API rework, merging mux and config and adding different state
support as well as pinctrl core dt binding support(in plan).
=== Plan ===
* Continue to help review pinctrl core patches since many of them are still
not hit mainline
* Adding pin config and DT support for MX6Q pinctrl driver after pinctrl
core rework patches get upstreamed
* Will spend some free time to add DT support for MX28 platform
Hi all,
I've added some detailed info on the wiki about how to go about
building bootable images for the big.LITTLE components, here:
https://wiki.linaro.org/Internal/Projects/Big.Little.Switcher/ARMFastModels…
For the benefit of anyone who can't see that page, I've also pasted it
here -- if anyone knows a better place to post this stuff, please let
me know!
Note that although the instructions give details of how to build a
filesystem image, there is essentially nothing b.L or model-specific
there -- it just serves as background for explaining how to work
around some issues which you may encounter.
These images are not supposed to present a fully working big.LITTLE
system -- they are there to help people understand how booting works,
where the sources are and how to work with the model.
Note also that the bootwrapper will change soon (when I get there) to
support loading of the kernel, initramfs from the host filesystem
using semihosting, just like the kvm bootwrapper, but this isn't
implemented for now.
Cheers
---Dave
== Filesystem ==
We need to create an SD card image with a filesystem on it, with the
rootfs partition matching the bootargs set previously. The following
example generates a suitable image using developer. The hardware pack
is largely irrelevant because we're not getting the kernel, modules,
bootloader or command-line from there -- but it keeps l-m-c happy.
{{{
$ wget http://releases.linaro.org/12.02/ubuntu/oneiric-images/developer/linaro-o-d…
$ wget http://releases.linaro.org/12.02/ubuntu/oneiric-images/developer/hwpack_lin…
}}}
Note that the ARM fast model's MMC interface emulation is currently
limited to 2G. Make the image a bit smaller than that to be on the
safe side:
{{{
$ sudo linaro-media-create --dev vexpress --image_file mmc.bin
--image_size 2000M --hwpack
hwpack_linaro-lt-vexpress-a9_20120221-1_armel_suupported.tar.gz
--binary linaro-o-developer-tar-20120221-0.tar.gz
}}}
After generating the filesystem, you probably want to customize it:
* Disable address layout randomization (mitigates a memory
consumption issue with the model, but not so important on host
machines with >4GB of RAM):
{{{
echo sys.kernel.randomize_va_space = 0 >>etc/sysctl.conf
}}}
* Disable DHCP for the network (otherwise boot will stall):
{{{
sed -i '/auto.*eth0/d; s/^\(iface.*eth0.*\)dhcp/\1manual/'
etc/network/interfaces
}}}
* Edit fstab to put the real device name into /etc/fstab in place of
UUID=<uuid>. This may not be necessary (mountall was getting
confused, but that may have been caused by not having an initramfs).
Finally, extract the initramfs image (whatever /initrd.img in the
filesystem image points to).
== Kernel, switcher and bootwrapper ==
Clone the big.LITTLE switcher:
{{{
$ git clone --branch gnu-build git://git.linaro.org/people/dmart/arm-virt-bl.git
}}}
Clone the kernel to run on the model. (Eventually we shouldn't need a
special tree for this. There are a few model-specific tweaks in this
tree, but nothing big.LITTLE-specific yet.)
{{{
$ git clone --branch arm/vexpressdt-rtsm
git://git.linaro.org/people/dmart/linux-2.6-arm.git
}}}
Now build the kernel:
{{{
$ cd linux-2.6-arm/
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- vexpress_rtsm_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage dtbs
}}}
The bootwrapper doesn't support device tree yet, so for now append a
suitable device tree blob to the zImage. This should match the model
you intend to run on:
{{{
$ cat arch/arm/boot/zImage arch/arm/boot/vexprress-v2p-ca15x4-rtsm.dtb >../zBlob
}}}
Now, build the bootwrapper using the kernel you just built:
{{{
$ cd ../arm-virt-bl/bootwrapper
}}}
Configure some things:
In Makefile, add the following argument to BOOTARGS:
{{{
root=/dev/mmcblk0p2
}}}
Due to current bugginess introduced by the ARM->GNU toolchain
migration, the switcher is not currently stable. For now, we turn off
autonomous asynchronous switching so that we can see the system
booting:
In big-little/Makefile, add change the line
{{{
ASYNC ?= TRUE
}}}
to
{{{
ASYNC ?= FALSE
}}}
Plug in the kernel and initramfs images from the previous steps:
{{{
$ : >payload/fsimg
$ cp ../../zBlob payload/kernel
$ cp initrd.img payload/fsimg
}}}
... and build:
{{{
$ make
[...]
LD img.axf
}}}
img.axf is the boot payload which is needed to start the model. It
contains the big.LITTLE switcher code and the kernel, along with a
minimal bootloader.
== Running ==
OK, so now we have:
* A boot image containing the switcher and kernel: img.axf
* A filesystem MMC card image: mmc.bin
* A model binary
Sample payload images can be found in
http://people.linaro.org/~dmart/bl-images/model-images-20120228.tar.bz2
Run like this:
{{{
$ ./RTSM_VE_Cortex-A15x4-A7x4 -C motherboard.mmc.p_mmc_file=mmc.bin -a
coretile.cluster0.*=img.axf
}}}
This should be enough to boot to a prompt on the simulated UART.
Beware though -- it can take up to 10 minutes or so to get there,
depending on your machine.
== Omar Ramirez <omarrmz> ==
=== Highlights ===
* Attended Linaro Connect from Feb 6 - 10
* Rebased iommu hwmod work onto Ohad's rpmsg-branch, created github
tree for him to check on the changes.
* Setting up OMAP3 ISP testing environment, to test iommu changes
without a sensor, following instructions received from Laurent
Pinchart.
* Looking at device tree for mailbox.
* Tidspbridge work:
- Tracking inclusion of memory leak fixes for tidspbridge.
- Patch to solve a L3 warning due to a missing wdt clock on the dsp side.