Workqueue used in ipv4 layer have no real dependency of scheduling these on the
cpu which scheduled them.
On a idle system, it is observed that an idle cpu wakes up many times just to
service this work. It would be better if we can schedule it on a cpu which the
scheduler believes to be the most appropriate one.
This patch replaces normal workqueues with power efficient versions. This
doesn't change existing behavior of code unless CONFIG_WQ_POWER_EFFICIENT is
enabled.
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
Initial support for power-efficient workqueues was added here:
https://lkml.org/lkml/2013/4/24/215
net/ipv4/devinet.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 646023b..ac2dff3 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -474,7 +474,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
inet_hash_insert(dev_net(in_dev->dev), ifa);
cancel_delayed_work(&check_lifetime_work);
- schedule_delayed_work(&check_lifetime_work, 0);
+ queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
/* Send message first, then call notifier.
Notifier will trigger FIB update, so that
@@ -684,7 +684,8 @@ static void check_lifetime(struct work_struct *work)
if (time_before(next_sched, now + ADDRCONF_TIMER_FUZZ_MAX))
next_sched = now + ADDRCONF_TIMER_FUZZ_MAX;
- schedule_delayed_work(&check_lifetime_work, next_sched - now);
+ queue_delayed_work(system_power_efficient_wq, &check_lifetime_work,
+ next_sched - now);
}
static void set_ifa_lifetime(struct in_ifaddr *ifa, __u32 valid_lft,
@@ -842,7 +843,8 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
ifa = ifa_existing;
set_ifa_lifetime(ifa, valid_lft, prefered_lft);
cancel_delayed_work(&check_lifetime_work);
- schedule_delayed_work(&check_lifetime_work, 0);
+ queue_delayed_work(system_power_efficient_wq,
+ &check_lifetime_work, 0);
rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid);
blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
}
@@ -2322,7 +2324,7 @@ void __init devinet_init(void)
register_gifconf(PF_INET, inet_gifconf);
register_netdevice_notifier(&ip_netdev_notifier);
- schedule_delayed_work(&check_lifetime_work, 0);
+ queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
rtnl_af_register(&inet_af_ops);
--
1.7.12.rc2.18.g61b472e
From: Mark Brown <broonie(a)linaro.org>
irqdomain now supports removal of domains on exit so we can properly clean
up on deletion of a regmap irqchip.
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
drivers/base/regmap/regmap-irq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 82692068d3cb..52ce0c17c68b 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -533,7 +533,7 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d)
return;
free_irq(irq, d);
- /* We should unmap the domain but... */
+ irq_domain_remove(d->domain);
kfree(d->wake_buf);
kfree(d->mask_buf_def);
kfree(d->mask_buf);
--
1.8.5.3
With the current implementation, the load average statistics of a sched entity
change according to other activity on the CPU even if this activity is done
between the running window of the sched entity and have no influence on the
running duration of the task.
When a task wakes up on the same CPU, we currently update last_runnable_update
with the return of __synchronize_entity_decay without updating the
runnable_avg_sum and runnable_avg_period accordingly. In fact, we have to sync
the load_contrib of the se with the rq's blocked_load_contrib before removing
it from the latter (with __synchronize_entity_decay) but we must keep
last_runnable_update unchanged for updating runnable_avg_sum/period during the
next update_entity_load_avg.
Signed-off-by: Vincent Guittot <vincent.guittot(a)linaro.org>
---
kernel/sched/fair.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e64b079..5b0ef90 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2370,8 +2370,7 @@ static inline void enqueue_entity_load_avg(struct cfs_rq *cfs_rq,
* would have made count negative); we must be careful to avoid
* double-accounting blocked time after synchronizing decays.
*/
- se->avg.last_runnable_update += __synchronize_entity_decay(se)
- << 20;
+ __synchronize_entity_decay(se);
}
/* migrated tasks did not contribute to our blocked load */
--
1.7.9.5
On Wed, Jan 22, 2014 at 12:06 AM, Will Deacon <will.deacon(a)arm.com> wrote:
> On Tue, Jan 21, 2014 at 02:10:14PM +0000, Vijay Kilari wrote:
>> Hi Will,
>
> Hello Vijay,
>
>> On Mon, Jan 20, 2014 at 3:53 PM, Will Deacon <will.deacon(a)arm.com> wrote:
>> > Well, the warnings are one thing but the 100 miles of backtrace output that
>> > appear on every boot (and I think end in an oops) are probably more
>> > important to fix. Please enable CONFIG_KGDB_TESTS and
>> > CONFIG_KGDB_TESTS_ON_BOOT and take a look.
>> >
>>
>> I could manage to run KGDB boot tests if I run from sysfs after complete boot
>>
>> echo V1F1000 > /sys/module/kgdbts/parameters/kgdbts
>>
>> Here the value of PSTATE is 80000145, which means PSTATE.D is unmasked
>> hence it works fine.
>>
>> If I run during boot by enabling CONFIG_KGDB_TESTS_ON_BOOT,
>> the step debug test fail because value of PSTATE is 80000345.
>> If I force PSTATE.D to 0, it works fine
>>
>> In debug_monitors.c file, only PSTATE.SS & MDSCR.KDE/MDE is managed
>> but not PSTATE.D
>>
>> Can you please let me know if where PSTATE.D is managed in arm64?
>
> That's a good point: I think we wait until our first exception before they
> are unmasked. Perhaps we should:
>
> (1) Move local_dbg_{save,restore} from debug-monitors.h into irqflags.h
> (2) Add local_dbg_enable/local_dbg_disable macros
> (3) Add a call to local_dbg_enable in the clear_os_lock function after the
> isb().
>
> Does that work for you?
Yes, only after first exception occurs the PSTATE.D is unmasked.
I have patched (temp) as below and now KGDB boot tests pass
diff --git a/arch/arm64/include/asm/debug-monitors.h
b/arch/arm64/include/asm/debug-monitors.h
index aff3a76..ea2bc46 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -64,6 +111,24 @@ struct task_struct;
#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
+#define local_dbg_enable()
\
+ do {
\
+ asm volatile(
\
+ "msr daifclr, #9 //
arch_local_irq_disable" \
+ :
\
+ :
\
+ : "memory");
\
+ } while (0)
+
+#define local_dbg_disable()
\
+ do {
\
+ asm volatile(
\
+ "msr daifset, #9 //
arch_local_irq_disable" \
+ :
\
+ :
\
+ : "memory");
\
+ } while (0)
+
struct step_hook {
struct list_head node;
int (*fn)(struct pt_regs *regs, unsigned int insn, unsigned long addr);
diff --git a/arch/arm64/kernel/debug-monitors.c
b/arch/arm64/kernel/debug-monitors.c
index f8b90c0..d0e55f7 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -139,6 +142,7 @@ static void clear_os_lock(void *unused)
{
asm volatile("msr oslar_el1, %0" : : "r" (0));
isb();
+ local_dbg_enable();
}
boot test:
[32927.161317] msgmni has been set to 1870
[32927.212747] alg: No test for stdrng (krng)
[32927.213953] Key type asymmetric registered
[32927.214899] Asymmetric key parser 'x509' registered
[32927.220029] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 253)
[32927.225824] io scheduler noop registered
[32927.226764] io scheduler deadline registered
[32927.230714] io scheduler cfq registered (default)
[32927.237895] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[32927.266066] kgdb: Registered I/O driver kgdbts.
[32927.266419] kgdb: Waiting for connection from remote gdb...
[32927.268598] kgdbts:RUN plant and detach test
[32927.270683] kgdbts:RUN sw breakpoint test
[32927.287659] kgdbts:RUN bad memory access test
[32927.290322] kgdbts:RUN singlestep test 1000 iterations
[32927.330342] kgdbts:RUN singlestep [0/1000]
[32931.286356] kgdbts:RUN singlestep [100/1000]
[32935.242536] kgdbts:RUN singlestep [200/1000]
[32939.205392] kgdbts:RUN singlestep [300/1000]
[32943.169522] kgdbts:RUN singlestep [400/1000]
[32947.231868] kgdbts:RUN singlestep [500/1000]
[32951.188008] kgdbts:RUN singlestep [600/1000]
[32955.332243] kgdbts:RUN singlestep [700/1000]
[32959.467109] kgdbts:RUN singlestep [800/1000]
[32963.430888] kgdbts:RUN singlestep [900/1000]
[32967.346992] kgdbts:RUN do_fork for 100 breakpoints
kgdb test using sysfs:
~ # echo V1F1000 > /sys/module/kgdbts/parameters/kgdbts
[33231.554237] kgdb: Registered I/O driver kgdbts.
[33231.554677] kgdbts:RUN plant and detach test
[33231.557072] kgdbts:RUN sw breakpoint test
[33231.576980] kgdbts:RUN bad memory access test
[33231.580022] kgdbts:RUN singlestep test 1000 iterations
[33231.627056] kgdbts:RUN singlestep [0/1000]
[33235.954027] kgdbts:RUN singlestep [100/1000]
[33240.429086] kgdbts:RUN singlestep [200/1000]
[33244.687118] kgdbts:RUN singlestep [300/1000]
[33248.945191] kgdbts:RUN singlestep [400/1000]
[33253.203751] kgdbts:RUN singlestep [500/1000]
[33257.462019] kgdbts:RUN singlestep [600/1000]
[33261.817809] kgdbts:RUN singlestep [700/1000]
[33266.081268] kgdbts:RUN singlestep [800/1000]
[33270.339813] kgdbts:RUN singlestep [900/1000]
[33274.712404] kgdbts:RUN do_fork for 1000 breakpoints
~ #
This works for me. Should I patch it or will you send a patch for this?
PS: cc to mailing list missed
>
> Will
[repost: adding kvmarm mailing list as per Christoffer's request]
Hi Guys,
Here is series that enables KVM support for V7 big endian kernels. Mostly
it deals with BE KVM host support. Marc Zyngier showed before with his patches
how BE guest could run on top LE host. With these patches BE guest runs on
top of BE host. If Marc's kvmtool is used with few additional changes I tested
that BE host could run LE guest. Also I verified that there were no
regressions in BE guest on top of LE host case.
Note that posted series covers only kernel side changes. The changes were
tested inside of bigger setup with additional changes in qemu and kvmtool.
I will post those changes separately in proper aliases but for completeness
sake Appendix A gives pointers to git repositories and branches with all
needed changes.
Please note first patch is not related to BE KVM per se. I've run
into an issue of conflicting 'push' identifier use while trying to include
assembler.h into KVM .S files. Details of an issue I observed covered in
Appendix B. The first patch is my take on solving it.
Victor Kamensky (5):
ARM: kvm: replace push and pop with stdmb and ldmia instrs to enable
assembler.h inclusion
ARM: fix KVM assembler files to work in BE case
ARM: kvm one_reg coproc set and get BE fixes
ARM: kvm vgic mmio should return data in BE format in BE case
ARM: kvm MMIO support BE host running LE code
arch/arm/include/asm/assembler.h | 7 +++
arch/arm/include/asm/kvm_asm.h | 4 +-
arch/arm/include/asm/kvm_emulate.h | 22 +++++++--
arch/arm/kvm/coproc.c | 94 ++++++++++++++++++++++++++++----------
arch/arm/kvm/init.S | 7 ++-
arch/arm/kvm/interrupts.S | 50 +++++++++++---------
arch/arm/kvm/interrupts_head.S | 61 +++++++++++++++----------
virt/kvm/arm/vgic.c | 4 +-
8 files changed, 168 insertions(+), 81 deletions(-)
--
1.8.1.4
Thanks,
Victor
Appendix A: Testing and Full Setup Description
----------------------------------------------
I) No mixed mode setup - i.e BE guest on BE host; and LE guest
on LE host tested to make sure no regressions.
KVM host and guest kernels:
TC2 on top of Linus 3.13-rc4 (this patch series):
git: git://git.linaro.org/people/victor.kamensky/linux-linaro-tracking-be.git
branch: armv7be-kvm-3.13-rc4
TC2 and Arndale on top of Linaro BE tree:
git: git://git.linaro.org/people/victor.kamensky/linux-linaro-tracking-be.git
branch: llct-be-20131216-kvm
- TC1 kernels used as guests
qemu:
git: git://git.linaro.org/people/victor.kamensky/qemu-be.git
branch: armv7be-v1
description: changes to run qemu on armeb target; and other
changes to work with be image on top of be host
kvmtool:
git: git://git.linaro.org/people/victor.kamensky/linux-linaro-tracking-be.git
branch: kvmtool-armv7be-v1
desciption: minimal changes to build kvmtool for armeb target; and
tiny change with virtio magic
II) Mixed mode setup all possible combinations within V7 (LE guest on BE host;
BE guest on LE host as Marc's setup tested to make sure no regressions) only
with kvmtool.
This work is based on Marc Zyngier's work that made BE guest to run on top
of LE host. For this setup special version of kvmtool should be used and
in addition I had to apply patch to guest kernel that would switch reading
virtio configs reads to be LE only, that is made on top of previous Rusty
Russell's changes. Effectively I just had to do very minor addition to make
LE guest to work on BE host, most of heavy lifting was done before by Marc.
KVM host kernels: as in previous setup
Guest TC1 kernels with LE virtio config patch:
git: git://git.linaro.org/people/victor.kamensky/linux-linaro-tracking-be.git
branch: virtio-leconfig-3.13-rc4
kvmtool:
git: git://git.linaro.org/people/victor.kamensky/linux-linaro-tracking-be.git
branch: kvmtool-mixed-v1
description: based on git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
branch kvm-arm64/kvmtool-be-on-le; adds missing include fix; above armeb target
build patches; and one fix related to BE mode
qemu:
git: git://git.linaro.org/people/victor.kamensky/qemu-be.git
branch: armv7be-leconfig-v1
description: change virtio-blk that so qemu could work with guest image
where virtio leconfig is made; note it does not work in mixed mode; to do
so qemu would need bunch of similar changes that Marc did in kvmtool
Appendix B: kvm asm file and asm/assembler.h file issue
-------------------------------------------------------
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
index ddc1553..5d3b511 100644
--- a/arch/arm/kvm/interrupts.S
+++ b/arch/arm/kvm/interrupts.S
@@ -25,6 +25,7 @@
#include <asm/kvm_asm.h>
#include <asm/kvm_arm.h>
#include <asm/vfpmacros.h>
+#include <asm/assembler.h>
#include "interrupts_head.S"
.text
produce the following compilation errors:
/run/media/kamensky/wd/linaro/linux-linaro-core-tracking/092913/linux-linaro-tracking-be/arch/arm/kvm/interrupts.S: Assembler messages:
/run/media/kamensky/wd/linaro/linux-linaro-core-tracking/092913/linux-linaro-tracking-be/arch/arm/kvm/interrupts.S:51: Error: ARM register expected -- `lsr {r2,r3}'
/run/media/kamensky/wd/linaro/linux-linaro-core-tracking/092913/linux-linaro-tracking-be/arch/arm/kvm/interrupts.S:100: Error: ARM register expected -- `lsr {r2}'
/run/media/kamensky/wd/linaro/linux-linaro-core-tracking/092913/linux-linaro-tracking-be/arch/arm/kvm/interrupts.S:100: Error: ARM register expected -- `lsr {r4-r12}'
Add support for unwinding using the dwarf information in compat
mode. Using the correct user stack pointer allows perf to record
the frames correctly in the native and compat modes.
Note that although the dwarf frame unwinding works ok using
libunwind in native mode (on ARMv7 & ARMv8), some changes are
required to the libunwind code for the compat mode. Those changes
are posted separately on the libunwind mailing list.
Tested on ARMv8 platform with v8 and compat v7 binaries, the latter
are statically built.
Signed-off-by: Jean Pihet <jean.pihet(a)linaro.org>
---
arch/arm64/include/asm/ptrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index fbb0020..86d5b54 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -133,7 +133,7 @@ struct pt_regs {
(!((regs)->pstate & PSR_F_BIT))
#define user_stack_pointer(regs) \
- ((regs)->sp)
+ (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp)
/*
* Are the current registers suitable for user mode? (used to maintain
--
1.7.11.7
On Wed, 8 Jan 2014 20:38:55 +0000, Mark Brown wrote:
> It has never been possible to even load the da9055 driver since both the
> MFD and CODEC drivers register the I2C device "da9055". Fix this by using
> the usual pattern for MFDs with multiple I2C addresses and having the CODEC
> driver reference an I2C dummy registered by the MFD.
> Since I don't know which I2C address to use for the CODEC a FIXME has been
> left in the MFD, this doesn't make anything any worse since the device has
> never been able to load in the first place.
What you're saying here is incorrect, as previously discussed at length in this thread:
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066027.…
The two drivers did work together fine until someone in 3.12 changed the PMIC I2C Id
back to just 'da9055' and broke it again. Also, I wanted to add a simple patch to tidy up
the I2C Id names and avoid this but you would not agree. The codec part can be
standalone and by doing what you've done here means that customers would need to
now add additional, unnecessary code to be able to use just the codec driver.
This is not right to me.
Paul & Vincent & Morten,
The following rough idea get during this KS. I want to have internal
review before send to LKML. Would you like to give some comments?
==========================
1, Current scheduler load balance is bottom-up mode, each CPU need
initiate the balance by self. Like in a integrate computer system, it
has smt/core/cpu/numa, 4 level scheduler domains.
If there is just 2 tasks in whole system that both running on cpu0.
Current load balance need to pull task to another smt in smt domain,
then pull task to another core, then pull task to another cpu, finally
pull task to another numa. Totally it is need 4 times task moving to get
system balance.
Generally, the task moving complexity is
O(nm log n), n := nr_cpus, m := nr_tasks
PeterZ has a excellent summary and explanation for this in
kernel/sched/fair.c:4605
Another weakness of current LB is that every cpu need to get the other
cpus' load info repeatedly and try to figure out busiest sched
group/queue on every sched domain level. but may not conduct a task
moving, one of reasons is that cpu can only pull task, not pushing.
2, Consider huge cost of task moving: CS, tlb/cache refill, and the
useless remote cpu load info getting. If we can have better solution for
load balance, like reduce the balance times to.
O(m) m := nr_tasks
It will be a great win on performance. like above example, we can move
task from cpu0 direct to another numa. that only need 1 task moving,
save 3 CS and tlb/cache refill.
To get this point, a rough idea is changing the load balance behaviour
to top-down mode. Say let each of cpu report self load status on per-cpu
memory. And a baby-sitter in system to collect these cpus load info,
then decide how to move task centralize, finally send IPI to each hungry
cpu to let them pull load quota from appointed cpus.
Like in above example, the baby-sitter will fetch each cpus' load info,
then send a pull task IPI to let a cpu in another numa pull one task
from cpu0. So in the task pulling, we still just involved 2 cpus, can
reuse move_tasks functions.
BTW, the baby-sitter can care all kind of balance, regular balance, idle
balance, wake up balance.
3, One of concern of top-down mode is that baby-sitter need remote
access cpu load info on top domain level every times. But the fact is
current load balance also need to get remote cpu load info for top level
domain balance. and more worse, such remote accessing maybe useless.
-- since there is just one thread reading the info, no competitor
writer, Paul, do you think it is worthy concern?
BTW, to reduce unnecessary remote info fetching, we can use current
idle_cpus_mask in nohz, we just skip the idle cpu in this cpumask simply.
4, From power saving POV, top-down give the whole system cpu topology
info directly. So beside the CS reducing, it can reduce the idle cpu
interfere by a transition task. and let idle cpu sleep better.
--
Thanks
Alex
From: Mark Brown <broonie(a)linaro.org>
Since the GPIO jacks are only supported if gpiolib is built and fail to
compile otherwise add a build depedency. This is unlikely to have any
practical impact outside of coverage testing.
Reported-by: Russell King <linux(a)arm.linux.org.uk>
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
sound/soc/omap/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 4a07f7179690..22ad9c5654b5 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -30,6 +30,7 @@ config SND_OMAP_SOC_RX51
select SND_OMAP_SOC_MCBSP
select SND_SOC_TLV320AIC3X
select SND_SOC_TPA6130A2
+ depends on GPIOLIB
help
Say Y if you want to add support for SoC audio on Nokia RX-51
hardware. This is also known as Nokia N900 product.
--
1.8.5.2
__und_usr_thumb function deals with thumb2 opcodes. In case of BE
image, it needs to byteswap half word thumb2 encoded instructions
before further processing them.
Without this fix BE image user-land thread executing first VFP
instruction encoded in thumb2 fails with SIGILL, because kernel
does not recognize instruction and does not enable VFP.
Reported-by: Corey Melton <comelton(a)cisco.com>
Signed-off-by: Victor Kamensky <victor.kamensky(a)linaro.org>
---
arch/arm/kernel/entry-armv.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index b3fb8c9..1879e8d 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -451,9 +451,11 @@ __und_usr_thumb:
.arch armv6t2
#endif
2: ldrht r5, [r4]
+ARM_BE8(rev16 r5, r5) @ little endian instruction
cmp r5, #0xe800 @ 32bit instruction if xx != 0
blo __und_usr_fault_16 @ 16bit undefined instruction
3: ldrht r0, [r2]
+ARM_BE8(rev16 r0, r0) @ little endian instruction
add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
str r2, [sp, #S_PC] @ it's a 2x16bit instr, update
orr r0, r0, r5, lsl #16
--
1.8.1.4
Some of the ACPI code is arch-dependent and make the code can't be
compiled on !x86 and !ia64, the first two patches just do some rework
on the idle_boot_override and _PDC related stuff to make the ACPI
code more arch-independent.
The third patch just introduce map_gic_id() for ACPI processor core
followed by the ACPI 5.0 spec.
These three patches are just ACPI related so I send them out as
a separate patch set.
I have compiled the kernel successful after appling this patch set
on x86, ia64 and powerpc(with cross compile tool).
Changes since last RFC version:
a) Remove the RFC tag;
b) Move idle_boot_override out of the arch directory suggested
by Alan;
c) Make these 3 patches as a separate patch set since there are
not not related to the ARM/ARM64 platform.
Hanjun Guo (3):
ACPI / idle: Move idle_boot_override out of the arch directory
ACPI / processor_core: Rework _PDC related stuff to make it more
arch-independent
ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method
arch/ia64/include/asm/acpi.h | 5 +---
arch/ia64/include/asm/processor.h | 3 ---
arch/ia64/kernel/acpi.c | 17 +++++++++++++
arch/powerpc/include/asm/processor.h | 1 -
arch/x86/include/asm/acpi.h | 19 +--------------
arch/x86/include/asm/processor.h | 3 ---
arch/x86/kernel/acpi/cstate.c | 31 ++++++++++++++++++++++++
arch/x86/kernel/process.c | 1 +
drivers/acpi/processor_core.c | 47 +++++++++++++++++++++---------------
include/linux/cpu.h | 8 ++++++
10 files changed, 87 insertions(+), 48 deletions(-)
--
1.8.2.2
This patch set is based on part1 "Make ACPI core running on ARM64" patch
set.
After we can get the ACPI tables from UEFI, we can use these tables
to initialise the system now.
GIC (means GIC cpu interface) structure and GIC distributor structure in
MADT table contains the information of GIC cpu interface base address
and GIC distributor base address, which can be used to initialise GIC.
Further more, parked address in GIC structure can be used as cpu release
address for spin table SMP initialisation.
This patch set use these information to init SMP and GIC.
Please refer to chapter 5.2.12.14/15 of ACPI 5.0 spec for GIC and GIC
distributor structure information.
Amit Daniel Kachhap (1):
irqdomain: Add a new API irq_create_acpi_mapping()
Hanjun Guo (8):
ARM64 / ACPI: Implement core functions for parsing MADT table
ARM64 / ACPI: Prefill cpu possible/present maps and map logical cpu
id to APIC id
ARM64 / ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT
method
ARM64 / ACPI: Use Parked Address in GIC structure for spin table SMP
initialisation
ACPI: Define ACPI_IRQ_MODEL_GIC needed for arm
Irqchip / gic: Set as default domain so we can access from ACPI
ACPI / ARM64: Update acpi_register_gsi to register with the core IRQ
subsystem
ACPI / GIC: Initialize GIC using the information in MADT
arch/arm64/include/asm/acpi.h | 16 +-
arch/arm64/kernel/irq.c | 5 +
arch/arm64/kernel/setup.c | 2 +
arch/arm64/kernel/smp.c | 2 +
arch/arm64/kernel/smp_spin_table.c | 16 +-
drivers/acpi/bus.c | 3 +
drivers/acpi/plat/arm-core.c | 397 +++++++++++++++++++++++++++++++++++-
drivers/acpi/processor_core.c | 26 +++
drivers/acpi/tables.c | 21 ++
drivers/irqchip/irq-gic.c | 7 +
include/linux/acpi.h | 9 +
kernel/irq/irqdomain.c | 27 +++
12 files changed, 521 insertions(+), 10 deletions(-)
--
1.7.9.5
Automated DT boot report for various ARM defconfigs.
Tree/Branch: queue
Git describe: v3.10.27-1-gcc30b1d
Failed boot tests (console logs at the end)
===========================================
am335x-bone: FAIL: omap2plus_defconfig
armada-xp-openblocks-ax3-4: FAIL: multi_v7_defconfig
armada-370-mirabox: FAIL: multi_v7_defconfig
sun4i-a10-cubieboard: FAIL: multi_v7_defconfig
sama5d35ek: FAIL: sama5_defconfig
Full Report
===========
omap2plus_defconfig
-------------------
omap3-beagle-xm PASS: 0 min 55.5 sec
am335x-bone FAIL: 0 min 31.4 sec
omap3-tobi,3530overo PASS: 0 min 33.7 sec
omap4-panda PASS: 1 min 3.8 sec
omap4-panda-es PASS: 1 min 7.2 sec
omap3-tobi,3730storm PASS: 0 min 35.9 sec
omap3-beagle PASS: 0 min 51.5 sec
tegra_defconfig
---------------
tegra30-beaver PASS: 0 min 17.8 sec
imx_v6_v7_defconfig
-------------------
imx6dl-wandboard,wand-dual PASS: 0 min 16.6 sec
imx6dl-wandboard,wand-solo PASS: 0 min 16.5 sec
mvebu_defconfig
---------------
armada-xp-openblocks-ax3-4 PASS: 0 min 21.3 sec
armada-370-mirabox PASS: 0 min 19.6 sec
exynos_defconfig
----------------
exynos5250-arndale PASS: 0 min 29.4 sec
multi_v7_defconfig
------------------
armada-xp-openblocks-ax3-4 FAIL: 0 min 20.0 sec
armada-370-mirabox FAIL: 0 min 17.9 sec
sun4i-a10-cubieboard FAIL: 1 min 8.5 sec
sama5_defconfig
---------------
sama5d35ek FAIL: 0 min 31.4 sec
Console logs for failures
=========================
omap2plus_defconfig
-------------------
am335x-bone: FAIL: last 24 lines of boot log:
---------------------------------------------
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
cu: /home/khilman/dev/am335xbone: Line in use
Unknown command '~`f~~~~ff~`f~~~~ff~`f~~~~ff~xp~~xp~' - try 'help'
U-Boot# ~$off
# PYBOOT: Exception: ERROR: Could not break into autoboot.
# PYBOOT: Time: 31.36 seconds.
# PYBOOT: Result: FAIL
multi_v7_defconfig
------------------
armada-xp-openblocks-ax3-4: FAIL: last 24 lines of boot log:
------------------------------------------------------------
[<c0013bec>] (unwind_backtrace+0x0/0xf4) from [<c00114b0>] (show_stack+0x10/0x14)
[<c00114b0>] (show_stack+0x10/0x14) from [<c0275d20>] (panic+0xa0/0x1e8)
[<c0275d20>] (panic+0xa0/0x1e8) from [<c0329110>] (mount_block_root+0x294/0x298)
[<c0329110>] (mount_block_root+0x294/0x298) from [<c03292c4>] (prepare_namespace+0x14c/0x184)
[<c03292c4>] (prepare_namespace+0x14c/0x184) from [<c0328d60>] (kernel_init_freeable+0x1c8/0x1d8)
[<c0328d60>] (kernel_init_freeable+0x1c8/0x1d8) from [<c0271a90>] (kernel_init+0x8/0x158)
[<c0271a90>] (kernel_init+0x8/0x158) from [<c000df18>] (ret_from_fork+0x14/0x3c)
CPU0: stopping
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.27-00001-gcc30b1d #1
[<c0013bec>] (unwind_backtrace+0x0/0xf4) from [<c00114b0>] (show_stack+0x10/0x14)
[<c00114b0>] (show_stack+0x10/0x14) from [<c001236c>] (handle_IPI+0x108/0x130)
[<c001236c>] (handle_IPI+0x108/0x130) from [<c000851c>] (armada_370_xp_handle_irq+0x90/0xa8)
[<c000851c>] (armada_370_xp_handle_irq+0x90/0xa8) from [<c000dac0>] (__irq_svc+0x40/0x50)
Exception stack(0xc0359f70 to 0xc0359fb8)
9f60: c1d5b6d8 00000000 000000be 000000be
9f80: c03604a8 c0358000 c036045c c0383b6c c027dec0 c0358000 c0383b6c c0358000
9fa0: 0000001f c0359fb8 c000f070 c004f970 60000113 ffffffff
[<c000dac0>] (__irq_svc+0x40/0x50) from [<c004f970>] (cpu_startup_entry+0xfc/0x140)
[<c004f970>] (cpu_startup_entry+0xfc/0x140) from [<c0328a3c>] (start_kernel+0x2c4/0x2d0)
[<c0328a3c>] (start_kernel+0x2c4/0x2d0) from [<00008074>] (0x8074)
~$off
# PYBOOT: Exception: kernel: ERROR: failed to boot: Kernel panic
# PYBOOT: Time: 19.96 seconds.
# PYBOOT: Result: FAIL
armada-370-mirabox: FAIL: last 24 lines of boot log:
----------------------------------------------------
mousedev: PS/2 mouse device common for all mice
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
VFP support v0.3: implementor 56 architecture 2 part 20 variant 9 rev 6
Registering SWP/SWPB emulation handler
/home/build/work/batch/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
List of all partitions:
No filesystem could mount root, tried:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.27-00001-gcc30b1d #1
[<c0013bec>] (unwind_backtrace+0x0/0xf4) from [<c00114b0>] (show_stack+0x10/0x14)
[<c00114b0>] (show_stack+0x10/0x14) from [<c0275d20>] (panic+0xa0/0x1e8)
[<c0275d20>] (panic+0xa0/0x1e8) from [<c0329110>] (mount_block_root+0x294/0x298)
[<c0329110>] (mount_block_root+0x294/0x298) from [<c03292c4>] (prepare_namespace+0x14c/0x184)
[<c03292c4>] (prepare_namespace+0x14c/0x184) from [<c0328d60>] (kernel_init_freeable+0x1c8/0x1d8)
[<c0328d60>] (kernel_init_freeable+0x1c8/0x1d8) from [<c0271a90>] (kernel_init+0x8/0x158)
[<c0271a90>] (kernel_init+0x8/0x158) from [<c000df18>] (ret_from_fork+0x14/0x3c)
~$off
# PYBOOT: Exception: kernel: ERROR: failed to boot: Kernel panic
# PYBOOT: Time: 17.89 seconds.
# PYBOOT: Result: FAIL
sun4i-a10-cubieboard: FAIL: last 24 lines of boot log:
------------------------------------------------------
ipmi_si: Trying default-specified bt state machine at i/o address 0xe4, slave address 0x0, irq 0
ipmi_si: Could not set up I/O space
Trying to free nonexistent resource <00000000000000e4-00000000000000e4>
Trying to free nonexistent resource <00000000000000e5-00000000000000e5>
Trying to free nonexistent resource <00000000000000e6-00000000000000e6>
ipmi_si: Unable to find any System Interface(s)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 17) is a U6_16550A
console [ttyS0] enabled
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
Registering SWP/SWPB emulation handler
/home/build/work/batch/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Waiting for root device /dev/mmcblk0p2...
~$off
# PYBOOT: Exception: kernel: ERROR: failed to boot: <class 'pexpect.TIMEOUT'>
# PYBOOT: Time: 68.48 seconds.
# PYBOOT: Result: FAIL
sama5_defconfig
---------------
sama5d35ek: FAIL: last 24 lines of boot log:
--------------------------------------------
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
cu: /home/khilman/dev/sama5: Line in use
~$off
# PYBOOT: Exception: ERROR: Could not break into autoboot.
# PYBOOT: Time: 31.45 seconds.
# PYBOOT: Result: FAIL
Each asm-generic/audit_xx.h defines a set of system calls for respective
audit permssion class (read, write, change attribute or exec).
This patch changes two entries:
1) fchown in audit_change_attr.h
Make fchown included by its own because in asm-generic/unistd.h, for example,
fchown always exists while chown is optional. This change is necessary at
least for arm64.
2) truncate64 in audit_write.h
Add missing truncate64/ftruncate64 as well as truncate/ftruncate
Signed-off-by: AKASHI Takahiro <takahiro.akashi(a)linaro.org>
---
include/asm-generic/audit_change_attr.h | 4 +++-
include/asm-generic/audit_write.h | 6 ++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h
index 89b73e5..a186553 100644
--- a/include/asm-generic/audit_change_attr.h
+++ b/include/asm-generic/audit_change_attr.h
@@ -4,9 +4,11 @@ __NR_chmod,
__NR_fchmod,
#ifdef __NR_chown
__NR_chown,
-__NR_fchown,
__NR_lchown,
#endif
+#ifdef __NR_fchown
+__NR_fchown,
+#endif
__NR_setxattr,
__NR_lsetxattr,
__NR_fsetxattr,
diff --git a/include/asm-generic/audit_write.h b/include/asm-generic/audit_write.h
index e7020c5..274575d 100644
--- a/include/asm-generic/audit_write.h
+++ b/include/asm-generic/audit_write.h
@@ -10,6 +10,12 @@ __NR_truncate,
#ifdef __NR_truncate64
__NR_truncate64,
#endif
+#ifdef __NR_ftruncate
+__NR_ftruncate,
+#endif
+#ifdef __NR_ftruncate64
+__NR_ftruncate64,
+#endif
#ifdef __NR_bind
__NR_bind, /* bind can affect fs object only in one way... */
#endif
--
1.7.9.5
From: Al Stone <al.stone(a)linaro.org>
ACPI hardware reduced mode exists to allow newer platforms to use a
simpler form of ACPI that does not require supporting legacy versions
of the specification and their associated hardware. This mode was
introduced in the ACPI 5.0 specification.
To enable the hardware reduced mode of ACPI, we need to set the flag
ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source. In order to do
that, we introduce a kernel configuration item to enable or disable
ACPI_REDUCED_HARDWARE. We can then change the kernel configuration
instead of having to modify the kernel source.
Introducing this configuration item is based on suggestions from Lv
Zheng saying that this does not belong in ACPICA, but rather to the
Linux kernel itself. Hence, we introduce this configuration item so
that we can make ACPI_REDUCED_HARDWARE configurable. For the details
of the discussion, please refer to:
http://www.spinics.net/lists/linux-acpi/msg46369.html
Changes for v3:
-- Minimize the changelog.
Changes for v2:
-- Changed test for EXPERT to avoid reported Kconfig warning
Signed-off-by: Hanjun Guo <hanjun.guo(a)linaro.org>
Signed-off-by: Al Stone <al.stone(a)linaro.org>
---
drivers/acpi/Kconfig | 13 +++++++++++++
include/acpi/platform/aclinux.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4770de5..9fd6a7a 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -343,6 +343,19 @@ config ACPI_BGRT
data from the firmware boot splash. It will appear under
/sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE_ONLY
+ bool "Hardware-reduced ACPI support only" if EXPERT
+ def_bool n
+ depends on ACPI
+ help
+ This config item changes the way the ACPI code is built. When this
+ option is selected, the kernel will use a specialized version of
+ ACPICA that ONLY supports the ACPI "reduced hardware" mode. The
+ resulting kernel will be smaller but it will also be restricted to
+ running in ACPI reduced hardware mode ONLY.
+
+ If you are unsure what to do, do not enable this option.
+
source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..7d71f08 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,12 @@
#ifdef __KERNEL__
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
--
1.8.4.2
From: Al Stone <al.stone(a)linaro.org>
Hardware reduced mode, despite the name, exists primarily to allow
newer platforms to use a much simpler form of ACPI that does not
require supporting the legacy of previous versions of the specification.
This mode was first introduced in the ACPI 5.0 specification, but because
it is so much simpler and reduces the size of the object code needed to
support ACPI, it is likely to be used more often in the near future.
To enable the hardware reduced mode of ACPI on some platforms (such as
ARM), we need to modify the kernel code and set ACPI_REDUCED_HARDWARE
to TRUE in the ACPICA source. For ARM/ARM64, hardware reduced ACPI
should be the only mode used; legacy mode would require modifications
to SoCs in order to provide several x86-specific hardware features (e.g.,
an NMI and SMI support).
We set ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source by introducing
a kernel config item to enable/disable ACPI_REDUCED_HARDWARE. We can then
change the kernel config instead of having to modify the kernel source
directly to enable the reduced hardware mode of ACPI.
Lv Zheng suggested that this configuration item does not belong in ACPICA,
the upstream source for much of the ACPI internals, but rather to the
Linux kernel itself. Hence, we introduce this flag so that we can make
ACPI_REDUCED_HARDWARE configurable. For the details of the discussion,
please refer to: http://www.spinics.net/lists/linux-acpi/msg46369.html
Even though support for X86 in hardware reduced mode is possible, it
is NOT enabled. Extensive effort has gone into the Linux kernel so that
there is a single kernel image than can run on all x86 hardware; the kernel
changes run-time behavior to adapt to the hardware being used. This is not
currently possible with the existing ACPICA infrastructure but only presents
a problem on achitectures supporting both hardware-reduced and legacy modes
of ACPI -- i.e., on x86 only.
The problem with the current ACPICA code base is that if one builds legacy
ACPI (a proper superset of hardware-reduced), the kernel can run in hardware-
reduced with the proper ACPI tables, but there is still ACPICA code that could
be executed even though it is not allowed by the specification. If one builds
a hardware-reduced only ACPI, the kernel cannot run with ACPI tables that are
for legacy mode. To ensure compliance with ACPI, one must therefore build
two separate kernels. Once this problem has been properly fixed, we can then
enable x86 hardware-reduced mode and use a single kernel.
This patch used to be part of a set to implement stricter conformance with
hardware reduced ACPI. The code changes from that set are being re-thought
in order to handle some non-compliant hardware, but this patch did not depend
on those changes. In the meantime, this patch is needed in order to enable
ACPI core functionality for ARMv8 servers and hence is being submitted
separately in order to aid that effort.
Signed-off-by: Hanjun Guo <hanjun.guo(a)linaro.org>
Signed-off-by: Al Stone <al.stone(a)linaro.org>
---
drivers/acpi/Kconfig | 13 +++++++++++++
include/acpi/platform/aclinux.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4770de5..961ea9e 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -343,6 +343,19 @@ config ACPI_BGRT
data from the firmware boot splash. It will appear under
/sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE_ONLY
+ bool "Hardware-reduced ACPI support only"
+ def_bool n
+ depends on ACPI && EXPERT
+ help
+ This config item changes the way the ACPI code is built. When this
+ option is selected, the kernel will use a specialized version of
+ ACPICA that ONLY supports the ACPI "reduced hardware" mode. The
+ resulting kernel will be smaller but it will also be restricted to
+ running in ACPI reduced hardware mode ONLY.
+
+ If you are unsure what to do, do not enable this option.
+
source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..7d71f08 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,12 @@
#ifdef __KERNEL__
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
--
1.8.4.2
Currently we just try to find least load cpu. If some cpus idled,
we just pick the first cpu in cpu mask.
In fact we can get the interrupted idle cpu or the latest idled cpu,
then we may get the benefit from both latency and power.
The selected cpu maybe not the best, since other cpu may be interrupted
during our selecting. But be captious costs too much.
Signed-off-by: Alex Shi <alex.shi(a)linaro.org>
---
kernel/sched/fair.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c7395d9..fb52d26 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4167,6 +4167,26 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
min_load = load;
idlest = i;
}
+#ifdef CONFIG_NO_HZ_COMMON
+ /*
+ * Coarsely to get the latest idle cpu for shorter latency and
+ * possible power benefit.
+ */
+ if (!min_load) {
+ struct tick_sched *ts = &per_cpu(tick_cpu_sched, i);
+
+ s64 latest_wake = 0;
+ /* idle cpu doing irq */
+ if (ts->inidle && !ts->idle_active)
+ idlest = i;
+ /* the cpu resched */
+ else if (!ts->inidle)
+ idlest = i;
+ /* find latest idle cpu */
+ else if (ktime_to_us(ts->idle_entrytime) > latest_wake)
+ idlest = i;
+ }
+#endif
}
return idlest;
--
1.8.1.2
From: Al Stone <al.stone(a)linaro.org>
Hardware reduced mode, despite the name, exists primarily to allow
newer platforms to use a much simpler form of ACPI that does not
require supporting the legacy of previous versions of the specification.
This mode was first introduced in the ACPI 5.0 specification, but because
it is so much simpler and reduces the size of the object code needed to
support ACPI, it is likely to be used more often in the near future.
To enable the hardware reduced mode of ACPI on some platforms (such as
ARM), we need to modify the kernel code and set ACPI_REDUCED_HARDWARE
to TRUE in the ACPICA source. For ARM/ARM64, hardware reduced ACPI
should be the only mode used; legacy mode would require modifications
to SoCs in order to provide several x86-specific hardware features (e.g.,
an NMI and SMI support).
We set ACPI_REDUCED_HARDWARE to TRUE in the ACPICA source by introducing
a kernel config item to enable/disable ACPI_REDUCED_HARDWARE. We can then
change the kernel config instead of having to modify the kernel source
directly to enable the reduced hardware mode of ACPI.
Lv Zheng suggested that this configuration item does not belong in ACPICA,
the upstream source for much of the ACPI internals, but rather to the
Linux kernel itself. Hence, we introduce this flag so that we can make
ACPI_REDUCED_HARDWARE configurable. For the details of the discussion,
please refer to: http://www.spinics.net/lists/linux-acpi/msg46369.html
Even though support for X86 in hardware reduced mode is possible, it
is NOT enabled. Extensive effort has gone into the Linux kernel so that
there is a single kernel image than can run on all x86 hardware; the kernel
changes run-time behavior to adapt to the hardware being used. This is not
currently possible with the existing ACPICA infrastructure but only presents
a problem on achitectures supporting both hardware-reduced and legacy modes
of ACPI -- i.e., on x86 only.
The problem with the current ACPICA code base is that if one builds legacy
ACPI (a proper superset of hardware-reduced), the kernel can run in hardware-
reduced with the proper ACPI tables, but there is still ACPICA code that could
be executed even though it is not allowed by the specification. If one builds
a hardware-reduced only ACPI, the kernel cannot run with ACPI tables that are
for legacy mode. To ensure compliance with ACPI, one must therefore build
two separate kernels. Once this problem has been properly fixed, we can then
enable x86 hardware-reduced mode and use a single kernel.
Changes for v2:
-- Changed test for EXPERT to avoid reported Kconfig warning
Signed-off-by: Hanjun Guo <hanjun.guo(a)linaro.org>
Signed-off-by: Al Stone <al.stone(a)linaro.org>
---
drivers/acpi/Kconfig | 13 +++++++++++++
include/acpi/platform/aclinux.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4770de5..9fd6a7a 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -343,6 +343,19 @@ config ACPI_BGRT
data from the firmware boot splash. It will appear under
/sys/firmware/acpi/bgrt/ .
+config ACPI_REDUCED_HARDWARE_ONLY
+ bool "Hardware-reduced ACPI support only" if EXPERT
+ def_bool n
+ depends on ACPI
+ help
+ This config item changes the way the ACPI code is built. When this
+ option is selected, the kernel will use a specialized version of
+ ACPICA that ONLY supports the ACPI "reduced hardware" mode. The
+ resulting kernel will be smaller but it will also be restricted to
+ running in ACPI reduced hardware mode ONLY.
+
+ If you are unsure what to do, do not enable this option.
+
source "drivers/acpi/apei/Kconfig"
config ACPI_EXTLOG
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..7d71f08 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,12 @@
#ifdef __KERNEL__
+/* Compile for reduced hardware mode only with this kernel config */
+
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
+#define ACPI_REDUCED_HARDWARE 1
+#endif
+
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
--
1.8.4.2
Add AARCH64 specific support. This includes the following:
- AARCH64 perf registers definition and hooks,
- compat mode registers use, i.e. profiling a 32-bit binary on
a 64-bit system,
- unwinding using the dwarf information from the .debug_frame
section of the ELF binary; only in 64-bit mode,
- unwinding using the frame pointer information; in 64-bit and
compat modes.
ToDo:
- add support for unwinding using the dwarf information in compat
mode. This requires some changes to the libunwind code.
Tested on ARMv7 and ARMv8 platforms. The compat mode has been tested
on ARMv8 using statically built 32-bit binaries.
Jean Pihet (3):
ARM64: perf: add support for perf registers API
ARM64: perf: wire up perf_regs and unwind support
ARM64: perf: add support for frame pointer unwinding in compat mode
arch/arm64/Kconfig | 2 +
arch/arm64/include/asm/ptrace.h | 1 +
arch/arm64/include/uapi/asm/Kbuild | 1 +
arch/arm64/include/uapi/asm/perf_regs.h | 40 ++++++++++++++
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/perf_event.c | 75 +++++++++++++++++++++++---
arch/arm64/kernel/perf_regs.c | 44 ++++++++++++++++
tools/perf/arch/arm64/Makefile | 7 +++
tools/perf/arch/arm64/include/perf_regs.h | 88 +++++++++++++++++++++++++++++++
tools/perf/arch/arm64/util/dwarf-regs.c | 80 ++++++++++++++++++++++++++++
tools/perf/arch/arm64/util/unwind.c | 82 ++++++++++++++++++++++++++++
tools/perf/config/Makefile | 8 ++-
12 files changed, 420 insertions(+), 9 deletions(-)
create mode 100644 arch/arm64/include/uapi/asm/perf_regs.h
create mode 100644 arch/arm64/kernel/perf_regs.c
create mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/include/perf_regs.h
create mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c
create mode 100644 tools/perf/arch/arm64/util/unwind.c
--
1.7.11.7
From: Mark Brown <broonie(a)linaro.org>
The process of DMA mapping buffers for SPI transfers does not vary between
devices so in order to save duplication of code in drivers this can be
factored out into the core, allowing it to be integrated with the work that
is being done on factoring out the common elements from the data path
including more sharing of dmaengine code.
In order to use this masters need to provide a can_dma() operation and while
the hardware is prepared they should ensure that DMA channels are provided
in tx_dma and rx_dma. The core will then ensure that the buffers are mapped
for DMA prior to calling transfer_one_message().
Currently the cleanup on error is not complete, this needs to be improved.
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
drivers/spi/spi.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/spi/spi.h | 18 +++++++++++
2 files changed, 97 insertions(+)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a86569e1f178..314d326bce9f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -24,6 +24,8 @@
#include <linux/device.h>
#include <linux/init.h>
#include <linux/cache.h>
+#include <linux/dma-mapping.h>
+#include <linux/dmaengine.h>
#include <linux/mutex.h>
#include <linux/of_device.h>
#include <linux/of_irq.h>
@@ -570,6 +572,74 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
spi->master->set_cs(spi, !enable);
}
+static int spi_dma_map_msg(struct spi_master *master, struct spi_message *msg)
+{
+ struct device *dev = master->dev.parent;
+ struct device *tx_dev, *rx_dev;
+ struct spi_transfer *xfer;
+
+ if (msg->is_dma_mapped || !master->can_dma)
+ return 0;
+
+ tx_dev = &master->dma_tx->dev->device;
+ rx_dev = &master->dma_rx->dev->device;
+
+ list_for_each_entry(xfer, &msg->transfers, transfer_list) {
+ if (!master->can_dma(master, msg->spi, xfer))
+ continue;
+
+ if (xfer->tx_buf != NULL) {
+ xfer->tx_dma = dma_map_single(tx_dev,
+ (void *)xfer->tx_buf,
+ xfer->len,
+ DMA_TO_DEVICE);
+ if (dma_mapping_error(dev, xfer->tx_dma)) {
+ dev_err(dev, "dma_map_single Tx failed\n");
+ return -ENOMEM;
+ }
+ }
+
+ if (xfer->rx_buf != NULL) {
+ xfer->rx_dma = dma_map_single(rx_dev,
+ xfer->rx_buf, xfer->len,
+ DMA_FROM_DEVICE);
+ if (dma_mapping_error(dev, xfer->rx_dma)) {
+ dev_err(dev, "dma_map_single Rx failed\n");
+ dma_unmap_single(tx_dev, xfer->tx_dma,
+ xfer->len, DMA_TO_DEVICE);
+ return -ENOMEM;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int spi_dma_unmap_msg(struct spi_master *master,
+ struct spi_message *msg)
+{
+ struct spi_transfer *xfer;
+ struct device *tx_dev, *rx_dev;
+
+ if (!master->cur_msg_mapped || msg->is_dma_mapped || !master->can_dma)
+ return 0;
+
+ tx_dev = &master->dma_tx->dev->device;
+ rx_dev = &master->dma_rx->dev->device;
+
+ list_for_each_entry(xfer, &msg->transfers, transfer_list) {
+ if (!master->can_dma(master, msg->spi, xfer))
+ continue;
+
+ dma_unmap_single(rx_dev, xfer->rx_dma, xfer->len,
+ DMA_FROM_DEVICE);
+ dma_unmap_single(tx_dev, xfer->tx_dma, xfer->len,
+ DMA_TO_DEVICE);
+ }
+
+ return 0;
+}
+
/*
* spi_transfer_one_message - Default implementation of transfer_one_message()
*
@@ -740,6 +810,13 @@ static void spi_pump_messages(struct kthread_work *work)
master->cur_msg_prepared = true;
}
+ ret = spi_dma_map_msg(master, master->cur_msg);
+ if (ret) {
+ master->cur_msg->status = ret;
+ spi_finalize_current_message(master);
+ return;
+ }
+
ret = master->transfer_one_message(master, master->cur_msg);
if (ret) {
dev_err(&master->dev,
@@ -829,6 +906,8 @@ void spi_finalize_current_message(struct spi_master *master)
queue_kthread_work(&master->kworker, &master->pump_messages);
spin_unlock_irqrestore(&master->queue_lock, flags);
+ spi_dma_unmap_msg(master, mesg);
+
if (master->cur_msg_prepared && master->unprepare_message) {
ret = master->unprepare_message(master, mesg);
if (ret) {
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 21a7251d85ee..14380043491b 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -25,6 +25,8 @@
#include <linux/kthread.h>
#include <linux/completion.h>
+struct dma_chan;
+
/*
* INTERFACES between SPI master-side drivers and SPI infrastructure.
* (There's no SPI slave support for Linux yet...)
@@ -385,6 +387,17 @@ struct spi_master {
void (*cleanup)(struct spi_device *spi);
/*
+ * Used to enable core support for DMA handling, if can_dma()
+ * exists and returns true then the transfer will be mapped
+ * prior to transfer_one() being called. The driver should
+ * not modify or store xfer and dma_tx and dma_rx must be set
+ * while the device is prepared.
+ */
+ bool (*can_dma)(struct spi_master *master,
+ struct spi_device *spi,
+ struct spi_transfer *xfer);
+
+ /*
* These hooks are for drivers that want to use the generic
* master transfer queueing mechanism. If these are used, the
* transfer() function above must NOT be specified by the driver.
@@ -402,6 +415,7 @@ struct spi_master {
bool rt;
bool auto_runtime_pm;
bool cur_msg_prepared;
+ bool cur_msg_mapped;
struct completion xfer_completion;
int (*prepare_transfer_hardware)(struct spi_master *master);
@@ -423,6 +437,10 @@ struct spi_master {
/* gpio chip select */
int *cs_gpios;
+
+ /* DMA channels for use with core dmaengine helpers */
+ struct dma_chan *dma_tx;
+ struct dma_chan *dma_rx;
};
static inline void *spi_master_get_devdata(struct spi_master *master)
--
1.8.5.2
From: Mark Brown <broonie(a)linaro.org>
Make it easier for generic code to work with set_sysclk() by distinguishing
between the operation not being supported and an error as is done for
other operations like set_dai_fmt()
Signed-off-by: Mark Brown <broonie(a)linaro.org>
---
sound/soc/soc-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a128f0cd752..fe1df50805a3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3485,7 +3485,7 @@ int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
return dai->codec->driver->set_sysclk(dai->codec, clk_id, 0,
freq, dir);
else
- return -EINVAL;
+ return -ENOTSUPP;
}
EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
@@ -3506,7 +3506,7 @@ int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
return codec->driver->set_sysclk(codec, clk_id, source,
freq, dir);
else
- return -EINVAL;
+ return -ENOTSUPP;
}
EXPORT_SYMBOL_GPL(snd_soc_codec_set_sysclk);
--
1.8.5.2
From: Vijaya Kumar K <Vijaya.Kumar(a)caviumnetworks.com>
Based on the step-handler and break-handler hooks patch from
Sandeepa, KGDB debugging support is added for EL1
debug in AArch64 mode. Any updates that come for Patch 1 from
Sandeepa will be rebased in next version
With second patch,register layout is updated to be inline with GDB tool.
Basic GDB connection, break point set/clear and info commands
are supported except step/next debugging
With third patch, step/next debugging support is added, where in
pc is updated to point to the instruction to be stepped and
stopped.
With fourth patch, the compile time breakpoint instruction
reordering is fixed by making kgbd_breakpoint() as noinline
Tested with ARM64 simulator
v6:
- Change pstate register to 8 bytes to make endian nuetral.
Use GDB below GDB patch to display pstate in Big endian mode.
https://sourceware.org/ml/gdb-patches/2013-12/msg00720.html
Thanks to Andrew.
v5:
- Updated BRK #imm16 value to 0x400 & 0x401 as per recommendation
as per Marcus recommendataion
http://patchwork.ozlabs.org/patch/290801/
- Rebased to 3.13 AArch64 kernel
v4:
- Updated kgdb_single_step and kgdb_cpu_doing_single_step
variables properly based on gdb state
v3:
- Rebased to v4 version of Sandeepa Prabhu's patch (patch 1)
- Made dynamic break point instruction encoding generic
- Made ESR value encoding generic for dynamic and compile break point
- Used memcpy and memset to copy register contents to gdb buffer
- Fixed reordering of break point instruction by compiler with
patch 3
- Rebased against AAach64 upstream kernel
v2:
- Moved break instruction encoding to debug-monitors.h file
- Fixed endianess of compile break instruction encoding
- Updated I/O buffer sizes
- Updated register buffer size
- Remove changes to debug_exception handler in entry.S for
- ELR update and step debugging with update pc instead of ELR
- Rebased against AArch64 upstream kernel
v1:
- Initial patch-set
Vijaya Kumar K (3):
AArch64: KGDB: Add Basic KGDB support
AArch64: KGDB: Add step debugging support
KGDB: make kgdb_breakpoint() as noinline
arch/arm64/include/asm/debug-monitors.h | 47 +++++
arch/arm64/include/asm/kgdb.h | 86 ++++++++
arch/arm64/kernel/Makefile | 1 +
arch/arm64/kernel/kgdb.c | 341 +++++++++++++++++++++++++++++++
kernel/debug/debug_core.c | 2 +-
5 files changed, 476 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/include/asm/kgdb.h
create mode 100644 arch/arm64/kernel/kgdb.c
--
1.7.9.5
Another round of cosmetic updates here, this should address everything
from the last round.
arm64: topology: Implement basic CPU topology support
arm64: topology: Add support for topology DT bindings
arm64: topology: Tell the scheduler about the relative
arm64: topology: Provide relative power numbers for cores
In a multi-platform scenario, the hard-coded major/minor numbers in
serial drivers may conflict with each other. A typical scenario is
observed with amba-pl011 and samsung-uart drivers, both of these
drivers use same set of major/minor numbers. If both of these drivers
are enabled, probe of samsung-uart driver fails because the desired
node is busy.
The issue is fixed by adding a fallback in driver core, so that we can
use dynamic major number in case device node allocation fails for
hard-coded major/minor number.
Signed-off-by: Tushar Behera <tushar.behera(a)linaro.org>
---
Initial approach to fix this problem was by forcing samsung-uart driver
to use dynamic major number, but it was rejected [1] because of possible
user-space breakage. Current approach falls back to dynamic major
number as a fallback in case of failure.
[1] https://lkml.org/lkml/2013/12/27/2
Can I get an Acked-by/Reviewed-by before I send this to lkml?
Changes for V2:
* Added warning message in case major number is getting orverriden
drivers/tty/tty_io.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c74a00a..ff4aada 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3341,6 +3341,24 @@ int tty_register_driver(struct tty_driver *driver)
dev_t dev;
struct device *d;
+ if (driver->major) {
+ dev = MKDEV(driver->major, driver->minor_start);
+ error = register_chrdev_region(dev, driver->num, driver->name);
+ /* In case of error, fall back to dynamic allocation */
+ if (error < 0) {
+ printk(KERN_WARNING
+ "Default device node (%d:%d) for %s is busy, "
+ "using dynamic major number\n",
+ driver->major, driver->minor_start,
+ driver->name);
+ driver->major = 0;
+ }
+ }
+
+ /*
+ * Don't replace the following check with an else to above if statement,
+ * as it may also be called as a fallback.
+ */
if (!driver->major) {
error = alloc_chrdev_region(&dev, driver->minor_start,
driver->num, driver->name);
@@ -3348,9 +3366,6 @@ int tty_register_driver(struct tty_driver *driver)
driver->major = MAJOR(dev);
driver->minor_start = MINOR(dev);
}
- } else {
- dev = MKDEV(driver->major, driver->minor_start);
- error = register_chrdev_region(dev, driver->num, driver->name);
}
if (error < 0)
goto err;
--
1.7.9.5
Another round of minor tweaks
- Remove some problematic and controversial prints
- Pass cluster_id around as a pointer
- Move slab.h further back in the series
arm64: topology: Implement basic CPU topology support
arm64: topology: Add support for topology DT bindings
arm64: topology: Tell the scheduler about the relative
arm64: topology: Provide relative power numbers for cores
From: Al Stone <al.stone(a)linaro.org>
This series of patches starts with Hanjun's patch to create a kernel
config item for CONFIG_ACPI_REDUCED_HARDWARE [0]. Building on that, I
then reviewed all of the code that touched any of several fields in the
FADT that the OSPM is supposed to ignore when ACPI is in Hardware Reduced
mode [1]. Any time there was a use of one of the fields to be ignored,
I evaluated whether or not the code was implementing Hardware Reduced
mode correctly. Similarly, for each the flags in the FADT flags field
that are to be ignored in Hardware Reduced mode, the kernel code was again
scanned for proper usage. The remainder of the patches are to fix all of
the situations I could find where the kernel would not behave correctly
in this ACPI mode.
These seem to work just fine on the RTSM model for ARMv7, both with and
without ACPI enabled, and with and without ACPI_REDUCED_HARDWARE enabled;
similarly for the FVP model for ARMv8. The patches for ACPI on ARM
hardware have been submitted elsewhere but they presume that reduced HW
mode is functioning correctly. In the meantime, there's no way I can think
of to test all possible scenarios so feedback would be greatly appreciated.
[0] List at https://wiki.linaro.org/LEG/Engineering/Kernel/ACPI/AcpiReducedHw#Section_5…
[1] Please see the ACPI Specification v5.0 for details on Hardware Reduced
mode (sections 3.11.1, 4.1, 5.2.9, at a minimum).
Changes for v6:
-- Allow selection of CONFIG_ACPI_REDUCED_HARDWARE_ONLY to be more
architecture-independent, but make it harder to accidentally enable.
-- Make sure that ACPI ECs do not use the ACPI global lock when in
hardware reduced mode (I had missed this case in earlier reviews
of the kernel tree).
Changes for v5:
-- Clarify that if the kernel config option to build ACPI hardware reduced
mode is used, it builds a hardware reduced *only* kernel (i.e., full
legacy ACPI mode will no longer work).
Changes for v4:
-- Given the current state of ACPICA, disable CONFIG_ACPI_REDUCED_HARDWARE
for use on anything other than ARM.
-- Replaced #ifdefs with run-time checking for hardware reduced mode,
whenever possible
Changes for v3:
-- Modified enabling ACPI_REDUCED_HARDWARE in ACPICA when using
kernel config item CONFIG_ACPI_REDUCED_HARDWARE; now consistent
with ACPICA code base where needed
-- Enable X86 for CONFIG_ACPI_REDUCED_HARDWARE
-- Minimize bus master reload patching
-- Remove unneeded patch for dmi_check_system() (was 4/6)
-- Correct the patch for removing unneeded map/unmap of FADT fields
Changes for v2:
-- Remove patch that was outside of reduced HW mode changes
-- Simplify CONFIG_ACPI_REDUCED_HARDWARE in Kconfig
-- Simplify use of CONFIG_ACPI_REDUCED_HARDWARE in #ifdefs
-- Ensure changelogs are present
-- Combine and simplify previous patches 8 & 10
Al Stone (6):
ACPI: introduce CONFIG_ACPI_REDUCED_HARDWARE_ONLY to enforce this ACPI
mode
ACPI: bus master reload not supported in reduced HW mode
ACPI: HW reduced mode does not allow use of the FADT sci_interrupt
field
ACPI: in HW reduced mode, using FADT PM information is not allowed.
ACPI: do not map/unmap memory regions for FADT entries in reduced HW
mode
ACPI: make sure ECs do not use the ACPI global lock
drivers/acpi/Kconfig | 12 ++++++++++++
drivers/acpi/bus.c | 30 ++++++++++++++++--------------
drivers/acpi/ec.c | 12 ++++++++++--
drivers/acpi/osl.c | 38 +++++++++++++++++++-------------------
drivers/acpi/pci_link.c | 2 ++
drivers/acpi/processor_idle.c | 14 ++++++++++++--
include/acpi/platform/aclinux.h | 6 ++++++
7 files changed, 77 insertions(+), 37 deletions(-)
--
1.8.4.2