Re: [PATCH] kmod: Pass usermodehelper "-b" to use blacklist commands

2014-05-06 Thread Rusty Russell
Andrew Morton  writes:
> On Tue, 6 May 2014 19:31:36 +0200 Oleg Nesterov  wrote:
>
>> On 05/06, Kirill Tkhai wrote:
>> >
>> > User may want to prohibit autoloading of some modules,
>> > which happens when someone in kernel calls request_module().
>> >
>> > For comparison, udev considers blacklist even if corresponding
>> > hardware presents in the system. In-kernel request_module()
>> > functionality is rather similar to udev's, so user may want
>> > to disallow it too.
>> 
>> Personally, I am always nervous (perhaps too much) when it comes to the
>> user-visible changes like this.
>> 
>> And if a user/distro wants "-b" it can create a simple script which just
>> execs /sbin/modprobe with "-b" and overwrite /proc/sys/kernel/modprobe.
>> 
>> OTOH. What if /proc/sys/kernel/modprobe points to a binary which is not
>> /sbin/modprobe and doesn't expect "-b" ? This can break things.
>> 
>
> Yup.  Perhaps the kernel should provide modprobe with a reliable way of
> knowing "you were called by the kernel" (if there isn't presently a
> way) and let modprobe work out what to do.

Indeed, this is a non-starter.

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/6] arm64: KVM: Implement 4 levels of translation tables for HYP and stage2

2014-05-06 Thread Jungseok Lee
On Tuesday, May 06, 2014 7:49 PM, Christoffer Dall wrote:
> On Thu, May 01, 2014 at 11:34:19AM +0900, Jungseok Lee wrote:
> > This patch adds 4 levels of translation tables implementation for both
> > HYP and stage2.
> >
> > Both symmetric and asymmetric configurations for page size and
> > translation levels are are validated on Fast Models:
> >
> >  1) 4KB  + 3 levels guest on 4KB  + 3 levels host
> >
> >  2) 4KB  + 4 levels guest on 4KB  + 3 levels host
> >
> >  3) 64KB + 2 levels guest on 4KB  + 3 levels host
> >
> >  4) 4KB  + 3 levels guest on 4KB  + 4 levels host
> >
> >  5) 4KB  + 4 levels guest on 4KB  + 4 levels host
> >
> >  6) 64KB + 2 levels guest on 4KB  + 4 levels host
> >
> >  7) 4KB  + 3 levels guest on 64KB + 2 levels host
> >
> >  8) 4KB  + 4 levels guest on 64KB + 2 levels host
> >
> >  9) 64KB + 2 levels guest on 64KB + 2 levels host
> >
> > Cc: Marc Zyngier 
> > Cc: Christoffer Dall 
> > Signed-off-by: Jungseok Lee 
> > Reviewed-by: Sungjinn Chung 
> > ---
> >  arch/arm/include/asm/kvm_mmu.h   |   10 +
> >  arch/arm/kvm/mmu.c   |   88 
> > +-
> >  arch/arm64/include/asm/kvm_arm.h |   34 ---
> >  arch/arm64/include/asm/kvm_mmu.h |   12 ++
> >  4 files changed, 127 insertions(+), 17 deletions(-)
> >
> > diff --git a/arch/arm/include/asm/kvm_mmu.h
> > b/arch/arm/include/asm/kvm_mmu.h index 5c7aa3c..31eaaa6 100644
> > --- a/arch/arm/include/asm/kvm_mmu.h
> > +++ b/arch/arm/include/asm/kvm_mmu.h
> > @@ -37,6 +37,11 @@
> >   */
> >  #define TRAMPOLINE_VA  UL(CONFIG_VECTORS_BASE)
> >
> > +/*
> > + * MMU_CACHE_MIN_PAGES is the number of stage2 page table translation 
> > levels.
> > + */
> > +#define MMU_CACHE_MIN_PAGES2
> > +
> 
> I would prefer this was KVM_MMU_CACHE_MIN_PAGES

Okay, I will change it.

> >  #ifndef __ASSEMBLY__
> >
> >  #include 
> > @@ -94,6 +99,11 @@ static inline void kvm_clean_pgd(pgd_t *pgd)
> > clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t));  }
> >
> > +static inline void kvm_clean_pmd(pmd_t *pmd) {
> > +   clean_dcache_area(pmd, PTRS_PER_PMD * sizeof(pmd_t)); }
> > +
> >  static inline void kvm_clean_pmd_entry(pmd_t *pmd)  {
> > clean_pmd_entry(pmd);
> > diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index
> > 80bb1e6..3ffbdfb 100644
> > --- a/arch/arm/kvm/mmu.c
> > +++ b/arch/arm/kvm/mmu.c
> > @@ -388,13 +388,44 @@ static int create_hyp_pmd_mappings(pud_t *pud, 
> > unsigned long start,
> > return 0;
> >  }
> >
> > +static int create_hyp_pud_mappings(pgd_t *pgd, unsigned long start,
> > +  unsigned long end, unsigned long pfn,
> > +  pgprot_t prot)
> > +{
> > +   pud_t *pud;
> > +   pmd_t *pmd;
> > +   unsigned long addr, next;
> > +
> > +   addr = start;
> > +   do {
> > +   pud = pud_offset(pgd, addr);
> > +
> > +   if (pud_none_or_clear_bad(pud)) {
> > +   pmd = pmd_alloc_one(NULL, addr);
> > +   if (!pmd) {
> > +   kvm_err("Cannot allocate Hyp pmd\n");
> > +   return -ENOMEM;
> > +   }
> > +   pud_populate(NULL, pud, pmd);
> > +   get_page(virt_to_page(pud));
> > +   kvm_flush_dcache_to_poc(pud, sizeof(*pud));
> > +   }
> > +
> > +   next = pud_addr_end(addr, end);
> > +
> > +   create_hyp_pmd_mappings(pud, addr, next, pfn, prot);
> > +   pfn += (next - addr) >> PAGE_SHIFT;
> > +   } while (addr = next, addr != end);
> > +
> > +   return 0;
> > +}
> > +
> >  static int __create_hyp_mappings(pgd_t *pgdp,
> >  unsigned long start, unsigned long end,
> >  unsigned long pfn, pgprot_t prot)  {
> > pgd_t *pgd;
> > pud_t *pud;
> > -   pmd_t *pmd;
> > unsigned long addr, next;
> > int err = 0;
> >
> > @@ -403,22 +434,23 @@ static int __create_hyp_mappings(pgd_t *pgdp,
> > end = PAGE_ALIGN(end);
> > do {
> > pgd = pgdp + pgd_index(addr);
> > -   pud = pud_offset(pgd, addr);
> >
> > -   if (pud_none_or_clear_bad(pud)) {
> > -   pmd = pmd_alloc_one(NULL, addr);
> > -   if (!pmd) {
> > -   kvm_err("Cannot allocate Hyp pmd\n");
> > +   if (pgd_none(*pgd)) {
> > +   pud = pud_alloc_one(NULL, addr);
> > +   if (!pud) {
> > +   kvm_err("Cannot allocate Hyp pud\n");
> > err = -ENOMEM;
> > goto out;
> > }
> > -   pud_populate(NULL, pud, pmd);
> > -   get_page(virt_to_page(pud));
> > -   kvm_flush_dcache_to_poc(pud, sizeof(*pud));
> > +   pgd_populate(NULL, pgd, pud);
> > +   get_page(virt_to_page(pgd));
> > +   

[PATCH] ARM: remove redundant code in machine_halt

2014-05-06 Thread Neil Zhang
There is no need to call local_irq_disable twice.

Signed-off-by: Neil Zhang 
---
 arch/arm/kernel/process.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 81ef686..18cfce4 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -195,7 +195,6 @@ void machine_halt(void)
local_irq_disable();
smp_send_stop();
 
-   local_irq_disable();
while (1);
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: IMA & truncate

2014-05-06 Thread Dmitry Kasatkin
On 6 May 2014 22:11, Al Viro  wrote:
> On Tue, May 06, 2014 at 02:39:17PM -0400, Mimi Zohar wrote:
>
>> Al, you're not going to like this, but ima_calc_file_hash() calls
>> ima_calc_file_hash_tfm(), which already sets/unsets FMODE_READ in order
>> to calculate the file hash.
>
> And if it happens to be on NFS and server says "no reads for you"?

Sorry for repost. Lousy Android gmail client is not able to send with
plain text, even with reply.

IMA works by policy. It ignores non-local file systems by default.

But if someone still tries to enable nfs in the custom policy, it
might get into such situation. But then there are other issues like
security xattrs. Anyone using ima needs to be aware what he does.


> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-security-module" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Thanks,
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: IMA & truncate

2014-05-06 Thread Dmitry Kasatkin
On 6 May 2014 19:59, Al Viro  wrote:
> On Tue, May 06, 2014 at 04:32:27PM +0300, Dmitry Kasatkin wrote:
>> Hi,
>>
>> I have discovered one IMA related issue.
>>
>> IMA file hash is re-calculate if needed on file close.
>>
>> It works with ftruncate(fd, length) syscall, because it operates on
>> "opened" file.
>> Recalculation is happening on file close.
>>
>> truncate(path, length) syscall works with path and no file open/close
>> takes place.
>> Recalculation does not happen.
>> IMA denies file access later.
>>
>> It looks like vfs_truncate() should possibly call IMA to recalculate the
>> hash.
>
> Who said that it has permissions to read the file?  Reread truncate(2)
> manpage; it requires the file to be *writable* for caller, but it doesn't
> need it to be readable.

Sorry for repost. Lousy Android gmail client is not able to send with
plain text, even with reply.

This is the same case as for normal file close.
IMA will do file reading for the purpose of calculating a hash, even
file was opened for writing only. File reading is done when the last
writer closes the file and it is protected by mutex. Subsequent file
open is delayed by the mutex.

> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-security-module" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Performance regression in v3.14

2014-05-06 Thread Viresh Kumar
Cc'ing Dirk who is taking care of intel-pstate driver.

On 6 May 2014 22:05, Johan Hovold  wrote:
> After updating my main system from v3.13 to v3.14.2, I found that the
> git bash-completion was extremely sluggish. Completing a file name would
> take roughly six rather than one second on this Haswell machine
> (i7-4770). (Other things, such as git rebase, also felt slower, but
> the completion issue was much more obvious and easy to measure).
>
> I managed to reproduce the problem using the following minimal construct
>
> cat dmesg.repeat | while read x; do true; done
>
> where dmesg.repeat is simply dmesg concatenated together to an
> equivalent number of lines as produced by git ls-files in the
> kernel-source tree root (45k), and where the actual processing of each
> line has been removed.
>
> Most of the time I get:
>
> $ time cat dmesg.repeat | while read x; do true; done
>
> real0m6.091s
> user0m3.674s
> sys 0m2.447s
>
> but sometimes it only takes one second.
>
> $ time cat dmesg.repeat | while read x; do true; done
>
> real0m1.100s
> user0m0.544s
> sys 0m0.570s
>
> I don't seem to be able to reproduce the problem on 3.13 where the pipe
> always takes about one second to finish.
>
> Taking all but one core offline seems to make the problem go away, and so
> does using the performance rather than powersave governor of the
> intel_pstate cpufreq driver (on at least one of two online cores).
>
> Moving the mouse cursor makes to loop finish faster, and so does
> switching to a another terminal to print cpufreq/cpuinfo_cur_freq which
> was around cpuinfo_min_freq several times (when tracing, see below).
>
> I could not reproduce the problem when using perf record, but I can get
> function-profile traces using ftrace (in which case the loop takes about
> 60 seconds instead of six seconds to finish).
>
> Comparing the traces I see a lot of functions taking ten times longer to
> finish, but I guess that's expected if this is indeed a cpufreq issue.
>
> Since this is my main machine (and only multi-core machine at the
> moment) I'm not able to bisect this myself. And for the same reason I
> have not verified that the problem persists in v3.15-rc.
>
> I don't see any cpufreq patches in the v3.14.3 stable queue nor anything
> obviously related and marked for stable in v3.15-rc.
>
> Any ideas about what might be going on?

I tried to take a look at the diff for cpufreq between 3.13 and 3.14.2 and
couldn't pin point on any change which might cause it. Don't have a clue
of what's going on. I don't know how to help you on this.

Normally I test my stuff on a ARM board and I don't remember facing
any such behavior there. There might be something wrong with intel-pstate
as well..

Also, can you try to use acpi-cpufreq instead? And see how that is behaving?

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/3] Add display support for gta04 device

2014-05-06 Thread Belisko Marek
Tomi,

any objections to this patch set? If not can you please take it? Thanks.

On Wed, Apr 23, 2014 at 10:15 PM, Marek Belisko  wrote:
> This 3 patches adding display support for openmoko gta04 device.
> First patch add DT bindings for topolly td028 panel. Second add description 
> for
> dss + panel and third fix panel probing when panel is compiled as module.
>
> Changes from v1:
> - extend panel compatible string by 'omapdss'
> - add tpo-td028 panel to dss_compat_conv_list
> - add MODULE_ALIAS macro to properly probe panel when is compiled as module
>
> Marek Belisko (3):
>   omapdss: panel-tpo-td028ec1: Add DT support.
>   ARM: dts: oma3-gta04: Add display support
>   omapdss: panel-tpo-td028ec1: Add module alias
>
>  .../bindings/video/toppoly,td028ttec1.txt  | 30 
>  arch/arm/boot/dts/omap3-gta04.dts  | 86 
> ++
>  arch/arm/mach-omap2/display.c  |  1 +
>  .../omap2/displays-new/panel-tpo-td028ttec1.c  | 33 -
>  4 files changed, 149 insertions(+), 1 deletion(-)
>  create mode 100644 
> Documentation/devicetree/bindings/video/toppoly,td028ttec1.txt
>
> --
> 1.8.3.2
>

BR,

marek

-- 
as simple and primitive as possible
-
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


e1000 crash on 3.15.0-rc4

2014-05-06 Thread Liu Bo
Hi,

I'm using qemu to load kernel of 3.15.0-rc4, and with CONFIG_E1000=y,
everying is ok, but with CONFIG_E1000=m, I got the following crash:

[...]
[6.020409] tsc: Refined TSC clocksource calibration: 2491.912 MHz
[6.074925] floppy: Unknown symbol mutex_lock (err 0)
[6.128579] virtio_blk: Unknown symbol mutex_lock (err 0)
[6.141264] i2c_core: Unknown symbol mutex_lock (err 0)
[6.167490] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[6.168240] e1000: Copyright (c) 1999-2006 Intel Corporation.
[6.171078] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10
[6.190295] BUG: spinlock bad magic on CPU#3, systemd-udevd/208
[6.190686]  lock: e1000_eeprom_lock+0x0/0x81b6 [e1000], .magic:
, .owner: /-1, .owner_cpu: 0
[6.191402] CPU: 3 PID: 208 Comm: systemd-udevd Not tainted 3.15.0-rc4+ #107
[6.191800] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
01/01/2011
[6.192457]  a00aee4a 88005f2fd968 817901cb
0007
[6.193454]   88005f2fd988 8178b460
a00aee4a
[6.194893]  81a3bcfb 88005f2fd9a8 8178b48b
a00aee4a
[6.196842] Call Trace:
[6.197523]  [] dump_stack+0x4e/0x68
[6.198287]  [] spin_dump+0x91/0x96
[6.199269]  [] spin_bug+0x26/0x2b
[6.199944]  [] do_raw_spin_lock+0x13e/0x160
[6.202632]  [] _raw_spin_lock+0x41/0x50
[6.203287]  [] ? e1000_read_eeprom+0x39/0x240 [e1000]
[6.203966]  [] e1000_read_eeprom+0x39/0x240 [e1000]
[6.204741]  [] e1000_validate_eeprom_checksum+0x40/0xd0
[e1000]
[6.205893]  [] ? e1000_reset_hw+0xb8/0x340 [e1000]
[6.206658]  [] e1000_probe+0x6bb/0xe50 [e1000]
[6.207520]  [] local_pci_probe+0x4e/0xa0
[6.208248]  [] ? get_device+0x17/0x30
[6.209085]  [] pci_device_probe+0xd9/0x120
[6.209792]  [] driver_probe_device+0x9d/0x3d0
[6.210661]  [] __driver_attach+0xab/0xb0
[6.211423]  [] ? driver_probe_device+0x3d0/0x3d0
[6.212304]  [] bus_for_each_dev+0x5d/0xa0
[6.213086]  [] driver_attach+0x1e/0x20
[6.213717]  [] bus_add_driver+0x127/0x250
[6.214538]  [] ? 0xa00b4fff
[6.215307]  [] driver_register+0x64/0xf0
[6.215921]  [] ? 0xa00b4fff
[6.216550]  [] __pci_register_driver+0x64/0x70
[6.217271]  [] e1000_init_module+0x51/0x1000 [e1000]
[6.218152]  [] do_one_initcall+0xda/0x180
[6.218794]  [] ? set_memory_nx+0x43/0x50
[6.219596]  [] ? set_section_ro_nx+0x6d/0x74
[6.220408]  [] load_module+0x1c86/0x2680
[6.221225]  [] ? module_unload_free+0xf0/0xf0
[6.222109]  [] SyS_init_module+0xd7/0x120
[6.222827]  [] system_call_fastpath+0x16/0x1b
[6.507708] BUG: unable to handle kernel NULL pointer dereference at
(null)
[6.508083] IP: [] memcpy+0x12/0x110
[6.508083] PGD 0 
[6.508083] Oops: 0002 [#1] SMP 
[6.508083] Modules linked in: e1000(+)
[6.508083] CPU: 3 PID: 208 Comm: systemd-udevd Not tainted 3.15.0-rc4+ #107
[6.508083] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
01/01/2011
[6.508083] task: 88001ee94420 ti: 88005f2fc000 task.ti:
88005f2fc000
[6.508083] RIP: 0010:[]  []
memcpy+0x12/0x110
[6.508083] RSP: 0018:88005f2fdaa0  EFLAGS: 00010206
[6.508083] RAX:  RBX: 88004f3f7000 RCX: 0006
[6.508083] RDX: 0006 RSI: 880021488cdc RDI: 
[6.508083] RBP: 88005f2fdb28 R08: 0003 R09: 
[6.508083] R10: 88001ee94420 R11:  R12: 0043
[6.508083] R13: 880021488be8 R14: 880021488000 R15: 880021488cdc
[6.508083] FS:  7f542c158840() GS:880051d8()
knlGS:
[6.508083] CS:  0010 DS:  ES:  CR0: 80050033
[6.508083] CR2:  CR3: 5f31c000 CR4: 06e0
[6.508083] Stack:
[6.508083]  a0097ccb 88005f2fdac8 0002
0286
[6.508083]  88004f3f71a0 88002140 88004f3f7098
88005f2fdaf8
[6.508083]  0286 0001 0004
88005f2fdb28
[6.508083] Call Trace:
[6.508083]  [] ? e1000_probe+0x6fb/0xe50 [e1000]
[6.508083]  [] local_pci_probe+0x4e/0xa0
[6.508083]  [] ? get_device+0x17/0x30
[6.508083]  [] pci_device_probe+0xd9/0x120
[6.508083]  [] driver_probe_device+0x9d/0x3d0
[6.508083]  [] __driver_attach+0xab/0xb0
[6.508083]  [] ? driver_probe_device+0x3d0/0x3d0
[6.508083]  [] bus_for_each_dev+0x5d/0xa0
[6.508083]  [] driver_attach+0x1e/0x20
[6.508083]  [] bus_add_driver+0x127/0x250
[6.508083]  [] ? 0xa00b4fff
[6.508083]  [] driver_register+0x64/0xf0
[6.508083]  [] ? 0xa00b4fff
[6.508083]  [] __pci_register_driver+0x64/0x70
[6.508083]  [] e1000_init_module+0x51/0x1000 [e1000]
[6.508083]  [] 

Re: [PATCH] ARM: zImage: Allow DTB to override broken ATAG_MEM

2014-05-06 Thread Bjorn Andersson
On Tue, May 6, 2014 at 10:16 PM, Bjorn Andersson
 wrote:
[...]
> +static int fdt_overrides_atag_mem(void *fdt)
> +{
> +   const char *memory;
> +   int len = 0;
> +
> +   memory = getprop(fdt, "/memory", "reg", );
> +   if (memory) {
> +   while (len--) {
> +   if (*memory != '\0')

Sorry, this is of course supposed to be:
   if (*memory++ != '\0')

> +   return 1;
> +   }
> +   }
> +
> +   return 0;
> +}

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1] net-sysfs: expose permanent hardware address in sysfs

2014-05-06 Thread Florian Fainelli

Le 05/05/2014 20:34, David Decotigny a écrit :

Tested:
   grep . /sys/class/net/*/*addr*


Please also include the relevant sysfs documentation changes in 
Documentation/ABI/testing/sysfs-class-net.


Thanks!



Signed-off-by: David Decotigny 
---
  net/core/net-sysfs.c | 15 +++
  1 file changed, 15 insertions(+)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 1cac29e..bf57024 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -127,6 +127,20 @@ static ssize_t address_show(struct device *dev, struct 
device_attribute *attr,
  }
  static DEVICE_ATTR_RO(address);

+static ssize_t perm_addr_show(struct device *dev, struct device_attribute 
*attr,
+ char *buf)
+{
+   struct net_device *net = to_net_dev(dev);
+   ssize_t ret = -EINVAL;
+
+   read_lock(_base_lock);
+   if (dev_isalive(net))
+   ret = sysfs_format_mac(buf, net->perm_addr, net->addr_len);
+   read_unlock(_base_lock);
+   return ret;
+}
+static DEVICE_ATTR_RO(perm_addr);
+
  static ssize_t broadcast_show(struct device *dev,
  struct device_attribute *attr, char *buf)
  {
@@ -391,6 +405,7 @@ static struct attribute *net_class_attrs[] = {
_attr_addr_len.attr,
_attr_link_mode.attr,
_attr_address.attr,
+   _attr_perm_addr.attr,
_attr_broadcast.attr,
_attr_speed.attr,
_attr_duplex.attr,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/8] Introduce new cpufreq helper macros

2014-05-06 Thread Viresh Kumar
On 6 May 2014 23:25, Stratos Karafotis  wrote:
> My bad. I'm sorry for this. :(
>
> Rafael,
> A solution could be to make cpufreq_next_valid an inline function in 
> cpufreq.h,
> but as Viresh mentioned this would be very inefficient because of multiple 
> copies.

That statement was true when we didn't had this problem..

> So, maybe it's better to revert the 2 patches that don't depend on 
> CONFIG_CPU_FREQ:
>
> 4229e1c61a4a ("sh: clk: Use cpufreq_for_each_valid_entry macro for 
> iteration") and
> 04ae58645afa ("irda: sh_sir: Use cpufreq_for_each_valid_entry macro for 
> iteration").

This doesn't look right. It can happen to some other drivers as well in future.
So, there are two solutions I can think of:
1. move cpufreq_next_valid and rename it to __cpufreq_next_valid(). Also make it
inline. Then create two versions of cpufreq_next_valid(), one inlined (only when
CONFIG_CPU_FREQ=n) and other one in cpufreq.c (non- inlined)..

But probably that would be called ugly by some people :)

2. Make cpufreq_next_valid() inline and forget about extra space it takes :)

@Rafel: Let me know which one you like :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: zImage: Allow DTB to override broken ATAG_MEM

2014-05-06 Thread Bjorn Andersson
Support overriding ATAG_MEM, by specifying non-zero content of the /memory/reg
property in the appended DTB. This is needed to work around bootloaders passing
broken tags.

Signed-off-by: Bjorn Andersson 
---
 arch/arm/boot/compressed/atags_to_fdt.c |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/compressed/atags_to_fdt.c 
b/arch/arm/boot/compressed/atags_to_fdt.c
index d1153c8..b534cd6 100644
--- a/arch/arm/boot/compressed/atags_to_fdt.c
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -95,6 +95,22 @@ static void merge_fdt_bootargs(void *fdt, const char 
*fdt_cmdline)
setprop_string(fdt, "/chosen", "bootargs", cmdline);
 }
 
+static int fdt_overrides_atag_mem(void *fdt)
+{
+   const char *memory;
+   int len = 0;
+
+   memory = getprop(fdt, "/memory", "reg", );
+   if (memory) {
+   while (len--) {
+   if (*memory != '\0')
+   return 1;
+   }
+   }
+
+   return 0;
+}
+
 /*
  * Convert and fold provided ATAGs into the provided FDT.
  *
@@ -180,7 +196,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int 
total_space)
}
}
 
-   if (memcount) {
+   if (memcount && !fdt_overrides_atag_mem(fdt)) {
setprop(fdt, "/memory", "reg", mem_reg_property,
4 * memcount * memsize);
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] drm/exynos/mixer: use MXR_GRP_SXY_SY

2014-05-06 Thread Seung-Woo Kim
Hi Daniel,

On 2014년 05월 05일 00:26, Daniel Kurtz wrote:
> Mixer hardware supports offsetting dma from start of source buffer using
> the MXR_GRP_SXY register.
> 
> Signed-off-by: Daniel Kurtz 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 475eb49..40cf39b 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -529,13 +529,11 @@ static void mixer_graph_buffer(struct mixer_context 
> *ctx, int win)
>  
>   dst_x_offset = win_data->crtc_x;
>   dst_y_offset = win_data->crtc_y;
> + src_x_offset = win_data->fb_x;
> + src_y_offset = win_data->fb_y;
>  
>   /* converting dma address base and source offset */
> - dma_addr = win_data->dma_addr
> - + (win_data->fb_x * win_data->bpp >> 3)
> - + (win_data->fb_y * win_data->fb_width * win_data->bpp >> 3);
> - src_x_offset = 0;
> - src_y_offset = 0;
> + dma_addr = win_data->dma_addr;

Basically, you are right and source offset register can be used. But
because of limitation of resolution for mixer up to 1920x1080, I
considered modified soruce dma address to set one frame buffer, which is
bigger than 1920x1080, on to both fimd and hdmi.

Regards,
- Seung-Woo Kim

>  
>   if (win_data->scan_flags & DRM_MODE_FLAG_INTERLACE)
>   ctx->interlace = true;
> 

-- 
Seung-Woo Kim
Samsung Software R Center
--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-sunxi] [PATCH 7/7] ARM: sunxi: dt: add APP4-EVB1 board support

2014-05-06 Thread Koen Kooi

Op 7 mei 2014, om 05:50 heeft Maxime Ripard  
het volgende geschreven:

> From: Boris BREZILLON 
> 
> The APP4 EVB1 development boards embeds an A31, together with some NAND, one 
> SD
> card slot, and one SDIO + UART WiFi and Bluetooth chip, a few I2C buses, USB,
> and a LCD display.
> 
> Signed-off-by: Boris BREZILLON 
> Signed-off-by: Maxime Ripard 
> ---
> arch/arm/boot/dts/Makefile|  1 +
> arch/arm/boot/dts/sun6i-a31-app4-evb1.dts | 63 +++
> 2 files changed, 64 insertions(+)
> create mode 100644 arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index ffa3f5ef27d3..d50c0895a9d5 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -343,6 +343,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += \
>   sun5i-a10s-olinuxino-micro.dtb \
>   sun5i-a13-olinuxino.dtb \
>   sun5i-a13-olinuxino-micro.dtb \
> + sun6i-a31-app4-evb1.dtb \
>   sun6i-a31-colombus.dtb \
>   sun6i-a31-m9.dtb \
>   sun7i-a20-cubieboard2.dtb \
> diff --git a/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts 
> b/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
> new file mode 100644
> index ..270ab978f858
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
> @@ -0,0 +1,63 @@
> +/*
> + * Copyright 2014 Boris Brezillon
> + *
> + * Boris Brezillon 
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:

Doesn't the kernel try to avoid the 'or later' clause?

regards,

Koen


> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +/dts-v1/;
> +/include/ "sun6i-a31.dtsi"
> +
> +/ {
> + model = "Allwinner A31 APP4 EVB1 Evaluation Board";
> + compatible = "allwinner,app4-evb1", "allwinner,sun6i-a31";
> +
> + chosen {
> + bootargs = "earlyprintk console=ttyS0,115200";
> + };
> +
> + soc@01c0 {
> + pio: pinctrl@01c20800 {
> + usb1_vbus_pin_a: usb1_vbus_pin@0 {
> + allwinner,pins = "PH27";
> + allwinner,function = "gpio_out";
> + allwinner,drive = <0>;
> + allwinner,pull = <0>;
> + };
> + };
> +
> + usbphy: phy@01c19400 {
> + usb1_vbus-supply = <_usb1_vbus>;
> + status = "okay";
> + };
> +
> + ehci0: usb@01c1a000 {
> + status = "okay";
> + };
> +
> + uart0: serial@01c28000 {
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins_a>;
> + status = "okay";
> + };
> + };
> +
> + reg_usb1_vbus: usb1-vbus {
> + compatible = "regulator-fixed";
> + pinctrl-names = "default";
> + pinctrl-0 = <_vbus_pin_a>;
> + regulator-name = "usb1-vbus";
> + regulator-min-microvolt = <500>;
> + regulator-max-microvolt = <500>;
> + enable-active-high;
> + gpio = < 7 27 0>;
> + status = "okay";
> + };
> +
> +};
> -- 
> 1.9.1
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to linux-sunxi+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: kprobes broken in linux-next (was Re: [tip:perf/kprobes] kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist)

2014-05-06 Thread Vineet Gupta

On Friday 02 May 2014 06:43 AM, Masami Hiramatsu wrote:
> (2014/05/01 14:26), Vineet Gupta wrote:
>> On Thursday 24 April 2014 04:28 PM, tip-bot for Masami Hiramatsu wrote:
>>> Commit-ID:  376e242429bf8539ef39a080ac113c8799840b13
>>> Gitweb: 
>>> http://git.kernel.org/tip/376e242429bf8539ef39a080ac113c8799840b13
>>> Author: Masami Hiramatsu 
>>> AuthorDate: Thu, 17 Apr 2014 17:17:05 +0900
>>> Committer:  Ingo Molnar 
>>> CommitDate: Thu, 24 Apr 2014 10:02:56 +0200
>>>
>>> kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist
>>>
>>> Introduce NOKPROBE_SYMBOL() macro which builds a kprobes
>>> blacklist at kernel build time.
>>>
>> 
>>
>>> diff --git a/include/asm-generic/vmlinux.lds.h 
>>> b/include/asm-generic/vmlinux.lds.h
>>> index 146e4ff..40ceb3c 100644
>>> --- a/include/asm-generic/vmlinux.lds.h
>>> +++ b/include/asm-generic/vmlinux.lds.h
>>> @@ -109,6 +109,14 @@
>>>  #define BRANCH_PROFILE()
>>>  #endif
>>>  
>>> +#ifdef CONFIG_KPROBES
>>> +#define KPROBE_BLACKLIST() VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
>>> +   *(_kprobe_blacklist)  \
>>> +   VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
>>> +#else
>>> +#define KPROBE_BLACKLIST()
>>> +#endif
>>> +
>>>  #ifdef CONFIG_EVENT_TRACING
>>>  #define FTRACE_EVENTS(). = ALIGN(8);   
>>> \
>>> VMLINUX_SYMBOL(__start_ftrace_events) = .;  \
>>> @@ -507,6 +515,7 @@
>>> *(.init.rodata) \
>>> FTRACE_EVENTS() \
>>> TRACE_SYSCALLS()\
>>> +   KPROBE_BLACKLIST()  \
>>> MEM_DISCARD(init.rodata)\
>>> CLK_OF_TABLES() \
>>> RESERVEDMEM_OF_TABLES() \
>>
>> Linux-next fails to boot on ARC due to misaligned __start_kprobe_blacklist. 
>> Patch
>> below fixes it.
>>
>> >
>> >From c5afc4ebf9c1c094a260e2aaff6c5b3106063039 Mon Sep 17 00:00:00 2001
>> From: Vineet Gupta 
>> Date: Thu, 1 May 2014 10:47:29 +0530
>> Subject: [PATCH] kprobes: Ensure blacklist data is aligned
>>
>> ARC Linux (not supporting native unaligned access) was failing to boot
>> because __start_kprobe_blacklist was not aligned.
>>
>> This was because per generated vmlinux.lds it was emitted right next
>> to .rodata with strings etc hence could be randomly unaligned.
>>
>> Fix that by ensuring a word alignment. While 4 would suffice for 32bit
>> arches and problem at hand, it is probably better to put 8.
>>
>> | Path: (null) CPU: 0 PID: 1 Comm: swapper Not tainted
>> | 3.15.0-rc3-next-20140430 #2
>> | task: 8f044000 ti: 8f01e000 task.ti: 8f01e000
>> |
>> | [ECR   ]: 0x00230400 => Misaligned r/w from 0x800fb0d3
>> | [EFA   ]: 0x800fb0d3
>> | [BLINK ]: do_one_initcall+0x86/0x1bc
>> | [ERET  ]: init_kprobes+0x52/0x120
>>
>> Signed-off-by: Vineet Gupta 
> 
> Acked-by: Masami Hiramatsu 
> 
> Thanks!

Hi Ingo/Andrew,

Can one of you please pick this up - it doesn't show up in linux-next yet.

Thx,
-Vineet


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ARC patches for stable 3.10

2014-05-06 Thread Vineet Gupta
Hi Luis,

On Monday 05 May 2014 05:38 PM, Luis Henriques wrote:
> On Wed, Apr 30, 2014 at 09:53:05AM +, Vineet Gupta wrote:
>> Hi,
>>
>> Please apply the following mainline commits to stable 3.10 as prerequisites 
>> for a
>> patch for 3.15/stable which will follow to Linus right after.
>>
>> 147aece29b15051173eb1e767018135361cdba89  (went in 3.11-rc1)
>> "ARC: Entry Handler tweaks: Simplify branch for in-kernel preemption"
>>
>> fce16bc35ae4a45634f3dc348d8d297a25c277cf  (went in 3.12-rc1)
>> "ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE"
>>
>> Thx,
>> -Vineet
>> --
>> To unsubscribe from this list: send the line "unsubscribe stable" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> Thank you, I'll queue the 2nd patch for the 3.11 kernel (the 1st one
> is already applied).
> 
> Cheers,
> --
> Luís

Thanks for this. FWIW, above patch(es) were just a prerequisite for cleanly
applying below to 3.1x

8aa9e85adac6 ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe

Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Input: Introduce the use of the managed version of kzalloc

2014-05-06 Thread Himangi Saraogi
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(>dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi 
Acked-by: Julia Lawall 
---
 drivers/input/misc/pcf50633-input.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/input/misc/pcf50633-input.c 
b/drivers/input/misc/pcf50633-input.c
index db92f4f..15ae3ad 100644
--- a/drivers/input/misc/pcf50633-input.c
+++ b/drivers/input/misc/pcf50633-input.c
@@ -58,16 +58,13 @@ static int pcf50633_input_probe(struct platform_device 
*pdev)
struct input_dev *input_dev;
int ret;
 
-
-   input = kzalloc(sizeof(*input), GFP_KERNEL);
+   input = devm_kzalloc(>dev, sizeof(*input), GFP_KERNEL);
if (!input)
return -ENOMEM;
 
input_dev = input_allocate_device();
-   if (!input_dev) {
-   kfree(input);
+   if (!input_dev)
return -ENOMEM;
-   }
 
platform_set_drvdata(pdev, input);
input->pcf = dev_to_pcf50633(pdev->dev.parent);
@@ -81,7 +78,6 @@ static int pcf50633_input_probe(struct platform_device *pdev)
ret = input_register_device(input_dev);
if (ret) {
input_free_device(input_dev);
-   kfree(input);
return ret;
}
pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYR,
@@ -100,7 +96,6 @@ static int pcf50633_input_remove(struct platform_device 
*pdev)
pcf50633_free_irq(input->pcf, PCF50633_IRQ_ONKEYF);
 
input_unregister_device(input->input_dev);
-   kfree(input);
 
return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 3/3] KVM: x86: cache userspace address for faster fetches

2014-05-06 Thread Bandan Das
Paolo Bonzini  writes:

> Il 06/05/2014 02:40, Bandan Das ha scritto:
>> On every instruction fetch, kvm_read_guest_virt_helper
>> does the gva to gpa translation followed by searching for the
>> memslot. Store the gva hva mapping so that if there's a match
>> we can directly call __copy_from_user()
>>
>> Suggested-by: Paolo Bonzini 
>> Signed-off-by: Bandan Das 
>> ---
>>  arch/x86/include/asm/kvm_emulate.h |  7 ++-
>>  arch/x86/kvm/x86.c | 33 +++--
>>  2 files changed, 29 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/kvm_emulate.h 
>> b/arch/x86/include/asm/kvm_emulate.h
>> index 085d688..20ccde4 100644
>> --- a/arch/x86/include/asm/kvm_emulate.h
>> +++ b/arch/x86/include/asm/kvm_emulate.h
>> @@ -323,10 +323,11 @@ struct x86_emulate_ctxt {
>>  int (*execute)(struct x86_emulate_ctxt *ctxt);
>>  int (*check_perm)(struct x86_emulate_ctxt *ctxt);
>>  /*
>> - * The following five fields are cleared together,
>> + * The following six fields are cleared together,
>>   * the rest are initialized unconditionally in x86_decode_insn
>>   * or elsewhere
>>   */
>> +bool addr_cache_valid;
>
> You can just set gfn to -1 to invalidate the fetch.
>
>>  u8 rex_prefix;
>>  u8 lock_prefix;
>>  u8 rep_prefix;
>> @@ -348,6 +349,10 @@ struct x86_emulate_ctxt {
>>  struct fetch_cache fetch;
>>  struct read_cache io_read;
>>  struct read_cache mem_read;
>> +struct {
>> +gfn_t gfn;
>> +unsigned long uaddr;
>> +} addr_cache;
>
> This is not used by emulate.c, so it should be directly in struct
> kvm_vcpu.  You could invalidate it in init_emulate_ctxt, together with
> emulate_regs_need_sync_from_vcpu.

Ok.

> In the big picture, however, what we really want is to persist the
> cache across multiple instructions, and also cache the linearization
> of the address (where you add RIP and CS.base).  This would be a
> bigger source of improvement.  If you do that, the cache has to be
> indeed in x86_emulate_ctxt, but on the other hand the implementation
> needs to be in emulate.c.
>
>>  };
>>
>>  /* Repeat String Operation Prefix */
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index cf69e3b..7afcfc7 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -4072,26 +4072,38 @@ static int kvm_read_guest_virt_helper(gva_t addr, 
>> void *val, unsigned int bytes,
>>  unsigned toread = min(bytes, (unsigned)PAGE_SIZE - offset);
>>  int ret;
>>  unsigned long uaddr;
>> +gfn_t gfn = addr >> PAGE_SHIFT;
>>
>> -ret = ctxt->ops->memory_prepare(ctxt, addr, toread,
>> -exception, false,
>> -NULL, );
>> -if (ret != X86EMUL_CONTINUE)
>> -return ret;
>> +if (ctxt->addr_cache_valid &&
>> +(ctxt->addr_cache.gfn == gfn))
>> +uaddr = (ctxt->addr_cache.uaddr << PAGE_SHIFT) +
>> +offset_in_page(addr);
>> +else {
>> +ret = ctxt->ops->memory_prepare(ctxt, addr, toread,
>> +exception, false,
>> +NULL, );
>
> Did you measure the hit rate, and the speedup after every patch?  My
> reading of the code is that the fetch is done only once per page, with

Yes, I did. IIRC, patch 3 actually improved the speedup compared to 2.
A rough estimate for jmp - patch 2 reduced it to the low 600s, I guess
around 610, but I could get a fresh set of numbers.

So, not sure where the speed up is coming from, I will try to find out.

> the speedup coming from the microoptimization that patch 2 provides
> for single-page reads.  Single-page reads are indeed a very common
> case for the emulator.
>
> I suggest to start with making patch 2 ready for inclusion.
>
> Paolo
>
>> +if (ret != X86EMUL_CONTINUE)
>> +return ret;
>> +
>> +if (unlikely(kvm_is_error_hva(uaddr))) {
>> +r = X86EMUL_PROPAGATE_FAULT;
>> +return r;
>> +}
>>
>> -if (unlikely(kvm_is_error_hva(uaddr))) {
>> -r = X86EMUL_PROPAGATE_FAULT;
>> -return r;
>> +/* Cache gfn and hva */
>> +ctxt->addr_cache.gfn = addr >> PAGE_SHIFT;
>> +ctxt->addr_cache.uaddr = uaddr >> PAGE_SHIFT;
>> +ctxt->addr_cache_valid = true;
>>  }
>>
>>  ret = __copy_from_user(data, (void __user *)uaddr, toread);
>>  if (ret < 0) {
>>  r = X86EMUL_IO_NEEDED;
>> +/* Where else should we invalidate cache ? */
>> +

[PATCH] timblogiw: Introduce the use of the managed version of kzalloc

2014-05-06 Thread Himangi Saraogi
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions.The label err_register is removed as it is no longer required.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(>dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}


Signed-off-by: Himangi Saraogi 
---
 drivers/media/platform/timblogiw.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/timblogiw.c 
b/drivers/media/platform/timblogiw.c
index ccdadd6..fbfdada 100644
--- a/drivers/media/platform/timblogiw.c
+++ b/drivers/media/platform/timblogiw.c
@@ -800,7 +800,7 @@ static int timblogiw_probe(struct platform_device *pdev)
if (!pdata->encoder.module_name)
dev_info(>dev, "Running without decoder\n");
 
-   lw = kzalloc(sizeof(*lw), GFP_KERNEL);
+   lw = devm_kzalloc(>dev, sizeof(*lw), GFP_KERNEL);
if (!lw) {
err = -ENOMEM;
goto err;
@@ -820,7 +820,7 @@ static int timblogiw_probe(struct platform_device *pdev)
strlcpy(lw->v4l2_dev.name, DRIVER_NAME, sizeof(lw->v4l2_dev.name));
err = v4l2_device_register(NULL, >v4l2_dev);
if (err)
-   goto err_register;
+   goto err;
 
lw->video_dev.v4l2_dev = >v4l2_dev;
 
@@ -837,8 +837,6 @@ static int timblogiw_probe(struct platform_device *pdev)
 
 err_request:
v4l2_device_unregister(>v4l2_dev);
-err_register:
-   kfree(lw);
 err:
dev_err(>dev, "Failed to register: %d\n", err);
 
@@ -853,8 +851,6 @@ static int timblogiw_remove(struct platform_device *pdev)
 
v4l2_device_unregister(>v4l2_dev);
 
-   kfree(lw);
-
return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] MIPS: Introduce the use of the managed version of kzalloc

2014-05-06 Thread Himangi Saraogi
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions.The labels out and out_mem are also removed as they are no
longer required.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(>dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi 
---
 arch/mips/mti-sead3/sead3-i2c-drv.c | 37 ++---
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/arch/mips/mti-sead3/sead3-i2c-drv.c 
b/arch/mips/mti-sead3/sead3-i2c-drv.c
index 1f787a6..4d72e0e 100644
--- a/arch/mips/mti-sead3/sead3-i2c-drv.c
+++ b/arch/mips/mti-sead3/sead3-i2c-drv.c
@@ -304,22 +304,18 @@ static int sead3_i2c_platform_probe(struct 
platform_device *pdev)
int ret;
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!r) {
-   ret = -ENODEV;
-   goto out;
-   }
+   if (!r)
+   return -ENODEV;
 
-   priv = kzalloc(sizeof(struct pic32_i2c_platform_data), GFP_KERNEL);
-   if (!priv) {
-   ret = -ENOMEM;
-   goto out;
-   }
+   priv = devm_kzalloc(>dev,
+   sizeof(struct pic32_i2c_platform_data),
+   GFP_KERNEL);
+   if (!priv)
+   return -ENOMEM;
 
priv->base = r->start;
-   if (!priv->base) {
-   ret = -EBUSY;
-   goto out_mem;
-   }
+   if (!priv->base)
+   return -EBUSY;
 
priv->xfer_timeout = 200;
priv->ack_timeout = 200;
@@ -334,15 +330,11 @@ static int sead3_i2c_platform_probe(struct 
platform_device *pdev)
sead3_i2c_platform_setup(priv);
 
ret = i2c_add_numbered_adapter(>adap);
-   if (ret == 0) {
-   platform_set_drvdata(pdev, priv);
-   return 0;
-   }
-
-out_mem:
-   kfree(priv);
-out:
-   return ret;
+   if (ret)
+   return ret;
+   
+   platform_set_drvdata(pdev, priv);
+   return 0;
 }
 
 static int sead3_i2c_platform_remove(struct platform_device *pdev)
@@ -351,7 +343,6 @@ static int sead3_i2c_platform_remove(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, NULL);
i2c_del_adapter(>adap);
-   kfree(priv);
return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V5 0/3] arm: dts: dra7: Updates for adding crossbar device

2014-05-06 Thread Sricharan R
On Wednesday 07 May 2014 03:15 AM, Darren Etheridge wrote:
> Sricharan R  wrote on Tue [2014-May-06 19:26:16 +0530]:
>> Some socs have a large number of interrupts requests to service
>> the needs of its many peripherals and subsystems. All of the interrupt
>> requests lines from the subsystems are not needed at the same
>> time, so they have to be muxed to the controllers appropriately.
>> In such places a interrupt controllers are preceded by an
>> IRQ CROSSBAR that provides flexibility in muxing the device interrupt
>> requests to the controller inputs.
>>
>> The dts file update to support the crossbar device and convert
>> peripheral irq numbers to crossbar number are added here.
>>
>> This is a rebase of V4 series on top of 3.15-rc4
>>
>> This series depends on crossbar-driver-fixes sent below
>> http://marc.info/?l=linux-omap=139929963420299=2
>>
>> Sricharan R (3):
>>   arm: dts: dra7: Add crossbar device binding
>>   arm: dts: dra7: Replace peripheral interrupt numbers with crossbar
>> inputs
>>   arm: dts: dra7: Add routable-irqs property for gic node
>>
> 
> OK, assuming the bisectability issues discussed earlier on this thread
> are addressed.  I have tested the earlier crossbar patch series in
> conjunction with this dts series with VIP capture and DSS display
> running together on DRA7.  Looks good with this combination of
> devices. VIP is one of the modules that must have a crossbar mapping as
> there is no default interrupt mapping for it, therefore VIP makes a good
> test case.
> 
> So please feel free to add:
> 
> Tested-by: Darren Etheridge 

  Thanks for the testing. Will reorder and repost.

Regards,
 Sricharan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] s2255drv: fix memory leak s2255_probe()

2014-05-06 Thread DaeSeok Youn
Hello,

2014-05-05 17:38 GMT+09:00 Sakari Ailus :
> On Tue, Apr 15, 2014 at 07:54:43PM +0900, DaeSeok Youn wrote:
>> Hi, Sakari
>>
>> 2014-04-15 18:33 GMT+09:00 Sakari Ailus :
>> > Hi Daeseok,
>> >
>> > On Tue, Apr 15, 2014 at 01:49:34PM +0900, Daeseok Youn wrote:
>> >>
>> >> smatch says:
>> >>  drivers/media/usb/s2255/s2255drv.c:2246 s2255_probe() warn:
>> >> possible memory leak of 'dev'
>> >>
>> >> Signed-off-by: Daeseok Youn 
>> >> ---
>> >>  drivers/media/usb/s2255/s2255drv.c |1 +
>> >>  1 files changed, 1 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/drivers/media/usb/s2255/s2255drv.c 
>> >> b/drivers/media/usb/s2255/s2255drv.c
>> >> index 1d4ba2b..8aca3ef 100644
>> >> --- a/drivers/media/usb/s2255/s2255drv.c
>> >> +++ b/drivers/media/usb/s2255/s2255drv.c
>> >> @@ -2243,6 +2243,7 @@ static int s2255_probe(struct usb_interface 
>> >> *interface,
>> >>   dev->cmdbuf = kzalloc(S2255_CMDBUF_SIZE, GFP_KERNEL);
>> >>   if (dev->cmdbuf == NULL) {
>> >>   s2255_dev_err(>dev, "out of memory\n");
>> >> + kfree(dev);
>> >>   return -ENOMEM;
>> >>   }
>> >>
>> >
>> > The rest of the function already uses goto and labels for error handling. I
>> > think it'd take adding one more. dev is correctly released in other error
>> > cases.
>> I am not sure that adding a new label for error handling when
>> allocation for dev->cmdbuf is failed.
>> I think it is ok to me. :-) Because I think it is not good adding a
>> new label and use goto statement for this.
>
> I can ack this if you use the same pattern for error handling that's already
> there.
But it has a redundant kfree() call for dev->cmdbuf when it failed to
allocate, right?
If it is ok, I send this again after fixing as your comment.

Thanks.
Daeseok Youn.
>
> --
> Sakari Ailus
> e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv5] ARM: EXYNOS: Support secondary CPU boot of Exynos4212

2014-05-06 Thread Chanwoo Choi
Dear Kukjin,

Could you please pick this patch?

Best Regards,
Chanwoo Choi

On 04/29/2014 10:37 AM, Chanwoo Choi wrote:
> From: Kyungmin Park 
> 
> This patch fix the offset of CPU boot address and change parameter of smc call
> of SMC_CMD_CPU1BOOT command for Exynos4212.
> 
> Signed-off-by: Kyungmin Park 
> Signed-off-by: Chanwoo Choi 
> Reviewed-by: Tomasz Figa 
> ---
> Changes from v4:
> - Post only this patch separated from following patchset[1]
> [1] https://lkml.org/lkml/2014/4/24/873
> 
>  arch/arm/mach-exynos/firmware.c | 15 ++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
> index 932129e..aa01c42 100644
> --- a/arch/arm/mach-exynos/firmware.c
> +++ b/arch/arm/mach-exynos/firmware.c
> @@ -18,6 +18,8 @@
>  
>  #include 
>  
> +#include 
> +
>  #include "smc.h"
>  
>  static int exynos_do_idle(void)
> @@ -28,13 +30,24 @@ static int exynos_do_idle(void)
>  
>  static int exynos_cpu_boot(int cpu)
>  {
> + /*
> +  * The second parameter of SMC_CMD_CPU1BOOT command means CPU id.
> +  * But, Exynos4212 has only one secondary CPU so second parameter
> +  * isn't used for informing secure firmware about CPU id.
> +  */
> + if (soc_is_exynos4212())
> + cpu = 0;
> +
>   exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
>   return 0;
>  }
>  
>  static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
>  {
> - void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c + 4*cpu;
> + void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c;
> +
> + if (!soc_is_exynos4212())
> + boot_reg += 4*cpu;
>  
>   __raw_writel(boot_addr, boot_reg);
>   return 0;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 3/4] KVM: emulate: avoid per-byte copying in instruction fetches

2014-05-06 Thread Bandan Das
Paolo Bonzini  writes:

> We do not need a memory copying loop anymore in insn_fetch; we
> can use a byte-aligned pointer to access instruction fields directly

Nice approach!

> from the fetch_cache.  This eliminates 40-80 cycles (corresponding to
> a 5-7% improvement in performance) from each instruction.
>
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/emulate.c | 47 ++-
>  1 file changed, 22 insertions(+), 25 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 886f9a88010f..245a2d0bfe68 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -706,7 +706,7 @@ static int segmented_read_std(struct x86_emulate_ctxt 
> *ctxt,
>   * Prefetch the remaining bytes of the instruction without crossing page
>   * boundary if they are not in fetch_cache yet.
>   */
> -static int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size)
> +static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size)
>  {
>   struct fetch_cache *fc = >fetch;
>   int rc;
> @@ -738,42 +738,39 @@ static int do_insn_fetch_bytes(struct x86_emulate_ctxt 
> *ctxt, int op_size)
>   return X86EMUL_CONTINUE;
>  }
>  
> -static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
> -  void *__dest, unsigned size)
> +static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
> +unsigned size)
>  {
> - int rc;
> - struct fetch_cache *fc = >fetch;
> - u8 *dest = __dest;
> - u8 *src = >data[ctxt->_eip - fc->start];
> -
>   /* We have to be careful about overflow! */
> - if (unlikely(ctxt->_eip > fc->end - size)) {
> - rc != do_insn_fetch_bytes(ctxt, size);
> - if (rc != X86EMUL_CONTINNUE)
> - goto done;
> - }
> -
> - while (size--) {
> - *dest++ = *src++;
> - ctxt->_eip++;
> - continue;
> - }
> - return X86EMUL_CONTINUE;
> + if (unlikely(ctxt->_eip > ctxt->fetch.end - size))
> + return __do_insn_fetch_bytes(ctxt, size);
> + else
> + return X86EMUL_CONTINUE;
>  }
>  
>  /* Fetch next part of the instruction being emulated. */
>  #define insn_fetch(_type, _ctxt) \
> -({   unsigned long _x;   \
> - rc = do_insn_fetch(_ctxt, &_x, sizeof(_type));  \
> +({   _type _x;   \
> + struct fetch_cache *_fc;\
> + \
> + rc = do_insn_fetch_bytes(_ctxt, sizeof(_type)); \
>   if (rc != X86EMUL_CONTINUE) \
>   goto done;  \
> - (_type)_x;  \
> + _fc = >fetch; \
> + _x = *(_type __aligned(1) *) &_fc->data[ctxt->_eip - _fc->start]; \
For my own understanding, how does the __aligned help here ? Wouldn't 
that result in unaligned accesses that will actually impact performance ?

> + ctxt->_eip += sizeof(_type);\
> + _x; \
>  })
>  
>  #define insn_fetch_arr(_arr, _size, _ctxt)   \
> -({   rc = do_insn_fetch(_ctxt, _arr, (_size));   \
> +({   \
> + struct fetch_cache *_fc;\
> + rc = do_insn_fetch_bytes(_ctxt, _size); \
>   if (rc != X86EMUL_CONTINUE) \
>   goto done;  \
> + _fc = >fetch; \
> + memcpy(_arr, &_fc->data[ctxt->_eip - _fc->start], _size);   \
> + ctxt->_eip += (_size);  \
>  })
>  
>  /*
> @@ -4282,7 +4279,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void 
> *insn, int insn_len)
>   if (insn_len > 0)
>   memcpy(ctxt->fetch.data, insn, insn_len);
>   else {
> - rc = do_insn_fetch_bytes(ctxt, 1);
> + rc = __do_insn_fetch_bytes(ctxt, 1);
>   if (rc != X86EMUL_CONTINUE)
>   return rc;
>   }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/24] net, diet: Make TCP metrics optional

2014-05-06 Thread Andi Kleen
On Tue, May 06, 2014 at 04:29:39PM -0700, Eric Dumazet wrote:
> On Tue, 2014-05-06 at 14:05 -0700, Andi Kleen wrote:
> 
> > - Make GRO optional.
> > This is purely a performance feature for high bandwidth.
> 
> Make this properly then, instead of relying on LTO.
> 
> We did preliminary work to put this stuff in separate files, but its not
> complete yet.

FWIW doesn't matter for LTO.

> 
> tcpv4_offload has pointers to tcp4_gro_receive() and tcp4_gro_complete()
> 
> Is LTO smart enough to understand this will never be called, and do
> proper code elimination of whole _gro_ helpers ?

When there are pointers in static objects it cannot eliminate it for C
(it may work for C++)

However if you just  remove the pointer it'll remove the rest.

-Andi

-- 
a...@linux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] rmap: validate pointer in anon_vma_clone

2014-05-06 Thread Jianyu Zhan
On Wed, May 7, 2014 at 10:32 AM, Leon Ma  wrote:
> If memory allocation failed in first loop, root will be NULL and
> will lead to kernel panic.

Hello, Leon,

I am afraid not.  unlock_anon_vma_root() has a sanity check NULLness of root,
so it is impossible to panic for a dangling root pointer.



Thanks,
Jianyu Zhan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 5/6] arm64: mm: Implement 4 levels of translation tables

2014-05-06 Thread Jungseok Lee
On Tuesday, May 06, 2014 9:02 PM, Steve Capper wrote:
> On Thu, May 01, 2014 at 11:34:16AM +0900, Jungseok Lee wrote:
> > This patch implements 4 levels of translation tables since 3 levels of
> > page tables with 4KB pages cannot support 40-bit physical address
> > space described in [1] due to the following issue.
> >
> > It is a restriction that kernel logical memory map with 4KB + 3 levels
> > (0xffc0-0x) cannot cover RAM region from
> > 544GB to 1024GB in [1]. Specifically, ARM64 kernel fails to create
> > mapping for this region in map_mem function since __phys_to_virt for
> > this region reaches to address overflow.
> >
> > If SoC design follows the document, [1], over 32GB RAM would be placed
> > from 544GB. Even 64GB system is supposed to use the region from 544GB
> > to 576GB for only 32GB RAM. Naturally, it would reach to enable 4
> > levels of page tables to avoid hacking __virt_to_phys and __phys_to_virt.
> >
> > However, it is recommended 4 levels of page table should be only
> > enabled if memory map is too sparse or there is about 512GB RAM.
> >
> 
> Hi Jungseok,
> One comment below:

Hi Steve.

> [ ... ]
> 
> > diff --git a/arch/arm64/include/asm/tlb.h
> > b/arch/arm64/include/asm/tlb.h index bc19101..086112b 100644
> > --- a/arch/arm64/include/asm/tlb.h
> > +++ b/arch/arm64/include/asm/tlb.h
> > @@ -100,6 +100,15 @@ static inline void __pmd_free_tlb(struct
> > mmu_gather *tlb, pmd_t *pmdp,  }  #endif
> >
> > +#ifdef CONFIG_ARM64_4_LEVELS
> > +static inline void __pud_free_tlb(struct mmu_gather *tlb, pmd_t *pudp,
> > + unsigned long addr)
> 
> The second parameter needs to be a pointer to pud_t ?
> (this fires up a warning with STRICT_MM_TYPECHECKS).

You're right. My fault...

> With that and Christoffer's feedback about expanding the comments on 
> create_pud_entry addressed:

Okay. I will add it.

> Reviewed-by: Steve Capper 

Thanks for review!

- Jungseok Lee

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 5/6] arm64: mm: Implement 4 levels of translation tables

2014-05-06 Thread Jungseok Lee
On Tuesday, May 06, 2014 7:49 PM, Christoffer Dall wrote:
> On Thu, May 01, 2014 at 11:34:16AM +0900, Jungseok Lee wrote:
> > This patch implements 4 levels of translation tables since 3 levels of
> > page tables with 4KB pages cannot support 40-bit physical address
> > space described in [1] due to the following issue.
> >
> > It is a restriction that kernel logical memory map with 4KB + 3 levels
> > (0xffc0-0x) cannot cover RAM region from
> > 544GB to 1024GB in [1]. Specifically, ARM64 kernel fails to create
> > mapping for this region in map_mem function since __phys_to_virt for
> > this region reaches to address overflow.
> >
> > If SoC design follows the document, [1], over 32GB RAM would be placed
> > from 544GB. Even 64GB system is supposed to use the region from 544GB
> > to 576GB for only 32GB RAM. Naturally, it would reach to enable 4
> > levels of page tables to avoid hacking __virt_to_phys and __phys_to_virt.
> >
> > However, it is recommended 4 levels of page table should be only
> > enabled if memory map is too sparse or there is about 512GB RAM.
> 
> Who recommends this then?  This paragraph just confuses me.

It is a paraphrase of Catalin's comment:
"I agree, we should only enable 4-levels of page table if we have close
to 512GB of RAM or the range is too sparse but I would actually push
back on the hardware guys to keep it tighter."

The above message comes from the discussion on 4 levels.
http://www.spinics.net/linux/lists/arm-kernel/msg319055.html

> >
> > References
> > --
> > [1]: Principles of ARM Memory Maps, White Paper, Issue C
> >
> > Cc: Catalin Marinas 
> > Cc: Steve Capper 
> > Signed-off-by: Jungseok Lee 
> > Reviewed-by: Sungjinn Chung 
> > ---
> >  arch/arm64/Kconfig |8 ++
> >  arch/arm64/include/asm/memblock.h  |6 +
> >  arch/arm64/include/asm/page.h  |4 ++-
> >  arch/arm64/include/asm/pgalloc.h   |   20 ++
> >  arch/arm64/include/asm/pgtable-hwdef.h |6 +++--
> >  arch/arm64/include/asm/pgtable.h   |   45 
> > +++
> >  arch/arm64/include/asm/tlb.h   |9 +++
> >  arch/arm64/kernel/head.S   |   46 
> > +---
> >  arch/arm64/kernel/traps.c  |5 
> >  arch/arm64/mm/fault.c  |1 +
> >  arch/arm64/mm/mmu.c|   16 ---
> >  11 files changed, 150 insertions(+), 16 deletions(-)
> >

[ ... ]

> > diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index
> > 0fd5650..03ec424 100644
> > --- a/arch/arm64/kernel/head.S
> > +++ b/arch/arm64/kernel/head.S
> > @@ -37,8 +37,9 @@
> >
> >  /*
> >   * swapper_pg_dir is the virtual address of the initial page table.
> > We place
> > - * the page tables 3 * PAGE_SIZE below KERNEL_RAM_VADDR. The
> > idmap_pg_dir has
> > - * 2 pages and is placed below swapper_pg_dir.
> > + * the page tables 3 * PAGE_SIZE (2 or 3 levels) or 4 * PAGE_SIZE (4
> > + levels)
> > + * below KERNEL_RAM_VADDR. The idmap_pg_dir has 2 pages (2 or 3
> > + levels) or
> > + * 3 pages (4 levels) and is placed below swapper_pg_dir.
> >   */
> >  #define KERNEL_RAM_VADDR   (PAGE_OFFSET + TEXT_OFFSET)
> >
> > @@ -46,8 +47,13 @@
> >  #error KERNEL_RAM_VADDR must start at 0xXXX8  #endif
> >
> > +#ifdef CONFIG_ARM64_4_LEVELS
> > +#define SWAPPER_DIR_SIZE   (4 * PAGE_SIZE)
> > +#define IDMAP_DIR_SIZE (3 * PAGE_SIZE)
> > +#else
> >  #define SWAPPER_DIR_SIZE   (3 * PAGE_SIZE)
> >  #define IDMAP_DIR_SIZE (2 * PAGE_SIZE)
> > +#endif
> >
> > .globl  swapper_pg_dir
> > .equswapper_pg_dir, KERNEL_RAM_VADDR - SWAPPER_DIR_SIZE
> > @@ -370,16 +376,38 @@ ENDPROC(__calc_phys_offset)
> > .quad   PAGE_OFFSET
> >
> >  /*
> > + * Macro to populate the PUD for the corresponding block entry in the
> > + next
> > + * level (tbl) for the given virtual address in case of 4levels.
> > + */
> 
> With the relatively high number of parameters to this macro, I feel it would 
> be helpful to state in
> the comment that this actually modifies \tbl and returns a value in \pud.

Okay, I will add it.

> > +   .macro  create_pud_entry, pgd, tbl, virt, pud, tmp1, tmp2
> > +#ifdef CONFIG_ARM64_4_LEVELS
> > +   add \tbl, \tbl, #PAGE_SIZE  // bump tbl 1 page up.
> > +   // to make room for pud
> > +   add \pud, \pgd, #PAGE_SIZE  // pgd points to pud which
> > +   // follows pgd
> > +   lsr \tmp1, \virt, #PUD_SHIFT
> > +   and \tmp1, \tmp1, #PTRS_PER_PUD - 1 // PUD index
> > +   orr \tmp2, \tbl, #3 // PUD entry table type
> > +   str \tmp2, [\pud, \tmp1, lsl #3]
> > +#else
> > +   mov \pud, \tbl
> > +#endif
> > +   .endm
> > +
> > +/*
> >   * Macro to populate the PGD for the corresponding block entry in the next
> >   * level (tbl) for the given virtual address.
> 
> Then 

Re: [RFC PATCH 2/4] KVM: emulate: avoid repeated calls to do_insn_fetch_bytes

2014-05-06 Thread Bandan Das
Paolo Bonzini  writes:

> do_insn_fetch_bytes will only be called once in a given insn_fetch and
> insn_fetch_arr, because in fact it will only be called at most twice
> for any instruction and the first call is explicit in x86_decode_insn.
> This observation lets us hoist the call out of the memory copying loop.
> It does not buy performance, because most fetches are one byte long
> anyway, but it prepares for the next patch.
>
> The overflow check is tricky, but correct.  Because do_insn_fetch_bytes
> has already been called once, we know that fc->end is at least 15.  So
> it is okay to subtract the number of bytes we want to read.
>
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/emulate.c | 25 +
>  1 file changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index c7b625bf0b5d..886f9a88010f 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -706,7 +706,7 @@ static int segmented_read_std(struct x86_emulate_ctxt 
> *ctxt,
>   * Prefetch the remaining bytes of the instruction without crossing page
>   * boundary if they are not in fetch_cache yet.
>   */
> -static int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt)
> +static int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size)
>  {
>   struct fetch_cache *fc = >fetch;
>   int rc;
> @@ -718,7 +718,14 @@ static int do_insn_fetch_bytes(struct x86_emulate_ctxt 
> *ctxt)
>   cur_size = fc->end - fc->start;
>   size = min(15UL - cur_size,
>  PAGE_SIZE - offset_in_page(fc->end));
> - if (unlikely(size == 0))
> +
> + /*
> +  * One instruction can only straddle two pages,
> +  * and one has been loaded at the beginning of
> +  * x86_decode_insn.  So, if not enough bytes
> +  * still, we must have hit the 15-byte boundary.
> +  */
> + if (unlikely(size < op_size))
>   return X86EMUL_UNHANDLEABLE;
>   rc = __linearize(ctxt, addr, size, false, true, );
>   if (unlikely(rc != X86EMUL_CONTINUE))
> @@ -739,12 +746,14 @@ static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
>   u8 *dest = __dest;
>   u8 *src = >data[ctxt->_eip - fc->start];
>  
> + /* We have to be careful about overflow! */
> + if (unlikely(ctxt->_eip > fc->end - size)) {
> + rc != do_insn_fetch_bytes(ctxt, size);
This is a typo I guess ..

> + if (rc != X86EMUL_CONTINNUE)
> + goto done;
> + }
> +
>   while (size--) {
> - if (unlikely(ctxt->_eip == fc->end)) {
> - rc = do_insn_fetch_bytes(ctxt);
> - if (rc != X86EMUL_CONTINUE)
> - return rc;
> - }
>   *dest++ = *src++;
>   ctxt->_eip++;
>   continue;
> @@ -4273,7 +4282,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void 
> *insn, int insn_len)
>   if (insn_len > 0)
>   memcpy(ctxt->fetch.data, insn, insn_len);
>   else {
> - rc = do_insn_fetch_bytes(ctxt);
> + rc = do_insn_fetch_bytes(ctxt, 1);
Is this saying that if the cache is full, then we fetch one more byte ?

>   if (rc != X86EMUL_CONTINUE)
>   return rc;
>   }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] Add test to validate udelay

2014-05-06 Thread Doug Anderson
John,

On Tue, May 6, 2014 at 5:25 PM, John Stultz  wrote:
> On 05/06/2014 05:12 PM, David Riley wrote:
>> This change adds a module and a script that makes use of it to
>> validate that udelay delays for at least as long as requested
>> (as compared to ktime).
>
> Interesting.
>
> So fundamentally, udelay is a good bit fuzzier accuracy wise then
> ktime_get(), as it may be backed by relatively coarsely calibrated delay
> loops, or very rough tsc freq estimates.
>
> ktime_get on the other hand is as fine grained as we can be, and is ntp
> corrected, so that a second can really be a second.
>
> So your comparing the fast and loose interface so we can delay a bit
> before hitting some hardware again with a fairly precise interface.
> Thus  I'd not be surprised if your test failed on various hardware. I'd
> really only trust udelay to be roughly accurate, so you might want to
> consider adding some degree of acceptable error to the test.

My understanding is that udelay should be >= the true delay.
Specifically it tends to be used when talking to hardware.  We used it
to ensure a minimum delay between SPI transactions when talking to a
slow embedded controller.  I think the regulator code uses udelay() to
wait for voltage to ramp up, for instance.  Waiting too long isn't
terrible, but too short is bad.

That being said, I think if udelay was within 1% we're probably OK.  I
believe I have seen systems where udelay is marginally shorter than it
ought to be and it didn't upset me too much.


> Really, I'm curious about the backstory that made you generate the test?
> I assume something bit you where udelay was way off? Or were you using
> udelay for some sort of accuracy sensitive use?

Several times we've seen cases where udelay() was pretty broken with
cpufreq if you were actually implementing udelay() with
loops_per_jiffy.  I believe it may also be broken upstream on
multicore systems, though now that ARM arch timers are there maybe we
don't care as much?

Specifically, there is a lot of confusion between the global loops per
jiffy and the per CPU one.  On ARM I think we always use the global
one and we attempt to scale it as cpufreq changes.  ...but...

* cores tend scale together and there's a single global.  That means
you might have started the delay loop at one freq and ended it at
another (if another CPU changes the freq).

* I believe there's some strange issues in terms of how the loops per
jiffy variable is initialized and how the "original CPU freq" is.  I
know we ran into issues on big.LITTLE where the LITTLE cores came up
and clobbered the loops_per_jiffy variable but it was still doing math
based on the big cores.


-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ceph: fix corruption when using page_count 0 page in rbd

2014-05-06 Thread tuxoko


On 西元2014年05月07日 00:34, Ilya Dryomov wrote:
> On Tue, May 6, 2014 at 8:31 PM, Sage Weil  wrote:
>> On Tue, 6 May 2014, Ilya Dryomov wrote:
>>>
>>> Looks good to me.  Have you tested it with pre "Fix crash when using
>>> ZFS on Ceph rbd" ZFS?
>>
>> Once this looks ready, we should perhaps stick it in for-linus so that it
>> can go into 3.15.
> 
> That's the plan, I just wanted to confirm it's been tested, since ZFS
> folks went ahead and fixed it by using compound pages.
> 
> Thanks,
> 
> Ilya
> 

Hi Ilya

Yes, I've tested before the ZFS fix and it worked for me.

Thanks,
Chunwei Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] ARM: sunxi: dt: add APP4-EVB1 board support

2014-05-06 Thread Maxime Ripard
From: Boris BREZILLON 

The APP4 EVB1 development boards embeds an A31, together with some NAND, one SD
card slot, and one SDIO + UART WiFi and Bluetooth chip, a few I2C buses, USB,
and a LCD display.

Signed-off-by: Boris BREZILLON 
Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/Makefile|  1 +
 arch/arm/boot/dts/sun6i-a31-app4-evb1.dts | 63 +++
 2 files changed, 64 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun6i-a31-app4-evb1.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ffa3f5ef27d3..d50c0895a9d5 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -343,6 +343,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += \
sun5i-a10s-olinuxino-micro.dtb \
sun5i-a13-olinuxino.dtb \
sun5i-a13-olinuxino-micro.dtb \
+   sun6i-a31-app4-evb1.dtb \
sun6i-a31-colombus.dtb \
sun6i-a31-m9.dtb \
sun7i-a20-cubieboard2.dtb \
diff --git a/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts 
b/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
new file mode 100644
index ..270ab978f858
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31-app4-evb1.dts
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2014 Boris Brezillon
+ *
+ * Boris Brezillon 
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "sun6i-a31.dtsi"
+
+/ {
+   model = "Allwinner A31 APP4 EVB1 Evaluation Board";
+   compatible = "allwinner,app4-evb1", "allwinner,sun6i-a31";
+
+   chosen {
+   bootargs = "earlyprintk console=ttyS0,115200";
+   };
+
+   soc@01c0 {
+   pio: pinctrl@01c20800 {
+   usb1_vbus_pin_a: usb1_vbus_pin@0 {
+   allwinner,pins = "PH27";
+   allwinner,function = "gpio_out";
+   allwinner,drive = <0>;
+   allwinner,pull = <0>;
+   };
+   };
+
+   usbphy: phy@01c19400 {
+   usb1_vbus-supply = <_usb1_vbus>;
+   status = "okay";
+   };
+
+   ehci0: usb@01c1a000 {
+   status = "okay";
+   };
+
+   uart0: serial@01c28000 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+   };
+   };
+
+   reg_usb1_vbus: usb1-vbus {
+   compatible = "regulator-fixed";
+   pinctrl-names = "default";
+   pinctrl-0 = <_vbus_pin_a>;
+   regulator-name = "usb1-vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   enable-active-high;
+   gpio = < 7 27 0>;
+   status = "okay";
+   };
+
+};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/7] Add Allwinner A31 USB support

2014-05-06 Thread Maxime Ripard
Hi everyone,

This patchset adds support for the USB controllers found in the
Allwinner A31.

While the design is similar to the earlier Allwinner SoCs that are
already supported, a few details here and there change, like the fact
that the PHYs now have one clock per phy, while it used to be only one
for all the PHYs.

Thanks,
Maxime

Boris BREZILLON (2):
  usb: ehci-platform: add optional reset controller retrieval
  ARM: sunxi: dt: add APP4-EVB1 board support

Maxime Ripard (5):
  clk: sunxi: Implement A31 USB clock
  ARM: sun6i: Add the USB clocks to the DTSI.
  phy: usb: sunxi: Introduce Allwinner A31 USB PHY support
  usb: ohci-platform: Enable optional use of reset controller
  ARM: sun6i: dt: Add support for the USB controllers

 Documentation/devicetree/bindings/usb/usb-ehci.txt |  1 +
 Documentation/devicetree/bindings/usb/usb-ohci.txt |  1 +
 arch/arm/boot/dts/Makefile |  1 +
 arch/arm/boot/dts/sun6i-a31-app4-evb1.dts  | 63 
 arch/arm/boot/dts/sun6i-a31.dtsi   | 88 ++
 drivers/clk/sunxi/clk-sunxi.c  |  6 ++
 drivers/phy/phy-sun4i-usb.c| 35 ++---
 drivers/usb/host/ehci-platform.c   | 25 +-
 drivers/usb/host/ohci-platform.c   | 25 +-
 9 files changed, 234 insertions(+), 11 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun6i-a31-app4-evb1.dts

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/7] phy: usb: sunxi: Introduce Allwinner A31 USB PHY support

2014-05-06 Thread Maxime Ripard
The USB phy controller in the A31 differs mostly from the older controllers
because it has a clock dedicated for each phy, while the older ones were having
a single clock for all the phys.

Signed-off-by: Maxime Ripard 
---
 drivers/phy/phy-sun4i-usb.c | 35 ++-
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index e6e6c4ba7145..1d83abe07a29 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -61,16 +61,17 @@
 #define MAX_PHYS   3
 
 struct sun4i_usb_phy_data {
-   struct clk *clk;
void __iomem *base;
struct mutex mutex;
int num_phys;
u32 disc_thresh;
+   bool dedicated_clocks;
struct sun4i_usb_phy {
struct phy *phy;
void __iomem *pmu;
struct regulator *vbus;
struct reset_control *reset;
+   struct clk *clk;
int index;
} phys[MAX_PHYS];
 };
@@ -146,13 +147,13 @@ static int sun4i_usb_phy_init(struct phy *_phy)
struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
int ret;
 
-   ret = clk_prepare_enable(data->clk);
+   ret = clk_prepare_enable(phy->clk);
if (ret)
return ret;
 
ret = reset_control_deassert(phy->reset);
if (ret) {
-   clk_disable_unprepare(data->clk);
+   clk_disable_unprepare(phy->clk);
return ret;
}
 
@@ -170,11 +171,10 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 static int sun4i_usb_phy_exit(struct phy *_phy)
 {
struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
-   struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
 
sun4i_usb_phy_passby(phy, 0);
reset_control_assert(phy->reset);
-   clk_disable_unprepare(data->clk);
+   clk_disable_unprepare(phy->clk);
 
return 0;
 }
@@ -230,6 +230,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
struct regulator *vbus;
struct resource *res;
struct phy *phy;
+   struct clk *clk;
char name[16];
int i;
 
@@ -249,15 +250,20 @@ static int sun4i_usb_phy_probe(struct platform_device 
*pdev)
else
data->disc_thresh = 2;
 
+   if (of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy"))
+   data->dedicated_clocks = true;
+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_ctrl");
data->base = devm_ioremap_resource(dev, res);
if (IS_ERR(data->base))
return PTR_ERR(data->base);
 
-   data->clk = devm_clk_get(dev, "usb_phy");
-   if (IS_ERR(data->clk)) {
-   dev_err(dev, "could not get usb_phy clock\n");
-   return PTR_ERR(data->clk);
+   if (!data->dedicated_clocks) {
+   clk = devm_clk_get(dev, "usb_phy");
+   if (IS_ERR(clk)) {
+   dev_err(dev, "could not get usb_phy clock\n");
+   return PTR_ERR(clk);
+   }
}
 
/* Skip 0, 0 is the phy for otg which is not yet supported. */
@@ -270,6 +276,15 @@ static int sun4i_usb_phy_probe(struct platform_device 
*pdev)
vbus = NULL;
}
 
+   if (data->dedicated_clocks) {
+   snprintf(name, sizeof(name), "usb%d_phy", i);
+   clk = devm_clk_get(dev, name);
+   if (IS_ERR(clk)) {
+   dev_err(dev, "failed to get clock %s\n", name);
+   return PTR_ERR(clk);
+   }
+   }
+
snprintf(name, sizeof(name), "usb%d_reset", i);
reset = devm_reset_control_get(dev, name);
if (IS_ERR(reset)) {
@@ -296,6 +311,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
data->phys[i].pmu = pmu;
data->phys[i].vbus = vbus;
data->phys[i].reset = reset;
+   data->phys[i].clk = clk;
data->phys[i].index = i;
phy_set_drvdata(phy, >phys[i]);
}
@@ -311,6 +327,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 static const struct of_device_id sun4i_usb_phy_of_match[] = {
{ .compatible = "allwinner,sun4i-a10-usb-phy" },
{ .compatible = "allwinner,sun5i-a13-usb-phy" },
+   { .compatible = "allwinner,sun6i-a31-usb-phy" },
{ .compatible = "allwinner,sun7i-a20-usb-phy" },
{ },
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/13] staging: rtl8188eu: Remove 'int frame_tag' from struct recv_frame

2014-05-06 Thread navin patidar
Remove unused variable 'int frame_tag'.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index e14ba98..b0fbdbd 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -254,7 +254,6 @@ struct recv_frame {
struct sk_buff   *pkt_newalloc;
struct adapter  *adapter;
u8 fragcnt;
-   int frame_tag;
struct rx_pkt_attrib attrib;
uint  len;
u8 *rx_head;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/13] staging: rtl8188eu: Remove 'u8 fragcnt' from struct recv_frame

2014-05-06 Thread navin patidar
Remove unused variable 'u8 fragcnt'.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index b0fbdbd..f0c26ef 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -253,7 +253,6 @@ struct recv_frame {
struct sk_buff   *pkt;
struct sk_buff   *pkt_newalloc;
struct adapter  *adapter;
-   u8 fragcnt;
struct rx_pkt_attrib attrib;
uint  len;
u8 *rx_head;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/13] staging: rtl8188eu: Remove unused inline function get_rx_status()

2014-05-06 Thread navin patidar
Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index e5b4e10..dac2e0c 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -291,11 +291,6 @@ static inline u8 *get_rxmem(struct recv_frame *precvframe)
return precvframe->rx_head;
 }
 
-static inline u8 *get_rx_status(struct recv_frame *precvframe)
-{
-   return get_rxmem(precvframe);
-}
-
 static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz)
 {
/*  rx_data += sz; move rx_data sz bytes  hereafter */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/13] staging: rtl8188eu: Remove 'void *precvbuf' from struct recv_frame

2014-05-06 Thread navin patidar
Remove unused variable 'void *precvbuf'.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/hal/usb_ops_linux.c |1 -
 drivers/staging/rtl8188eu/include/rtw_recv.h  |1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
index d8fc747..fc73147 100644
--- a/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
@@ -333,7 +333,6 @@ static int recvbuf2recvframe(struct adapter *adapt, struct 
sk_buff *pskb)
}
 
_rtw_init_listhead(>list);
-   precvframe->precvbuf = NULL;/* can't access the precvbuf 
for new arch. */
precvframe->len = 0;
 
update_recvframe_attrib_88e(precvframe, prxstat);
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index dac2e0c..e14ba98 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -261,7 +261,6 @@ struct recv_frame {
u8 *rx_data;
u8 *rx_tail;
u8 *rx_end;
-   void *precvbuf;
struct sta_info *psta;
/* for A-MPDU Rx reordering buffer control */
struct recv_reorder_ctrl *preorder_ctrl;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/13] staging: rtl8188eu: Remove unused inline function recvframe_push()

2014-05-06 Thread navin patidar
Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h |   20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 68c2ad5f..e5b4e10 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -296,26 +296,6 @@ static inline u8 *get_rx_status(struct recv_frame 
*precvframe)
return get_rxmem(precvframe);
 }
 
-static inline u8 *recvframe_push(struct recv_frame *precvframe, int sz)
-{
-   /*  append data before rx_data */
-
-   /* add data to the start of recv_frame
- *
- *  This function extends the used data area of the recv_frame at the 
buffer
- *  start. rx_data must be still larger than rx_head, after pushing.
- */
-   if (precvframe == NULL)
-   return NULL;
-   precvframe->rx_data -= sz;
-   if (precvframe->rx_data < precvframe->rx_head) {
-   precvframe->rx_data += sz;
-   return NULL;
-   }
-   precvframe->len += sz;
-   return precvframe->rx_data;
-}
-
 static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz)
 {
/*  rx_data += sz; move rx_data sz bytes  hereafter */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/13] staging: rtl8188eu: Remove function rtw_os_recv_resource_free()

2014-05-06 Thread navin . patidar
From: navin patidar 

rtw_os_recv_resource_free() has empty defination, so we can remove it.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c  |2 --
 drivers/staging/rtl8188eu/include/recv_osdep.h |1 -
 drivers/staging/rtl8188eu/os_dep/recv_linux.c  |5 -
 3 files changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 56b1ef1..db6ab4f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -117,8 +117,6 @@ void _rtw_free_recv_priv (struct recv_priv *precvpriv)
 
rtw_free_uc_swdec_pending_queue(padapter);
 
-   rtw_os_recv_resource_free(precvpriv);
-
if (precvpriv->pallocated_frame_buf) {
vfree(precvpriv->pallocated_frame_buf);
}
diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h 
b/drivers/staging/rtl8188eu/include/recv_osdep.h
index f49ac56..44caea9 100644
--- a/drivers/staging/rtl8188eu/include/recv_osdep.h
+++ b/drivers/staging/rtl8188eu/include/recv_osdep.h
@@ -41,7 +41,6 @@ void rtw_free_recv_priv(struct recv_priv *precvpriv);
 
 int rtw_os_recv_resource_alloc(struct adapter *adapt,
   struct recv_frame *recvfr);
-void rtw_os_recv_resource_free(struct recv_priv *precvpriv);
 
 int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf);
 int rtw_os_recvbuf_resource_free(struct adapter *adapt, struct recv_buf *buf);
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index c1fbe8d..d1ce639 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -37,11 +37,6 @@ int rtw_os_recv_resource_alloc(struct adapter *padapter,
return _SUCCESS;
 }
 
-/* free os related resource in struct recv_frame */
-void rtw_os_recv_resource_free(struct recv_priv *precvpriv)
-{
-}
-
 /* alloc os related resource in struct recv_buf */
 int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
  struct recv_buf *precvbuf)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/13] staging: rtl8188eu: Remove function rtw_hostapd_mlme_rx()

2014-05-06 Thread navin . patidar
From: navin patidar 

rtw_hostapd_mlme_rx() has empty defination, so we can remove it.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  |2 --
 drivers/staging/rtl8188eu/include/recv_osdep.h |1 -
 drivers/staging/rtl8188eu/os_dep/recv_linux.c  |5 -
 3 files changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 55be52f..e854732 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -502,8 +502,6 @@ void mgt_dispatcher(struct adapter *padapter, struct 
recv_frame *precv_frame)
break;
default:
_mgt_dispatcher(padapter, ptable, precv_frame);
-   if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
-   rtw_hostapd_mlme_rx(padapter, precv_frame);
break;
}
 #else
diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h 
b/drivers/staging/rtl8188eu/include/recv_osdep.h
index 44caea9..5333598 100644
--- a/drivers/staging/rtl8188eu/include/recv_osdep.h
+++ b/drivers/staging/rtl8188eu/include/recv_osdep.h
@@ -33,7 +33,6 @@ int rtw_recv_indicatepkt(struct adapter *adapter,
 struct recv_frame *recv_frame);
 void rtw_recv_returnpacket(struct  net_device *cnxt, struct sk_buff *retpkt);
 
-void rtw_hostapd_mlme_rx(struct adapter *padapter, struct recv_frame *recv_fr);
 void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup);
 
 int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter);
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index d1ce639..edb7969 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -95,11 +95,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 
bgroup)
, (char *));
 }
 
-void rtw_hostapd_mlme_rx(struct adapter *padapter,
-struct recv_frame *precv_frame)
-{
-}
-
 int rtw_recv_indicatepkt(struct adapter *padapter,
 struct recv_frame *precv_frame)
 {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/13] staging: rtl8188eu: Remove function rtw_os_recvbuf_resource_free()

2014-05-06 Thread navin . patidar
From: navin patidar 

Use usb_free_urb() instead of rtw_os_recvbuf_resource_free() to free URB.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c |2 +-
 drivers/staging/rtl8188eu/include/recv_osdep.h |1 -
 drivers/staging/rtl8188eu/os_dep/recv_linux.c  |8 
 3 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index 2b45564..0f6222d 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -97,7 +97,7 @@ void rtl8188eu_free_recv_priv(struct adapter *padapter)
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
 
for (i = 0; i < NR_RECVBUFF; i++) {
-   rtw_os_recvbuf_resource_free(padapter, precvbuf);
+   usb_free_urb(precvbuf->purb);
precvbuf++;
}
 
diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h 
b/drivers/staging/rtl8188eu/include/recv_osdep.h
index 5333598..a4fd957 100644
--- a/drivers/staging/rtl8188eu/include/recv_osdep.h
+++ b/drivers/staging/rtl8188eu/include/recv_osdep.h
@@ -42,7 +42,6 @@ int rtw_os_recv_resource_alloc(struct adapter *adapt,
   struct recv_frame *recvfr);
 
 int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf);
-int rtw_os_recvbuf_resource_free(struct adapter *adapt, struct recv_buf *buf);
 
 void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf);
 
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index edb7969..c0fa8fd 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -51,14 +51,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
return res;
 }
 
-/* free os related resource in struct recv_buf */
-int rtw_os_recvbuf_resource_free(struct adapter *padapter,
-struct recv_buf *precvbuf)
-{
-   usb_free_urb(precvbuf->purb);
-   return _SUCCESS;
-}
-
 void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
 {
union iwreq_data wrqu;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 2/6] arm64: Introduce VA_BITS and translation level options

2014-05-06 Thread Jungseok Lee
On Friday, May 02, 2014 8:17 PM, Christoffer Dall wrote:
> On Fri, May 02, 2014 at 10:57:09AM +0900, Jungseok Lee wrote:
> > On Thursday, May 01, 2014 7:06 PM, Christoffer Dall wrote:
> > > On Thu, May 01, 2014 at 11:33:56AM +0900, Jungseok Lee wrote:
> 
> [...]
> 
> > > > +
> > > > +choice
> > > > +   prompt "Virtual address space size"
> > > > +   default ARM64_VA_BITS_39 if ARM64_4K_PAGES
> > > > +   default ARM64_VA_BITS_42 if ARM64_64K_PAGES
> > > > +   help
> > > > + Allows virtual address space size. A level of translation
> > > > +tables
> > >
> > > What does "Allows virtual address space size" mean exactly?
> >
> > It means that VA space size can be chosen. For example, there are two
> > VA size options, 39-bit and 48-bit, with 4KB pages. If 39-bit VA space
> > is not enough, 48-bit can be selected instead. The 5th patch adds a
> > 48-bit option to this choice blocks.
> >
> > If 16KB pages are supported with both 47-bit and 48-bit VA size,
> > people could configure it in menuconfig.
> >
> > In this context, I've written it down like page size.
> >
> > I think Catalin's comment would be helpful.
> > http://www.spinics.net/linux/lists/arm-kernel/msg319552.html
> >
> I didn't have problems understanding the concept, I was questioning the 
> language.  The way it is
> written now it suggests having a virtual address space size, as opposed to 
> not having a size at all,
> which doesn't make sense.
> 
> I think you want to say something along the lines of "Allows choosing a 
> virtual address space size",
> or "Allows choosing one of multiple possible virtual address space sizes".

Ahh... I see. I will revise the sentence clearly.
Thanks!

- Jungseok Lee

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/13] staging: rtl8188eu: Remove struct zero_bulkout_context

2014-05-06 Thread navin . patidar
From: navin patidar 

Remove unused struct zero_bulkout_context.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c |7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index fb0bba8..ba2a8ab 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -39,13 +39,6 @@ unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 
addr)
return pipe;
 }
 
-struct zero_bulkout_context {
-   void *pbuf;
-   void *purb;
-   void *pirp;
-   void *padapter;
-};
-
 void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
 {
 }
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/13] staging: rtl8188eu: Remove function rtw_os_recv_resource_init()

2014-05-06 Thread navin . patidar
From: navin patidar 

rtw_os_recv_resource_init() has empty defination, so we can remove it.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c  |2 --
 drivers/staging/rtl8188eu/include/recv_osdep.h |1 -
 drivers/staging/rtl8188eu/os_dep/recv_linux.c  |7 ---
 3 files changed, 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 5260fe5..56b1ef1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -71,8 +71,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
 
precvpriv->free_recvframe_cnt = NR_RECVFRAME;
 
-   rtw_os_recv_resource_init(precvpriv, padapter);
-
precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct 
recv_frame) + RXFRAME_ALIGN_SZ);
 
if (precvpriv->pallocated_frame_buf == NULL) {
diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h 
b/drivers/staging/rtl8188eu/include/recv_osdep.h
index d76cc2d..f49ac56 100644
--- a/drivers/staging/rtl8188eu/include/recv_osdep.h
+++ b/drivers/staging/rtl8188eu/include/recv_osdep.h
@@ -39,7 +39,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 
bgroup);
 int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter);
 void rtw_free_recv_priv(struct recv_priv *precvpriv);
 
-int rtw_os_recv_resource_init(struct recv_priv *recvpr, struct adapter *adapt);
 int rtw_os_recv_resource_alloc(struct adapter *adapt,
   struct recv_frame *recvfr);
 void rtw_os_recv_resource_free(struct recv_priv *precvpriv);
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index 29ec014..c1fbe8d 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -28,13 +28,6 @@
 #include 
 #include 
 
-/* init os related resource in struct recv_priv */
-int rtw_os_recv_resource_init(struct recv_priv *precvpriv,
- struct adapter *padapter)
-{
-   return _SUCCESS;
-}
-
 /* alloc os related resource in struct recv_frame */
 int rtw_os_recv_resource_alloc(struct adapter *padapter,
   struct recv_frame *precvframe)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/13] staging: rtl8188eu: Remove unused member variables of struct recv_priv

2014-05-06 Thread navin . patidar
From: navin patidar 

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 5b3bf29..d52cfe8 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -189,10 +189,6 @@ struct recv_priv {
u64 rx_drop;
u64 last_rx_bytes;
 
-   uint  rx_icv_err;
-   uint  rx_largepacket_crcerr;
-   uint  rx_smallpacket_crcerr;
-   uint  rx_middlepacket_crcerr;
uintff_hwaddr;
u8  rx_pending_cnt;
 
@@ -212,9 +208,7 @@ struct recv_priv {
u8 signal_strength;
u8 signal_qual;
u8 noise;
-   int RxSNRdB[2];
s8 RxRssi[2];
-   int FalseAlmCnt_all;
 
struct timer_list signal_stat_timer;
u32 signal_stat_sampling_interval;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: HULK management policy and user manual-v1.4//Re: 收集了大家的意见,修改了部分分支管理。//欧拉统一内核版本管理策略以及操作手册//Re: 确认一下各位要访问哪些仓库 // Re: 请各位提供访问 git 服务器的公钥 // Re: Fw: 需要加入中软内部git以及maillist的名单

2014-05-06 Thread Ding Tianhong
On 2014/5/7 10:45, Li Zefan wrote:
> On 2014/5/6 20:19, Ding Tianhong wrote:
>> On 2014/5/6 19:15, sanil kumar wrote:
>>> On 5/6/2014 4:37 PM, Ding Tianhong wrote:
 On 2014/5/6 17:29, maobibo 00177601 wrote:
> Hi Tianhong,
>
> I have two questions about the HULK
>1) When we get kernel from HULK such as euler-arm64branch, if there 
> are some bugs in the branch and we report this bug,
>   will CSI team be responsible to fix the bug?

 If the bug is exist in the kernel and not from third-party application 
 just like Customer's own drivers, I have to say "YES", we
 will fix them and upstream them.


>
>2) When we submit a patch to HULK and if it is accepted, will CSI team 
> be response to push it to upstream mainline branch?
>


 If this patch is developed by yourself, and only for features or 
 capabilities, you have to upstream the patch yourself.
>>> If we don't have strategy to handle this, we may end up facing issues with 
>>> long term maintenance of HULK. Do you see this risk?
>>> This can be applicable to any patches whether its coming from external or 
>>> internal members of CSI.
>>
>> Hi sanil:
>>
>> Yes, I got your opinion, and we already face this problem several times, in 
>> principle everyone should be responsible for their own code,
>> I hope every patch in our HULK repository could be applied to linux mainline 
>> tree, the CSI should help them to make the code more in line
>> with the community standard, it is a relationship, not a obligations.
>>
>> So I think we should discuss the strategy together, In my opinion, there is 
>> no external or internal members of CSI, everyone is a
>> kernel developer, if the code or patch has a good reason to upstream to the 
>> linux mainline tree, the author should have responsibility to handle
>> this work, if the author met some problem and could not handle this alone, 
>> our HULK team should help him to upstream, this is a great team should do.
>>
>> Hi zefan: 
>> As a senior expert, can you give us more suggestion to handle this, thanks.
>>
> 
> As I'm not working on arm64, I don't know how you guys have been 
> co-operating. :)
> 
> Can't we learn from the development process of LSK?
> 
> How about we obey a rule "upstream first". Patches are sent to our internal 
> mailing
> list for review, and then they should be sent to the community. They won't be 
> accepted
> by HULK util they are merged into mainline, or you have to explain why they 
> aren't
> accepted and why it's ok for HULK to merge them though.
> 
> The principal is we should all work on upstreaming our code. We can't ask 
> HULK to
> do all the upstream work.
> 
> The community doesn't like delegation, which means it should be the author 
> that submits
> the patch. However this is not a strict requirement. If you can fully 
> understand the
> patch and you're able to answer people's comments on this patch when it's 
> posted, you
> may submit it given you've got the autoher's approval.
> 

Hi zefan:

Thanks for your suggestion, I think it is more clear and reasonable, if we need 
deeper discussion, the branch maintainer for CHI and Hisilicon need to enter
this discussion.

Hi guozhu, wangwei:

I need to know the branch maintainer for your department, please tell me the 
name and then I could discussion with them for the strategy and perfect the 
HULK document,
thanks for any suggestion.

Regards
Ding

> btw what does CSI mean?
> 

Central Software Institute :)

> 



> .
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/13] staging: rtl8188eu: Remove 'spinlock_t lock' from struct recv_priv

2014-05-06 Thread navin . patidar
From: navin patidar 

Remove unused variable 'spinlock_t lock'.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c|2 --
 drivers/staging/rtl8188eu/include/rtw_recv.h |1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index a065a7f..5260fe5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -63,8 +63,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
 
int res = _SUCCESS;
 
-   spin_lock_init(>lock);
-
_rtw_init_queue(>free_recv_queue);
_rtw_init_queue(>recv_pending_queue);
_rtw_init_queue(>uc_swdec_pending_queue);
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index d52cfe8..68c2ad5f 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -175,7 +175,6 @@ recv_thread(passive) ; returnpkt(dispatch)
 using enter_critical section to protect
 */
 struct recv_priv {
-   spinlock_t lock;
struct __queue free_recv_queue;
struct __queue recv_pending_queue;
struct __queue uc_swdec_pending_queue;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/13] staging: rtl8188eu: Remove 'semaphore allrxreturnevt' from struct recv_priv

2014-05-06 Thread navin . patidar
From: navin patidar 

Remove unused variable 'semaphore allrxreturnevt'.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c|2 --
 drivers/staging/rtl8188eu/include/rtw_recv.h |1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index da26fa5c..a065a7f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -101,8 +101,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
}
precvpriv->rx_pending_cnt = 1;
 
-   sema_init(>allrxreturnevt, 0);
-
res = rtw_hal_init_recv_priv(padapter);
 
_init_timer(>signal_stat_timer, padapter->pnetdev, 
RTW_TIMER_HDL_NAME(signal_stat), padapter);
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 971dd16..5b3bf29 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -193,7 +193,6 @@ struct recv_priv {
uint  rx_largepacket_crcerr;
uint  rx_smallpacket_crcerr;
uint  rx_middlepacket_crcerr;
-   struct semaphore allrxreturnevt;
uintff_hwaddr;
u8  rx_pending_cnt;
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/13]staging: rtl8188eu: Remove unused functions and variables

2014-05-06 Thread navin . patidar
From: navin patidar 

Following patches remove unused functions, variables and functions with empty
definition.

navin patidar (13):
  staging: rtl8188eu: Remove 'semaphore allrxreturnevt' from struct
recv_priv
  staging: rtl8188eu: Remove unused member variables of struct
recv_priv
  staging: rtl8188eu: Remove 'spinlock_t lock' from struct recv_priv
  staging: rtl8188eu: Remove struct zero_bulkout_context
  staging: rtl8188eu: Remove function rtw_os_recv_resource_init()
  staging: rtl8188eu: Remove function rtw_os_recv_resource_free()
  staging: rtl8188eu: Remove function rtw_hostapd_mlme_rx()
  staging: rtl8188eu: Remove function rtw_os_recvbuf_resource_free()
  staging: rtl8188eu: Remove unused inline function recvframe_push()
  staging: rtl8188eu: Remove unused inline function get_rx_status()
  staging: rtl8188eu: Remove 'void  *precvbuf' from struct recv_frame
  staging: rtl8188eu: Remove 'int frame_tag' from struct recv_frame
  staging: rtl8188eu: Remove 'u8 fragcnt' from struct recv_frame

 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c|2 --
 drivers/staging/rtl8188eu/core/rtw_recv.c|8 -
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c   |2 +-
 drivers/staging/rtl8188eu/hal/usb_ops_linux.c|1 -
 drivers/staging/rtl8188eu/include/recv_osdep.h   |4 ---
 drivers/staging/rtl8188eu/include/rtw_recv.h |   36 --
 drivers/staging/rtl8188eu/os_dep/recv_linux.c|   25 ---
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c |7 -
 8 files changed, 1 insertion(+), 84 deletions(-)

--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/7] ARM: sun6i: dt: Add support for the USB controllers

2014-05-06 Thread Maxime Ripard
The A31 has two ECHI/OHCI controllers, and one OHCI-only phy-less controller.

Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun6i-a31.dtsi | 77 
 1 file changed, 77 insertions(+)

diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 13aa56ed5858..5e9f01af6d99 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -341,6 +341,83 @@
status = "disabled";
};
 
+   usbphy: phy@01c19400 {
+   compatible = "allwinner,sun6i-a31-usb-phy";
+   reg = <0x01c19400 0x10>,
+ <0x01c1a800 0x4>,
+ <0x01c1b800 0x4>;
+   reg-names = "phy_ctrl",
+   "pmu1",
+   "pmu2";
+   clocks = <_clk 8>,
+<_clk 9>,
+<_clk 10>;
+   clock-names = "usb0_phy",
+ "usb1_phy",
+ "usb2_phy";
+   resets = <_clk 0>,
+<_clk 1>,
+<_clk 2>;
+   reset-names = "usb0_reset",
+ "usb1_reset",
+ "usb2_reset";
+   status = "disabled";
+   #phy-cells = <1>;
+   };
+
+   ehci0: usb@01c1a000 {
+   compatible = "allwinner,sun6i-a31-ehci", "generic-ehci";
+   reg = <0x01c1a000 0x100>;
+   interrupts = <0 72 4>;
+   clocks = <_gates 26>;
+   resets = <_rst 26>;
+   phys = < 1>;
+   phy-names = "usb";
+   status = "disabled";
+   };
+
+   ohci0: usb@01c1a400 {
+   compatible = "allwinner,sun6i-a31-ohci", "generic-ohci";
+   reg = <0x01c1a400 0x100>;
+   interrupts = <0 73 4>;
+   clocks = <_gates 29>, <_clk 16>;
+   resets = <_rst 29>;
+   phys = < 1>;
+   phy-names = "usb";
+   status = "disabled";
+   };
+
+   ehci1: usb@01c1b000 {
+   compatible = "allwinner,sun6i-a31-ehci", "generic-ehci";
+   reg = <0x01c1b000 0x100>;
+   interrupts = <0 74 4>;
+   clocks = <_gates 27>;
+   resets = <_rst 27>;
+   phys = < 2>;
+   phy-names = "usb";
+   status = "disabled";
+   };
+
+   ohci1: usb@01c1b400 {
+   compatible = "allwinner,sun6i-a31-ohci", "generic-ohci";
+   reg = <0x01c1b400 0x100>;
+   interrupts = <0 75 4>;
+   clocks = <_gates 30>, <_clk 17>;
+   resets = <_rst 30>;
+   phys = < 2>;
+   phy-names = "usb";
+   status = "disabled";
+   };
+
+   ohci2: usb@01c1c000 {
+   compatible = "allwinner,sun6i-a31-ohci", "generic-ohci";
+   reg = <0x01c1c400 0x100>;
+   interrupts = <0 77 4>;
+   clocks = <_gates 31>, <_clk 18>;
+   resets = <_rst 31>;
+   status = "disabled";
+   };
+
pio: pinctrl@01c20800 {
compatible = "allwinner,sun6i-a31-pinctrl";
reg = <0x01c20800 0x400>;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/7] usb: ehci-platform: add optional reset controller retrieval

2014-05-06 Thread Maxime Ripard
From: Boris BREZILLON 

On the Allwinner's A31 SoC the reset line connected to the EHCI IP has to
be deasserted for the EHCI block to be usable.

Add support for an optional reset controller that will be deasserted on
power off and asserted on power on.

Signed-off-by: Boris BREZILLON 
Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/usb/usb-ehci.txt |  1 +
 drivers/usb/host/ehci-platform.c   | 25 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/usb-ehci.txt 
b/Documentation/devicetree/bindings/usb/usb-ehci.txt
index ff151ec084c4..43c1a4e06767 100644
--- a/Documentation/devicetree/bindings/usb/usb-ehci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-ehci.txt
@@ -15,6 +15,7 @@ Optional properties:
  - clocks : a list of phandle + clock specifier pairs
  - phys : phandle + phy specifier pair
  - phy-names : "usb"
+ - resets : phandle + reset specifier pair
 
 Example (Sequoia 440EPx):
 ehci@e300 {
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index c7dd93aad20c..4ee67728e443 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,6 +42,7 @@
 
 struct ehci_platform_priv {
struct clk *clks[EHCI_MAX_CLKS];
+   struct reset_control *rst;
struct phy *phy;
 };
 
@@ -84,10 +86,16 @@ static int ehci_platform_power_on(struct platform_device 
*dev)
goto err_disable_clks;
}
 
+   if (priv->rst) {
+   ret = reset_control_deassert(priv->rst);
+   if (ret)
+   goto err_disable_clks;
+   }
+
if (priv->phy) {
ret = phy_init(priv->phy);
if (ret)
-   goto err_disable_clks;
+   goto err_assert_rst;
 
ret = phy_power_on(priv->phy);
if (ret)
@@ -98,6 +106,9 @@ static int ehci_platform_power_on(struct platform_device 
*dev)
 
 err_exit_phy:
phy_exit(priv->phy);
+err_assert_rst:
+   if (priv->rst)
+   reset_control_assert(priv->rst);
 err_disable_clks:
while (--clk >= 0)
clk_disable_unprepare(priv->clks[clk]);
@@ -119,6 +130,9 @@ static void ehci_platform_power_off(struct platform_device 
*dev)
for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--)
if (priv->clks[clk])
clk_disable_unprepare(priv->clks[clk]);
+
+   if (priv->rst)
+   reset_control_assert(priv->rst);
 }
 
 static struct hc_driver __read_mostly ehci_platform_hc_driver;
@@ -206,6 +220,15 @@ static int ehci_platform_probe(struct platform_device *dev)
break;
}
}
+
+   priv->rst = devm_reset_control_get_optional(>dev,
+   NULL);
+   if (IS_ERR(priv->rst)) {
+   err = PTR_ERR(priv->rst);
+   if (err ==  -EPROBE_DEFER)
+   goto err_put_clks;
+   priv->rst = NULL;
+   }
}
 
if (pdata->big_endian_desc)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/7] usb: ohci-platform: Enable optional use of reset controller

2014-05-06 Thread Maxime Ripard
The OHCI controllers used in the Allwinner A31 are asserted in reset using a
global reset controller.

Add optional support for such a controller in the OHCI platform driver.

Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/usb/usb-ohci.txt |  1 +
 drivers/usb/host/ohci-platform.c   | 25 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt 
b/Documentation/devicetree/bindings/usb/usb-ohci.txt
index 45f67d91e888..b968a1aea995 100644
--- a/Documentation/devicetree/bindings/usb/usb-ohci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-ohci.txt
@@ -12,6 +12,7 @@ Optional properties:
 - clocks : a list of phandle + clock specifier pairs
 - phys : phandle + phy specifier pair
 - phy-names : "usb"
+- resets : phandle + reset specifier pair
 
 Example:
 
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index b6002c951c5c..55f6c87628eb 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,7 @@
 
 struct ohci_platform_priv {
struct clk *clks[OHCI_MAX_CLKS];
+   struct reset_control *rst;
struct phy *phy;
 };
 
@@ -67,10 +69,16 @@ static int ohci_platform_power_on(struct platform_device 
*dev)
goto err_disable_clks;
}
 
+   if (priv->rst) {
+   ret = reset_control_deassert(priv->rst);
+   if (ret)
+   goto err_disable_clks;
+   }
+
if (priv->phy) {
ret = phy_init(priv->phy);
if (ret)
-   goto err_disable_clks;
+   goto err_assert_rst;
 
ret = phy_power_on(priv->phy);
if (ret)
@@ -81,6 +89,9 @@ static int ohci_platform_power_on(struct platform_device *dev)
 
 err_exit_phy:
phy_exit(priv->phy);
+err_assert_rst:
+   if (priv->rst)
+   reset_control_assert(priv->rst);
 err_disable_clks:
while (--clk >= 0)
clk_disable_unprepare(priv->clks[clk]);
@@ -99,6 +110,9 @@ static void ohci_platform_power_off(struct platform_device 
*dev)
phy_exit(priv->phy);
}
 
+   if (priv->rst)
+   reset_control_assert(priv->rst);
+
for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
if (priv->clks[clk])
clk_disable_unprepare(priv->clks[clk]);
@@ -191,6 +205,15 @@ static int ohci_platform_probe(struct platform_device *dev)
break;
}
}
+
+   priv->rst = devm_reset_control_get_optional(>dev,
+   NULL);
+   if (IS_ERR(priv->rst)) {
+   err = PTR_ERR(priv->rst);
+   if (err ==  -EPROBE_DEFER)
+   goto err_put_clks;
+   priv->rst = NULL;
+   }
}
 
if (pdata->big_endian_desc)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/7] clk: sunxi: Implement A31 USB clock

2014-05-06 Thread Maxime Ripard
The A31 USB clock slightly differ from its older counterparts, mostly because
it has a different gate for each PHY, while the older one had a single gate for
all the phy.

Signed-off-by: Maxime Ripard 
---
 drivers/clk/sunxi/clk-sunxi.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index bd7dc733c1ca..d9bab75f128b 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -972,6 +972,11 @@ static const struct gates_data sun5i_a13_usb_gates_data 
__initconst = {
.reset_mask = 0x03,
 };
 
+static const struct gates_data sun6i_a31_usb_gates_data __initconst = {
+   .mask = { BIT(18) | BIT(17) | BIT(16) | BIT(10) | BIT(9) | BIT(8) },
+   .reset_mask = BIT(2) | BIT(1) | BIT(0),
+};
+
 static void __init sunxi_gates_clk_setup(struct device_node *node,
 struct gates_data *data)
 {
@@ -1267,6 +1272,7 @@ static const struct of_device_id clk_gates_match[] 
__initconst = {
{.compatible = "allwinner,sun6i-a31-apb2-gates-clk", .data = 
_a31_apb2_gates_data,},
{.compatible = "allwinner,sun4i-a10-usb-clk", .data = 
_a10_usb_gates_data,},
{.compatible = "allwinner,sun5i-a13-usb-clk", .data = 
_a13_usb_gates_data,},
+   {.compatible = "allwinner,sun6i-a31-usb-clk", .data = 
_a31_usb_gates_data,},
{}
 };
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/7] ARM: sun6i: Add the USB clocks to the DTSI.

2014-05-06 Thread Maxime Ripard
The USB clocks of the A31 seems to be parented to the 24MHz oscillator, and
handle the clocks for the USB phys and OHCI devices.

Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun6i-a31.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index eec1afa257a5..13aa56ed5858 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -269,6 +269,17 @@
clocks = <>, <>;
clock-output-names = "spi3";
};
+
+   usb_clk: clk@01c200cc {
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   compatible = "allwinner,sun6i-a31-usb-clk";
+   reg = <0x01c200cc 0x4>;
+   clocks = <>;
+   clock-output-names = "usb_phy0", "usb_phy1", "usb_phy2",
+"usb_ohci0", "usb_ohci1",
+"usb_ohci2";
+   };
};
 
soc@01c0 {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the drm tree with the drm-intel-fixes tree

2014-05-06 Thread Stephen Rothwell
Hi Dave,

Today's linux-next merge of the drm tree got a conflict in
drivers/gpu/drm/i915/i915_gem_gtt.c between commit cfa7c862982b
("drm/i915: Sanitize the enable_ppgtt module option once") from the
drm-intel-fixes tree and commit 5db6c735ead5 ("drm/i915: dmesg output for
VT-d testing") from the drm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc drivers/gpu/drm/i915/i915_gem_gtt.c
index 154b0f8bb88d,0d514ff9b94c..
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@@ -62,62 -48,13 +62,9 @@@ static int sanitize_enable_ppgtt(struc
}
  #endif
  
 -  /* Full ppgtt disabled by default for now due to issues. */
 -  if (full)
 -  return HAS_PPGTT(dev) && (i915.enable_ppgtt == 2);
 -  else
 -  return HAS_ALIASING_PPGTT(dev);
 +  return HAS_ALIASING_PPGTT(dev) ? 1 : 0;
  }
  
- #define GEN6_PPGTT_PD_ENTRIES 512
- #define I915_PPGTT_PT_ENTRIES (PAGE_SIZE / sizeof(gen6_gtt_pte_t))
- typedef uint64_t gen8_gtt_pte_t;
- typedef gen8_gtt_pte_t gen8_ppgtt_pde_t;
- 
- /* PPGTT stuff */
- #define GEN6_GTT_ADDR_ENCODE(addr)((addr) | (((addr) >> 28) & 0xff0))
- #define HSW_GTT_ADDR_ENCODE(addr) ((addr) | (((addr) >> 28) & 0x7f0))
- 
- #define GEN6_PDE_VALID(1 << 0)
- /* gen6+ has bit 11-4 for physical addr bit 39-32 */
- #define GEN6_PDE_ADDR_ENCODE(addr)GEN6_GTT_ADDR_ENCODE(addr)
- 
- #define GEN6_PTE_VALID(1 << 0)
- #define GEN6_PTE_UNCACHED (1 << 1)
- #define HSW_PTE_UNCACHED  (0)
- #define GEN6_PTE_CACHE_LLC(2 << 1)
- #define GEN7_PTE_CACHE_L3_LLC (3 << 1)
- #define GEN6_PTE_ADDR_ENCODE(addr)GEN6_GTT_ADDR_ENCODE(addr)
- #define HSW_PTE_ADDR_ENCODE(addr) HSW_GTT_ADDR_ENCODE(addr)
- 
- /* Cacheability Control is a 4-bit value. The low three bits are stored in *
-  * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
-  */
- #define HSW_CACHEABILITY_CONTROL(bits)bits) & 0x7) << 1) | \
-(((bits) & 0x8) << (11 - 3)))
- #define HSW_WB_LLC_AGE3   HSW_CACHEABILITY_CONTROL(0x2)
- #define HSW_WB_LLC_AGE0   HSW_CACHEABILITY_CONTROL(0x3)
- #define HSW_WB_ELLC_LLC_AGE0  HSW_CACHEABILITY_CONTROL(0xb)
- #define HSW_WB_ELLC_LLC_AGE3  HSW_CACHEABILITY_CONTROL(0x8)
- #define HSW_WT_ELLC_LLC_AGE0  HSW_CACHEABILITY_CONTROL(0x6)
- #define HSW_WT_ELLC_LLC_AGE3  HSW_CACHEABILITY_CONTROL(0x7)
- 
- #define GEN8_PTES_PER_PAGE(PAGE_SIZE / sizeof(gen8_gtt_pte_t))
- #define GEN8_PDES_PER_PAGE(PAGE_SIZE / sizeof(gen8_ppgtt_pde_t))
- 
- /* GEN8 legacy style addressis defined as a 3 level page table:
-  * 31:30 | 29:21 | 20:12 |  11:0
-  * PDPE  |  PDE  |  PTE  | offset
-  * The difference as compared to normal x86 3 level page table is the PDPEs 
are
-  * programmed via register.
-  */
- #define GEN8_PDPE_SHIFT   30
- #define GEN8_PDPE_MASK0x3
- #define GEN8_PDE_SHIFT21
- #define GEN8_PDE_MASK 0x1ff
- #define GEN8_PTE_SHIFT12
- #define GEN8_PTE_MASK 0x1ff
- 
- #define PPAT_UNCACHED_INDEX   (_PAGE_PWT | _PAGE_PCD)
- #define PPAT_CACHED_PDE_INDEX 0 /* WB LLC */
- #define PPAT_CACHED_INDEX _PAGE_PAT /* WB LLCeLLC */
- #define PPAT_DISPLAY_ELLC_INDEX   _PAGE_PCD /* WT eLLC */
  
  static void ppgtt_bind_vma(struct i915_vma *vma,
   enum i915_cache_level cache_level,
@@@ -2041,15 -1962,11 +1972,20 @@@ int i915_gem_gtt_init(struct drm_devic
 gtt->base.total >> 20);
DRM_DEBUG_DRIVER("GMADR size = %ldM\n", gtt->mappable_end >> 20);
DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n", gtt->stolen_size >> 20);
 +  /*
 +   * i915.enable_ppgtt is read-only, so do an early pass to validate the
 +   * user's requested state against the hardware/driver capabilities.  We
 +   * do this now so that we can print out any log messages once rather
 +   * than every time we check intel_enable_ppgtt().
 +   */
 +  i915.enable_ppgtt = sanitize_enable_ppgtt(dev, i915.enable_ppgtt);
 +  DRM_DEBUG_DRIVER("ppgtt mode: %i\n", i915.enable_ppgtt);
 +
+ #ifdef CONFIG_INTEL_IOMMU
+   if (intel_iommu_gfx_mapped)
+   DRM_INFO("VT-d active for gfx access\n");
+ #endif
+ 
return 0;
  }
  


pgpZHFdC6cko7.pgp
Description: PGP signature


[PATCH] ARM: tegra: enable console framebuffer rotation

2014-05-06 Thread Alexandre Courbot
Console rotation is needed for devices like Tegra Note 7 and NVIDIA
SHIELD to get the boot console in the expected orientation.

Signed-off-by: Alexandre Courbot 
---
 arch/arm/configs/tegra_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index c706d399557b..e2441e286822 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -183,6 +183,7 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y
 # CONFIG_BACKLIGHT_GENERIC is not set
 CONFIG_BACKLIGHT_PWM=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_LOGO=y
 CONFIG_SOUND=y
 CONFIG_SND=y
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: i.MX28 based system losing eth0 on boot

2014-05-06 Thread Fabio Estevam
Brian,

On Tue, May 6, 2014 at 1:44 PM, Brian Lilly  wrote:
> Uwe:
>
> With commit a264b981f2c76e281ef27e7232774bf6c54ec865 we're having eth0
> come up, then brought right back down with an MDIO rx timeout moments
> after.  Adding back in the removed code keeps the interface alive and
> it's working afterward without trouble.  I've tested the re-inserted
> code in 3.12, 3.14 without issue on our boards.
>
> Is there something else that can be done to prevent the MDIO timeouts?
> We are using basically the same schematic for networking as the
> imx28evk.
>
> Any thoughts on how to resolve this?

Could you try the latest Russell's FEC patches available at?
 http://ftp.arm.linux.org.uk/cgit/linux-arm.git/log/?h=fec-testing

In particular this one could help with your "MDIO timeout" issue:
http://ftp.arm.linux.org.uk/cgit/linux-arm.git/commit/?h=fec-testing=ec1fac3de70b16c69d3edc9f223e91d56b1915de
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC][PATCH v2] tracing: Add __bitmask() macro to trace events to cpumasks and other bitmasks

2014-05-06 Thread Steven Rostedt

Being able to show a cpumask of events can be useful as some events
may affect only some CPUs. There is no standard way to record the
cpumask and converting it to a string is rather expensive during
the trace as traces happen in hotpaths. It would be better to record
the raw event mask and be able to parse it at print time.

The following macros were added for use with the TRACE_EVENT() macro:

  __bitmask()
  __assign_bitmask()
  __get_bitmask()

To test this, I added this to the sched_migrate_task event, which
looked like this:

TRACE_EVENT(sched_migrate_task,

TP_PROTO(struct task_struct *p, int dest_cpu, const struct cpumask 
*cpus),

TP_ARGS(p, dest_cpu, cpus),

TP_STRUCT__entry(
__array(char,   comm,   TASK_COMM_LEN   )
__field(pid_t,  pid )
__field(int,prio)
__field(int,orig_cpu)
__field(int,dest_cpu)
__bitmask(  cpumask, cpus   )
),

TP_fast_assign(
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
__entry->pid= p->pid;
__entry->prio   = p->prio;
__entry->orig_cpu   = task_cpu(p);
__entry->dest_cpu   = dest_cpu;
__assign_bitmask(cpumask, cpumask_bits(cpus));
),

TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d cpumask=%s",
  __entry->comm, __entry->pid, __entry->prio,
  __entry->orig_cpu, __entry->dest_cpu,
  __get_bitmask(cpumask))
);

With the output of:

ksmtuned-3613  [003] d..2   485.220508: sched_migrate_task: 
comm=ksmtuned pid=3615 prio=120 orig_cpu=3 dest_cpu=2 cpumask=,000f
 migration/1-13[001] d..5   485.221202: sched_migrate_task: 
comm=ksmtuned pid=3614 prio=120 orig_cpu=1 dest_cpu=0 cpumask=,000f
 awk-3615  [002] d.H5   485.221747: sched_migrate_task: 
comm=rcu_preempt pid=7 prio=120 orig_cpu=0 dest_cpu=1 cpumask=,00ff
 migration/2-18[002] d..5   485.222062: sched_migrate_task: 
comm=ksmtuned pid=3615 prio=120 orig_cpu=2 dest_cpu=3 cpumask=,000f

Link: 
http://lkml.kernel.org/r/1399377998-14870-6-git-send-email-javi.mer...@arm.com

Suggested-by: Javi Merino 
Signed-off-by: Steven Rostedt 
---

Changes since v1: Use bitmask name instead of cpumask naming.

---
 include/linux/ftrace_event.h |  3 +++
 include/linux/trace_seq.h| 10 
 include/trace/ftrace.h   | 57 +++-
 kernel/trace/trace_output.c  | 41 +++
 4 files changed, 110 insertions(+), 1 deletion(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index d16da3e..cff3106 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -38,6 +38,9 @@ const char *ftrace_print_symbols_seq_u64(struct trace_seq *p,
 *symbol_array);
 #endif
 
+const char *ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
+unsigned int bitmask_size);
+
 const char *ftrace_print_hex_seq(struct trace_seq *p,
 const unsigned char *buf, int len);
 
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index a32d86e..1361169 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -46,6 +46,9 @@ extern int trace_seq_putmem_hex(struct trace_seq *s, const 
void *mem,
 extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
 extern int trace_seq_path(struct trace_seq *s, const struct path *path);
 
+extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
+int nmaskbits);
+
 #else /* CONFIG_TRACING */
 static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
 {
@@ -57,6 +60,13 @@ trace_seq_bprintf(struct trace_seq *s, const char *fmt, 
const u32 *binary)
return 0;
 }
 
+static inline int
+trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
+ int nmaskbits)
+{
+   return 0;
+}
+
 static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
 {
return 0;
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 0a1a4f7..d9c44af 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -53,6 +53,9 @@
 #undef __string
 #define __string(item, src) __dynamic_array(char, item, -1)
 
+#undef __bitmask
+#define __bitmask(item, src) __dynamic_array(char, item, -1)
+
 #undef TP_STRUCT__entry
 #define TP_STRUCT__entry(args...) args
 
@@ -128,6 +131,9 @@
 #undef __string
 #define __string(item, src) __dynamic_array(char, item, -1)
 
+#undef __string
+#define __string(item, 

[RFA][PATCH v2] tracing: Add trace__enabled() function

2014-05-06 Thread Steven Rostedt

There are some code paths in the kernel that need to do some preparations
before it calls a tracepoint. As that code is worthless overhead when
the tracepoint is not enabled, it would be prudent to have that code
only run when the tracepoint is active. To accomplish this, all tracepoints
now get a static inline function called "trace__enabled()"
which returns true when the tracepoint is enabled and false otherwise.

As an added bonus, that function uses the static_key of the tracepoint
such that no branch is needed.

  if (trace_mytracepoint_enabled()) {
arg = process_tp_arg();
trace_mytracepoint(arg);
  }

Will keep the "process_tp_arg()" (which may be expensive to run) from
being executed when the tracepoint isn't enabled.

It's best to encapsulate the tracepoint itself in the if statement
just to keep races. For example, if you had:

  if (trace_mytracepoint_enabled())
arg = process_tp_arg();
  trace_mytracepoint(arg);

There's a chance that the tracepoint could be enabled just after the
if statement, and arg will be undefined when calling the tracepoint.

Link: http://lkml.kernel.org/r/20140506094407.507b6...@gandalf.local.home

Signed-off-by: Steven Rostedt 
---
Changes since v1: Added some documentation about using this function.
---
 Documentation/trace/tracepoints.txt | 24 
 include/linux/tracepoint.h  | 10 ++
 2 files changed, 34 insertions(+)

diff --git a/Documentation/trace/tracepoints.txt 
b/Documentation/trace/tracepoints.txt
index 6b018b5..a3efac6 100644
--- a/Documentation/trace/tracepoints.txt
+++ b/Documentation/trace/tracepoints.txt
@@ -115,6 +115,30 @@ If the tracepoint has to be used in kernel modules, an
 EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be
 used to export the defined tracepoints.
 
+If you need to do a bit of work for a tracepoint parameter, and
+that work is only used for the tracepoint, that work can be encapsulated
+within an if statement with the following:
+
+   if (trace_foo_bar_enabled()) {
+   int i;
+   int tot = 0;
+
+   for (i = 0; i < count; i++)
+   tot += calculate_nuggets();
+
+   trace_foo_bar(tot);
+   }
+
+All trace_() calls have a matching trace__enabled()
+function defined that returns true if the tracepoint is enabled and
+false otherwise. The trace_() should always be within the
+block of the if (trace__enabled()) to prevent races between
+the tracepoint being enabled and the check being seen.
+
+The advantage of using the trace__enabled() is that it uses
+the static_key of the tracepoint to allow the if statement to be implemented
+with jump labels and avoid conditional branches.
+
 Note: The convenience macro TRACE_EVENT provides an alternative way to
   define tracepoints. Check http://lwn.net/Articles/379903,
   http://lwn.net/Articles/381064 and http://lwn.net/Articles/383362
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 9d30ee4..2e2a5f7 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -185,6 +185,11 @@ extern void syscall_unregfunc(void);
static inline void  \
check_trace_callback_type_##name(void (*cb)(data_proto))\
{   \
+   }   \
+   static inline bool  \
+   trace_##name##_enabled(void)\
+   {   \
+   return static_key_false(&__tracepoint_##name.key);  \
}
 
 /*
@@ -230,6 +235,11 @@ extern void syscall_unregfunc(void);
}   \
static inline void check_trace_callback_type_##name(void 
(*cb)(data_proto)) \
{   \
+   }   \
+   static inline bool  \
+   trace_##name##_enabled(void)\
+   {   \
+   return false;   \
}
 
 #define DEFINE_TRACE_FN(name, reg, unreg)
-- 
1.8.1.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHSET 00/17] perf report: Add -F option for specifying output fields (v4)

2014-05-06 Thread Namhyung Kim
Hi Jiri,

On Sun, 4 May 2014 19:53:34 +0200, Jiri Olsa wrote:
> On Wed, Apr 16, 2014 at 12:05:37PM +0900, Namhyung Kim wrote:
>
> SNIP
>
>> 
>>  * changes in v4:
>>   - fix a tui navigation bug
>>   - fix a bug in output change of perf diff
>>   - move call to perf_hpp__init() out of setup_browser()
>>   - fix alignment of some output fields on stdio
>> 
>>  * changes in v3:
>>   - rename to --fields option for consistency  (David)
>>   - prevent to add same keys multiple times
>>   - change dso sorting to show unknown dsos last
>>   - fix minor bugs
>> 
>>  * changes in v2:
>>   - add a cleanup patch using ui__has_annotation()
>>   - cleanup default sort order managment
>>   - support perf top also
>>   - handle elided sort entries properly
>>   - add Acked-by's from Ingo
>> 
>> 
>> I pushed the patch series on the 'perf/field-v4' branch in my tree
>> 
>>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
>
> hi,
> I tried to merge this with my latest perf/core and got
> some conflicts. Looks like it's missing the latest hist
> code changes.. could you please rebase?

I can do it maybe next week.  But I need to think about the
grouping/hierarchy concept that Don suggested beforehand.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: i.MX28 based system losing eth0 on boot

2014-05-06 Thread Florian Fainelli
2014-05-06 15:27 GMT-07:00 Brian Lilly :
> It would appear that I don't have that commit.  I could move to 3.14
> to see if it makes a difference, but the last couple of responses have
> been on 3.12.18 -- or perhaps I'm missing something else.

I did miss that you were also seeing the problem in 3.12. At that
point, I believe that the driver was working around a potential PHY
bug that is not covered by the SMSC PHY driver, or that the MDIO
timeout is simply not long enough, or that your MDIO interrupts fire
much longer than what the timeout allows, or that these interrupts are
not reliable.

You could probably try to ignore the timeout and see if you get
sensible data out of the MDIO bus regardless.

> Please let me know if you have any questions.
>
> Thank you.
>
> Brian Lilly
> Crystalfontz America, Incorporated
> 12412 East Saltese Road
> Spokane Valley, WA 99216
> br...@crystalfontz.com http://www.crystalfontz.com
> Twitter: @Crystalfontz
> US toll-free (888) 206-9720 voice (509) 892-1200
>
>
> On Tue, May 6, 2014 at 3:06 PM, Florian Fainelli  wrote:
>> 2014-05-06 14:40 GMT-07:00 Brian Lilly :
>>> The PHY on board is the SMSC LAN8720
>>>
>>> With the generic PHY driver selected:  http://pastebin.com/A4MH4Ptw
>>>
>>> [   28.828761] fec 800f.ethernet eth0: Freescale FEC PHY driver
>>> [Generic PHY] (mii_bus:phy_addr=800f.etherne:00, irq=-1)
>>> [   28.840626] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>>> [   30.827536] libphy: 800f.etherne:00 - Link is Up - 100/Full
>>> [   30.833739] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
>>> [   32.986999] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
>>> [   37.316421] fec 800f.ethernet eth0: Freescale FEC PHY driver
>>> [Generic PHY] (mii_bus:phy_addr=800f.etherne:00, irq=-1)
>>> [   38.345047] fec 800f.ethernet eth0: MDIO read timeout
>>> [   39.506210] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>>> [   40.374961] fec 800f.ethernet eth0: MDIO read timeout
>>>
>>> With the SMSC PHY driver selected:  http://pastebin.com/DhdDyrMv
>>>
>>> [   28.778974] fec 800f.ethernet eth0: Freescale FEC PHY driver
>>> [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=800f.etherne:00, irq=-1)
>>> [   28.791742] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>>> [   30.773078] libphy: 800f.etherne:00 - Link is Up - 100/Full
>>> [   30.779286] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
>>> [   32.934692] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
>>> [   37.242162] fec 800f.ethernet eth0: Freescale FEC PHY driver
>>> [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=800f.etherne:00, irq=-1)
>>> [   38.270611] fec 800f.ethernet eth0: MDIO read timeout
>>> [   39.415256] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
>>> [   40.300454] fec 800f.ethernet eth0: MDIO read timeout
>>
>> Thanks for trying this, at least this is consistent no matter which
>> PHY driver we are using. Just to rule out a potential PHY power-down
>> issue, could you try to revert the following commit
>> be9dad1f9f26604fb71c0d53ccb39a8f1d425807 ("net: phy: suspend phydev
>> when going to HALTED") and see if that works better for you?
>>
>> Thanks!
>>
>>>
>>> On Tue, May 6, 2014 at 12:24 PM, Florian Fainelli  
>>> wrote:
 2014-05-06 12:12 GMT-07:00 Brian Lilly :
> It is happening during boot up:
>
> 
>
> Configuring network interfaces... [   35.117114] fec 800f.ethernet
> eth0: Freescale FEC PHY driver [SMSC LAN8710/LAN8720]

 Note that the SMSC PHY driver is picked up here, and that specific
 driver implements a different phy_read_status() callback due to how
 the PHY operates. The PHY driver also overrides the config_init()
 callback to perform some PHY-specific initialization. See below for
 more.

> (mii_bus:phy_addr=800f.etherne:00, irq=-1)
> [   35.129967] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> udhcpc (v1.21.1) started
>
> Sending discover...
>
> [   37.113901] libphy: 800f.etherne:00 - Link is Up - 100/Full
> [   37.120134] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> Sending discover...
>
> Sending select for 10.10.10.217...
> Lease of 10.10.10.217 obtained, lease time 86400
> /etc/udhcpc.d/50default: Adding DNS 10.10.10.13
> [   39.319957] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
> done.
> Starting rpcbind daemon...done.
> net.ipv4.conf.default.rp_filter = 1
> net.ipv4.conf.all.rp_filter = 1
> Mon Apr 14 22:40:00 UTC 2014
> INIT: Entering runlevel: 5
> Starting Xserver
> Starting system message bus: dbus.
> Starting Connection Manager
> Starting wpa_supplicant
> Successfully initialized wpa_supplicant
> Starting Dropbear SSH server
> [   44.754915] fec 800f.ethernet eth0: Freescale FEC PHY driver
> [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=800f.etherne:00, irq=-1)

 The 

Re: [PATCHSET 00/17] perf report: Add -F option for specifying output fields (v4)

2014-05-06 Thread Namhyung Kim
Hi Don,

On Wed, 30 Apr 2014 09:35:55 -0400, Don Zickus wrote:
> On Wed, Apr 30, 2014 at 08:38:10AM +0900, Namhyung Kim wrote:
>> Hi Don,
>> 
>> On Tue, 29 Apr 2014 13:27:35 -0400, Don Zickus wrote:
>> > On Tue, Apr 29, 2014 at 10:13:35AM +0900, Namhyung Kim wrote:
>> >> >/*
>> >> > * Addresses with no major/minor numbers are assumed to be
>> >> > * anonymous in userspace.  Sort those on pid then address.
>> >> > *
>> >> > * The kernel and non-zero major/minor mapped areas are
>> >> > * assumed to be unity mapped.  Sort those on address.
>> >> > */
>> >> >
>> >> >if ((left->cpumode != PERF_RECORD_MISC_KERNEL) &&
>> >> >!l_map->maj && !l_map->min && !l_map->ino &&
>> >> >!l_map->ino_generation) {
>> >> >/* userspace anonymous */
>> >> >
>> >> >if (left->thread->pid_ > right->thread->pid_) return -1;
>> >> >if (left->thread->pid_ < right->thread->pid_) return 1;
>> >> 
>> >> Isn't it necessary to check whether the address is in a same map in case
>> >> of anon pages?  I mean the daddr.al_addr is a map-relative offset so it
>> >> might have same value for different maps.
>> >
>> > That's why I sort on pids here.  Because the anon address might have the
>> > same value for different maps.  The thought was to group all the pid
>> > addresses together to keep things seperated.
>> >
>> > Do you see a different way to solve the problem?  I am not sure al_addr
>> > vs. addr will make much difference here.
>> 
>> I'm not saying to get rid of the pid check, I'm saying that it might
>> need to add another check for maps (i.e. start address) as there might
>> be many maps in a single address space.
>
> Hmm, I guess I would need to see an example.  While I agree there might be
> many maps in a single address space (/proc//maps demonstrates that),
> I understood them to map to a unique location (ie no overlap) unless they
> are shared.
>
> I am willing to believe I missed scenario when sorting, I just can't think
> of it (so I wouldn't know how to fix it).  That's why I was looking for an
> example to make it more obvious to me.  Sorry for being slow..

I'm also sorry for being late.  Looking at the code, it seems to use
identity__map_ip() for anon maps so my concern is bogus.  Please just
forget about it and keep going.  Sorry for interrupting your work..

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/6] ARM: sunxi: Remove reset code from the platform

2014-05-06 Thread Maxime Ripard
Now that reset is handled either by the watchdog driver for the sun4i, sun5i
and sun7i, and by a driver of its own for sun6i, we can remove it from the
platform code.

Signed-off-by: Maxime Ripard 
Acked-by: Arnd Bergmann 
---
 arch/arm/mach-sunxi/sunxi.c | 98 -
 1 file changed, 98 deletions(-)

diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 460b5a4962ef..1c62a0a021d7 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -12,109 +12,14 @@
 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
 
 #include 
-#include 
-#include 
 
 #include "common.h"
 
-#define SUN4I_WATCHDOG_CTRL_REG0x00
-#define SUN4I_WATCHDOG_CTRL_RESTARTBIT(0)
-#define SUN4I_WATCHDOG_MODE_REG0x04
-#define SUN4I_WATCHDOG_MODE_ENABLE BIT(0)
-#define SUN4I_WATCHDOG_MODE_RESET_ENABLE   BIT(1)
-
-#define SUN6I_WATCHDOG1_IRQ_REG0x00
-#define SUN6I_WATCHDOG1_CTRL_REG   0x10
-#define SUN6I_WATCHDOG1_CTRL_RESTART   BIT(0)
-#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
-#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
-#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
-#define SUN6I_WATCHDOG1_MODE_REG   0x18
-#define SUN6I_WATCHDOG1_MODE_ENABLEBIT(0)
-
-static void __iomem *wdt_base;
-
-static void sun4i_restart(enum reboot_mode mode, const char *cmd)
-{
-   if (!wdt_base)
-   return;
-
-   /* Enable timer and set reset bit in the watchdog */
-   writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
-  wdt_base + SUN4I_WATCHDOG_MODE_REG);
-
-   /*
-* Restart the watchdog. The default (and lowest) interval
-* value for the watchdog is 0.5s.
-*/
-   writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG);
-
-   while (1) {
-   mdelay(5);
-   writel(SUN4I_WATCHDOG_MODE_ENABLE | 
SUN4I_WATCHDOG_MODE_RESET_ENABLE,
-  wdt_base + SUN4I_WATCHDOG_MODE_REG);
-   }
-}
-
-static void sun6i_restart(enum reboot_mode mode, const char *cmd)
-{
-   if (!wdt_base)
-   return;
-
-   /* Disable interrupts */
-   writel(0, wdt_base + SUN6I_WATCHDOG1_IRQ_REG);
-
-   /* We want to disable the IRQ and just reset the whole system */
-   writel(SUN6I_WATCHDOG1_CONFIG_RESTART,
-   wdt_base + SUN6I_WATCHDOG1_CONFIG_REG);
-
-   /* Enable timer. The default and lowest interval value is 0.5s */
-   writel(SUN6I_WATCHDOG1_MODE_ENABLE,
-   wdt_base + SUN6I_WATCHDOG1_MODE_REG);
-
-   /* Restart the watchdog. */
-   writel(SUN6I_WATCHDOG1_CTRL_RESTART,
-   wdt_base + SUN6I_WATCHDOG1_CTRL_REG);
-
-   while (1) {
-   mdelay(5);
-   writel(SUN6I_WATCHDOG1_MODE_ENABLE,
-   wdt_base + SUN6I_WATCHDOG1_MODE_REG);
-   }
-}
-
-static struct of_device_id sunxi_restart_ids[] = {
-   { .compatible = "allwinner,sun4i-a10-wdt" },
-   { .compatible = "allwinner,sun6i-a31-wdt" },
-   { /*sentinel*/ }
-};
-
-static void sunxi_setup_restart(void)
-{
-   struct device_node *np;
-
-   np = of_find_matching_node(NULL, sunxi_restart_ids);
-   if (WARN(!np, "unable to setup watchdog restart"))
-   return;
-
-   wdt_base = of_iomap(np, 0);
-   WARN(!wdt_base, "failed to map watchdog base address");
-}
-
 static void __init sunxi_dt_init(void)
 {
-   sunxi_setup_restart();
-
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
@@ -128,7 +33,6 @@ static const char * const sunxi_board_dt_compat[] = {
 DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
.init_machine   = sunxi_dt_init,
.dt_compat  = sunxi_board_dt_compat,
-   .restart= sun4i_restart,
 MACHINE_END
 
 static const char * const sun6i_board_dt_compat[] = {
@@ -148,7 +52,6 @@ DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
.init_machine   = sunxi_dt_init,
.init_time  = sun6i_timer_init,
.dt_compat  = sun6i_board_dt_compat,
-   .restart= sun6i_restart,
.smp= smp_ops(sun6i_smp_ops),
 MACHINE_END
 
@@ -160,5 +63,4 @@ static const char * const sun7i_board_dt_compat[] = {
 DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
.init_machine   = sunxi_dt_init,
.dt_compat  = sun7i_board_dt_compat,
-   .restart= sun4i_restart,
 MACHINE_END
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/6] ARM: sunxi: Add A31 reset driver to sunxi_defconfig

2014-05-06 Thread Maxime Ripard
Now that the A31 reset code is a driver of its own, we need it in the
defconfig.

Signed-off-by: Maxime Ripard 
---
 arch/arm/configs/sunxi_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index 81ba78eaf54a..e0c91b23fde7 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -52,6 +52,9 @@ CONFIG_I2C_MV64XXX=y
 CONFIG_SPI=y
 CONFIG_SPI_SUN6I=y
 CONFIG_GPIO_SYSFS=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_SUN6I=y
 # CONFIG_HWMON is not set
 CONFIG_WATCHDOG=y
 CONFIG_SUNXI_WATCHDOG=y
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] kmemleak on __radix_tree_preload

2014-05-06 Thread Jaegeuk Kim
Hi Johannes and Catalin,

Actually bisecting is the best way, but I failed to run fsstress with
early 3.15-rcX due to BUG_ONs in mm; recently it seems that most of
there-in issues have been resolved.

So I pulled the linus tree having:

commit 38583f095c5a8138ae2a1c9173d0fd8a9f10e8aa
Merge: 8169d30 3ca9e5d
Author: Linus Torvalds 
Date:   Tue May 6 13:07:41 2014 -0700

Merge branch 'akpm' (incoming from Andrew)

Merge misc fixes from Andrew Morton:
 "13 fixes"

And then when I tested again with Catalin's patch, it still throws the
following warning.
Is it false alarm?

unreferenced object 0x880004226da0 (size 576):
  comm "fsstress", pid 14590, jiffies 4295191259 (age 706.308s)
  hex dump (first 32 bytes):
01 00 00 00 81 ff ff ff 00 00 00 00 00 00 00 00  
50 89 34 81 ff ff ff ff b8 6d 22 04 00 88 ff ff  P.4..m".
  backtrace:
[] kmemleak_update_trace+0x58/0x80
[] radix_tree_node_alloc+0x77/0xa0
[] __radix_tree_create+0x1d8/0x230
[] __add_to_page_cache_locked+0x9c/0x1b0
[] add_to_page_cache_lru+0x28/0x80
[] grab_cache_page_write_begin+0x98/0xf0
[] f2fs_write_begin+0xb4/0x3c0 [f2fs]
[] generic_perform_write+0xc7/0x1c0
[] __generic_file_aio_write+0x1cd/0x3f0
[] generic_file_aio_write+0x5e/0xe0
[] do_sync_write+0x5a/0x90
[] vfs_write+0xc2/0x1d0
[] SyS_write+0x4f/0xb0
[] system_call_fastpath+0x16/0x1b
[] 0x


2014-05-01 (목), 14:41 -0400, Johannes Weiner:
> On Thu, May 01, 2014 at 06:06:10PM +0100, Catalin Marinas wrote:
> > On Fri, Apr 25, 2014 at 10:45:40AM +0900, Jaegeuk Kim wrote:
> > > 2. Bug
> > >  This is one of the results, but all the results indicate
> > > __radix_tree_preload.
> > > 
> > > unreferenced object 0x88002ae2a238 (size 576):
> > > comm "fsstress", pid 25019, jiffies 4295651360 (age 2276.104s)
> > > hex dump (first 32 bytes):
> > > 01 00 00 00 81 ff ff ff 00 00 00 00 00 00 00 00  
> > > 40 7d 37 81 ff ff ff ff 50 a2 e2 2a 00 88 ff ff  @}7.P..*
> > > backtrace:
> > >  [] kmemleak_alloc+0x26/0x50
> > >  [] kmem_cache_alloc+0xdc/0x190
> > >  [] __radix_tree_preload+0x49/0xc0
> > >  [] radix_tree_maybe_preload+0x21/0x30
> > >  [] add_to_page_cache_lru+0x3c/0xc0
> > >  [] grab_cache_page_write_begin+0x98/0xf0
> > >  [] f2fs_write_begin+0xa1/0x370 [f2fs]
> > >  [] generic_perform_write+0xc7/0x1e0
> > >  [] __generic_file_aio_write+0x1d0/0x400
> > >  [] generic_file_aio_write+0x60/0xe0
> > >  [] do_sync_write+0x5a/0x90
> > >  [] vfs_write+0xc5/0x1f0
> > >  [] SyS_write+0x52/0xb0
> > >  [] system_call_fastpath+0x16/0x1b
> > >  [] 0x
> > 
> > Do all the backtraces look like the above (coming from
> > add_to_page_cache_lru)?

Yap.

> > 
> > There were some changes in lib/radix-tree.c since 3.14, maybe you could
> > try reverting them and see if the leaks still appear (cc'ing Johannes).
> > It could also be a false positive.
> >
> > An issue with debugging such cases is that the preloading is common for
> > multiple radix trees, so the actual radix_tree_node_alloc() could be on
> > a different path. You could give the patch below a try to see what
> > backtrace you get (it updates backtrace in radix_tree_node_alloc()).
> 
> That patch makes a lot of sense to me.  I applied it locally but I am
> unable to reproduce this with page cache heavy workloads.  Jaegeuk?

-- 
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] rmap: validate pointer in anon_vma_clone

2014-05-06 Thread Ma, Xindong
Sorry, my fault. It's already validated in unlock_anon_vma_root().


BR
Leon


-Original Message-
From: Ma, Xindong 
Sent: Wednesday, May 07, 2014 10:32 AM
To: a...@linux-foundation.org; iamjoonsoo@lge.com; 
n-horigu...@ah.jp.nec.com; kirill.shute...@linux.intel.com; gorcu...@gmail.com; 
linux...@kvack.org; linux-kernel@vger.kernel.org
Cc: Ma, Xindong
Subject: [PATCH] rmap: validate pointer in anon_vma_clone

If memory allocation failed in first loop, root will be NULL and will lead to 
kernel panic.

Signed-off-by: Leon Ma 
---
 mm/rmap.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 9c3e773..6e53aed 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -246,8 +246,10 @@ int anon_vma_clone(struct vm_area_struct *dst, struct 
vm_area_struct *src)
 
avc = anon_vma_chain_alloc(GFP_NOWAIT | __GFP_NOWARN);
if (unlikely(!avc)) {
-   unlock_anon_vma_root(root);
-   root = NULL;
+   if (!root) {
+   unlock_anon_vma_root(root);
+   root = NULL;
+   }
avc = anon_vma_chain_alloc(GFP_KERNEL);
if (!avc)
goto enomem_failure;
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/6] ARM: sunxi: Remove init_machine callback

2014-05-06 Thread Maxime Ripard
The init_machine hook is now at its default value. We can remove it.

Even though the sun4i and sun7i machines are nothing more than generic machines
now, leave them in so that we won't have to add them back if needed, and so
that the machine is still displayed in /proc/cpuinfo.

Signed-off-by: Maxime Ripard 
---
 arch/arm/mach-sunxi/sunxi.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 1c62a0a021d7..efb2f93b02e6 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -12,17 +12,11 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
 #include "common.h"
 
-static void __init sunxi_dt_init(void)
-{
-   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-}
-
 static const char * const sunxi_board_dt_compat[] = {
"allwinner,sun4i-a10",
"allwinner,sun5i-a10s",
@@ -31,7 +25,6 @@ static const char * const sunxi_board_dt_compat[] = {
 };
 
 DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
-   .init_machine   = sunxi_dt_init,
.dt_compat  = sunxi_board_dt_compat,
 MACHINE_END
 
@@ -49,7 +42,6 @@ static void __init sun6i_timer_init(void)
 }
 
 DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
-   .init_machine   = sunxi_dt_init,
.init_time  = sun6i_timer_init,
.dt_compat  = sun6i_board_dt_compat,
.smp= smp_ops(sun6i_smp_ops),
@@ -61,6 +53,5 @@ static const char * const sun7i_board_dt_compat[] = {
 };
 
 DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
-   .init_machine   = sunxi_dt_init,
.dt_compat  = sun7i_board_dt_compat,
 MACHINE_END
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/6] wdt: sunxi: Move restart code to the watchdog driver

2014-05-06 Thread Maxime Ripard
Most of the watchdog code is duplicated between the machine restart code and
the watchdog driver. Add the restart hook to the watchdog driver, to be able to
remove it from the machine code eventually.

Signed-off-by: Maxime Ripard 
Acked-by: Arnd Bergmann 
---
 drivers/watchdog/sunxi_wdt.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c
index cd00a7836cdc..0d07855bc88a 100644
--- a/drivers/watchdog/sunxi_wdt.c
+++ b/drivers/watchdog/sunxi_wdt.c
@@ -14,6 +14,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -22,9 +23,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include 
+
 #define WDT_MAX_TIMEOUT 16
 #define WDT_MIN_TIMEOUT 1
 #define WDT_MODE_TIMEOUT(n) ((n) << 3)
@@ -70,6 +74,26 @@ static const int wdt_timeout_map[] = {
[16] = 0b1011, /* 16s */
 };
 
+static void __iomem *reboot_wdt_base;
+
+static void sun4i_wdt_restart(enum reboot_mode mode, const char *cmd)
+{
+   /* Enable timer and set reset bit in the watchdog */
+   writel(WDT_MODE_EN | WDT_MODE_RST_EN, reboot_wdt_base + WDT_MODE);
+
+   /*
+* Restart the watchdog. The default (and lowest) interval
+* value for the watchdog is 0.5s.
+*/
+   writel(WDT_CTRL_RELOAD, reboot_wdt_base + WDT_CTRL);
+
+   while (1) {
+   mdelay(5);
+   writel(WDT_MODE_EN | WDT_MODE_RST_EN,
+  reboot_wdt_base + WDT_MODE);
+   }
+}
+
 static int sunxi_wdt_ping(struct watchdog_device *wdt_dev)
 {
struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev);
@@ -181,6 +205,9 @@ static int sunxi_wdt_probe(struct platform_device *pdev)
if (unlikely(err))
return err;
 
+   reboot_wdt_base = sunxi_wdt->wdt_base;
+   arm_pm_restart = sun4i_wdt_restart;
+
dev_info(>dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
sunxi_wdt->wdt_dev.timeout, nowayout);
 
@@ -191,6 +218,8 @@ static int sunxi_wdt_remove(struct platform_device *pdev)
 {
struct sunxi_wdt_dev *sunxi_wdt = platform_get_drvdata(pdev);
 
+   arm_pm_restart = NULL;
+
watchdog_unregister_device(_wdt->wdt_dev);
watchdog_set_drvdata(_wdt->wdt_dev, NULL);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/6] ARM: sunxi: Machine code cleanup

2014-05-06 Thread Maxime Ripard
Hi,

This serie moves the restart code out of the mach-sunxi directory to
either the watchdog driver or to a new driver in drivers/power/reset.

Since the reset code was pretty much all the code left in the
mach-sunxi directory for all the SoCs but the A31, the only thing left
into mach-sunxi are empty machine definition.

Thanks, Maxime

Changes from v1:
  - Left the minimal machines instead of removing them
  - Changed the context pointer in the watchdog driver to just a
global base address

Maxime Ripard (6):
  wdt: sunxi: Move restart code to the watchdog driver
  power: reset: Add Allwinner A31 reset code
  ARM: sunxi: Remove reset code from the platform
  ARM: sunxi: Remove init_machine callback
  ARM: sunxi: Add A31 reset driver to sunxi_defconfig
  ARM: multi_v7: Add Allwinner reset drivers to multi_v7_defconfig

 arch/arm/configs/multi_v7_defconfig |   2 +
 arch/arm/configs/sunxi_defconfig|   3 +
 arch/arm/mach-sunxi/sunxi.c | 107 
 drivers/power/reset/Kconfig |   7 +++
 drivers/power/reset/Makefile|   1 +
 drivers/power/reset/sun6i-reboot.c  |  85 
 drivers/watchdog/sunxi_wdt.c|  29 ++
 7 files changed, 127 insertions(+), 107 deletions(-)
 create mode 100644 drivers/power/reset/sun6i-reboot.c

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 6/6] ARM: multi_v7: Add Allwinner reset drivers to multi_v7_defconfig

2014-05-06 Thread Maxime Ripard
Now that the reset code are part of drivers of their own, we need those in the
defconfig.

Signed-off-by: Maxime Ripard 
---
 arch/arm/configs/multi_v7_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index d4e8a47a2f7c..960187ac35e0 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -200,12 +200,14 @@ CONFIG_BATTERY_SBS=y
 CONFIG_CHARGER_TPS65090=y
 CONFIG_POWER_RESET_AS3722=y
 CONFIG_POWER_RESET_GPIO=y
+CONFIG_POWER_RESET_SUN6I=y
 CONFIG_SENSORS_LM90=y
 CONFIG_THERMAL=y
 CONFIG_DOVE_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_ORION_WATCHDOG=y
+CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MFD_AS3722=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 00/12 v1] A new CPU load metric for power-efficient scheduler: CPU ConCurrency

2014-05-06 Thread Yuyang Du
> The general code structure is an immediate no go. We're not going to
> bolt on anything like this.

Could you please detail a little bit about general code structure?

Thank you all the same,
Yuyang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ptrace: gpf in syscall_trace_enter

2014-05-06 Thread Sasha Levin
On 05/06/2014 08:36 PM, Sasha Levin wrote:
> Hi all,
> 
> While fuzzing with trinity inside a KVM tools guest running the latest -next
> kernel I've stumbled on the following spew:

And another similar trace:

[ 6897.628729] general protection fault:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 6897.629654] Dumping ftrace buffer:
[ 6897.630034](ftrace buffer empty)
[ 6897.630034] Modules linked in:
[ 6897.630034] CPU: 24 PID: 23736 Comm: trinity-c148 Tainted: GB 
3.15.0-rc4-next-20140506-sasha-00021-gc164334-dirty #447
[ 6897.630034] task: 88002a87 ti: 88000ef04000 task.ti: 
88000ef04000
[ 6897.630034] RIP: syscall_trace_leave (include/trace/events/syscalls.h:42 
arch/x86/kernel/ptrace.c:1517)
[ 6897.630034] RSP: :88000ef05f20  EFLAGS: 00010286
[ 6897.630034] RAX:  RBX: 88000ef05f58 RCX: 0001
[ 6897.630034] RDX: fff2 RSI: 88000ef05f58 RDI: 6b6b6b6b6b6b6b6b
[ 6897.630034] RBP: 88000ef05f40 R08: 880218c3c498 R09: 000100290024
[ 6897.630034] R10:  R11:  R12: 8806c5d04630
[ 6897.630034] R13: fff2 R14: 32e0 R15: 00af
[ 6897.630034] FS:  7f5541eec700() GS:88058700() 
knlGS:
[ 6897.630034] CS:  0010 DS:  ES:  CR0: 8005003b
[ 6897.630034] CR2: 7fff1ac95d78 CR3: 036a CR4: 06a0
[ 6897.630034] DR0: 006df000 DR1:  DR2: 
[ 6897.630034] DR3:  DR6: 0ff0 DR7: 000f0602
[ 6897.630034] Stack:
[ 6897.630034]  7f5541f0e2e0 006e2000 7f5541f0e2e0 
0094
[ 6897.630034]  0011 b458577f 1008feff 
00af
[ 6897.630034]  32e0 0094 7f5541f0e2e0 
0011
[ 6897.630034] Call Trace:
[ 6897.630034] int_check_syscall_exit_work (arch/x86/kernel/entry_64.S:795)
[ 6897.630034] Code: 05 d1 9d f0 05 01 e8 2d 2e 14 00 4d 85 e4 75 10 65 ff 0c 
25 a0 da 00 00 0f 84 85 00 00 00 eb 1c 49 8b 7c 24 08 4c 89 ea 48 89 de <41> ff 
14 24 49 83 c4 10 49 83 3c 24 00 75 e6 eb d4 0f 1f 40 00
[ 6897.630034] RIP syscall_trace_leave (include/trace/events/syscalls.h:42 
arch/x86/kernel/ptrace.c:1517)
[ 6897.630034]  RSP 


Thanks,
Sasha

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/3] devicetree, qcomm PMIC: fix node name conflict

2014-05-06 Thread Frank Rowand
On 5/6/2014 6:32 PM, Rob Herring wrote:
> On Tue, May 6, 2014 at 7:48 PM, Frank Rowand  wrote:
>> An issue with the path of SPMI nodes under /sys/bus/... was reported in
>> https://lkml.org/lkml/2014/4/23/312.  The symptom is that two different

< snip >

>>
> 
> I think the primary question to ask is there any added benefit to
> having the additional hierarchy of devices. I don't think there is
> much support to have more hierarchy from what I have seen of past
> discussions.

The hierarchy avoids the name space conflict.

It also maps the physical reality better than pretending all devices
are on the platform bus.

It follows the model that non-device tree systems use.  For example,
why should a usb device show up under /sys/bus/platform/ instead of
under /sys/bus/usb/ ?  (I'm not positive this actually happens, but
let me pretend it would.)

> Another approach could be to support having multiple platform bus
> instances. Then drivers can easily create a new instance for each set
> of sub-devices.
> 
> This can be solved in a much less invasive way just in the DT naming
> algorithm. This is slightly different from what I had suggested of
> just dropping the unit address. It keeps the unit address, but adds
> the unique index on untranslate-able addresses. The diff is bigger due
> to refactoring to reduce the indentation levels. It is untested and
> whitespace corrupted:
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 404d1da..c77dd7a 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -105,23 +105,33 @@ void of_device_make_bus_id(struct device *dev)
>  * For MMIO, get the physical address
>  */
> reg = of_get_property(node, "reg", NULL);
> -   if (reg) {
> -   if (of_can_translate_address(node)) {
> -   addr = of_translate_address(node, reg);
> -   } else {
> -   addrp = of_get_address(node, 0, NULL, NULL);
> -   if (addrp)
> -   addr = of_read_number(addrp, 1);
> -   else
> -   addr = OF_BAD_ADDR;
> -   }
> -   if (addr != OF_BAD_ADDR) {
> -   dev_set_name(dev, "%llx.%s",
> -(unsigned long long)addr, node->name);
> -   return;
> -   }
> +   if (!reg)
> +   goto no_bus_id;
> +
> +   if (of_can_translate_address(node)) {
> +   addr = of_translate_address(node, reg);
> +   if (addr == OF_BAD_ADDR)
> +   goto no_bus_id;
> +
> +   dev_set_name(dev, "%llx.%s",
> +(unsigned long long)addr, node->name);
> +   return;
> }
> 
> +   addrp = of_get_address(node, 0, NULL, NULL);
> +   if (!addrp)
> +   goto no_bus_id;
> +
> +   addr = of_read_number(addrp, 1);
> +   if (addr == OF_BAD_ADDR)
> +   goto no_bus_id;
> +
> +   magic = atomic_add_return(1, _no_reg_magic);
> +   dev_set_name(dev, "%llx.%s.%d", (unsigned long long)addr,
> +node->name, magic - 1);
> +   return;
> +
> +no_bus_id:
> /*
>  * No BusID, use the node name and add a globally incremented
>  * counter (and pray...)
> 

I think the refactored code is easier to read.  (End of bike shed...)

The result of that patch is an even uglier set of device names.  I would love 
to get rid of
the bus_no_reg_magic instead of making more extensive use of it.  The new names 
for the
system that started this discussion are:

$ ls /sys/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-00/
100.qcom,revid.19gpios.21
3100.qcom,pm8x41-adc-usr.20  power
6000.qcom,rtc.18 subsystem
driver   uevent

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-00/
100.qcom,revid.19gpios.21
3100.qcom,pm8x41-adc-usr.20  power
6000.qcom,rtc.18 subsystem
driver   uevent

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-01/
b040.pm8xxx-pwm.22  driver  uevent
d000.pm8xxx-pwm-led.23  power
d800.pm8xxx-wled.24 subsystem

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-04/
100.qcom,revid.25  power  uevent
driver subsystem

$ ls /sys/bus/platform/devices/
100.qcom,revid.19  fc4ab000.restart
100.qcom,revid.25  fc4cf000.qcom,spmi
3100.qcom,pm8x41-adc-usr.20fd484000.hwlock
6000.qcom,rtc.18   fd51.pinctrl
alarmtimer fd8c.clock-controller
b040.pm8xxx-pwm.22 gpio_keys.5
cpu-pmu.1  gpios.21
cpus.0 iio-thermal.4
d000.pm8xxx-pwm-led.23 pm8841-s1.6
d800.pm8xxx-wled.24pm8841-s2.7
f900.interrupt-controller  pm8941-l3.11
f9011000.smem 

[PATCH v2 2/6] power: reset: Add Allwinner A31 reset code

2014-05-06 Thread Maxime Ripard
That code used to be in the machine code, but it's more fit here with other
restart hooks.

That will allow to cleanup the machine directory, while waiting for a proper
watchdog driver for the A31.

Signed-off-by: Maxime Ripard 
Acked-by: Arnd Bergmann 
---
 drivers/power/reset/Kconfig|  7 
 drivers/power/reset/Makefile   |  1 +
 drivers/power/reset/sun6i-reboot.c | 85 ++
 3 files changed, 93 insertions(+)
 create mode 100644 drivers/power/reset/sun6i-reboot.c

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index fa0e4e057b99..67aeb6ec08f9 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -43,6 +43,13 @@ config POWER_RESET_RESTART
  Instead they restart, and u-boot holds the SoC until the
  user presses a key. u-boot then boots into Linux.
 
+config POWER_RESET_SUN6I
+   bool "Allwinner A31 SoC reset driver"
+   depends on ARCH_SUNXI
+   depends on POWER_RESET
+   help
+ Reboot support for the Allwinner A31 SoCs.
+
 config POWER_RESET_VEXPRESS
bool "ARM Versatile Express power-off and reset driver"
depends on ARM || ARM64
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index a5b4a77d1a41..950fdc011c7a 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
 obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
 obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
 obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
+obj-$(CONFIG_POWER_RESET_SUN6I) += sun6i-reboot.o
 obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
 obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o
diff --git a/drivers/power/reset/sun6i-reboot.c 
b/drivers/power/reset/sun6i-reboot.c
new file mode 100644
index ..af2cd7ff2fe8
--- /dev/null
+++ b/drivers/power/reset/sun6i-reboot.c
@@ -0,0 +1,85 @@
+/*
+ * Allwinner A31 SoCs reset code
+ *
+ * Copyright (C) 2012-2014 Maxime Ripard
+ *
+ * Maxime Ripard 
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define SUN6I_WATCHDOG1_IRQ_REG0x00
+#define SUN6I_WATCHDOG1_CTRL_REG   0x10
+#define SUN6I_WATCHDOG1_CTRL_RESTART   BIT(0)
+#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
+#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
+#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
+#define SUN6I_WATCHDOG1_MODE_REG   0x18
+#define SUN6I_WATCHDOG1_MODE_ENABLEBIT(0)
+
+static void __iomem *wdt_base;
+
+static void sun6i_wdt_restart(enum reboot_mode mode, const char *cmd)
+{
+   if (!wdt_base)
+   return;
+
+   /* Disable interrupts */
+   writel(0, wdt_base + SUN6I_WATCHDOG1_IRQ_REG);
+
+   /* We want to disable the IRQ and just reset the whole system */
+   writel(SUN6I_WATCHDOG1_CONFIG_RESTART,
+   wdt_base + SUN6I_WATCHDOG1_CONFIG_REG);
+
+   /* Enable timer. The default and lowest interval value is 0.5s */
+   writel(SUN6I_WATCHDOG1_MODE_ENABLE,
+   wdt_base + SUN6I_WATCHDOG1_MODE_REG);
+
+   /* Restart the watchdog. */
+   writel(SUN6I_WATCHDOG1_CTRL_RESTART,
+   wdt_base + SUN6I_WATCHDOG1_CTRL_REG);
+
+   while (1) {
+   mdelay(5);
+   writel(SUN6I_WATCHDOG1_MODE_ENABLE,
+   wdt_base + SUN6I_WATCHDOG1_MODE_REG);
+   }
+}
+
+static int sun6i_reboot_probe(struct platform_device *pdev)
+{
+   wdt_base = of_iomap(pdev->dev.of_node, 0);
+   if (!wdt_base) {
+   WARN(1, "failed to map watchdog base address");
+   return -ENODEV;
+   }
+
+   arm_pm_restart = sun6i_wdt_restart;
+
+   return 0;
+}
+
+static struct of_device_id sun6i_reboot_of_match[] = {
+   { .compatible = "allwinner,sun6i-a31-wdt" },
+   {}
+};
+
+static struct platform_driver sun6i_reboot_driver = {
+   .probe = sun6i_reboot_probe,
+   .driver = {
+   .name = "sun6i-reboot",
+   .of_match_table = sun6i_reboot_of_match,
+   },
+};
+module_platform_driver(sun6i_reboot_driver);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH v2] hwmon: add support for Sensirion SHTC1 sensor

2014-05-06 Thread Guenter Roeck

On 05/06/2014 09:03 AM, Tomas Pop wrote:

Hi Gunter,

Yes, that's exactly the idea - we would like to provide basic support
for a few low-cost boards as a starting point for anybody who is
interested in the sensor. Previously I was testing mostly on some
Android devices (kernel 3.4), and it seems, that a lot of thinks changed
in since version 3.4 :-)

I will send in few days a tested version..


Great. Unfortunately those chips are so small that they don't fit on
my test boards, or I would have ordered some myself. I am looking forward
to see those boards available for order somewhere ... hopefully at a lower
price point than your evaluation boards ;-).

Thanks,
Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


blktrace: NULL ptr deref in sysfs_blk_trace_attr_store

2014-05-06 Thread Sasha Levin
Hi all,

While fuzzing with trinity inside a KVM tools guest running the latest -next
kernel I've stumbled on the following spew:

[ 6230.740626] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[ 6230.740626] IP: __list_del_entry (lib/list_debug.c:57)
[ 6230.740626] PGD 44d661067 PUD 44d660067 PMD 0
[ 6230.740626] Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 6230.740626] Dumping ftrace buffer:
[ 6230.740626](ftrace buffer empty)
[ 6230.740626] Modules linked in:
[ 6230.740626] CPU: 2 PID: 23998 Comm: trinity-c257 Not tainted 
3.15.0-rc4-next-20140506-sasha-00021-gc164334-dirty #447
[ 6230.740626] task: 8804716db000 ti: 88044ca9e000 task.ti: 
88044ca9e000
[ 6230.740626] RIP: __list_del_entry (lib/list_debug.c:57)
[ 6230.740626] RSP: 0018:88044ca9fdd8  EFLAGS: 00010007
[ 6230.740626] RAX:  RBX: 88005a455948 RCX: dead00200200
[ 6230.740626] RDX:  RSI: 938fdf78 RDI: 88005a455948
[ 6230.740626] RBP: 88044ca9fdd8 R08: 0001 R09: 8804716dbdd0
[ 6230.740626] R10: 8804716db000 R11:  R12: 07f5
[ 6230.740626] R13: 88017b88 R14: 88005a4558f0 R15: 88036a188758
[ 6230.740626] FS:  7fec10273700() GS:8800a6c0() 
knlGS:
[ 6230.740626] CS:  0010 DS:  ES:  CR0: 8005003b
[ 6230.740626] CR2:  CR3: 00044d662000 CR4: 06a0
[ 6230.740626] DR0: 006df000 DR1:  DR2: 
[ 6230.740626] DR3:  DR6: 0ff0 DR7: 0600
[ 6230.740626] Stack:
[ 6230.740626]  88044ca9fdf8 8fb40441 88036a188740 
88036a188740
[ 6230.740626]  88044ca9fe68 8f25d75d  
8804716db000
[ 6230.740626]  0286 880333f61330  
0286
[ 6230.740626] Call Trace:
[ 6230.740626] list_del (lib/list_debug.c:78)
[ 6230.740626] sysfs_blk_trace_attr_store (include/linux/spinlock.h:353 
kernel/trace/blktrace.c:1498 kernel/trace/blktrace.c:1740)
[ 6230.740626] dev_attr_store (drivers/base/core.c:138)
[ 6230.740626] sysfs_kf_write (fs/sysfs/file.c:114)
[ 6230.740626] kernfs_fop_write (fs/kernfs/file.c:295)
[ 6230.740626] vfs_write (fs/read_write.c:532)
[ 6230.740626] SyS_write (fs/read_write.c:584 fs/read_write.c:576)
[ 6230.740626] ia32_do_call (arch/x86/ia32/ia32entry.S:430)
[ 6230.740626] Code: 7d 93 be 3e 00 00 00 48 c7 c7 d2 46 7d 93 31 c0 e8 6f fb 
61 ff eb 2c 0f 1f 44 00 00 48 b9 00 02 20 00 00 00 ad de 48 39 c8 74 8c <4c> 8b 
00 4c 39 c7 75 a6 4c 8b 42 08 4c 39 c7 75 bc 48 89 42 08
[ 6230.740626] RIP __list_del_entry (lib/list_debug.c:57)
[ 6230.740626]  RSP 
[ 6230.740626] CR2: 


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] rmap: validate pointer in anon_vma_clone

2014-05-06 Thread Leon Ma
If memory allocation failed in first loop, root will be NULL and
will lead to kernel panic.

Signed-off-by: Leon Ma 
---
 mm/rmap.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 9c3e773..6e53aed 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -246,8 +246,10 @@ int anon_vma_clone(struct vm_area_struct *dst, struct 
vm_area_struct *src)
 
avc = anon_vma_chain_alloc(GFP_NOWAIT | __GFP_NOWARN);
if (unlikely(!avc)) {
-   unlock_anon_vma_root(root);
-   root = NULL;
+   if (!root) {
+   unlock_anon_vma_root(root);
+   root = NULL;
+   }
avc = anon_vma_chain_alloc(GFP_KERNEL);
if (!avc)
goto enomem_failure;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 1/4] KVM: emulate: speed up do_insn_fetch

2014-05-06 Thread Bandan Das
Ok! Now that you posted your changes, I am getting to understand this
a little :)
 
Paolo Bonzini  writes:

> Hoist the common case up from do_insn_fetch_byte to do_insn_fetch,
> and prime the fetch_cache in x86_decode_insn.  This helps both the
> compiler and the branch predictor.
>
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/emulate.c | 67 
> +++---
>  1 file changed, 36 insertions(+), 31 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 42820f5fdd04..c7b625bf0b5d 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -703,51 +703,51 @@ static int segmented_read_std(struct x86_emulate_ctxt 
> *ctxt,
>  }
>  
>  /*
> - * Fetch the next byte of the instruction being emulated which is pointed to
> - * by ctxt->_eip, then increment ctxt->_eip.
> - *
> - * Also prefetch the remaining bytes of the instruction without crossing page
> + * Prefetch the remaining bytes of the instruction without crossing page
>   * boundary if they are not in fetch_cache yet.
>   */
> -static int do_insn_fetch_byte(struct x86_emulate_ctxt *ctxt, u8 *dest)
> +static int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt)
>  {
>   struct fetch_cache *fc = >fetch;
>   int rc;
>   int size, cur_size;
> -
> - if (ctxt->_eip == fc->end) {
> - unsigned long linear;
> - struct segmented_address addr = { .seg = VCPU_SREG_CS,
> -   .ea  = ctxt->_eip };
> - cur_size = fc->end - fc->start;
> - size = min(15UL - cur_size,
> -PAGE_SIZE - offset_in_page(ctxt->_eip));
> - rc = __linearize(ctxt, addr, size, false, true, );
> - if (unlikely(rc != X86EMUL_CONTINUE))
> - return rc;
> - rc = ctxt->ops->fetch(ctxt, linear, fc->data + cur_size,
> -   size, >exception);
> - if (unlikely(rc != X86EMUL_CONTINUE))
> - return rc;
> - fc->end += size;
> - }
> - *dest = fc->data[ctxt->_eip - fc->start];
> - ctxt->_eip++;
> + unsigned long linear;
> +
> + struct segmented_address addr = { .seg = VCPU_SREG_CS,
> +   .ea  = fc->end };
> + cur_size = fc->end - fc->start;
> + size = min(15UL - cur_size,
> +PAGE_SIZE - offset_in_page(fc->end));
> + if (unlikely(size == 0))
> + return X86EMUL_UNHANDLEABLE;
> + rc = __linearize(ctxt, addr, size, false, true, );
> + if (unlikely(rc != X86EMUL_CONTINUE))
> + return rc;
> + rc = ctxt->ops->fetch(ctxt, linear, fc->data + cur_size,
> +   size, >exception);
> + if (unlikely(rc != X86EMUL_CONTINUE))
> + return rc;
> + fc->end += size;
>   return X86EMUL_CONTINUE;
>  }
>  
>  static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
> -  void *dest, unsigned size)
> +  void *__dest, unsigned size)
>  {
>   int rc;
> + struct fetch_cache *fc = >fetch;
> + u8 *dest = __dest;
> + u8 *src = >data[ctxt->_eip - fc->start];
>  
> - /* x86 instructions are limited to 15 bytes. */
> - if (unlikely(ctxt->_eip + size - ctxt->eip > 15))
> - return X86EMUL_UNHANDLEABLE;
>   while (size--) {
> - rc = do_insn_fetch_byte(ctxt, dest++);
> - if (rc != X86EMUL_CONTINUE)
> - return rc;
> + if (unlikely(ctxt->_eip == fc->end)) {

Is this really going to be unlikely ?

> + rc = do_insn_fetch_bytes(ctxt);
> + if (rc != X86EMUL_CONTINUE)
> + return rc;
> + }
> + *dest++ = *src++;
> + ctxt->_eip++;
> + continue;
>   }
>   return X86EMUL_CONTINUE;
>  }
> @@ -4272,6 +4272,11 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, 
> void *insn, int insn_len)
>   ctxt->opcode_len = 1;
>   if (insn_len > 0)
>   memcpy(ctxt->fetch.data, insn, insn_len);
> + else {
> + rc = do_insn_fetch_bytes(ctxt);
> + if (rc != X86EMUL_CONTINUE)
> + return rc;
> + }
>  
>   switch (mode) {
>   case X86EMUL_MODE_REAL:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] perf tools: Use tid for finding thread

2014-05-06 Thread Namhyung Kim
I believe that passing pid (instead of tid) as the 3rd arg of the
machine__find*_thread() was to find a main thread so that it can
search proper map group for symbols.  However with the map sharing
patch applied, it now can do it in any thread.

It fixes a bug when each thread has different name, it only reports a
main thread for samples in other threads.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Stephane Eranian 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-inject.c | 2 +-
 tools/perf/builtin-kmem.c   | 2 +-
 tools/perf/tests/code-reading.c | 2 +-
 tools/perf/util/build-id.c  | 2 +-
 tools/perf/util/event.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 3a7387551369..6a3af0013d68 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -209,7 +209,7 @@ static int perf_event__inject_buildid(struct perf_tool 
*tool,
 
cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 
-   thread = machine__findnew_thread(machine, sample->pid, sample->pid);
+   thread = machine__findnew_thread(machine, sample->pid, sample->tid);
if (thread == NULL) {
pr_err("problem processing %d event, skipping it.\n",
   event->header.type);
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index f91fa4376f4b..bef3376bfaf3 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -235,7 +235,7 @@ static int process_sample_event(struct perf_tool *tool 
__maybe_unused,
struct machine *machine)
 {
struct thread *thread = machine__findnew_thread(machine, sample->pid,
-   sample->pid);
+   sample->tid);
 
if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index adf3de3e38d6..67f2d6323558 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -256,7 +256,7 @@ static int process_sample_event(struct machine *machine,
return -1;
}
 
-   thread = machine__findnew_thread(machine, sample.pid, sample.pid);
+   thread = machine__findnew_thread(machine, sample.pid, sample.tid);
if (!thread) {
pr_debug("machine__findnew_thread failed\n");
return -1;
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 6baabe63182b..a904a4cfe7d3 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -25,7 +25,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool 
__maybe_unused,
struct addr_location al;
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct thread *thread = machine__findnew_thread(machine, sample->pid,
-   sample->pid);
+   sample->tid);
 
if (thread == NULL) {
pr_err("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index dbcaea1a8180..65795b835b39 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -788,7 +788,7 @@ int perf_event__preprocess_sample(const union perf_event 
*event,
 {
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct thread *thread = machine__findnew_thread(machine, sample->pid,
-   sample->pid);
+   sample->tid);
 
if (thread == NULL)
return -1;
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v3 2/6] mm, compaction: return failed migration target pages back to freelist

2014-05-06 Thread David Rientjes
Memory compaction works by having a "freeing scanner" scan from one end of a 
zone which isolates pages as migration targets while another "migrating 
scanner" 
scans from the other end of the same zone which isolates pages for migration.

When page migration fails for an isolated page, the target page is returned to 
the system rather than the freelist built by the freeing scanner.  This may 
require the freeing scanner to continue scanning memory after suitable 
migration 
targets have already been returned to the system needlessly.

This patch returns destination pages to the freeing scanner freelist when page 
migration fails.  This prevents unnecessary work done by the freeing scanner 
but 
also encourages memory to be as compacted as possible at the end of the zone.

Reported-by: Greg Thelen 
Acked-by: Mel Gorman 
Acked-by: Vlastimil Babka 
Signed-off-by: David Rientjes 
---
 mm/compaction.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -797,23 +797,32 @@ static struct page *compaction_alloc(struct page 
*migratepage,
 }
 
 /*
- * We cannot control nr_migratepages and nr_freepages fully when migration is
- * running as migrate_pages() has no knowledge of compact_control. When
- * migration is complete, we count the number of pages on the lists by hand.
+ * This is a migrate-callback that "frees" freepages back to the isolated
+ * freelist.  All pages on the freelist are from the same zone, so there is no
+ * special handling needed for NUMA.
+ */
+static void compaction_free(struct page *page, unsigned long data)
+{
+   struct compact_control *cc = (struct compact_control *)data;
+
+   list_add(>lru, >freepages);
+   cc->nr_freepages++;
+}
+
+/*
+ * We cannot control nr_migratepages fully when migration is running as
+ * migrate_pages() has no knowledge of of compact_control.  When migration is
+ * complete, we count the number of pages on the list by hand.
  */
 static void update_nr_listpages(struct compact_control *cc)
 {
int nr_migratepages = 0;
-   int nr_freepages = 0;
struct page *page;
 
list_for_each_entry(page, >migratepages, lru)
nr_migratepages++;
-   list_for_each_entry(page, >freepages, lru)
-   nr_freepages++;
 
cc->nr_migratepages = nr_migratepages;
-   cc->nr_freepages = nr_freepages;
 }
 
 /* possible outcome of isolate_migratepages */
@@ -1023,8 +1032,8 @@ static int compact_zone(struct zone *zone, struct 
compact_control *cc)
}
 
nr_migrate = cc->nr_migratepages;
-   err = migrate_pages(>migratepages, compaction_alloc, NULL,
-   (unsigned long)cc,
+   err = migrate_pages(>migratepages, compaction_alloc,
+   compaction_free, (unsigned long)cc,
cc->sync ? MIGRATE_SYNC_LIGHT : MIGRATE_ASYNC,
MR_COMPACTION);
update_nr_listpages(cc);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v3 3/6] mm, compaction: add per-zone migration pfn cache for async compaction

2014-05-06 Thread David Rientjes
Each zone has a cached migration scanner pfn for memory compaction so that 
subsequent calls to memory compaction can start where the previous call left 
off.

Currently, the compaction migration scanner only updates the per-zone cached 
pfn 
when pageblocks were not skipped for async compaction.  This creates a 
dependency on calling sync compaction to avoid having subsequent calls to async 
compaction from scanning an enormous amount of non-MOVABLE pageblocks each time 
it is called.  On large machines, this could be potentially very expensive.

This patch adds a per-zone cached migration scanner pfn only for async 
compaction.  It is updated everytime a pageblock has been scanned in its 
entirety and when no pages from it were successfully isolated.  The cached 
migration scanner pfn for sync compaction is updated only when called for sync 
compaction.

Signed-off-by: David Rientjes 
---
 v3: do not update pageblock skip metadata when skipped due to async per
 Vlastimil.

 include/linux/mmzone.h |  5 ++--
 mm/compaction.c| 66 ++
 2 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -360,9 +360,10 @@ struct zone {
/* Set to true when the PG_migrate_skip bits should be cleared */
boolcompact_blockskip_flush;
 
-   /* pfns where compaction scanners should start */
+   /* pfn where compaction free scanner should start */
unsigned long   compact_cached_free_pfn;
-   unsigned long   compact_cached_migrate_pfn;
+   /* pfn where async and sync compaction migration scanner should start */
+   unsigned long   compact_cached_migrate_pfn[2];
 #endif
 #ifdef CONFIG_MEMORY_HOTPLUG
/* see spanned/present_pages for more description */
diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -89,7 +89,8 @@ static void __reset_isolation_suitable(struct zone *zone)
unsigned long end_pfn = zone_end_pfn(zone);
unsigned long pfn;
 
-   zone->compact_cached_migrate_pfn = start_pfn;
+   zone->compact_cached_migrate_pfn[0] = start_pfn;
+   zone->compact_cached_migrate_pfn[1] = start_pfn;
zone->compact_cached_free_pfn = end_pfn;
zone->compact_blockskip_flush = false;
 
@@ -131,9 +132,10 @@ void reset_isolation_suitable(pg_data_t *pgdat)
  */
 static void update_pageblock_skip(struct compact_control *cc,
struct page *page, unsigned long nr_isolated,
-   bool migrate_scanner)
+   bool set_unsuitable, bool migrate_scanner)
 {
struct zone *zone = cc->zone;
+   unsigned long pfn;
 
if (cc->ignore_skip_hint)
return;
@@ -141,20 +143,31 @@ static void update_pageblock_skip(struct compact_control 
*cc,
if (!page)
return;
 
-   if (!nr_isolated) {
-   unsigned long pfn = page_to_pfn(page);
+   if (nr_isolated)
+   return;
+
+   /*
+* Only skip pageblocks when all forms of compaction will be known to
+* fail in the near future.
+*/
+   if (set_unsuitable)
set_pageblock_skip(page);
 
-   /* Update where compaction should restart */
-   if (migrate_scanner) {
-   if (!cc->finished_update_migrate &&
-   pfn > zone->compact_cached_migrate_pfn)
-   zone->compact_cached_migrate_pfn = pfn;
-   } else {
-   if (!cc->finished_update_free &&
-   pfn < zone->compact_cached_free_pfn)
-   zone->compact_cached_free_pfn = pfn;
-   }
+   pfn = page_to_pfn(page);
+
+   /* Update where async and sync compaction should restart */
+   if (migrate_scanner) {
+   if (cc->finished_update_migrate)
+   return;
+   if (pfn > zone->compact_cached_migrate_pfn[0])
+   zone->compact_cached_migrate_pfn[0] = pfn;
+   if (cc->sync && pfn > zone->compact_cached_migrate_pfn[1])
+   zone->compact_cached_migrate_pfn[1] = pfn;
+   } else {
+   if (cc->finished_update_free)
+   return;
+   if (pfn < zone->compact_cached_free_pfn)
+   zone->compact_cached_free_pfn = pfn;
}
 }
 #else
@@ -166,7 +179,7 @@ static inline bool isolation_suitable(struct 
compact_control *cc,
 
 static void update_pageblock_skip(struct compact_control *cc,
struct page *page, unsigned long nr_isolated,
-   bool migrate_scanner)
+   bool set_unsuitable, bool migrate_scanner)
 {
 }
 #endif /* CONFIG_COMPACTION */
@@ -329,7 

[patch v3 5/6] mm, thp: avoid excessive compaction latency during fault

2014-05-06 Thread David Rientjes
Synchronous memory compaction can be very expensive: it can iterate an enormous 
amount of memory without aborting, constantly rescheduling, waiting on page
locks and lru_lock, etc, if a pageblock cannot be defragmented.

Unfortunately, it's too expensive for transparent hugepage page faults and 
it's much better to simply fallback to pages.  On 128GB machines, we find that 
synchronous memory compaction can take O(seconds) for a single thp fault.

Now that async compaction remembers where it left off without strictly relying
on sync compaction, this makes thp allocations best-effort without causing
egregious latency during fault.  We still need to retry async compaction after
reclaim, but this won't stall for seconds.

Signed-off-by: David Rientjes 
---
 mm/page_alloc.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2584,7 +2584,17 @@ rebalance:
_some_progress);
if (page)
goto got_pg;
-   migration_mode = MIGRATE_SYNC_LIGHT;
+
+   if (gfp_mask & __GFP_NO_KSWAPD) {
+   /*
+* Khugepaged is allowed to try MIGRATE_SYNC_LIGHT, the latency
+* of this allocation isn't critical.  Everything else, however,
+* should only be allowed to do MIGRATE_ASYNC to avoid excessive
+* stalls during fault.
+*/
+   if ((current->flags & (PF_KTHREAD | PF_KSWAPD)) == PF_KTHREAD)
+   migration_mode = MIGRATE_SYNC_LIGHT;
+   }
 
/*
 * If compaction is deferred for high-order allocations, it is because
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v3 6/6] mm, compaction: terminate async compaction when rescheduling

2014-05-06 Thread David Rientjes
Async compaction terminates prematurely when need_resched(), see
compact_checklock_irqsave().  This can never trigger, however, if the 
cond_resched() in isolate_migratepages_range() always takes care of the 
scheduling.

If the cond_resched() actually triggers, then terminate this pageblock scan for 
async compaction as well.

Signed-off-by: David Rientjes 
---
 mm/compaction.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -500,8 +500,13 @@ isolate_migratepages_range(struct zone *zone, struct 
compact_control *cc,
return 0;
}
 
+   if (cond_resched()) {
+   /* Async terminates prematurely on need_resched() */
+   if (cc->mode == MIGRATE_ASYNC)
+   return 0;
+   }
+
/* Time to isolate some pages for migration */
-   cond_resched();
for (; low_pfn < end_pfn; low_pfn++) {
/* give a chance to irqs before checking need_resched() */
if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v3 4/6] mm, compaction: embed migration mode in compact_control

2014-05-06 Thread David Rientjes
We're going to want to manipulate the migration mode for compaction in the page 
allocator, and currently compact_control's sync field is only a bool.  

Currently, we only do MIGRATE_ASYNC or MIGRATE_SYNC_LIGHT compaction depending 
on the value of this bool.  Convert the bool to enum migrate_mode and pass the 
migration mode in directly.  Later, we'll want to avoid MIGRATE_SYNC_LIGHT for 
thp allocations in the pagefault patch to avoid unnecessary latency.

This also alters compaction triggered from sysfs, either for the entire system 
or for a node, to force MIGRATE_SYNC.

Suggested-by: Mel Gorman 
Signed-off-by: David Rientjes 
---
 include/linux/compaction.h |  4 ++--
 mm/compaction.c| 36 +++-
 mm/internal.h  |  2 +-
 mm/page_alloc.c| 37 -
 4 files changed, 38 insertions(+), 41 deletions(-)

diff --git a/include/linux/compaction.h b/include/linux/compaction.h
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,7 +22,7 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, 
int write,
 extern int fragmentation_index(struct zone *zone, unsigned int order);
 extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
int order, gfp_t gfp_mask, nodemask_t *mask,
-   bool sync, bool *contended);
+   enum migrate_mode sync, bool *contended);
 extern void compact_pgdat(pg_data_t *pgdat, int order);
 extern void reset_isolation_suitable(pg_data_t *pgdat);
 extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -91,7 +91,7 @@ static inline bool compaction_restarting(struct zone *zone, 
int order)
 #else
 static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
int order, gfp_t gfp_mask, nodemask_t *nodemask,
-   bool sync, bool *contended)
+   enum migrate_mode sync, bool *contended)
 {
return COMPACT_CONTINUE;
 }
diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -161,7 +161,8 @@ static void update_pageblock_skip(struct compact_control 
*cc,
return;
if (pfn > zone->compact_cached_migrate_pfn[0])
zone->compact_cached_migrate_pfn[0] = pfn;
-   if (cc->sync && pfn > zone->compact_cached_migrate_pfn[1])
+   if (cc->mode != MIGRATE_ASYNC &&
+   pfn > zone->compact_cached_migrate_pfn[1])
zone->compact_cached_migrate_pfn[1] = pfn;
} else {
if (cc->finished_update_free)
@@ -208,7 +209,7 @@ static bool compact_checklock_irqsave(spinlock_t *lock, 
unsigned long *flags,
}
 
/* async aborts if taking too long or contended */
-   if (!cc->sync) {
+   if (cc->mode == MIGRATE_ASYNC) {
cc->contended = true;
return false;
}
@@ -479,7 +480,8 @@ isolate_migratepages_range(struct zone *zone, struct 
compact_control *cc,
bool locked = false;
struct page *page = NULL, *valid_page = NULL;
bool set_unsuitable = true;
-   const isolate_mode_t mode = (!cc->sync ? ISOLATE_ASYNC_MIGRATE : 0) |
+   const isolate_mode_t mode = (cc->mode == MIGRATE_ASYNC ?
+   ISOLATE_ASYNC_MIGRATE : 0) |
(unevictable ? ISOLATE_UNEVICTABLE : 0);
 
/*
@@ -489,7 +491,7 @@ isolate_migratepages_range(struct zone *zone, struct 
compact_control *cc,
 */
while (unlikely(too_many_isolated(zone))) {
/* async migration should just abort */
-   if (!cc->sync)
+   if (cc->mode == MIGRATE_ASYNC)
return 0;
 
congestion_wait(BLK_RW_ASYNC, HZ/10);
@@ -554,7 +556,8 @@ isolate_migratepages_range(struct zone *zone, struct 
compact_control *cc,
 * the minimum amount of work satisfies the allocation
 */
mt = get_pageblock_migratetype(page);
-   if (!cc->sync && !migrate_async_suitable(mt)) {
+   if (cc->mode == MIGRATE_ASYNC &&
+   !migrate_async_suitable(mt)) {
set_unsuitable = false;
goto next_pageblock;
}
@@ -990,6 +993,7 @@ static int compact_zone(struct zone *zone, struct 
compact_control *cc)
int ret;
unsigned long start_pfn = zone->zone_start_pfn;
unsigned long end_pfn = zone_end_pfn(zone);
+   const bool sync = cc->mode != MIGRATE_ASYNC;
 
ret = compaction_suitable(zone, cc->order);
switch (ret) {
@@ -1015,7 +1019,7 @@ static int compact_zone(struct zone *zone, struct 

[patch v3 1/6] mm, migration: add destination page freeing callback

2014-05-06 Thread David Rientjes
Memory migration uses a callback defined by the caller to determine how to
allocate destination pages.  When migration fails for a source page, however, 
it 
frees the destination page back to the system.

This patch adds a memory migration callback defined by the caller to determine 
how to free destination pages.  If a caller, such as memory compaction, builds 
its own freelist for migration targets, this can reuse already freed memory 
instead of scanning additional memory.

If the caller provides a function to handle freeing of destination pages, it is 
called when page migration fails.  Otherwise, it may pass NULL and freeing back 
to the system will be handled as usual.  This patch introduces no functional 
change.

Acked-by: Mel Gorman 
Acked-by: Vlastimil Babka 
Reviewed-by: Naoya Horiguchi 
Signed-off-by: David Rientjes 
---
 include/linux/migrate.h | 11 ++
 mm/compaction.c |  2 +-
 mm/memory-failure.c |  4 ++--
 mm/memory_hotplug.c |  2 +-
 mm/mempolicy.c  |  4 ++--
 mm/migrate.c| 55 +++--
 mm/page_alloc.c |  2 +-
 7 files changed, 53 insertions(+), 27 deletions(-)

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -5,7 +5,9 @@
 #include 
 #include 
 
-typedef struct page *new_page_t(struct page *, unsigned long private, int **);
+typedef struct page *new_page_t(struct page *page, unsigned long private,
+   int **reason);
+typedef void free_page_t(struct page *page, unsigned long private);
 
 /*
  * Return values from addresss_space_operations.migratepage():
@@ -38,7 +40,7 @@ enum migrate_reason {
 extern void putback_movable_pages(struct list_head *l);
 extern int migrate_page(struct address_space *,
struct page *, struct page *, enum migrate_mode);
-extern int migrate_pages(struct list_head *l, new_page_t x,
+extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
unsigned long private, enum migrate_mode mode, int reason);
 
 extern int migrate_prep(void);
@@ -56,8 +58,9 @@ extern int migrate_page_move_mapping(struct address_space 
*mapping,
 #else
 
 static inline void putback_movable_pages(struct list_head *l) {}
-static inline int migrate_pages(struct list_head *l, new_page_t x,
-   unsigned long private, enum migrate_mode mode, int reason)
+static inline int migrate_pages(struct list_head *l, new_page_t new,
+   free_page_t free, unsigned long private, enum migrate_mode mode,
+   int reason)
{ return -ENOSYS; }
 
 static inline int migrate_prep(void) { return -ENOSYS; }
diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1023,7 +1023,7 @@ static int compact_zone(struct zone *zone, struct 
compact_control *cc)
}
 
nr_migrate = cc->nr_migratepages;
-   err = migrate_pages(>migratepages, compaction_alloc,
+   err = migrate_pages(>migratepages, compaction_alloc, NULL,
(unsigned long)cc,
cc->sync ? MIGRATE_SYNC_LIGHT : MIGRATE_ASYNC,
MR_COMPACTION);
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1500,7 +1500,7 @@ static int soft_offline_huge_page(struct page *page, int 
flags)
 
/* Keep page count to indicate a given hugepage is isolated. */
list_move(>lru, );
-   ret = migrate_pages(, new_page, MPOL_MF_MOVE_ALL,
+   ret = migrate_pages(, new_page, NULL, MPOL_MF_MOVE_ALL,
MIGRATE_SYNC, MR_MEMORY_FAILURE);
if (ret) {
pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
@@ -1581,7 +1581,7 @@ static int __soft_offline_page(struct page *page, int 
flags)
inc_zone_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
list_add(>lru, );
-   ret = migrate_pages(, new_page, MPOL_MF_MOVE_ALL,
+   ret = migrate_pages(, new_page, NULL, MPOL_MF_MOVE_ALL,
MIGRATE_SYNC, MR_MEMORY_FAILURE);
if (ret) {
if (!list_empty()) {
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1332,7 +1332,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long 
end_pfn)
 * alloc_migrate_target should be improved!!
 * migrate_pages returns # of failed pages.
 */
-   ret = migrate_pages(, alloc_migrate_target, 0,
+   ret = migrate_pages(, alloc_migrate_target, NULL, 0,
MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
if (ret)
   

[PATCH V4] gic: preserve gic V2 bypass bits in cpu ctrl register

2014-05-06 Thread Feng Kan
This change is made to preserve the GIC v2 bypass bits in the
GIC_CPU_CTRL register (also known as the GICC_CTLR register in spec).
This code will preserve all bits configured by the bootload regarding
v2 bypass group bits. In the X-Gene platform (as well others), the
bypass functionality is not generally used and bypass bits should not
be changed by the kernel gic code as it could lead to incorrect behavior.
Tested on X-Gene mustang board.

Signed-off-by: Vinayak Kale 
Acked-by: Anup Patel 
Signed-off-by: Feng Kan 
---
 V4: Change to use bypass mask, change to use more suitable variable name.
 V3: Fix code not touch other bits other than bypass bits.

 drivers/irqchip/irq-gic.c |   20 +---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 4300b66..50a7bb2 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -97,6 +97,8 @@ struct irq_chip gic_arch_extn = {
 #define MAX_GIC_NR 1
 #endif
 
+#define GIC_BYPASS_MASK0x1e0
+
 static struct gic_chip_data gic_data[MAX_GIC_NR] __read_mostly;
 
 #ifdef CONFIG_GIC_NON_BANKED
@@ -418,6 +420,7 @@ static void gic_cpu_init(struct gic_chip_data *gic)
void __iomem *dist_base = gic_data_dist_base(gic);
void __iomem *base = gic_data_cpu_base(gic);
unsigned int cpu_mask, cpu = smp_processor_id();
+   unsigned int bypass;
int i;
 
/*
@@ -449,13 +452,20 @@ static void gic_cpu_init(struct gic_chip_data *gic)
writel_relaxed(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 
4);
 
writel_relaxed(0xf0, base + GIC_CPU_PRIMASK);
-   writel_relaxed(1, base + GIC_CPU_CTRL);
+
+   bypass = readl(base + GIC_CPU_CTRL);
+   bypass &= GIC_BYPASS_MASK;
+   writel_relaxed(bypass | 0x1, base + GIC_CPU_CTRL);
 }
 
 void gic_cpu_if_down(void)
 {
void __iomem *cpu_base = gic_data_cpu_base(_data[0]);
-   writel_relaxed(0, cpu_base + GIC_CPU_CTRL);
+   unsigned int bypass;
+
+   bypass = readl(cpu_base + GIC_CPU_CTRL);
+   bypass &= GIC_BYPASS_MASK;
+   writel_relaxed(bypass, cpu_base + GIC_CPU_CTRL);
 }
 
 #ifdef CONFIG_CPU_PM
@@ -566,6 +576,7 @@ static void gic_cpu_restore(unsigned int gic_nr)
 {
int i;
u32 *ptr;
+   unsigned int bypass;
void __iomem *dist_base;
void __iomem *cpu_base;
 
@@ -590,7 +601,10 @@ static void gic_cpu_restore(unsigned int gic_nr)
writel_relaxed(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4);
 
writel_relaxed(0xf0, cpu_base + GIC_CPU_PRIMASK);
-   writel_relaxed(1, cpu_base + GIC_CPU_CTRL);
+
+   bypass = readl(cpu_base + GIC_CPU_CTRL);
+   bypass &= GIC_BYPASS_MASK;
+   writel_relaxed(bypass | 0x1, cpu_base + GIC_CPU_CTRL);
 }
 
 static int gic_notifier(struct notifier_block *self, unsigned long cmd,
void *v)
-- 
1.7.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/3] devicetree, qcomm PMIC: fix node name conflict

2014-05-06 Thread Rob Herring
On Tue, May 6, 2014 at 7:48 PM, Frank Rowand  wrote:
> An issue with the path of SPMI nodes under /sys/bus/... was reported in
> https://lkml.org/lkml/2014/4/23/312.  The symptom is that two different
> grandchild nodes of the spmi with the same node-name@unit-address will
> result in attempting to create duplicate links at
> /sys/bus/platform/devices/unit-address.node-name.  It turns out that the
> specific example provided might not be an expected configuration for
> current hardware, but the reported trap remains an issue.
>
> I have been poking at the problem, trying to figure out how to cleanly
> fix the issue without breaking devicetree device creation.
>
> The first patch in the series is the one that may be a very bad idea.  Or
> it may help show the way forward to deal with what I think is the major
> underlying problem.  I have not finished investigating the possible negative
> side effects.  And I am still thinking whether this is a conceptually good
> approach, or whether it is simply an expediant hack that hides the underlying
> problem.  But I am throwing this out prematurely because I have mentioned
> it to several people, and I want to make it visible to everyone involved.
>
> The underlying architectural problem (in my opinion) is that a lot of devices
> are created by the device tree infrastructure as platform devices, when they
> truly should not be platform devices.  They should not be platform devices
> because they are not physically on a platform bus, they are instead somewhere
> below some other bus.  The first patch in this series is a hack which
> results in the devices still being represented by "struct platform_device"
> objects, but with a link to their parent's "struct bus_type" instead of
> to _bus_type.
>
> The second patch does not require the first patch.  The second patch provides
> a mechanism to allow subsystems to provide a method of naming devices to
> avoid name collisions.
>
> The third patch provides an example of a subsystem using the new feature
> provided by the second patch.
>

I think the primary question to ask is there any added benefit to
having the additional hierarchy of devices. I don't think there is
much support to have more hierarchy from what I have seen of past
discussions.

Another approach could be to support having multiple platform bus
instances. Then drivers can easily create a new instance for each set
of sub-devices.

This can be solved in a much less invasive way just in the DT naming
algorithm. This is slightly different from what I had suggested of
just dropping the unit address. It keeps the unit address, but adds
the unique index on untranslate-able addresses. The diff is bigger due
to refactoring to reduce the indentation levels. It is untested and
whitespace corrupted:

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 404d1da..c77dd7a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -105,23 +105,33 @@ void of_device_make_bus_id(struct device *dev)
 * For MMIO, get the physical address
 */
reg = of_get_property(node, "reg", NULL);
-   if (reg) {
-   if (of_can_translate_address(node)) {
-   addr = of_translate_address(node, reg);
-   } else {
-   addrp = of_get_address(node, 0, NULL, NULL);
-   if (addrp)
-   addr = of_read_number(addrp, 1);
-   else
-   addr = OF_BAD_ADDR;
-   }
-   if (addr != OF_BAD_ADDR) {
-   dev_set_name(dev, "%llx.%s",
-(unsigned long long)addr, node->name);
-   return;
-   }
+   if (!reg)
+   goto no_bus_id;
+
+   if (of_can_translate_address(node)) {
+   addr = of_translate_address(node, reg);
+   if (addr == OF_BAD_ADDR)
+   goto no_bus_id;
+
+   dev_set_name(dev, "%llx.%s",
+(unsigned long long)addr, node->name);
+   return;
}

+   addrp = of_get_address(node, 0, NULL, NULL);
+   if (!addrp)
+   goto no_bus_id;
+
+   addr = of_read_number(addrp, 1);
+   if (addr == OF_BAD_ADDR)
+   goto no_bus_id;
+
+   magic = atomic_add_return(1, _no_reg_magic);
+   dev_set_name(dev, "%llx.%s.%d", (unsigned long long)addr,
+node->name, magic - 1);
+   return;
+
+no_bus_id:
/*
 * No BusID, use the node name and add a globally incremented
 * counter (and pray...)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [NOMERGE] reserved ram for pstore on PC (applied on top of new pstore patch)

2014-05-06 Thread Liu ShuoX

On Tue  6.May'14 at 10:48:00 -0400, Paul Gortmaker wrote:

On 14-05-06 01:03 AM, Liu ShuoX wrote:

for pstore record test.


I don't know what kind of cc mechanism you were manually deploying
when using git send-email here, but it is customary to actually

Sorry. This is my first time to send out test patch.
I used --cc-cmd=./scripts/get_maintainer.pl for my
patchset(include this NOMERGE one).
Actually, this one is for testing and verifying. Because of the x86 arch
code changing in the patch, get_maintainer.pl involves more guys.
BTW, what's the right/good approach to send out test patch?
Need i send it by deploying cc-list manually?

Thanks.

ensure that the 0/N summary also appears in the inbox of anyone
who is cc'd on any of the patches, so they have some context.

Not writing a four line commit log is also a good way to add
extra context too.

Paul.
--



Signed-off-by: Liu ShuoX 
---
 arch/x86/kernel/setup.c |   2 +
 fs/pstore/Makefile  |   2 +-
 fs/pstore/test.c| 170 
 3 files changed, 173 insertions(+), 1 deletion(-)
 create mode 100644 fs/pstore/test.c

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 09c76d2..021b17a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -854,6 +854,7 @@ dump_kernel_offset(struct notifier_block *self, unsigned 
long v, void *p)
  * Note: On x86_64, fixmaps are ready for use even before this is called.
  */

+extern void pstore_ram_reserved_memory(void);
 void __init setup_arch(char **cmdline_p)
 {
memblock_reserve(__pa_symbol(_text),
@@ -1217,6 +1218,7 @@ void __init setup_arch(char **cmdline_p)

x86_init.resources.reserve_resources();

+   pstore_ram_reserved_memory();
e820_setup_gap();

 #ifdef CONFIG_VT
diff --git a/fs/pstore/Makefile b/fs/pstore/Makefile
index 4c9095c..b2a961b 100644
--- a/fs/pstore/Makefile
+++ b/fs/pstore/Makefile
@@ -7,5 +7,5 @@ obj-y += pstore.o
 pstore-objs += inode.o platform.o
 obj-$(CONFIG_PSTORE_FTRACE)+= ftrace.o

-ramoops-objs += ram.o ram_core.o
+ramoops-objs += ram.o ram_core.o test.o
 obj-$(CONFIG_PSTORE_RAM)   += ramoops.o
diff --git a/fs/pstore/test.c b/fs/pstore/test.c
new file mode 100644
index 000..109c5a8
--- /dev/null
+++ b/fs/pstore/test.c
@@ -0,0 +1,170 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct norm_zone_test_record {
+   unsigned long val;
+   char str[32];
+};
+
+static void print_record(struct seq_file *s, void *rec)
+{
+   struct norm_zone_test_record *record = rec;
+   pstore_print(s, "%s: %ld\n",
+   record->str, record->val);
+}
+
+DEFINE_PSTORE_RAMZONE(test_zone) = {
+   .size = 4096,
+   .name = "test_zone",
+   .item_size = sizeof(struct norm_zone_test_record),
+   .print_record = print_record,
+};
+
+DEFINE_PSTORE_RAMZONE(test_zone1) = {
+   .size = 4096,
+   .name = "test_zone1",
+   .item_size = sizeof(struct norm_zone_test_record),
+   .print_record = print_record,
+};
+
+static void add_test_record(char *str, unsigned long val)
+{
+   struct norm_zone_test_record *record;
+   record = persistent_ram_new_record(test_zone.prz);
+   if (record) {
+   record->val = val;
+   strcpy(record->str, str);
+   }
+   record = persistent_ram_new_record(test_zone1.prz);
+   if (record) {
+   record->val = val;
+   strcpy(record->str, str);
+   }
+}
+
+static int test_cpufreq_transition(struct notifier_block *nb,
+   unsigned long event, void *data)
+{
+   add_test_record("cpufreq transition", event);
+   return 0;
+}
+
+static struct notifier_block freq_transition = {
+   .notifier_call = test_cpufreq_transition,
+};
+
+#define SZ_4K   0x1000
+#define SZ_2M   0x0020
+#define SZ_2_1M 0x00219000
+#define SZ_16M  0x0100
+
+#define PSTORE_RAM_START_DEFAULTSZ_16M
+#define PSTORE_RAM_SIZE_DEFAULT SZ_2_1M
+
+#ifdef CONFIG_X86_32
+#define RAM_MAX_MEM (max_low_pfn << PAGE_SHIFT)
+#else
+#define RAM_MAX_MEM (1 << 28)
+#endif
+
+static struct ramoops_platform_data pstore_ram_data = {
+   .mem_size   = PSTORE_RAM_SIZE_DEFAULT,
+   .mem_address= PSTORE_RAM_START_DEFAULT,
+   .record_size= SZ_4K,
+   .console_size   = SZ_2M,
+   .dump_oops  = 1,
+};
+
+static struct platform_device pstore_ram_dev = {
+   .name = "ramoops",
+   .dev = {
+   .platform_data = _ram_data,
+   },
+};
+
+static int __init pstore_ram_register(void)
+{
+   int ret;
+
+   ret = platform_device_register(_ram_dev);
+   if (ret) {
+   pr_err("%s: unable to register pstore_ram device: "
+   "start=0x%llx, size=0x%lx, ret=%d\n", __func__,
+   (unsigned long long)pstore_ram_data.mem_address,
+   pstore_ram_data.mem_size, ret);

Re: [PATCH 2/2] mm/page_alloc: DEBUG_VM checks for free_list placement of CMA and RESERVE pages

2014-05-06 Thread Minchan Kim
On Mon, May 05, 2014 at 05:50:46PM +0200, Vlastimil Babka wrote:
> On 05/05/2014 04:36 PM, Sasha Levin wrote:
> >On 05/02/2014 08:08 AM, Vlastimil Babka wrote:
> >>On 04/30/2014 11:46 PM, Sasha Levin wrote:
> On 04/03/2014 11:40 AM, Vlastimil Babka wrote:
> >>For the MIGRATE_RESERVE pages, it is important they do not get misplaced
> >>on free_list of other migratetype, otherwise the whole MIGRATE_RESERVE
> >>pageblock might be changed to other migratetype in 
> >>try_to_steal_freepages().
> >>For MIGRATE_CMA, the pages also must not go to a different free_list, 
> >>otherwise
> >>they could get allocated as unmovable and result in CMA failure.
> >>
> >>This is ensured by setting the freepage_migratetype appropriately when 
> >>placing
> >>pages on pcp lists, and using the information when releasing them back 
> >>to
> >>free_list. It is also assumed that CMA and RESERVE pageblocks are 
> >>created only
> >>in the init phase. This patch adds DEBUG_VM checks to catch any 
> >>regressions
> >>introduced for this invariant.
> >>
> >>Cc: Yong-Taek Lee 
> >>Cc: Bartlomiej Zolnierkiewicz 
> >>Cc: Joonsoo Kim 
> >>Cc: Mel Gorman 
> >>Cc: Minchan Kim 
> >>Cc: KOSAKI Motohiro 
> >>Cc: Marek Szyprowski 
> >>Cc: Hugh Dickins 
> >>Cc: Rik van Riel 
> >>Cc: Michal Nazarewicz 
> >>Signed-off-by: Vlastimil Babka 
> 
> Two issues with this patch.
> 
> First:
> 
> [ 3446.320082] kernel BUG at mm/page_alloc.c:1197!
> [ 3446.320082] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [ 3446.320082] Dumping ftrace buffer:
> [ 3446.320082](ftrace buffer empty)
> [ 3446.320082] Modules linked in:
> [ 3446.320082] CPU: 1 PID: 8923 Comm: trinity-c42 Not tainted 
> 3.15.0-rc3-next-20140429-sasha-00015-g7c7e0a7-dirty #427
> [ 3446.320082] task: 88053e208000 ti: 88053e246000 task.ti: 
> 88053e246000
> [ 3446.320082] RIP: get_page_from_freelist (mm/page_alloc.c:1197 
> mm/page_alloc.c:1548 mm/page_alloc.c:2036)
> [ 3446.320082] RSP: 0018:88053e247778  EFLAGS: 00010002
> [ 3446.320082] RAX: 0003 RBX: eaf4 RCX: 
> 0008
> [ 3446.320082] RDX: 0002 RSI: 0003 RDI: 
> 00a0
> [ 3446.320082] RBP: 88053e247868 R08: 0007 R09: 
> 
> [ 3446.320082] R10: 88006ffcef00 R11:  R12: 
> 0014
> [ 3446.335888] R13: ea000115ffe0 R14: ea000115ffe0 R15: 
> 
> [ 3446.335888] FS:  7f8c9f059700() GS:88006ec0() 
> knlGS:
> [ 3446.335888] CS:  0010 DS:  ES:  CR0: 8005003b
> [ 3446.335888] CR2: 02cbc048 CR3: 00054cdb4000 CR4: 
> 06a0
> [ 3446.335888] DR0: 006de000 DR1: 006de000 DR2: 
> 
> [ 3446.335888] DR3:  DR6: 0ff0 DR7: 
> 0602
> [ 3446.335888] Stack:
> [ 3446.335888]  88053e247798 88006eddc0b8 0016 
> 
> [ 3446.335888]  88006ffd2068 88006ffdb008 0001 
> 
> [ 3446.335888]  88006ffdb000  0003 
> 0001
> [ 3446.335888] Call Trace:
> [ 3446.335888] __alloc_pages_nodemask (mm/page_alloc.c:2731)
> [ 3446.335888] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
> [ 3446.335888] alloc_pages_vma (include/linux/mempolicy.h:76 
> mm/mempolicy.c:1998)
> [ 3446.335888] ? shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? kvm_clock_read (arch/x86/include/asm/preempt.h:90 
> arch/x86/kernel/kvmclock.c:86)
> [ 3446.335888] shmem_alloc_page (mm/shmem.c:881)
> [ 3446.335888] ? __const_udelay (arch/x86/lib/delay.c:126)
> [ 3446.335888] ? __rcu_read_unlock (kernel/rcu/update.c:97)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:979)
> [ 3446.335888] ? find_get_entry (mm/filemap.c:940)
> [ 3446.335888] ? find_lock_entry (mm/filemap.c:1024)
> [ 3446.335888] shmem_getpage_gfp (mm/shmem.c:1130)
> [ 3446.335888] ? sched_clock_local (kernel/sched/clock.c:214)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] shmem_fault (mm/shmem.c:1237)
> [ 3446.335888] ? do_read_fault.isra.42 (mm/memory.c:3523)
> [ 3446.335888] __do_fault (mm/memory.c:3344)
> [ 3446.335888] ? _raw_spin_unlock (arch/x86/include/asm/preempt.h:98 
> include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:183)
> [ 3446.335888] do_read_fault.isra.42 (mm/memory.c:3524)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] ? get_parent_ip (kernel/sched/core.c:2485)
> [ 3446.335888] __handle_mm_fault (mm/memory.c:3662 

Re: [PATCH] Staging: android: fix coding style issue for Eudyptula Challenge in timed_gpio.c

2014-05-06 Thread Greg KH
On Wed, May 07, 2014 at 12:44:31AM +0100, John Church wrote:
> 

> Signed-off-by: John Church 


What coding style issue?

You need to be specific in your body of your email, and put a blank line
after the signed-off-by and before the patch, otherwise the tools can
complain.

And drop the Eudyptula challenge line in subject:, it's not needed at
all.

Can you redo this and resend?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Fwd: [crypto:master 60/60] arch/x86/crypto/ghash-clmulni-intel_glue.c:71:25: sparse: cast to restricted __be64

2014-05-06 Thread gre...@linuxfoundation.org
On Fri, Apr 11, 2014 at 09:48:42PM +0200, Ard Biesheuvel wrote:
> On 11 April 2014 18:03, gre...@linuxfoundation.org
>  wrote:
> > On Fri, Apr 04, 2014 at 10:11:19AM +0200, Ard Biesheuvel wrote:
> >> Greg,
> >>
> >> This pertains to commit 8ceee72808d1 (crypto: ghash-clmulni-intel -
> >> use C implementation for setkey()) that has been pulled by Linus
> >> during the current merge window.
> >>
> >> It is missing two things:
> >> - a cc to stable annotation
> >> - a fix for the sparse warning below (change cast from __be64 to __force 
> >> __be64)
> >>
> >> The reason for cc'ing stable on this patch is that it fixes a
> >> potential data corruption issue where the ghash setkey() method uses
> >> SSE registers without calling kernel_fpu_begin() first. This issue was
> >> introduced by 0e1227d356e9b (crypto: ghash - Add PCLMULQDQ accelerated
> >> implementation).
> >>
> >> So how would you like to proceed with this? Should I propose a new
> >> patch somewhere?
> >
> > No problem, I'll apply this as-is.  But it doesn't apply to the
> > 3.4-stable tree cleanly, can you send me a backported version if it's
> > still needed there as well?
> >
> 
> Yes, the code was broken from the start. 3.4 version is attached, the
> only difference is the missing ENDPROC() at the end of the asm file.

Now applied, thanks.

> In the mean time, Herbert has submitted a fix for the sparse warning,
> but we settled on a different fix than I had suggested before.
> https://git.kernel.org/cgit/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=0ea481466d1c
> 
> Note that this code has not been tested (not by me, at least), so I
> wouldn't suggest you take it straight away, but if you care about the
> sparse warning, we could add a cc stable to it as well, I suppose.

If it's a real bugfix that people can hit, then yse, I'll take it.  Just
let me know when it hits Linus's tree.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ARC patches for stable 3.10

2014-05-06 Thread Greg KH
On Wed, Apr 30, 2014 at 09:53:05AM +, Vineet Gupta wrote:
> Hi,
> 
> Please apply the following mainline commits to stable 3.10 as prerequisites 
> for a
> patch for 3.15/stable which will follow to Linus right after.
> 
> 147aece29b15051173eb1e767018135361cdba89  (went in 3.11-rc1)
> "ARC: Entry Handler tweaks: Simplify branch for in-kernel preemption"
> 
> fce16bc35ae4a45634f3dc348d8d297a25c277cf  (went in 3.12-rc1)
> "ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE"

Now applied, thanks.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 1/2] perf record: Propagate exit status of a command line workload

2014-05-06 Thread Namhyung Kim
Currently perf record doesn't propagate the exit status of a workload
given by the command line.  But sometimes it'd useful if it's
propagated so that a monitoring script can handle errors
appropriately.

To do that, it got rid of exit handlers and run/call them directly in
the __cmd_record().  I don't see any reason why those are in a form of
exit handlers in the first place.  Also it cleaned up the resource
management code in record__exit().

With this change, perf record returns the child exit status in case of
normal termination.  (Not sure what should be returned on abnormal
cases though).

Example run of Stephane's case:

  $ perf record true && echo yes || echo no
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
  yes

  $ perf record false && echo yes || echo no
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
  no

And Jiri's case (error in parent):

  $ perf record -m 10G true && echo yes || echo no
  rounding mmap pages size to 17179869184 bytes (4194304 pages)
  failed to mmap with 12 (Cannot allocate memory)
  no

Reported-by: Stephane Eranian 
Acked-by: Stephane Eranian 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-record.c | 127 ++--
 1 file changed, 53 insertions(+), 74 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 8ce62ef7f6c3..e4cb53397b83 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -140,7 +140,6 @@ out:
 }
 
 static volatile int done = 0;
-static volatile int signr = -1;
 static volatile int child_finished = 0;
 
 static void sig_handler(int sig)
@@ -149,27 +148,6 @@ static void sig_handler(int sig)
child_finished = 1;
 
done = 1;
-   signr = sig;
-}
-
-static void record__sig_exit(int exit_status __maybe_unused, void *arg)
-{
-   struct record *rec = arg;
-   int status;
-
-   if (rec->evlist->workload.pid > 0) {
-   if (!child_finished)
-   kill(rec->evlist->workload.pid, SIGTERM);
-
-   wait();
-   if (WIFSIGNALED(status))
-   psignal(WTERMSIG(status), rec->progname);
-   }
-
-   if (signr == -1 || signr == SIGUSR1)
-   return;
-
-   signal(signr, SIG_DFL);
 }
 
 static int record__open(struct record *rec)
@@ -243,27 +221,6 @@ static int process_buildids(struct record *rec)
  size, 
_id__mark_dso_hit_ops);
 }
 
-static void record__exit(int status, void *arg)
-{
-   struct record *rec = arg;
-   struct perf_data_file *file = >file;
-
-   if (status != 0)
-   return;
-
-   if (!file->is_pipe) {
-   rec->session->header.data_size += rec->bytes_written;
-
-   if (!rec->no_buildid)
-   process_buildids(rec);
-   perf_session__write_header(rec->session, rec->evlist,
-  file->fd, true);
-   perf_session__delete(rec->session);
-   perf_evlist__delete(rec->evlist);
-   symbol__exit();
-   }
-}
-
 static void perf_event__synthesize_guest_os(struct machine *machine, void 
*data)
 {
int err;
@@ -344,18 +301,19 @@ static volatile int workload_exec_errno;
  * if the fork fails, since we asked by setting its
  * want_signal to true.
  */
-static void workload_exec_failed_signal(int signo, siginfo_t *info,
+static void workload_exec_failed_signal(int signo __maybe_unused,
+   siginfo_t *info,
void *ucontext __maybe_unused)
 {
workload_exec_errno = info->si_value.sival_int;
done = 1;
-   signr = signo;
child_finished = 1;
 }
 
 static int __cmd_record(struct record *rec, int argc, const char **argv)
 {
int err;
+   int status = 0;
unsigned long waking = 0;
const bool forks = argc > 0;
struct machine *machine;
@@ -367,7 +325,6 @@ static int __cmd_record(struct record *rec, int argc, const 
char **argv)
 
rec->progname = argv[0];
 
-   on_exit(record__sig_exit, rec);
signal(SIGCHLD, sig_handler);
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
@@ -394,26 +351,21 @@ static int __cmd_record(struct record *rec, int argc, 
const char **argv)
 
if (record__open(rec) != 0) {
err = -1;
-   goto out_delete_session;
+   goto out_child;
}
 
if (!rec->evlist->nr_groups)
perf_header__clear_feat(>header, HEADER_GROUP_DESC);
 
-   /*
-* perf_session__delete(session) will be called at record__exit()
-*/
-   on_exit(record__exit, rec);
-
if (file->is_pipe) {
err = 

[PATCH v4 2/2] perf tools: Get rid of on_exit() feature test

2014-05-06 Thread Namhyung Kim
The on_exit() function was only used in perf record but it's gone in
previous patch.

Acked-by: Stephane Eranian 
Cc: Bernhard Rosenkraenzer 
Cc: Irina Tirdea 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-record.c | 31 -
 tools/perf/config/Makefile  |  8 ---
 tools/perf/config/feature-checks/Makefile   |  4 
 tools/perf/config/feature-checks/test-all.c |  5 
 tools/perf/config/feature-checks/test-on-exit.c | 16 -
 5 files changed, 64 deletions(-)
 delete mode 100644 tools/perf/config/feature-checks/test-on-exit.c

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e4cb53397b83..adaf3414c00b 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -30,37 +30,6 @@
 #include 
 #include 
 
-#ifndef HAVE_ON_EXIT_SUPPORT
-#ifndef ATEXIT_MAX
-#define ATEXIT_MAX 32
-#endif
-static int __on_exit_count = 0;
-typedef void (*on_exit_func_t) (int, void *);
-static on_exit_func_t __on_exit_funcs[ATEXIT_MAX];
-static void *__on_exit_args[ATEXIT_MAX];
-static int __exitcode = 0;
-static void __handle_on_exit_funcs(void);
-static int on_exit(on_exit_func_t function, void *arg);
-#define exit(x) (exit)(__exitcode = (x))
-
-static int on_exit(on_exit_func_t function, void *arg)
-{
-   if (__on_exit_count == ATEXIT_MAX)
-   return -ENOMEM;
-   else if (__on_exit_count == 0)
-   atexit(__handle_on_exit_funcs);
-   __on_exit_funcs[__on_exit_count] = function;
-   __on_exit_args[__on_exit_count++] = arg;
-   return 0;
-}
-
-static void __handle_on_exit_funcs(void)
-{
-   int i;
-   for (i = 0; i < __on_exit_count; i++)
-   __on_exit_funcs[i] (__exitcode, __on_exit_args[i]);
-}
-#endif
 
 struct record {
struct perf_tooltool;
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 150c84c7416d..f2edc593a7a7 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -174,7 +174,6 @@ CORE_FEATURE_TESTS =\
libpython-version   \
libslang\
libunwind   \
-   on-exit \
stackprotector-all  \
timerfd \
libdw-dwarf-unwind
@@ -200,7 +199,6 @@ VF_FEATURE_TESTS =  \
libelf-getphdrnum   \
libelf-mmap \
libpython-version   \
-   on-exit \
stackprotector-all  \
timerfd \
libunwind-debug-frame   \
@@ -571,12 +569,6 @@ ifneq ($(filter -lbfd,$(EXTLIBS)),)
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
 endif
 
-ifndef NO_ON_EXIT
-  ifeq ($(feature-on-exit), 1)
-CFLAGS += -DHAVE_ON_EXIT_SUPPORT
-  endif
-endif
-
 ifndef NO_BACKTRACE
   ifeq ($(feature-backtrace), 1)
 CFLAGS += -DHAVE_BACKTRACE_SUPPORT
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index 2da103c53f89..64c84e5f0514 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -24,7 +24,6 @@ FILES=\
test-libslang.bin   \
test-libunwind.bin  \
test-libunwind-debug-frame.bin  \
-   test-on-exit.bin\
test-stackprotector-all.bin \
test-timerfd.bin\
test-libdw-dwarf-unwind.bin
@@ -133,9 +132,6 @@ test-liberty-z.bin:
 test-cplus-demangle.bin:
$(BUILD) -liberty
 
-test-on-exit.bin:
-   $(BUILD)
-
 test-backtrace.bin:
$(BUILD)
 
diff --git a/tools/perf/config/feature-checks/test-all.c 
b/tools/perf/config/feature-checks/test-all.c
index fc37eb3ca17b..fe5c1e5c952f 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -69,10 +69,6 @@
 # include "test-libbfd.c"
 #undef main
 
-#define main main_test_on_exit
-# include "test-on-exit.c"
-#undef main
-
 #define main main_test_backtrace
 # include "test-backtrace.c"
 #undef main
@@ -110,7 +106,6 @@ int main(int argc, char *argv[])
main_test_gtk2(argc, argv);
main_test_gtk2_infobar(argc, argv);
main_test_libbfd();
-   main_test_on_exit();
main_test_backtrace();
main_test_libnuma();
main_test_timerfd();
diff --git a/tools/perf/config/feature-checks/test-on-exit.c 
b/tools/perf/config/feature-checks/test-on-exit.c
deleted file mode 100644
index 8e88b16e6ded..
--- a/tools/perf/config/feature-checks/test-on-exit.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include 
-#include 
-
-static void exit_fn(int status, void *__data)
-{
-   printf("exit status: %d, data: %d\n", status, *(int *)__data);
-}
-
-static int data = 123;
-
-int main(void)
-{
-   

Re: [PATCH 1/3] PM / OPP: Add support for descending order for cpufreq table

2014-05-06 Thread Nishanth Menon
On Tue, May 6, 2014 at 6:43 PM, Jonghwan Choi  wrote:
> Hi

Please dont top post. it is usually frowned upon.

>
> My holiday is finished.
>
> I implemented another cpufreq driver. And that driver also have to use 
> exynos_sort_descend_freq_table().
> Then exynos5440 and new cpufreq have a duplicate 
> function.(exynos_sort_descend_freq_table().
> So I want to solve it.

As discussed in the thread, creating stuff that are common into a
common file, and even isolating this into cpufreq specific solution
might be good.

[1] now moves that entire logic of table creation to be cpufreq
specific - we could consider modifier functions to them.

In some quick tests by reversing table [2], I cant see any difference
in behavior in ascending[3] or descending[4] order of the cpufreq
table.

So, we could do [2] as default as well, if it is determined to impact
no one else making any form of assumptions on table ordering - but it
might be preferable for drivers not to depend on framework ordering of
data as things could change in the future.

[1] https://patchwork.kernel.org/patch/4115141/ +
https://patchwork.kernel.org/patch/4115101/
[2] http://slexy.org/view/s21HyCUhXK
[3] http://slexy.org/view/s202xTUG59
[4] http://slexy.org/view/s20ewFa6PW


Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH 3/3] devicetree, qcomm PMIC: use new hook to make PMIC device names unique

2014-05-06 Thread Frank Rowand
From: Frank Rowand 

The previous patch in the series does:

   Optionally push device naming into a function called dynamically by
   of_device_alloc().

This patch adds an example of using that capability.

Signed-off-by: Frank Rowand 
---
 drivers/mfd/pm8x41.c |   39 +++
 1 file changed, 39 insertions(+)

Index: b/drivers/mfd/pm8x41.c
===
--- a/drivers/mfd/pm8x41.c
+++ b/drivers/mfd/pm8x41.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static const struct regmap_config pm8x41_regmap_config = {
@@ -32,6 +33,43 @@ static void pm8x41_remove(struct spmi_de
device_for_each_child(>dev, NULL, pm8x41_remove_child);
 }
 
+static void spmi_of_device_make_bus_id(struct device *dev)
+{
+   struct device_node *node = dev->of_node;
+   const __be32 *reg;
+   u64 addr;
+   const __be32 *addrp;
+   struct spmi_device *sdev;
+
+   sdev = container_of(dev->parent, struct spmi_device, dev);
+
+   /*
+* For MMIO, get the physical address
+*/
+   reg = of_get_property(node, "reg", NULL);
+   if (reg) {
+   if (of_can_translate_address(node)) {
+   addr = of_translate_address(node, reg);
+   } else {
+   addrp = of_get_address(node, 0, NULL, NULL);
+   if (addrp)
+   addr = of_read_number(addrp, 1);
+   else
+   addr = OF_BAD_ADDR;
+   }
+   if (addr != OF_BAD_ADDR) {
+   dev_set_name(dev, "%d-%02x:%llx.%s",
+sdev->ctrl->nr, sdev->usid,
+(unsigned long long)addr, node->name);
+   return;
+   }
+   }
+
+   dev_set_name(dev, "%d-%02x:%s",
+sdev->ctrl->nr, sdev->usid,
+node->name);
+}
+
 static int pm8x41_probe(struct spmi_device *sdev)
 {
struct regmap *regmap;
@@ -42,6 +80,7 @@ static int pm8x41_probe(struct spmi_devi
return PTR_ERR(regmap);
}
 
+   sdev->dev.of_node->of_device_make_bus_id = spmi_of_device_make_bus_id;
return of_platform_populate(sdev->dev.of_node, NULL, NULL, >dev);
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH 2/3] devicetree: provide hook to allow setting devicetree device name

2014-05-06 Thread Frank Rowand
From: Frank Rowand 

Optionally push devicetree device naming into a function called dynamically by
of_device_alloc().

TODO:
   Change made to of_device_alloc() could also be made to
   of_amba_device_create()

Signed-off-by: Frank Rowand 
---
 drivers/of/platform.c |2 ++
 include/linux/of.h|2 ++
 3 files changed, 43 insertions(+)

Index: b/drivers/of/platform.c
===
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -179,6 +179,8 @@ struct platform_device *of_device_alloc(
 
if (bus_id)
dev_set_name(>dev, "%s", bus_id);
+   else if (np->parent->of_device_make_bus_id)
+   np->parent->of_device_make_bus_id(>dev);
else
of_device_make_bus_id(>dev);
 
Index: b/include/linux/of.h
===
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -17,6 +17,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -60,6 +61,7 @@ struct device_node {
struct  kobject kobj;
unsigned long _flags;
void*data;
+   void(*of_device_make_bus_id)(struct device *dev);
 #if defined(CONFIG_SPARC)
const char *path_component_name;
unsigned int unique_id;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH 1/3] devicetree: set bus type same as parent

2014-05-06 Thread Frank Rowand
From: Frank Rowand 

This is a somewhat scary patch since it touches a path that is central to
device creation based on the device tree.  It should not be applied without
careful consideration.

I am not sure if this patch is a good idea, even if it does not break
anything.

An issue with the path of SPMI nodes under /sys/bus/... was reported in
https://lkml.org/lkml/2014/4/23/312.  The symptom is that two different
grandchild nodes of the spmi with the same node-name@unit-address will
result in attempting to create duplicate links at
/sys/bus/platform/devices/unit-address.node-name.  It turns out that the
specific example provided might not be an expected configuration for
current hardware, but the reported trap remains an issue.

The common pattern exposed is a driver probe function calling
of_platform_populate() to create child devices.  As the reporting
email noted, the devices are created with dev.bus set to
platform_bus_type.  Thus all devices created via this pattern will
result in a link in /sys/bus/platform/devices/, with the risk that
a name collision will occur.

This patch reduces the scope of possible name collisions to devices
on the same bus type.  This is still not ideal, because a legal
device tree source file can result in run time errors.  In the case
of SPMI nodes, the collisions will occur in /bus/spmi/devices/.

I have not investigated whether other drivers would be negatively impacted
by this change - there are 26 drivers in tree that call of_platform_populate().

Signed-off-by: Frank Rowand 
---
 drivers/of/platform.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: b/drivers/of/platform.c
===
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -217,7 +217,10 @@ static struct platform_device *of_platfo
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
if (!dev->dev.dma_mask)
dev->dev.dma_mask = >dev.coherent_dma_mask;
-   dev->dev.bus = _bus_type;
+   if (parent && parent->bus)
+   dev->dev.bus = parent->bus;
+   else
+   dev->dev.bus = _bus_type;
dev->dev.platform_data = platform_data;
 
/* We do not fill the DMA ops for platform devices by default.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC PATCH 0/3] devicetree, qcomm PMIC: fix node name conflict

2014-05-06 Thread Frank Rowand
An issue with the path of SPMI nodes under /sys/bus/... was reported in
https://lkml.org/lkml/2014/4/23/312.  The symptom is that two different
grandchild nodes of the spmi with the same node-name@unit-address will
result in attempting to create duplicate links at
/sys/bus/platform/devices/unit-address.node-name.  It turns out that the
specific example provided might not be an expected configuration for
current hardware, but the reported trap remains an issue.

I have been poking at the problem, trying to figure out how to cleanly
fix the issue without breaking devicetree device creation.

The first patch in the series is the one that may be a very bad idea.  Or
it may help show the way forward to deal with what I think is the major
underlying problem.  I have not finished investigating the possible negative
side effects.  And I am still thinking whether this is a conceptually good
approach, or whether it is simply an expediant hack that hides the underlying
problem.  But I am throwing this out prematurely because I have mentioned
it to several people, and I want to make it visible to everyone involved.

The underlying architectural problem (in my opinion) is that a lot of devices
are created by the device tree infrastructure as platform devices, when they
truly should not be platform devices.  They should not be platform devices
because they are not physically on a platform bus, they are instead somewhere
below some other bus.  The first patch in this series is a hack which
results in the devices still being represented by "struct platform_device"
objects, but with a link to their parent's "struct bus_type" instead of
to _bus_type.

The second patch does not require the first patch.  The second patch provides
a mechanism to allow subsystems to provide a method of naming devices to
avoid name collisions.

The third patch provides an example of a subsystem using the new feature
provided by the second patch.

The resulting device naming and soft links from applying all three patches,
or just the second and third patches are:


=  no patches applied:

$ ls /sys/devices/
ARMv7 Krait  cpu-pmu.1platform software tracepoint
breakpoint   cpus.0   soc.2system   virtual

$ ls /sys/devices/soc.2/
f900.interrupt-controller  fc4281d0.qcom,mpm
f9011000.smem  fc4ab000.restart
f9012000.regulator fc4cf000.qcom,spmi
f902.timer fd484000.hwlock
f9088000.clock-controller  fd51.pinctrl
f9098000.clock-controller  fd8c.clock-controller
f90a8000.clock-controller  gpio_keys.5
f90b8000.clock-controller  iio-thermal.4
f9824900.sdhc  modalias
f991e000.serialpower
f9924000.i2c2  subsystem
f9928000.i2c6  timer.3
f9bff000.rng   uevent
fc40.clock-controller

$ ls /sys/devices/soc.2/fc4cf000.qcom,spmi/
driver modalias   power  spmi-0 subsystem  uevent

$ ls /sys/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/
0-00   0-01   0-04   power  subsystem  uevent

$ ls /sys/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-00/
100.qcom,reviddriversubsystem
3100.qcom,pm8x41-adc-usr  gpios.18  uevent
6000.qcom,rtc power



$ ls /sys/bus/platform/devices/soc.2/
f900.interrupt-controller  fc4281d0.qcom,mpm
f9011000.smem  fc4ab000.restart
f9012000.regulator fc4cf000.qcom,spmi
f902.timer fd484000.hwlock
f9088000.clock-controller  fd51.pinctrl
f9098000.clock-controller  fd8c.clock-controller
f90a8000.clock-controller  gpio_keys.5
f90b8000.clock-controller  iio-thermal.4
f9824900.sdhc  modalias
f991e000.serialpower
f9924000.i2c2  subsystem
f9928000.i2c6  timer.3
f9bff000.rng   uevent
fc40.clock-controller

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/
driver modalias   power  spmi-0 subsystem  uevent

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/
0-00   0-01   0-04   power  subsystem  uevent

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-00/
100.qcom,reviddriversubsystem
3100.qcom,pm8x41-adc-usr  gpios.18  uevent
6000.qcom,rtc power

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-01/
b040.pm8xxx-pwm  driver   uevent
d000.pm8xxx-pwm-led  power
d800.pm8xxx-wled subsystem

$ ls /sys/bus/platform/devices/soc.2/fc4cf000.qcom,spmi/spmi-0/0-04/
driver power  subsystem  uevent



$ ls /sys/bus/spmi/devices/
0-000-010-04spmi-0

$ ls /sys/bus/platform/devices/
100.qcom,revid fc4cf000.qcom,spmi
3100.qcom,pm8x41-adc-usr   fd484000.hwlock
6000.qcom,rtc  fd51.pinctrl
alarmtimer fd8c.clock-controller

  1   2   3   4   5   6   7   8   9   10   >