[PATCH] decompressors: fix "no limit" output buffer length

2013-07-21 Thread Alexandre Courbot
When decompressing into memory, the output buffer length is set to some
arbitrarily high value (0x7fff) to indicate the output is,
virtually, unlimited in size.

The problem with this is that some platforms have their physical memory
at high physical addresses (0x8000 or more), and that the output
buffer address and its "unlimited" length cannot be added without
overflowing. An example of this can be found in inflate_fast():

/* next_out is the output buffer address */
out = strm->next_out - OFF;
/* avail_out is the output buffer size. end will overflow if the output
 * address is >= 0x8104 */
end = out + (strm->avail_out - 257);

This has huge consequences on the performance of kernel decompression,
since the following exit condition of inflate_fast() will be always
true:

} while (in < last && out < end);

Indeed, "end" has overflowed and is now always lower than "out". As a
result, inflate_fast() will return after processing one single byte of
input data, and will thus need to be called an unreasonably high number
of times. This probably went unnoticed because kernel decompression is
fast enough even with this issue.

Nonetheless, adjusting the output buffer length in such a way that the
above pointer arithmetic never overflows results in a kernel
decompression that is about 3 times faster on affected machines.

Signed-off-by: Alexandre Courbot 
---
 lib/decompress_inflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c
index 19ff89e..d619b28 100644
--- a/lib/decompress_inflate.c
+++ b/lib/decompress_inflate.c
@@ -48,7 +48,7 @@ STATIC int INIT gunzip(unsigned char *buf, int len,
out_len = 0x8000; /* 32 K */
out_buf = malloc(out_len);
} else {
-   out_len = 0x7fff; /* no limit */
+   out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */
}
if (!out_buf) {
error("Out of memory while allocating output buffer");
-- 
1.8.3.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: [PATCH] backlight-lm3630-apply chip revision

2013-07-21 Thread Jingoo Han
On Friday, July 19, 2013 7:50 PM, Daniel Jeong wrote:
> 

Please, change the subject name as below:

[PATCH] backlight: lm3630: apply lm3630a chip revision

> The TI LM3630 chip was revised and chip name was also changed to LM3630A.

Then, replace all 'lm3630' strings with 'lm3630a' strings.

For example,
1. file names
drivers/video/backlight/lm3630_bl.c --> 
drivers/video/backlight/lm3630a_bl.c
include/linux/platform_data/lm3630_bl.h  --> 
include/linux/platform_data/lm3630a_bl.h
2. config name
BACKLIGHT_LM3630  --> BACKLIGHT_LM3630A
3. function names
lm3630_read() --> lm3630a_read()
etc.
4. struct names
lm3630_chip --> lm3630a_chip
lm3630_platform_data --> lm3630a_platform_data
etc
5. enum and variable names
6. etc...


> And register map, default values and initial sequences are changed.
> www.ti.com

'www.ti.com' looks redundant.

> 
> Signed-off-by: daniel jeong 

s/daniel jeong/Daniel Jeong

> ---
>  drivers/video/backlight/Kconfig |4 +-
>  drivers/video/backlight/lm3630_bl.c |  491 
> ---
>  include/linux/platform_data/lm3630_bl.h |   68 +++--


lm3630_bl.c  --> lm3630a_bl.c
lm3630_bl.h --> lm3630a_bl.h


>  3 files changed, 293 insertions(+), 270 deletions(-)
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index d5ab658..048e7bd 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -369,11 +369,11 @@ config BACKLIGHT_AAT2870
> backlight driver.
> 
>  config BACKLIGHT_LM3630

s/BACKLIGHT_LM3630/ BACKLIGHT_LM3630A

> - tristate "Backlight Driver for LM3630"
> + tristate "Backlight Driver for LM3630A"
>   depends on BACKLIGHT_CLASS_DEVICE && I2C
>   select REGMAP_I2C
>   help
> -   This supports TI LM3630 Backlight Driver
> +   This supports TI LM3630A Backlight Driver
> 
>  config BACKLIGHT_LM3639
>   tristate "Backlight Driver for LM3639"
> diff --git a/drivers/video/backlight/lm3630_bl.c 
> b/drivers/video/backlight/lm3630_bl.c
> index 76a62e9..0e9d4e7 100644
> --- a/drivers/video/backlight/lm3630_bl.c
> +++ b/drivers/video/backlight/lm3630_bl.c
> @@ -1,5 +1,5 @@
>  /*
> -* Simple driver for Texas Instruments LM3630 Backlight driver chip
> +* Simple driver for Texas Instruments LM3630A Backlight driver chip
>  * Copyright (C) 2012 Texas Instruments
>  *
>  * This program is free software; you can redistribute it and/or modify
> @@ -16,12 +16,16 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> 
>  #define REG_CTRL 0x00
> +#define REG_BOOST0x02
>  #define REG_CONFIG   0x01
>  #define REG_BRT_A0x03
>  #define REG_BRT_B0x04
> +#define REG_I_A  0x05
> +#define REG_I_B  0x06
>  #define REG_INT_STATUS   0x09
>  #define REG_INT_EN   0x0A
>  #define REG_FAULT0x0B
> @@ -30,205 +34,211 @@
>  #define REG_MAX  0x1F
> 
>  #define INT_DEBOUNCE_MSEC10
> -
> -enum lm3630_leds {
> - BLED_ALL = 0,
> - BLED_1,
> - BLED_2
> -};
> -
> -static const char * const bled_name[] = {
> - [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */
> - [BLED_1] = "lm3630_bled1",  /*Bank1 controls bled1 */
> - [BLED_2] = "lm3630_bled2",  /*Bank1 or 2 controls bled2 */
> -};
> -
> -struct lm3630_chip_data {
> +struct lm3630_chip {
>   struct device *dev;
>   struct delayed_work work;
> +
>   int irq;
>   struct workqueue_struct *irqthread;
>   struct lm3630_platform_data *pdata;
> - struct backlight_device *bled1;
> - struct backlight_device *bled2;
> + struct backlight_device *bleda;
> + struct backlight_device *bledb;
>   struct regmap *regmap;
> + struct pwm_device *pwmd;
>  };
> 
> -/* initialize chip */
> -static int lm3630_chip_init(struct lm3630_chip_data *pchip)
> +/* i2c access */
> +static int lm3630_read(struct lm3630_chip *pchip, unsigned int reg)
>  {
> - int ret;
> + int rval;
>   unsigned int reg_val;
> - struct lm3630_platform_data *pdata = pchip->pdata;
> -
> - /*pwm control */
> - reg_val = ((pdata->pwm_active & 0x01) << 2) | (pdata->pwm_ctrl & 0x03);
> - ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x07, reg_val);
> - if (ret < 0)
> - goto out;
> 
> - /* bank control */
> - reg_val = ((pdata->bank_b_ctrl & 0x01) << 1) |
> - (pdata->bank_a_ctrl & 0x07);
> - ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x07, reg_val);
> - if (ret < 0)
> - goto out;
> + rval = regmap_read(pchip->regmap, reg, ®_val);
> + if (rval < 0)
> + return rval;
> + return reg_val & 0xFF;
> +}
> 
> - ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
> - if (ret < 0)
> - goto out;
> +static int lm3630_write(struct lm3630_chip *pchip,
> + unsigned int reg, unsigne

[PATCH 2/2] staging: gdm7240: added contacts for code maintanance

2013-07-21 Thread Won Kang
Signed-off-by: Won Kang 
---
 drivers/staging/gdm724x/TODO |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/gdm724x/TODO b/drivers/staging/gdm724x/TODO
index b9e1177..dba5823 100644
--- a/drivers/staging/gdm724x/TODO
+++ b/drivers/staging/gdm724x/TODO
@@ -1,2 +1,6 @@
 TODO:
-- Clean up coding style to meet kernel standard.
\ No newline at end of file
+- Clean up coding style to meet kernel standard.
+
+Patches to:
+   Jonathan Kim 
+   Dean ahn 
-- 
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] fsnotify: potential use after free

2013-07-21 Thread Dan Carpenter
My static checker complains that if we drop the last reference then it
would be a use after free.  I don't know if it's possible, but really
the atomic_dec(&group->num_marks); should be done while we are holding a
reference to "group".

Signed-off-by: Dan Carpenter 

diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 923fe4a..27e357e 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -262,9 +262,9 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
 err:
mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
list_del_init(&mark->g_list);
+   atomic_dec(&group->num_marks);
fsnotify_put_group(group);
mark->group = NULL;
-   atomic_dec(&group->num_marks);
 
spin_unlock(&mark->lock);
 
--
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 V3 0/2] [BUGFIX] virtio/console: Fix two bugs of splice_write

2013-07-21 Thread Amit Shah
On (Mon) 22 Jul 2013 [13:00:43], Yoshihiro YUNOMAE wrote:
> Hi,
> 
> This patch set fixes two bugs of splice_write in the virtio-console driver.
> 
> [BUG1] Although pipe->nrbufs is empty, the driver tries to do splice_write.
>=> This induces oops in sg_init_table().
> 
> [BUG2] No lock for competition of splice_write.
>=> This induces oops in splice_from_pipe_feed() by bug of any user
>   application.
> 
> These reports are written in each patch.
> 
> Changes in V2:
> - Fix a locking problem for error
> 
> Changes in V3:
> - Add Reviewed-by lines and stable@ line in sign-off area

Thank you!

Rusty, please pick this up.

Amit
--
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 - RADEON patch update for 3.10.1 urgency low

2013-07-21 Thread Dave Airlie

> did some re-design of the patch for detecting power modes in PowerPlayTable,
> I
> hope this version looks a little bit smarter. Quality check with my muxless
> HD 6490M
> succesful, integrity/sanity checks for other asics like si/r600 which use
> the
> radeon_atombios_parse_power_table_4_5 are to be done.
>  
> Best wishes and regards,
>  
> Michael Schuster

Hi,

I've cc'ed the lists, and Alex the radeon maintainer.


Dave.


Re: [RFC 0/4] Transparent on-demand struct page initialization embedded in the buddy allocator

2013-07-21 Thread Robin Holt
On Fri, Jul 19, 2013 at 04:51:49PM -0700, Yinghai Lu wrote:
> On Wed, Jul 17, 2013 at 2:30 AM, Robin Holt  wrote:
> > On Wed, Jul 17, 2013 at 01:17:44PM +0800, Sam Ben wrote:
> >> >With this patch, we did boot a 16TiB machine.  Without the patches,
> >> >the v3.10 kernel with the same configuration took 407 seconds for
> >> >free_all_bootmem.  With the patches and operating on 2MiB pages instead
> >> >of 1GiB, it took 26 seconds so performance was improved.  I have no feel
> >> >for how the 1GiB chunk size will perform.
> >>
> >> How to test how much time spend on free_all_bootmem?
> >
> > We had put a pr_emerg at the beginning and end of free_all_bootmem and
> > then used a modified version of script which record the time in uSecs
> > at the beginning of each line of output.
> 
> used two patches, found 3TiB system will take 100s before slub is ready.
> 
> about three portions:
> 1. sparse vmemap buf allocation, it is with bootmem wrapper, so clear those
> struct page area take about 30s.
> 2. memmap_init_zone: take about 25s
> 3. mem_init/free_all_bootmem about 30s.
> 
> so still wonder why 16TiB will need hours.

I don't know where you got the figure of hours for memory initialization.
That is likely for a 32TiB boot and includes the entire boot, not just
getting the memory allocator initialized.

For a 16 TiB boot:
1) 344
2) 1151
3) 407

I hope that illustrates why we chose to address the memmap_init_zone first
which had the nice side effect of also impacting the free_all_bootmem
slowdown.

With these patches, those numbers are currently:
1) 344
2) 49
3) 26

> also your patches looks like only address 2 and 3.

Right, but I thought that was the normal way to do things.  Address
one thing at a time and work toward a better kernel.  I don't see a
relationship between the work we are doing here and the sparse vmemmap
buffer allocation.  Have I missed something?

Did you happen to time a boot with these patches applied to see how
long it took and how much impact they had on a smaller config?

Robin
--
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 RFC V11 18/18] kvm hypervisor: Add directed yield in vcpu block path

2013-07-21 Thread Raghavendra K T
kvm hypervisor: Add directed yield in vcpu block path

From: Raghavendra K T 

We use the improved PLE handler logic in vcpu block patch for
scheduling rather than plain schedule, so that we can make
intelligent decisions.

Signed-off-by: Raghavendra K T 
---
 Changes: 
 Added stubs for missing architecture (Gleb)

 arch/arm/include/asm/kvm_host.h |5 +
 arch/arm64/include/asm/kvm_host.h   |5 +
 arch/ia64/include/asm/kvm_host.h|5 +
 arch/mips/include/asm/kvm_host.h|5 +
 arch/powerpc/include/asm/kvm_host.h |5 +
 arch/s390/include/asm/kvm_host.h|5 +
 arch/x86/include/asm/kvm_host.h |2 +-
 arch/x86/kvm/x86.c  |8 
 include/linux/kvm_host.h|2 +-
 virt/kvm/kvm_main.c |6 --
 10 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 7d22517..94836c0 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -226,6 +226,11 @@ static inline int kvm_arch_dev_ioctl_check_extension(long 
ext)
return 0;
 }
 
+static inline void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   schedule();
+}
+
 int kvm_perf_init(void);
 int kvm_perf_teardown(void);
 
diff --git a/arch/arm64/include/asm/kvm_host.h 
b/arch/arm64/include/asm/kvm_host.h
index 644d739..cd18913 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -186,6 +186,11 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
 int kvm_perf_init(void);
 int kvm_perf_teardown(void);
 
+static inline void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   schedule();
+}
+
 static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
   phys_addr_t pgd_ptr,
   unsigned long hyp_stack_ptr,
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 989dd3f..999ab15 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -595,6 +595,11 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu);
 int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
 void kvm_sal_emul(struct kvm_vcpu *vcpu);
 
+static inline void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   schedule();
+}
+
 #define __KVM_HAVE_ARCH_VM_ALLOC 1
 struct kvm *kvm_arch_alloc_vm(void);
 void kvm_arch_free_vm(struct kvm *kvm);
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 4d6fa0b..2c4aae9 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -655,6 +655,11 @@ extern int kvm_mips_trans_mtc0(uint32_t inst, uint32_t 
*opc,
   struct kvm_vcpu *vcpu);
 
 /* Misc */
+static inline void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   schedule();
+}
+
 extern void mips32_SyncICache(unsigned long addr, unsigned long size);
 extern int kvm_mips_dump_stats(struct kvm_vcpu *vcpu);
 extern unsigned long kvm_mips_get_ramsize(struct kvm *kvm);
diff --git a/arch/powerpc/include/asm/kvm_host.h 
b/arch/powerpc/include/asm/kvm_host.h
index af326cd..1aeecc0 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -628,4 +628,9 @@ struct kvm_vcpu_arch {
 #define __KVM_HAVE_ARCH_WQP
 #define __KVM_HAVE_CREATE_DEVICE
 
+static inline void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   schedule();
+}
+
 #endif /* __POWERPC_KVM_HOST_H__ */
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 3238d40..d3409fa 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -274,6 +274,11 @@ struct kvm_arch{
int css_support;
 };
 
+static inline void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   schedule();
+}
+
 extern int sie64a(struct kvm_s390_sie_block *, u64 *);
 extern char sie_exit;
 #endif
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 1d1f711..ed06ecd 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1053,5 +1053,5 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct 
msr_data *msr_info);
 int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);
 void kvm_handle_pmu_event(struct kvm_vcpu *vcpu);
 void kvm_deliver_pmi(struct kvm_vcpu *vcpu);
-
+void kvm_do_schedule(struct kvm_vcpu *vcpu);
 #endif /* _ASM_X86_KVM_HOST_H */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 640d112..ea64481 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7319,6 +7319,14 @@ bool kvm_arch_can_inject_async_page_present(struct 
kvm_vcpu *vcpu)
kvm_x86_ops->interrupt_allowed(vcpu);
 }
 
+void kvm_do_schedule(struct kvm_vcpu *vcpu)
+{
+   /* We try to yield to a kicked vcpu else do a schedule */
+   if (kvm_vcpu_on_spin(vcpu) <= 0)
+   schedule();
+}
+EXPORT_SYMBOL_GPL(kv

[PATCH RFC V11 16/18] kvm hypervisor : Simplify kvm_for_each_vcpu with kvm_irq_delivery_to_apic

2013-07-21 Thread Raghavendra K T
kvm hypervisor: Simplify kvm_for_each_vcpu with kvm_irq_delivery_to_apic

From: Raghavendra K T 

Note that we are using APIC_DM_REMRD which has reserved usage.
In future if APIC_DM_REMRD usage is standardized, then we should
find some other way or go back to old method.

Suggested-by: Gleb Natapov 
Signed-off-by: Raghavendra K T 
---
 arch/x86/kvm/lapic.c |5 -
 arch/x86/kvm/x86.c   |   25 ++---
 2 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index afc1124..48c13c9 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -706,7 +706,10 @@ out:
break;
 
case APIC_DM_REMRD:
-   apic_debug("Ignoring delivery mode 3\n");
+   result = 1;
+   vcpu->arch.pv.pv_unhalted = 1;
+   kvm_make_request(KVM_REQ_EVENT, vcpu);
+   kvm_vcpu_kick(vcpu);
break;
 
case APIC_DM_SMI:
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1e73dab..640d112 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5502,27 +5502,14 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
  */
 static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int 
apicid)
 {
-   struct kvm_vcpu *vcpu = NULL;
-   int i;
+   struct kvm_lapic_irq lapic_irq;
 
-   kvm_for_each_vcpu(i, vcpu, kvm) {
-   if (!kvm_apic_present(vcpu))
-   continue;
+   lapic_irq.shorthand = 0;
+   lapic_irq.dest_mode = 0;
+   lapic_irq.dest_id = apicid;
 
-   if (kvm_apic_match_dest(vcpu, 0, 0, apicid, 0))
-   break;
-   }
-   if (vcpu) {
-   /*
-* Setting unhalt flag here can result in spurious runnable
-* state when unhalt reset does not happen in vcpu_block.
-* But that is harmless since that should soon result in halt.
-*/
-   vcpu->arch.pv.pv_unhalted = true;
-   /* We need everybody see unhalt before vcpu unblocks */
-   smp_wmb();
-   kvm_vcpu_kick(vcpu);
-   }
+   lapic_irq.delivery_mode = APIC_DM_REMRD;
+   kvm_irq_delivery_to_apic(kvm, 0, &lapic_irq, NULL);
 }
 
 int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)

--
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 RFC V11 17/18] Documentation/kvm : Add documentation on Hypercalls and features used for PV spinlock

2013-07-21 Thread Raghavendra K T
Documentation/kvm : Add documentation on Hypercalls and features used for PV 
spinlock

From: Raghavendra K T 

KVM_HC_KICK_CPU  hypercall added to wakeup halted vcpu in paravirtual spinlock
enabled guest.

KVM_FEATURE_PV_UNHALT enables guest to check whether pv spinlock can be enabled
in guest.

Thanks Vatsa for rewriting KVM_HC_KICK_CPU

Signed-off-by: Srivatsa Vaddagiri 
Signed-off-by: Raghavendra K T 
---
 Documentation/virtual/kvm/cpuid.txt  |4 
 Documentation/virtual/kvm/hypercalls.txt |   14 ++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/virtual/kvm/cpuid.txt 
b/Documentation/virtual/kvm/cpuid.txt
index 83afe65..654f43c 100644
--- a/Documentation/virtual/kvm/cpuid.txt
+++ b/Documentation/virtual/kvm/cpuid.txt
@@ -43,6 +43,10 @@ KVM_FEATURE_CLOCKSOURCE2   || 3 || kvmclock 
available at msrs
 KVM_FEATURE_ASYNC_PF   || 4 || async pf can be enabled by
||   || writing to msr 0x4b564d02
 --
+KVM_FEATURE_PV_UNHALT  || 6 || guest checks this feature bit
+   ||   || before enabling paravirtualized
+   ||   || spinlock support.
+--
 KVM_FEATURE_CLOCKSOURCE_STABLE_BIT ||24 || host will warn if no guest-side
||   || per-cpu warps are expected in
||   || kvmclock.
diff --git a/Documentation/virtual/kvm/hypercalls.txt 
b/Documentation/virtual/kvm/hypercalls.txt
index ea113b5..022198e 100644
--- a/Documentation/virtual/kvm/hypercalls.txt
+++ b/Documentation/virtual/kvm/hypercalls.txt
@@ -64,3 +64,17 @@ Purpose: To enable communication between the hypervisor and 
guest there is a
 shared page that contains parts of supervisor visible register state.
 The guest can map this shared page to access its supervisor register through
 memory using this hypercall.
+
+5. KVM_HC_KICK_CPU
+
+Architecture: x86
+Status: active
+Purpose: Hypercall used to wakeup a vcpu from HLT state
+Usage example : A vcpu of a paravirtualized guest that is busywaiting in guest
+kernel mode for an event to occur (ex: a spinlock to become available) can
+execute HLT instruction once it has busy-waited for more than a threshold
+time-interval. Execution of HLT instruction would cause the hypervisor to put
+the vcpu to sleep until occurence of an appropriate event. Another vcpu of the
+same guest can wakeup the sleeping vcpu by issuing KVM_HC_KICK_CPU hypercall,
+specifying APIC ID (a1) of the vcpu to be woken up. An additional argument (a0)
+is used in the hypercall for future use.

--
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 RFC V11 11/18] xen/pvticketlock: Allow interrupts to be enabled while blocking

2013-07-21 Thread Raghavendra K T
xen/pvticketlock: Allow interrupts to be enabled while blocking

From: Jeremy Fitzhardinge 

If interrupts were enabled when taking the spinlock, we can leave them
enabled while blocking to get the lock.

If we can enable interrupts while waiting for the lock to become
available, and we take an interrupt before entering the poll,
and the handler takes a spinlock which ends up going into
the slow state (invalidating the per-cpu "lock" and "want" values),
then when the interrupt handler returns the event channel will
remain pending so the poll will return immediately, causing it to
return out to the main spinlock loop.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: Raghavendra K T 
---
 arch/x86/xen/spinlock.c |   46 --
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index dff5841..44d06f3 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -142,7 +142,20 @@ static void xen_lock_spinning(struct arch_spinlock *lock, 
__ticket_t want)
 * partially setup state.
 */
local_irq_save(flags);
-
+   /*
+* We don't really care if we're overwriting some other
+* (lock,want) pair, as that would mean that we're currently
+* in an interrupt context, and the outer context had
+* interrupts enabled.  That has already kicked the VCPU out
+* of xen_poll_irq(), so it will just return spuriously and
+* retry with newly setup (lock,want).
+*
+* The ordering protocol on this is that the "lock" pointer
+* may only be set non-NULL if the "want" ticket is correct.
+* If we're updating "want", we must first clear "lock".
+*/
+   w->lock = NULL;
+   smp_wmb();
w->want = want;
smp_wmb();
w->lock = lock;
@@ -157,24 +170,43 @@ static void xen_lock_spinning(struct arch_spinlock *lock, 
__ticket_t want)
/* Only check lock once pending cleared */
barrier();
 
-   /* Mark entry to slowpath before doing the pickup test to make
-  sure we don't deadlock with an unlocker. */
+   /*
+* Mark entry to slowpath before doing the pickup test to make
+* sure we don't deadlock with an unlocker.
+*/
__ticket_enter_slowpath(lock);
 
-   /* check again make sure it didn't become free while
-  we weren't looking  */
+   /*
+* check again make sure it didn't become free while
+* we weren't looking
+*/
if (ACCESS_ONCE(lock->tickets.head) == want) {
add_stats(TAKEN_SLOW_PICKUP, 1);
goto out;
}
+
+   /* Allow interrupts while blocked */
+   local_irq_restore(flags);
+
+   /*
+* If an interrupt happens here, it will leave the wakeup irq
+* pending, which will cause xen_poll_irq() to return
+* immediately.
+*/
+
/* Block until irq becomes pending (or perhaps a spurious wakeup) */
xen_poll_irq(irq);
add_stats(TAKEN_SLOW_SPURIOUS, !xen_test_irq_pending(irq));
+
+   local_irq_save(flags);
+
kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
 out:
cpumask_clear_cpu(cpu, &waiting_cpus);
w->lock = NULL;
+
local_irq_restore(flags);
+
spin_time_accum_blocked(start);
 }
 PV_CALLEE_SAVE_REGS_THUNK(xen_lock_spinning);
@@ -188,7 +220,9 @@ static void xen_unlock_kick(struct arch_spinlock *lock, 
__ticket_t next)
for_each_cpu(cpu, &waiting_cpus) {
const struct xen_lock_waiting *w = &per_cpu(lock_waiting, cpu);
 
-   if (w->lock == lock && w->want == next) {
+   /* Make sure we read lock before want */
+   if (ACCESS_ONCE(w->lock) == lock &&
+   ACCESS_ONCE(w->want) == next) {
add_stats(RELEASED_SLOW_KICKED, 1);
xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
break;

--
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 RFC V11 14/18] kvm guest : Add configuration support to enable debug information for KVM Guests

2013-07-21 Thread Raghavendra K T
kvm guest : Add configuration support to enable debug information for KVM Guests

From: Srivatsa Vaddagiri 

Signed-off-by: Srivatsa Vaddagiri 
Signed-off-by: Suzuki Poulose 
Signed-off-by: Raghavendra K T 
---
 arch/x86/Kconfig |9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 112e712..b1fb846 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -657,6 +657,15 @@ config KVM_GUEST
  underlying device model, the host provides the guest with
  timing infrastructure such as time of day, and system time
 
+config KVM_DEBUG_FS
+   bool "Enable debug information for KVM Guests in debugfs"
+   depends on KVM_GUEST && DEBUG_FS
+   default n
+   ---help---
+ This option enables collection of various statistics for KVM guest.
+ Statistics are displayed in debugfs filesystem. Enabling this option
+ may incur significant overhead.
+
 source "arch/x86/lguest/Kconfig"
 
 config PARAVIRT_TIME_ACCOUNTING

--
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 RFC V11 12/18] kvm hypervisor : Add a hypercall to KVM hypervisor to support pv-ticketlocks

2013-07-21 Thread Raghavendra K T
kvm hypervisor : Add a hypercall to KVM hypervisor to support pv-ticketlocks

From: Srivatsa Vaddagiri 

kvm_hc_kick_cpu allows the calling vcpu to kick another vcpu out of halt state.
the presence of these hypercalls is indicated to guest via
kvm_feature_pv_unhalt.

Signed-off-by: Srivatsa Vaddagiri 
Signed-off-by: Suzuki Poulose 
[Raghu: Apic related changes, folding pvunhalted into vcpu_runnable
 Added flags for future use (suggested by Gleb)]
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/kvm_host.h  |5 +
 arch/x86/include/uapi/asm/kvm_para.h |1 +
 arch/x86/kvm/cpuid.c |3 ++-
 arch/x86/kvm/x86.c   |   37 ++
 include/uapi/linux/kvm_para.h|1 +
 5 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index f87f7fc..1d1f711 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -511,6 +511,11 @@ struct kvm_vcpu_arch {
 * instruction.
 */
bool write_fault_to_shadow_pgtable;
+
+   /* pv related host specific info */
+   struct {
+   bool pv_unhalted;
+   } pv;
 };
 
 struct kvm_lpage_info {
diff --git a/arch/x86/include/uapi/asm/kvm_para.h 
b/arch/x86/include/uapi/asm/kvm_para.h
index 06fdbd9..94dc8ca 100644
--- a/arch/x86/include/uapi/asm/kvm_para.h
+++ b/arch/x86/include/uapi/asm/kvm_para.h
@@ -23,6 +23,7 @@
 #define KVM_FEATURE_ASYNC_PF   4
 #define KVM_FEATURE_STEAL_TIME 5
 #define KVM_FEATURE_PV_EOI 6
+#define KVM_FEATURE_PV_UNHALT  7
 
 /* The last 8 bits are used to indicate how to interpret the flags field
  * in pvclock structure. If no bits are set, all flags are ignored.
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index a20ecb5..b110fe6 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -413,7 +413,8 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 
function,
 (1 << KVM_FEATURE_CLOCKSOURCE2) |
 (1 << KVM_FEATURE_ASYNC_PF) |
 (1 << KVM_FEATURE_PV_EOI) |
-(1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT);
+(1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT) |
+(1 << KVM_FEATURE_PV_UNHALT);
 
if (sched_info_on())
entry->eax |= (1 << KVM_FEATURE_STEAL_TIME);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d21bce5..dae4575 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5495,6 +5495,36 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
return 1;
 }
 
+/*
+ * kvm_pv_kick_cpu_op:  Kick a vcpu.
+ *
+ * @apicid - apicid of vcpu to be kicked.
+ */
+static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int 
apicid)
+{
+   struct kvm_vcpu *vcpu = NULL;
+   int i;
+
+   kvm_for_each_vcpu(i, vcpu, kvm) {
+   if (!kvm_apic_present(vcpu))
+   continue;
+
+   if (kvm_apic_match_dest(vcpu, 0, 0, apicid, 0))
+   break;
+   }
+   if (vcpu) {
+   /*
+* Setting unhalt flag here can result in spurious runnable
+* state when unhalt reset does not happen in vcpu_block.
+* But that is harmless since that should soon result in halt.
+*/
+   vcpu->arch.pv.pv_unhalted = true;
+   /* We need everybody see unhalt before vcpu unblocks */
+   smp_wmb();
+   kvm_vcpu_kick(vcpu);
+   }
+}
+
 int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
 {
unsigned long nr, a0, a1, a2, a3, ret;
@@ -5528,6 +5558,10 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
case KVM_HC_VAPIC_POLL_IRQ:
ret = 0;
break;
+   case KVM_HC_KICK_CPU:
+   kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1);
+   ret = 0;
+   break;
default:
ret = -KVM_ENOSYS;
break;
@@ -5950,6 +5984,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
kvm_apic_accept_events(vcpu);
switch(vcpu->arch.mp_state) {
case KVM_MP_STATE_HALTED:
+   vcpu->arch.pv.pv_unhalted = false;
vcpu->arch.mp_state =
KVM_MP_STATE_RUNNABLE;
case KVM_MP_STATE_RUNNABLE:
@@ -6770,6 +6805,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
BUG_ON(vcpu->kvm == NULL);
kvm = vcpu->kvm;
 
+   vcpu->arch.pv.pv_unhalted = false;
vcpu->arch.emulate_ctxt.ops = &emulate_ops;
if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu))
vcpu->arch.mp_sta

[PATCH RFC V11 13/18] kvm : Fold pv_unhalt flag into GET_MP_STATE ioctl to aid migration

2013-07-21 Thread Raghavendra K T
kvm : Fold pv_unhalt flag into GET_MP_STATE ioctl to aid migration

From: Raghavendra K T 

During migration, any vcpu that got kicked but did not become runnable
(still in halted state) should be runnable after migration.

Signed-off-by: Raghavendra K T 
---
 arch/x86/kvm/x86.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index dae4575..1e73dab 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6284,7 +6284,12 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu 
*vcpu,
struct kvm_mp_state *mp_state)
 {
kvm_apic_accept_events(vcpu);
-   mp_state->mp_state = vcpu->arch.mp_state;
+   if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED &&
+   vcpu->arch.pv.pv_unhalted)
+   mp_state->mp_state = KVM_MP_STATE_RUNNABLE;
+   else
+   mp_state->mp_state = vcpu->arch.mp_state;
+
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/


[PATCH RFC V11 15/18] kvm : Paravirtual ticketlocks support for linux guests running on KVM hypervisor

2013-07-21 Thread Raghavendra K T
kvm : Paravirtual ticketlocks support for linux guests running on KVM hypervisor

From: Srivatsa Vaddagiri 

During smp_boot_cpus  paravirtualied KVM guest detects if the hypervisor has
required feature (KVM_FEATURE_PV_UNHALT) to support pv-ticketlocks. If so,
 support for pv-ticketlocks is registered via pv_lock_ops.

Use KVM_HC_KICK_CPU hypercall to wakeup waiting/halted vcpu.

Signed-off-by: Srivatsa Vaddagiri 
Signed-off-by: Suzuki Poulose 
[Raghu: check_zero race fix, enum for kvm_contention_stat, jumplabel related 
changes,
addition of safe_halt for irq enabled case(Gleb)]
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/kvm_para.h |   14 ++
 arch/x86/kernel/kvm.c   |  259 +++
 2 files changed, 271 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index 695399f..427afcb 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -118,10 +118,20 @@ void kvm_async_pf_task_wait(u32 token);
 void kvm_async_pf_task_wake(u32 token);
 u32 kvm_read_and_reset_pf_reason(void);
 extern void kvm_disable_steal_time(void);
-#else
-#define kvm_guest_init() do { } while (0)
+
+#ifdef CONFIG_PARAVIRT_SPINLOCKS
+void __init kvm_spinlock_init(void);
+#else /* !CONFIG_PARAVIRT_SPINLOCKS */
+static inline void kvm_spinlock_init(void)
+{
+}
+#endif /* CONFIG_PARAVIRT_SPINLOCKS */
+
+#else /* CONFIG_KVM_GUEST */
+#define kvm_guest_init() do {} while (0)
 #define kvm_async_pf_task_wait(T) do {} while(0)
 #define kvm_async_pf_task_wake(T) do {} while(0)
+
 static inline u32 kvm_read_and_reset_pf_reason(void)
 {
return 0;
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index cd6d9a5..b5aa5f4 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -419,6 +420,7 @@ static void __init kvm_smp_prepare_boot_cpu(void)
WARN_ON(kvm_register_clock("primary cpu clock"));
kvm_guest_cpu_init();
native_smp_prepare_boot_cpu();
+   kvm_spinlock_init();
 }
 
 static void __cpuinit kvm_guest_cpu_online(void *dummy)
@@ -523,3 +525,260 @@ static __init int activate_jump_labels(void)
return 0;
 }
 arch_initcall(activate_jump_labels);
+
+/* Kick a cpu by its apicid. Used to wake up a halted vcpu */
+void kvm_kick_cpu(int cpu)
+{
+   int apicid;
+   unsigned long flags = 0;
+
+   apicid = per_cpu(x86_cpu_to_apicid, cpu);
+   kvm_hypercall2(KVM_HC_KICK_CPU, flags, apicid);
+}
+
+#ifdef CONFIG_PARAVIRT_SPINLOCKS
+
+enum kvm_contention_stat {
+   TAKEN_SLOW,
+   TAKEN_SLOW_PICKUP,
+   RELEASED_SLOW,
+   RELEASED_SLOW_KICKED,
+   NR_CONTENTION_STATS
+};
+
+#ifdef CONFIG_KVM_DEBUG_FS
+#define HISTO_BUCKETS  30
+
+static struct kvm_spinlock_stats
+{
+   u32 contention_stats[NR_CONTENTION_STATS];
+   u32 histo_spin_blocked[HISTO_BUCKETS+1];
+   u64 time_blocked;
+} spinlock_stats;
+
+static u8 zero_stats;
+
+static inline void check_zero(void)
+{
+   u8 ret;
+   u8 old;
+
+   old = ACCESS_ONCE(zero_stats);
+   if (unlikely(old)) {
+   ret = cmpxchg(&zero_stats, old, 0);
+   /* This ensures only one fellow resets the stat */
+   if (ret == old)
+   memset(&spinlock_stats, 0, sizeof(spinlock_stats));
+   }
+}
+
+static inline void add_stats(enum kvm_contention_stat var, u32 val)
+{
+   check_zero();
+   spinlock_stats.contention_stats[var] += val;
+}
+
+
+static inline u64 spin_time_start(void)
+{
+   return sched_clock();
+}
+
+static void __spin_time_accum(u64 delta, u32 *array)
+{
+   unsigned index;
+
+   index = ilog2(delta);
+   check_zero();
+
+   if (index < HISTO_BUCKETS)
+   array[index]++;
+   else
+   array[HISTO_BUCKETS]++;
+}
+
+static inline void spin_time_accum_blocked(u64 start)
+{
+   u32 delta;
+
+   delta = sched_clock() - start;
+   __spin_time_accum(delta, spinlock_stats.histo_spin_blocked);
+   spinlock_stats.time_blocked += delta;
+}
+
+static struct dentry *d_spin_debug;
+static struct dentry *d_kvm_debug;
+
+struct dentry *kvm_init_debugfs(void)
+{
+   d_kvm_debug = debugfs_create_dir("kvm", NULL);
+   if (!d_kvm_debug)
+   printk(KERN_WARNING "Could not create 'kvm' debugfs 
directory\n");
+
+   return d_kvm_debug;
+}
+
+static int __init kvm_spinlock_debugfs(void)
+{
+   struct dentry *d_kvm;
+
+   d_kvm = kvm_init_debugfs();
+   if (d_kvm == NULL)
+   return -ENOMEM;
+
+   d_spin_debug = debugfs_create_dir("spinlocks", d_kvm);
+
+   debugfs_create_u8("zero_stats", 0644, d_spin_debug, &zero_stats);
+
+   debugfs_create_u32("taken_slow", 0444, d_spin_debug,
+  &spinlock_stats.contention_stats[TAKEN_SLOW]);
+   debugfs_create_u32("taken_slow_pickup", 0444, d_spin_deb

[PATCH RFC V11 10/18] x86/ticketlock: Add slowpath logic

2013-07-21 Thread Raghavendra K T
x86/ticketlock: Add slowpath logic

From: Jeremy Fitzhardinge 

Maintain a flag in the LSB of the ticket lock tail which indicates
whether anyone is in the lock slowpath and may need kicking when
the current holder unlocks.  The flags are set when the first locker
enters the slowpath, and cleared when unlocking to an empty queue (ie,
no contention).

In the specific implementation of lock_spinning(), make sure to set
the slowpath flags on the lock just before blocking.  We must do
this before the last-chance pickup test to prevent a deadlock
with the unlocker:

UnlockerLocker
test for lock pickup
-> fail
unlock
test slowpath
-> false
set slowpath flags
block

Whereas this works in any ordering:

UnlockerLocker
set slowpath flags
test for lock pickup
-> fail
block
unlock
test slowpath
-> true, kick

If the unlocker finds that the lock has the slowpath flag set but it is
actually uncontended (ie, head == tail, so nobody is waiting), then it
clears the slowpath flag.

The unlock code uses a locked add to update the head counter.  This also
acts as a full memory barrier so that its safe to subsequently
read back the slowflag state, knowing that the updated lock is visible
to the other CPUs.  If it were an unlocked add, then the flag read may
just be forwarded from the store buffer before it was visible to the other
CPUs, which could result in a deadlock.

Unfortunately this means we need to do a locked instruction when
unlocking with PV ticketlocks.  However, if PV ticketlocks are not
enabled, then the old non-locked "add" is the only unlocking code.

Note: this code relies on gcc making sure that unlikely() code is out of
line of the fastpath, which only happens when OPTIMIZE_SIZE=n.  If it
doesn't the generated code isn't too bad, but its definitely suboptimal.

Thanks to Srivatsa Vaddagiri for providing a bugfix to the original
version of this change, which has been folded in.
Thanks to Stephan Diestelhorst for commenting on some code which relied
on an inaccurate reading of the x86 memory ordering rules.

Signed-off-by: Jeremy Fitzhardinge 
Signed-off-by: Srivatsa Vaddagiri 
Reviewed-by: Konrad Rzeszutek Wilk 
Cc: Stephan Diestelhorst 
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/paravirt.h   |2 -
 arch/x86/include/asm/spinlock.h   |   86 -
 arch/x86/include/asm/spinlock_types.h |2 +
 arch/x86/kernel/paravirt-spinlocks.c  |3 +
 arch/x86/xen/spinlock.c   |6 ++
 5 files changed, 74 insertions(+), 25 deletions(-)

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 7131e12c..401f350 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -718,7 +718,7 @@ static __always_inline void __ticket_lock_spinning(struct 
arch_spinlock *lock,
PVOP_VCALLEE2(pv_lock_ops.lock_spinning, lock, ticket);
 }
 
-static __always_inline void ticket_unlock_kick(struct arch_spinlock *lock,
+static __always_inline void __ticket_unlock_kick(struct arch_spinlock *lock,
__ticket_t ticket)
 {
PVOP_VCALL2(pv_lock_ops.unlock_kick, lock, ticket);
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 04a5cd5..d68883d 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -1,11 +1,14 @@
 #ifndef _ASM_X86_SPINLOCK_H
 #define _ASM_X86_SPINLOCK_H
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+
 /*
  * Your basic SMP spinlocks, allowing only a single CPU anywhere
  *
@@ -37,32 +40,28 @@
 /* How long a lock should spin before we consider blocking */
 #define SPIN_THRESHOLD (1 << 15)
 
-#ifndef CONFIG_PARAVIRT_SPINLOCKS
+extern struct static_key paravirt_ticketlocks_enabled;
+static __always_inline bool static_key_false(struct static_key *key);
 
-static __always_inline void __ticket_lock_spinning(struct arch_spinlock *lock,
-   __ticket_t ticket)
+#ifdef CONFIG_PARAVIRT_SPINLOCKS
+
+static inline void __ticket_enter_slowpath(arch_spinlock_t *lock)
 {
+   set_bit(0, (volatile unsigned long *)&lock->tickets.tail);
 }
 
-static __always_inline void ticket_unlock_kick(struct arch_spinlock *lock,
-__ticket_t ticket)
+#else  /* !CONFIG_PARAVIRT_SPINLOCKS */
+static __always_inline void __ticket_lock_spinning(arch_spinlock_t *lock,
+   __ticket_t ticket)
 {
 }
-
-#endif /* CONFIG_PARAVIRT_SPINLOCKS */
-
-
-/*
- * If a spinlock has someone waiting on 

[PATCH RFC V11 6/18] xen/pvticketlocks: Add xen_nopvspin parameter to disable xen pv ticketlocks

2013-07-21 Thread Raghavendra K T
xen/pvticketlocks: Add xen_nopvspin parameter to disable xen pv ticketlocks

From: Jeremy Fitzhardinge 

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: Raghavendra K T 
---
 arch/x86/xen/spinlock.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 31949da..ec9183b 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -244,6 +244,8 @@ void xen_uninit_lock_cpu(int cpu)
per_cpu(irq_name, cpu) = NULL;
 }
 
+static bool xen_pvspin __initdata = true;
+
 void __init xen_init_spinlocks(void)
 {
/*
@@ -253,10 +255,22 @@ void __init xen_init_spinlocks(void)
if (xen_hvm_domain())
return;
 
+   if (!xen_pvspin) {
+   printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
+   return;
+   }
+
pv_lock_ops.lock_spinning = xen_lock_spinning;
pv_lock_ops.unlock_kick = xen_unlock_kick;
 }
 
+static __init int xen_parse_nopvspin(char *arg)
+{
+   xen_pvspin = false;
+   return 0;
+}
+early_param("xen_nopvspin", xen_parse_nopvspin);
+
 #ifdef CONFIG_XEN_DEBUG_FS
 
 static struct dentry *d_spin_debug;

--
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 RFC V11 7/18] x86/pvticketlock: Use callee-save for lock_spinning

2013-07-21 Thread Raghavendra K T
x86/pvticketlock: Use callee-save for lock_spinning

From: Jeremy Fitzhardinge 

Although the lock_spinning calls in the spinlock code are on the
uncommon path, their presence can cause the compiler to generate many
more register save/restores in the function pre/postamble, which is in
the fast path.  To avoid this, convert it to using the pvops callee-save
calling convention, which defers all the save/restores until the actual
function is called, keeping the fastpath clean.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Tested-by: Attilio Rao 
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/paravirt.h   |2 +-
 arch/x86/include/asm/paravirt_types.h |2 +-
 arch/x86/kernel/paravirt-spinlocks.c  |2 +-
 arch/x86/xen/spinlock.c   |3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 040e72d..7131e12c 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -715,7 +715,7 @@ static inline void __set_fixmap(unsigned /* enum 
fixed_addresses */ idx,
 static __always_inline void __ticket_lock_spinning(struct arch_spinlock *lock,
__ticket_t ticket)
 {
-   PVOP_VCALL2(pv_lock_ops.lock_spinning, lock, ticket);
+   PVOP_VCALLEE2(pv_lock_ops.lock_spinning, lock, ticket);
 }
 
 static __always_inline void ticket_unlock_kick(struct arch_spinlock *lock,
diff --git a/arch/x86/include/asm/paravirt_types.h 
b/arch/x86/include/asm/paravirt_types.h
index d5deb6d..350d017 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -330,7 +330,7 @@ struct arch_spinlock;
 #include 
 
 struct pv_lock_ops {
-   void (*lock_spinning)(struct arch_spinlock *lock, __ticket_t ticket);
+   struct paravirt_callee_save lock_spinning;
void (*unlock_kick)(struct arch_spinlock *lock, __ticket_t ticket);
 };
 
diff --git a/arch/x86/kernel/paravirt-spinlocks.c 
b/arch/x86/kernel/paravirt-spinlocks.c
index c2e010e..4251c1d 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -9,7 +9,7 @@
 
 struct pv_lock_ops pv_lock_ops = {
 #ifdef CONFIG_SMP
-   .lock_spinning = paravirt_nop,
+   .lock_spinning = __PV_IS_CALLEE_SAVE(paravirt_nop),
.unlock_kick = paravirt_nop,
 #endif
 };
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index ec9183b..b41872b 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -173,6 +173,7 @@ out:
local_irq_restore(flags);
spin_time_accum_blocked(start);
 }
+PV_CALLEE_SAVE_REGS_THUNK(xen_lock_spinning);
 
 static void xen_unlock_kick(struct arch_spinlock *lock, __ticket_t next)
 {
@@ -260,7 +261,7 @@ void __init xen_init_spinlocks(void)
return;
}
 
-   pv_lock_ops.lock_spinning = xen_lock_spinning;
+   pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
pv_lock_ops.unlock_kick = xen_unlock_kick;
 }
 

--
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 RFC V11 9/18] jump_label: Split out rate limiting from jump_label.h

2013-07-21 Thread Raghavendra K T
jump_label: Split jumplabel ratelimit

From: Andrew Jones 

Commit b202952075f62603bea9bfb6ebc6b0420db11949 ("perf, core: Rate limit
perf_sched_events jump_label patching") introduced rate limiting
for jump label disabling. The changes were made in the jump label code
in order to be more widely available and to keep things tidier. This is
all fine, except now jump_label.h includes linux/workqueue.h, which
makes it impossible to include jump_label.h from anything that
workqueue.h needs. For example, it's now impossible to include
jump_label.h from asm/spinlock.h, which is done in proposed
pv-ticketlock patches. This patch splits out the rate limiting related
changes from jump_label.h into a new file, jump_label_ratelimit.h, to
resolve the issue.

Signed-off-by: Andrew Jones 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: Raghavendra K T 
---
 include/linux/jump_label.h   |   26 +-
 include/linux/jump_label_ratelimit.h |   34 ++
 include/linux/perf_event.h   |1 +
 kernel/jump_label.c  |1 +
 4 files changed, 37 insertions(+), 25 deletions(-)
 create mode 100644 include/linux/jump_label_ratelimit.h

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 0976fc4..53cdf89 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -48,7 +48,6 @@
 
 #include 
 #include 
-#include 
 
 #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
 
@@ -61,12 +60,6 @@ struct static_key {
 #endif
 };
 
-struct static_key_deferred {
-   struct static_key key;
-   unsigned long timeout;
-   struct delayed_work work;
-};
-
 # include 
 # define HAVE_JUMP_LABEL
 #endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
@@ -119,10 +112,7 @@ extern void arch_jump_label_transform_static(struct 
jump_entry *entry,
 extern int jump_label_text_reserved(void *start, void *end);
 extern void static_key_slow_inc(struct static_key *key);
 extern void static_key_slow_dec(struct static_key *key);
-extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
 extern void jump_label_apply_nops(struct module *mod);
-extern void
-jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
 
 #define STATIC_KEY_INIT_TRUE ((struct static_key) \
{ .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
@@ -141,10 +131,6 @@ static __always_inline void jump_label_init(void)
 {
 }
 
-struct static_key_deferred {
-   struct static_key  key;
-};
-
 static __always_inline bool static_key_false(struct static_key *key)
 {
if (unlikely(atomic_read(&key->enabled)) > 0)
@@ -169,11 +155,6 @@ static inline void static_key_slow_dec(struct static_key 
*key)
atomic_dec(&key->enabled);
 }
 
-static inline void static_key_slow_dec_deferred(struct static_key_deferred 
*key)
-{
-   static_key_slow_dec(&key->key);
-}
-
 static inline int jump_label_text_reserved(void *start, void *end)
 {
return 0;
@@ -187,12 +168,6 @@ static inline int jump_label_apply_nops(struct module *mod)
return 0;
 }
 
-static inline void
-jump_label_rate_limit(struct static_key_deferred *key,
-   unsigned long rl)
-{
-}
-
 #define STATIC_KEY_INIT_TRUE ((struct static_key) \
{ .enabled = ATOMIC_INIT(1) })
 #define STATIC_KEY_INIT_FALSE ((struct static_key) \
@@ -203,6 +178,7 @@ jump_label_rate_limit(struct static_key_deferred *key,
 #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
 #define jump_label_enabled static_key_enabled
 
+static inline int atomic_read(const atomic_t *v);
 static inline bool static_key_enabled(struct static_key *key)
 {
return (atomic_read(&key->enabled) > 0);
diff --git a/include/linux/jump_label_ratelimit.h 
b/include/linux/jump_label_ratelimit.h
new file mode 100644
index 000..1137883
--- /dev/null
+++ b/include/linux/jump_label_ratelimit.h
@@ -0,0 +1,34 @@
+#ifndef _LINUX_JUMP_LABEL_RATELIMIT_H
+#define _LINUX_JUMP_LABEL_RATELIMIT_H
+
+#include 
+#include 
+
+#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
+struct static_key_deferred {
+   struct static_key key;
+   unsigned long timeout;
+   struct delayed_work work;
+};
+#endif
+
+#ifdef HAVE_JUMP_LABEL
+extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
+extern void
+jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
+
+#else  /* !HAVE_JUMP_LABEL */
+struct static_key_deferred {
+   struct static_key  key;
+};
+static inline void static_key_slow_dec_deferred(struct static_key_deferred 
*key)
+{
+   static_key_slow_dec(&key->key);
+}
+static inline void
+jump_label_rate_limit(struct static_key_deferred *key,
+   unsigned long rl)
+{
+}
+#endif /* HAVE_JUMP_LABEL */
+#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8873f82..b8cc383 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -4

[PATCH RFC V11 8/18] x86/pvticketlock: When paravirtualizing ticket locks, increment by 2

2013-07-21 Thread Raghavendra K T
x86/pvticketlock: When paravirtualizing ticket locks, increment by 2

From: Jeremy Fitzhardinge 

Increment ticket head/tails by 2 rather than 1 to leave the LSB free
to store a "is in slowpath state" bit.  This halves the number
of possible CPUs for a given ticket size, but this shouldn't matter
in practice - kernels built for 32k+ CPU systems are probably
specially built for the hardware rather than a generic distro
kernel.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Tested-by: Attilio Rao 
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/spinlock.h   |   10 +-
 arch/x86/include/asm/spinlock_types.h |   10 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 7442410..04a5cd5 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -78,7 +78,7 @@ static __always_inline void __ticket_unlock_kick(struct 
arch_spinlock *lock,
  */
 static __always_inline void arch_spin_lock(struct arch_spinlock *lock)
 {
-   register struct __raw_tickets inc = { .tail = 1 };
+   register struct __raw_tickets inc = { .tail = TICKET_LOCK_INC };
 
inc = xadd(&lock->tickets, inc);
 
@@ -104,7 +104,7 @@ static __always_inline int 
arch_spin_trylock(arch_spinlock_t *lock)
if (old.tickets.head != old.tickets.tail)
return 0;
 
-   new.head_tail = old.head_tail + (1 << TICKET_SHIFT);
+   new.head_tail = old.head_tail + (TICKET_LOCK_INC << TICKET_SHIFT);
 
/* cmpxchg is a full barrier, so nothing can move before it */
return cmpxchg(&lock->head_tail, old.head_tail, new.head_tail) == 
old.head_tail;
@@ -112,9 +112,9 @@ static __always_inline int 
arch_spin_trylock(arch_spinlock_t *lock)
 
 static __always_inline void arch_spin_unlock(arch_spinlock_t *lock)
 {
-   __ticket_t next = lock->tickets.head + 1;
+   __ticket_t next = lock->tickets.head + TICKET_LOCK_INC;
 
-   __add(&lock->tickets.head, 1, UNLOCK_LOCK_PREFIX);
+   __add(&lock->tickets.head, TICKET_LOCK_INC, UNLOCK_LOCK_PREFIX);
__ticket_unlock_kick(lock, next);
 }
 
@@ -129,7 +129,7 @@ static inline int arch_spin_is_contended(arch_spinlock_t 
*lock)
 {
struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
 
-   return (__ticket_t)(tmp.tail - tmp.head) > 1;
+   return (__ticket_t)(tmp.tail - tmp.head) > TICKET_LOCK_INC;
 }
 #define arch_spin_is_contended arch_spin_is_contended
 
diff --git a/arch/x86/include/asm/spinlock_types.h 
b/arch/x86/include/asm/spinlock_types.h
index 83fd3c7..e96fcbd 100644
--- a/arch/x86/include/asm/spinlock_types.h
+++ b/arch/x86/include/asm/spinlock_types.h
@@ -3,7 +3,13 @@
 
 #include 
 
-#if (CONFIG_NR_CPUS < 256)
+#ifdef CONFIG_PARAVIRT_SPINLOCKS
+#define __TICKET_LOCK_INC  2
+#else
+#define __TICKET_LOCK_INC  1
+#endif
+
+#if (CONFIG_NR_CPUS < (256 / __TICKET_LOCK_INC))
 typedef u8  __ticket_t;
 typedef u16 __ticketpair_t;
 #else
@@ -11,6 +17,8 @@ typedef u16 __ticket_t;
 typedef u32 __ticketpair_t;
 #endif
 
+#define TICKET_LOCK_INC((__ticket_t)__TICKET_LOCK_INC)
+
 #define TICKET_SHIFT   (sizeof(__ticket_t) * 8)
 
 typedef struct arch_spinlock {

--
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 RFC V11 5/18] xen/pvticketlock: Xen implementation for PV ticket locks

2013-07-21 Thread Raghavendra K T
xen/pvticketlock: Xen implementation for PV ticket locks

From: Jeremy Fitzhardinge 

Replace the old Xen implementation of PV spinlocks with and implementation
of xen_lock_spinning and xen_unlock_kick.

xen_lock_spinning simply registers the cpu in its entry in lock_waiting,
adds itself to the waiting_cpus set, and blocks on an event channel
until the channel becomes pending.

xen_unlock_kick searches the cpus in waiting_cpus looking for the one
which next wants this lock with the next ticket, if any.  If found,
it kicks it by making its event channel pending, which wakes it up.

We need to make sure interrupts are disabled while we're relying on the
contents of the per-cpu lock_waiting values, otherwise an interrupt
handler could come in, try to take some other lock, block, and overwrite
our values.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
 [ Raghavendra:  use function + enum instead of macro, cmpxchg for zero status 
reset
Reintroduce break since we know the exact vCPU to send IPI as suggested by 
Konrad.]
Signed-off-by: Raghavendra K T 
---
 arch/x86/xen/spinlock.c |  348 +++
 1 file changed, 79 insertions(+), 269 deletions(-)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 0454bcb..31949da 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -17,45 +17,44 @@
 #include "xen-ops.h"
 #include "debugfs.h"
 
-#ifdef CONFIG_XEN_DEBUG_FS
-static struct xen_spinlock_stats
-{
-   u64 taken;
-   u32 taken_slow;
-   u32 taken_slow_nested;
-   u32 taken_slow_pickup;
-   u32 taken_slow_spurious;
-   u32 taken_slow_irqenable;
+enum xen_contention_stat {
+   TAKEN_SLOW,
+   TAKEN_SLOW_PICKUP,
+   TAKEN_SLOW_SPURIOUS,
+   RELEASED_SLOW,
+   RELEASED_SLOW_KICKED,
+   NR_CONTENTION_STATS
+};
 
-   u64 released;
-   u32 released_slow;
-   u32 released_slow_kicked;
 
+#ifdef CONFIG_XEN_DEBUG_FS
 #define HISTO_BUCKETS  30
-   u32 histo_spin_total[HISTO_BUCKETS+1];
-   u32 histo_spin_spinning[HISTO_BUCKETS+1];
+static struct xen_spinlock_stats
+{
+   u32 contention_stats[NR_CONTENTION_STATS];
u32 histo_spin_blocked[HISTO_BUCKETS+1];
-
-   u64 time_total;
-   u64 time_spinning;
u64 time_blocked;
 } spinlock_stats;
 
 static u8 zero_stats;
 
-static unsigned lock_timeout = 1 << 10;
-#define TIMEOUT lock_timeout
-
 static inline void check_zero(void)
 {
-   if (unlikely(zero_stats)) {
-   memset(&spinlock_stats, 0, sizeof(spinlock_stats));
-   zero_stats = 0;
+   u8 ret;
+   u8 old = ACCESS_ONCE(zero_stats);
+   if (unlikely(old)) {
+   ret = cmpxchg(&zero_stats, old, 0);
+   /* This ensures only one fellow resets the stat */
+   if (ret == old)
+   memset(&spinlock_stats, 0, sizeof(spinlock_stats));
}
 }
 
-#define ADD_STATS(elem, val)   \
-   do { check_zero(); spinlock_stats.elem += (val); } while(0)
+static inline void add_stats(enum xen_contention_stat var, u32 val)
+{
+   check_zero();
+   spinlock_stats.contention_stats[var] += val;
+}
 
 static inline u64 spin_time_start(void)
 {
@@ -74,22 +73,6 @@ static void __spin_time_accum(u64 delta, u32 *array)
array[HISTO_BUCKETS]++;
 }
 
-static inline void spin_time_accum_spinning(u64 start)
-{
-   u32 delta = xen_clocksource_read() - start;
-
-   __spin_time_accum(delta, spinlock_stats.histo_spin_spinning);
-   spinlock_stats.time_spinning += delta;
-}
-
-static inline void spin_time_accum_total(u64 start)
-{
-   u32 delta = xen_clocksource_read() - start;
-
-   __spin_time_accum(delta, spinlock_stats.histo_spin_total);
-   spinlock_stats.time_total += delta;
-}
-
 static inline void spin_time_accum_blocked(u64 start)
 {
u32 delta = xen_clocksource_read() - start;
@@ -99,19 +82,15 @@ static inline void spin_time_accum_blocked(u64 start)
 }
 #else  /* !CONFIG_XEN_DEBUG_FS */
 #define TIMEOUT(1 << 10)
-#define ADD_STATS(elem, val)   do { (void)(val); } while(0)
+static inline void add_stats(enum xen_contention_stat var, u32 val)
+{
+}
 
 static inline u64 spin_time_start(void)
 {
return 0;
 }
 
-static inline void spin_time_accum_total(u64 start)
-{
-}
-static inline void spin_time_accum_spinning(u64 start)
-{
-}
 static inline void spin_time_accum_blocked(u64 start)
 {
 }
@@ -134,230 +113,84 @@ typedef u16 xen_spinners_t;
asm(LOCK_PREFIX " decw %0" : "+m" ((xl)->spinners) : : "memory");
 #endif
 
-struct xen_spinlock {
-   unsigned char lock; /* 0 -> free; 1 -> locked */
-   xen_spinners_t spinners;/* count of waiting cpus */
+struct xen_lock_waiting {
+   struct arch_spinlock *lock;
+   __ticket_t want;
 };
 
 static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
-
-#if 0
-static int xen_spin_is_locked(struct arch_spinlo

[PATCH RFC V11 4/18] xen: Defer spinlock setup until boot CPU setup

2013-07-21 Thread Raghavendra K T
xen: Defer spinlock setup until boot CPU setup

From: Jeremy Fitzhardinge 

There's no need to do it at very early init, and doing it there
makes it impossible to use the jump_label machinery.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: Raghavendra K T 
---
 arch/x86/xen/smp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c1367b2..c3c9bcf 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -279,6 +279,7 @@ static void __init xen_smp_prepare_boot_cpu(void)
 
xen_filter_cpu_maps();
xen_setup_vcpu_info_placement();
+   xen_init_spinlocks();
 }
 
 static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
@@ -680,7 +681,6 @@ void __init xen_smp_init(void)
 {
smp_ops = xen_smp_ops;
xen_fill_possible_map();
-   xen_init_spinlocks();
 }
 
 static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)

--
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 RFC V11 2/18] x86/ticketlock: Don't inline _spin_unlock when using paravirt spinlocks

2013-07-21 Thread Raghavendra K T
x86/ticketlock: Don't inline _spin_unlock when using paravirt spinlocks

From: Raghavendra K T 

The code size expands somewhat, and its better to just call
a function rather than inline it.

Thanks Jeremy for original version of ARCH_NOINLINE_SPIN_UNLOCK config patch,
which is simplified.

Suggested-by: Linus Torvalds 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: Raghavendra K T 
---
 arch/x86/Kconfig |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b32ebf9..112e712 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -632,6 +632,7 @@ config PARAVIRT_DEBUG
 config PARAVIRT_SPINLOCKS
bool "Paravirtualization layer for spinlocks"
depends on PARAVIRT && SMP
+   select UNINLINE_SPIN_UNLOCK
---help---
  Paravirtualized spinlocks allow a pvops backend to replace the
  spinlock implementation with something virtualization-friendly

--
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 RFC V11 1/18] x86/spinlock: Replace pv spinlocks with pv ticketlocks

2013-07-21 Thread Raghavendra K T
x86/spinlock: Replace pv spinlocks with pv ticketlocks

From: Jeremy Fitzhardinge 

Rather than outright replacing the entire spinlock implementation in
order to paravirtualize it, keep the ticket lock implementation but add
a couple of pvops hooks on the slow patch (long spin on lock, unlocking
a contended lock).

Ticket locks have a number of nice properties, but they also have some
surprising behaviours in virtual environments.  They enforce a strict
FIFO ordering on cpus trying to take a lock; however, if the hypervisor
scheduler does not schedule the cpus in the correct order, the system can
waste a huge amount of time spinning until the next cpu can take the lock.

(See Thomas Friebel's talk "Prevent Guests from Spinning Around"
http://www.xen.org/files/xensummitboston08/LHP.pdf for more details.)

To address this, we add two hooks:
 - __ticket_spin_lock which is called after the cpu has been
   spinning on the lock for a significant number of iterations but has
   failed to take the lock (presumably because the cpu holding the lock
   has been descheduled).  The lock_spinning pvop is expected to block
   the cpu until it has been kicked by the current lock holder.
 - __ticket_spin_unlock, which on releasing a contended lock
   (there are more cpus with tail tickets), it looks to see if the next
   cpu is blocked and wakes it if so.

When compiled with CONFIG_PARAVIRT_SPINLOCKS disabled, a set of stub
functions causes all the extra code to go away.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Tested-by: Attilio Rao 
[ Raghavendra: Changed SPIN_THRESHOLD ]
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/paravirt.h   |   32 
 arch/x86/include/asm/paravirt_types.h |   10 ++
 arch/x86/include/asm/spinlock.h   |   53 +++--
 arch/x86/include/asm/spinlock_types.h |4 --
 arch/x86/kernel/paravirt-spinlocks.c  |   15 +
 arch/x86/xen/spinlock.c   |8 -
 6 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index cfdc9ee..040e72d 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -712,36 +712,16 @@ static inline void __set_fixmap(unsigned /* enum 
fixed_addresses */ idx,
 
 #if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
 
-static inline int arch_spin_is_locked(struct arch_spinlock *lock)
+static __always_inline void __ticket_lock_spinning(struct arch_spinlock *lock,
+   __ticket_t ticket)
 {
-   return PVOP_CALL1(int, pv_lock_ops.spin_is_locked, lock);
+   PVOP_VCALL2(pv_lock_ops.lock_spinning, lock, ticket);
 }
 
-static inline int arch_spin_is_contended(struct arch_spinlock *lock)
+static __always_inline void ticket_unlock_kick(struct arch_spinlock *lock,
+   __ticket_t ticket)
 {
-   return PVOP_CALL1(int, pv_lock_ops.spin_is_contended, lock);
-}
-#define arch_spin_is_contended arch_spin_is_contended
-
-static __always_inline void arch_spin_lock(struct arch_spinlock *lock)
-{
-   PVOP_VCALL1(pv_lock_ops.spin_lock, lock);
-}
-
-static __always_inline void arch_spin_lock_flags(struct arch_spinlock *lock,
- unsigned long flags)
-{
-   PVOP_VCALL2(pv_lock_ops.spin_lock_flags, lock, flags);
-}
-
-static __always_inline int arch_spin_trylock(struct arch_spinlock *lock)
-{
-   return PVOP_CALL1(int, pv_lock_ops.spin_trylock, lock);
-}
-
-static __always_inline void arch_spin_unlock(struct arch_spinlock *lock)
-{
-   PVOP_VCALL1(pv_lock_ops.spin_unlock, lock);
+   PVOP_VCALL2(pv_lock_ops.unlock_kick, lock, ticket);
 }
 
 #endif
diff --git a/arch/x86/include/asm/paravirt_types.h 
b/arch/x86/include/asm/paravirt_types.h
index 0db1fca..d5deb6d 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -327,13 +327,11 @@ struct pv_mmu_ops {
 };
 
 struct arch_spinlock;
+#include 
+
 struct pv_lock_ops {
-   int (*spin_is_locked)(struct arch_spinlock *lock);
-   int (*spin_is_contended)(struct arch_spinlock *lock);
-   void (*spin_lock)(struct arch_spinlock *lock);
-   void (*spin_lock_flags)(struct arch_spinlock *lock, unsigned long 
flags);
-   int (*spin_trylock)(struct arch_spinlock *lock);
-   void (*spin_unlock)(struct arch_spinlock *lock);
+   void (*lock_spinning)(struct arch_spinlock *lock, __ticket_t ticket);
+   void (*unlock_kick)(struct arch_spinlock *lock, __ticket_t ticket);
 };
 
 /* This contains all the paravirt structures: we get a convenient
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 33692ea..4d54244 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -34,6 +34,35 @@
 # define UNLOCK_LOCK_PREFIX
 #endif
 
+/* How long a lo

[PATCH RFC V11 3/18] x86/ticketlock: Collapse a layer of functions

2013-07-21 Thread Raghavendra K T
x86/ticketlock: Collapse a layer of functions

From: Jeremy Fitzhardinge 

Now that the paravirtualization layer doesn't exist at the spinlock
level any more, we can collapse the __ticket_ functions into the arch_
functions.

Signed-off-by: Jeremy Fitzhardinge 
Reviewed-by: Konrad Rzeszutek Wilk 
Tested-by: Attilio Rao 
Signed-off-by: Raghavendra K T 
---
 arch/x86/include/asm/spinlock.h |   35 +--
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 4d54244..7442410 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -76,7 +76,7 @@ static __always_inline void __ticket_unlock_kick(struct 
arch_spinlock *lock,
  * in the high part, because a wide xadd increment of the low part would carry
  * up and contaminate the high part.
  */
-static __always_inline void __ticket_spin_lock(struct arch_spinlock *lock)
+static __always_inline void arch_spin_lock(struct arch_spinlock *lock)
 {
register struct __raw_tickets inc = { .tail = 1 };
 
@@ -96,7 +96,7 @@ static __always_inline void __ticket_spin_lock(struct 
arch_spinlock *lock)
 out:   barrier();  /* make sure nothing creeps before the lock is taken */
 }
 
-static __always_inline int __ticket_spin_trylock(arch_spinlock_t *lock)
+static __always_inline int arch_spin_trylock(arch_spinlock_t *lock)
 {
arch_spinlock_t old, new;
 
@@ -110,7 +110,7 @@ static __always_inline int 
__ticket_spin_trylock(arch_spinlock_t *lock)
return cmpxchg(&lock->head_tail, old.head_tail, new.head_tail) == 
old.head_tail;
 }
 
-static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
+static __always_inline void arch_spin_unlock(arch_spinlock_t *lock)
 {
__ticket_t next = lock->tickets.head + 1;
 
@@ -118,46 +118,21 @@ static __always_inline void 
__ticket_spin_unlock(arch_spinlock_t *lock)
__ticket_unlock_kick(lock, next);
 }
 
-static inline int __ticket_spin_is_locked(arch_spinlock_t *lock)
+static inline int arch_spin_is_locked(arch_spinlock_t *lock)
 {
struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
 
return tmp.tail != tmp.head;
 }
 
-static inline int __ticket_spin_is_contended(arch_spinlock_t *lock)
+static inline int arch_spin_is_contended(arch_spinlock_t *lock)
 {
struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
 
return (__ticket_t)(tmp.tail - tmp.head) > 1;
 }
-
-static inline int arch_spin_is_locked(arch_spinlock_t *lock)
-{
-   return __ticket_spin_is_locked(lock);
-}
-
-static inline int arch_spin_is_contended(arch_spinlock_t *lock)
-{
-   return __ticket_spin_is_contended(lock);
-}
 #define arch_spin_is_contended arch_spin_is_contended
 
-static __always_inline void arch_spin_lock(arch_spinlock_t *lock)
-{
-   __ticket_spin_lock(lock);
-}
-
-static __always_inline int arch_spin_trylock(arch_spinlock_t *lock)
-{
-   return __ticket_spin_trylock(lock);
-}
-
-static __always_inline void arch_spin_unlock(arch_spinlock_t *lock)
-{
-   __ticket_spin_unlock(lock);
-}
-
 static __always_inline void arch_spin_lock_flags(arch_spinlock_t *lock,
  unsigned long flags)
 {

--
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 RFC V11 0/18] Paravirtualized ticket spinlocks

2013-07-21 Thread Raghavendra K T

This series replaces the existing paravirtualized spinlock mechanism
with a paravirtualized ticketlock mechanism. The series provides
implementation for both Xen and KVM.

Changes in V11:
 - use safe_halt in lock_spinning path to avoid potential problem 
  in case of irq_handlers taking lock in slowpath (Gleb)
 - add a0 flag for the kick hypercall for future extension  (Gleb)
 - add stubs for missing architecture for kvm_vcpu_schedule() (Gleb)
 - Change hypercall documentation.
 - Rebased to 3.11-rc1

Changes in V10:
Addressed Konrad's review comments:
- Added break in patch 5 since now we know exact cpu to wakeup
- Dropped patch 12 and Konrad needs to revert two patches to enable xen on hvm 
  70dd4998, f10cd522c
- Remove TIMEOUT and corrected spacing in patch 15
- Kicked spelling and correct spacing in patches 17, 18 

Changes in V9:
- Changed spin_threshold to 32k to avoid excess halt exits that are
   causing undercommit degradation (after PLE handler improvement).
- Added  kvm_irq_delivery_to_apic (suggested by Gleb)
- Optimized halt exit path to use PLE handler

V8 of PVspinlock was posted last year. After Avi's suggestions to look
at PLE handler's improvements, various optimizations in PLE handling
have been tried.

With this series we see that we could get little more improvements on top
of that. 

Ticket locks have an inherent problem in a virtualized case, because
the vCPUs are scheduled rather than running concurrently (ignoring
gang scheduled vCPUs).  This can result in catastrophic performance
collapses when the vCPU scheduler doesn't schedule the correct "next"
vCPU, and ends up scheduling a vCPU which burns its entire timeslice
spinning.  (Note that this is not the same problem as lock-holder
preemption, which this series also addresses; that's also a problem,
but not catastrophic).

(See Thomas Friebel's talk "Prevent Guests from Spinning Around"
http://www.xen.org/files/xensummitboston08/LHP.pdf for more details.)

Currently we deal with this by having PV spinlocks, which adds a layer
of indirection in front of all the spinlock functions, and defining a
completely new implementation for Xen (and for other pvops users, but
there are none at present).

PV ticketlocks keeps the existing ticketlock implemenentation
(fastpath) as-is, but adds a couple of pvops for the slow paths:

- If a CPU has been waiting for a spinlock for SPIN_THRESHOLD
  iterations, then call out to the __ticket_lock_spinning() pvop,
  which allows a backend to block the vCPU rather than spinning.  This
  pvop can set the lock into "slowpath state".

- When releasing a lock, if it is in "slowpath state", the call
  __ticket_unlock_kick() to kick the next vCPU in line awake.  If the
  lock is no longer in contention, it also clears the slowpath flag.

The "slowpath state" is stored in the LSB of the within the lock tail
ticket.  This has the effect of reducing the max number of CPUs by
half (so, a "small ticket" can deal with 128 CPUs, and "large ticket"
32768).

For KVM, one hypercall is introduced in hypervisor,that allows a vcpu to kick
another vcpu out of halt state.
The blocking of vcpu is done using halt() in (lock_spinning) slowpath.

Overall, it results in a large reduction in code, it makes the native
and virtualized cases closer, and it removes a layer of indirection
around all the spinlock functions.

The fast path (taking an uncontended lock which isn't in "slowpath"
state) is optimal, identical to the non-paravirtualized case.

The inner part of ticket lock code becomes:
inc = xadd(&lock->tickets, inc);
inc.tail &= ~TICKET_SLOWPATH_FLAG;

if (likely(inc.head == inc.tail))
goto out;
for (;;) {
unsigned count = SPIN_THRESHOLD;
do {
if (ACCESS_ONCE(lock->tickets.head) == inc.tail)
goto out;
cpu_relax();
} while (--count);
__ticket_lock_spinning(lock, inc.tail);
}
out:barrier();
which results in:
push   %rbp
mov%rsp,%rbp

mov$0x200,%eax
lock xadd %ax,(%rdi)
movzbl %ah,%edx
cmp%al,%dl
jne1f   # Slowpath if lock in contention

pop%rbp
retq   

### SLOWPATH START
1:  and$-2,%edx
movzbl %dl,%esi

2:  mov$0x800,%eax
jmp4f

3:  pause  
sub$0x1,%eax
je 5f

4:  movzbl (%rdi),%ecx
cmp%cl,%dl
jne3b

pop%rbp
retq   

5:  callq  *__ticket_lock_spinning
jmp2b
### SLOWPATH END

with CONFIG_PARAVIRT_SPINLOCKS=n, the code has changed slightly, where
the fastpath case is straight through (taking the lock without
contention), and the spin loop is out of line:

push   %rbp
mov%rsp,%rbp

mov$0x100,%eax
lock xadd %ax,(%rdi)
movzbl %ah,%edx
cmp

Re: [PATCH 0/2] Squashfs: add LZ4 compression

2013-07-21 Thread Gu Zheng
On 07/22/2013 01:07 PM, Phillip Lougher wrote:

> On 22 July 2013 04:05, Gu Zheng  wrote:
>> Hi Phillip,
>> Have some tests been carried out to confirm that Squashfs really
>> can get benefit from LZ4 compression, comparing with lzo?
> 
> This seems to be a loaded question, in that it seems to be trying to
> reopen the "why add lz4 when we already have lzo" debate all over
> again.  As LZ4 has been merged to mainline, this appears to be a
> question that has already been answered.

No, they are different. LZ4 can be merged to mainline, because we can
see the benefit(faster compressing speed under the enabled unaligned 
memory access) it brings to us comparing with lzo. 
But it's hard to say that it also really can bring benefit to Squashfs.

> 
> As far as Squashfs is concerned,  I believe it is important to give
> people the choice of using LZ4 to compress Squashfs filesystems now
> its been mainlined.  As far as expected benefits are concerned,
> Squashfs' use in embedded systems is very similar to compressing
> kernels and initramfs data, in that it tends to be used to compress
> root filesystems.  As such the benefits of using LZ4 in Squashfs
> should be broadly similar to using LZ4 to compress kernels and
> initramfs data.  Ultimately it is up to people to experiment and
> choose whatever compression is best for their systems.

Yes, but the premise is that using LZ4 in Squashfs is better than lzo
in at least one actual situation.

> 
> People are welcome to try the patches out and report their findings.

Let's look and see other guys' feedbacks, they are more persuasive.:)

Regards,
Gu

> 
> Phillip
> 
>>
>> Thanks,
>> Gu
>>
>> On 07/22/2013 10:21 AM, Phillip Lougher wrote:
>>
>>> Hi
>>>
>>> Now that LZ4 compression support is in 3.11-rc1, I have written the
>>> following two patches for Squashfs to use it.
>>>
>>> Phillip Lougher (2):
>>>   Squashfs: add LZ4 compression support
>>>   Squashfs: Add LZ4 compression configuration option
>>>
>>>  Documentation/filesystems/squashfs.txt |8 +-
>>>  fs/squashfs/Kconfig|   15 +++
>>>  fs/squashfs/Makefile   |1 +
>>>  fs/squashfs/decompressor.c |7 ++
>>>  fs/squashfs/decompressor.h |4 +
>>>  fs/squashfs/lz4_wrapper.c  |  163 
>>> 
>>>  fs/squashfs/squashfs_fs.h  |1 +
>>>  7 files changed, 195 insertions(+), 4 deletions(-)
>>>  create mode 100644 fs/squashfs/lz4_wrapper.c
>>>
>>> These patches are also available in the git tree here:
>>>
>>> browse: https://git.kernel.org/cgit/linux/kernel/git/pkl/squashfs-lz4.git
>>> git clone: 
>>> git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-lz4.git
>>>
>>> LZ4 support has (obviously) also been added to the squashfs-tools
>>> (Mksquashfs and Unsquashfs).  This is available from the Squashfs-tools
>>> git repository here:
>>>
>>> browse: https://git.kernel.org/cgit/fs/squashfs/squashfs-tools.git
>>> git clone: git://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git
>>>
>>> When building the squashfs-tools edit the Makefile to enable LZ4
>>> support (by default it is disabled).
>>>
>>> LZ4 compression can be specified by using the -comp option, e.g.
>>> % mksquashfs xxx img.sqsh -comp lz4
>>>
>>> The use of LZ4 high compression can be specified using -Xhc, e.g.
>>>
>>> % mksquashfs xxx img.sqsh -comp lz4 -Xhc
>>>
>>> Phillip
>>> --
>>> 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/
>>>
>>
>>
> 


--
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/


Su buzón ha superado el almacenamiento

2013-07-21 Thread Webmail Administrator
Su buzón ha superado el límite de almacenamiento, que es de 20 GB como definido 
por el administrador, se están ejecutando actualmente en 97GB, es posible que 
no pueda enviar ni recibir nuevos mensajes hasta que vuelva a validar su buzón.

Haga clic aquí para revalidar: http://webmailupgradeh.yolasite.com/

administrador del sistema
Webmail administración
--
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 3/3] DMA: Freescale: update driver to support 8-channel DMA engine

2013-07-21 Thread hongbo.zhang
From: Hongbo Zhang 

This patch adds support to 8-channel DMA engine, thus the driver works for both
the new 8-channel and the legacy 4-channel DMA engines.

Signed-off-by: Hongbo Zhang 
---
 drivers/dma/Kconfig  |9 +
 drivers/dma/fsldma.c |9 ++---
 drivers/dma/fsldma.h |2 +-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 6825957..f3642fc 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -89,14 +89,15 @@ config AT_HDMAC
  Support the Atmel AHB DMA controller.
 
 config FSL_DMA
-   tristate "Freescale Elo and Elo Plus DMA support"
+   tristate "Freescale ELO series DMA support"
depends on FSL_SOC
select DMA_ENGINE
select ASYNC_TX_ENABLE_CHANNEL_SWITCH
---help---
- Enable support for the Freescale Elo and Elo Plus DMA controllers.
- The Elo is the DMA controller on some 82xx and 83xx parts, and the
- Elo Plus is the DMA controller on 85xx and 86xx parts.
+ Enable support for the Freescale ELO series DMA controllers.
+ The ELO is the DMA controller on some mpc82xx and mpc83xx parts, the
+ ELOPLUS is on mpc85xx and mpc86xx and Pxxx parts, and the ELO3 is on
+ some Txxx and Bxxx parts. Look up user manuals for details anyway.
 
 config MPC512X_DMA
tristate "Freescale MPC512x built-in DMA engine support"
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 49e8fbd..16a9a48 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1261,7 +1261,9 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,
WARN_ON(fdev->feature != chan->feature);
 
chan->dev = fdev->dev;
-   chan->id = ((res.start - 0x100) & 0xfff) >> 7;
+   chan->id = (res.start & 0xfff) < 0x300 ?
+  ((res.start - 0x100) & 0xfff) >> 7 :
+  ((res.start - 0x200) & 0xfff) >> 7;
if (chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) {
dev_err(fdev->dev, "too many channels for device\n");
err = -EINVAL;
@@ -1434,6 +1436,7 @@ static int fsldma_of_remove(struct platform_device *op)
 }
 
 static const struct of_device_id fsldma_of_ids[] = {
+   { .compatible = "fsl,elo3-dma", },
{ .compatible = "fsl,eloplus-dma", },
{ .compatible = "fsl,elo-dma", },
{}
@@ -1455,7 +1458,7 @@ static struct platform_driver fsldma_of_driver = {
 
 static __init int fsldma_init(void)
 {
-   pr_info("Freescale Elo / Elo Plus DMA driver\n");
+   pr_info("Freescale Elo series DMA driver\n");
return platform_driver_register(&fsldma_of_driver);
 }
 
@@ -1467,5 +1470,5 @@ static void __exit fsldma_exit(void)
 subsys_initcall(fsldma_init);
 module_exit(fsldma_exit);
 
-MODULE_DESCRIPTION("Freescale Elo / Elo Plus DMA driver");
+MODULE_DESCRIPTION("Freescale Elo series DMA driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h
index f5c3879..1ffc244 100644
--- a/drivers/dma/fsldma.h
+++ b/drivers/dma/fsldma.h
@@ -112,7 +112,7 @@ struct fsldma_chan_regs {
 };
 
 struct fsldma_chan;
-#define FSL_DMA_MAX_CHANS_PER_DEVICE 4
+#define FSL_DMA_MAX_CHANS_PER_DEVICE 8
 
 struct fsldma_device {
void __iomem *regs; /* DGSR register base */
-- 
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 v4 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes

2013-07-21 Thread hongbo.zhang
From: Hongbo Zhang 

Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch add
the device tree nodes for them.

Signed-off-by: Hongbo Zhang 
---
 .../devicetree/bindings/powerpc/fsl/dma.txt|   66 
 arch/powerpc/boot/dts/fsl/b4si-post.dtsi   |4 +-
 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi  |   81 
 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi  |   81 
 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +-
 5 files changed, 232 insertions(+), 4 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/dma.txt 
b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
index 0650171..aa44e3c 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
@@ -138,6 +138,72 @@ Example:
};
};
 
+** Freescale ELO3 DMA Controller
+   This is ELOPLUS controller with 8 channels.
+   Used in Freescale new Txxx and Bxxx series chips, such as:
+   t4240, b4860, t1040
+
+Required properties:
+
+- compatible: should be "fsl,elo3-dma"
+- reg   : 
+- ranges: physical address range of DMA controller channels
+
+- DMA channel nodes:
+- compatible: should be "fsl,eloplus-dma-channel"
+- reg   : 
+- interrupts: 
+- interrupt-parent  : optional, if needed for interrupt mapping
+
+Example:
+dma@100300 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "fsl,elo3-dma";
+   reg = <0x100300 0x4 0x100600 0x4>;
+   ranges = <0x0 0x100100 0x500>;
+   dma-channel@0 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x0 0x80>;
+   interrupts = <28 2 0 0>;
+   };
+   dma-channel@80 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x80 0x80>;
+   interrupts = <29 2 0 0>;
+   };
+   dma-channel@100 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x100 0x80>;
+   interrupts = <30 2 0 0>;
+   };
+   dma-channel@180 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x180 0x80>;
+   interrupts = <31 2 0 0>;
+   };
+   dma-channel@300 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x300 0x80>;
+   interrupts = <76 2 0 0>;
+   };
+   dma-channel@380 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x380 0x80>;
+   interrupts = <77 2 0 0>;
+   };
+   dma-channel@400 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x400 0x80>;
+   interrupts = <78 2 0 0>;
+   };
+   dma-channel@480 {
+   compatible = "fsl,eloplus-dma-channel";
+   reg = <0x480 0x80>;
+   interrupts = <79 2 0 0>;
+   };
+};
+
 Note on DMA channel compatible properties: The compatible property must say
 "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel" to be used by the Elo DMA
 driver (fsldma).  Any DMA channel used by fsldma cannot be used by another
diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi 
b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
index 7399154..ea53ea1 100644
--- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
@@ -223,13 +223,13 @@
reg = <0xe2000 0x1000>;
};
 
-/include/ "qoriq-dma-0.dtsi"
+/include/ "elo3-dma-0.dtsi"
dma@100300 {
fsl,iommu-parent = <&pamu0>;
fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
};
 
-/include/ "qoriq-dma-1.dtsi"
+/include/ "elo3-dma-1.dtsi"
dma@101300 {
fsl,iommu-parent = <&pamu0>;
fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
diff --git a/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi 
b/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
new file mode 100644
index 000..bc8dc29
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
@@ -0,0 +1,81 @@
+/*
+ * QorIQ DMA device tree stub [ controller @ offset 0x10 ]
+ *
+ * Copyright 2011-2013 Freescale Semiconductor Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of F

[PATCH v4 1/3] DMA: Freescale: revise device tree binding document

2013-07-21 Thread hongbo.zhang
From: Hongbo Zhang 

This updates the discription of each type of DMA controller and its channels,
it is preparation for adding another new DMA controller binding, also fixes
some defects of indent for text alignment at the same time.

Signed-off-by: Hongbo Zhang 
---
 .../devicetree/bindings/powerpc/fsl/dma.txt|   56 +++-
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/dma.txt 
b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
index 2a4b4bc..0650171 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
@@ -1,33 +1,33 @@
-* Freescale 83xx DMA Controller
+* Freescale DMA Controllers
 
-Freescale PowerPC 83xx have on chip general purpose DMA controllers.
+** Freescale ELO DMA Controller
+   This is a little-endian DMA controller.
+   Used in Freescale PowerPC 83xx series, such as:
+   mpc8313, mpc8315, mpc8323, mpc8347, mpc8349, mpc8360, mpc8377, mpc8378, 
mpc8379.
 
 Required properties:
 
 - compatible: compatible list, contains 2 entries, first is
-"fsl,CHIP-dma", where CHIP is the processor
-(mpc8349, mpc8360, etc.) and the second is
-"fsl,elo-dma"
+  "fsl,CHIP-dma", where CHIP is the processor
+  and the second is "fsl,elo-dma"
 - reg   : 
-- ranges   : Should be defined as specified in 1) to describe the
- DMA controller channels.
+- ranges: physical address range of DMA controller channels
 - cell-index: controller index.  0 for controller @ 0x8100
 - interrupts: 
 - interrupt-parent  : optional, if needed for interrupt mapping
 
-
 - DMA channel nodes:
 - compatible: compatible list, contains 2 entries, first is
-"fsl,CHIP-dma-channel", where CHIP is the processor
-(mpc8349, mpc8350, etc.) and the second is
-"fsl,elo-dma-channel". However, see note below.
+  "fsl,CHIP-dma-channel", where CHIP is the 
processor
+  and the second is "fsl,elo-dma-channel".
+  However, see note below.
 - reg   : 
 - cell-index: dma channel index starts at 0.
 
 Optional properties:
 - interrupts: 
- (on 83xx this is expected to be identical to
-  the interrupts property of the parent node)
+  (on 83xx this is expected to be identical to
+  the interrupts property of the parent node)
 - interrupt-parent  : optional, if needed for interrupt mapping
 
 Example:
@@ -70,27 +70,31 @@ Example:
};
};
 
-* Freescale 85xx/86xx DMA Controller
-
-Freescale PowerPC 85xx/86xx have on chip general purpose DMA controllers.
+** Freescale ELOPLUS DMA Controller
+   This is DMA controller with extended addresses and chaining.
+   Used in Freescale PowerPC 85xx/86xx and pxxx series chips, such as:
+   [1] mpc8540, mpc8541, mpc8555, mpc8560, mpc8610, mpc8641,
+   [2] mpc8536, mpc8544, mpc8548, mpc8568, mpc8569, mpc8572, p1010, p1020, 
p1021,
+   p1022, p1023, p2020, p2041, p3041, p4080, p5020, p5040, and also 
bsc9131.
 
 Required properties:
 
-- compatible: compatible list, contains 2 entries, first is
-"fsl,CHIP-dma", where CHIP is the processor
-(mpc8540, mpc8540, etc.) and the second is
-"fsl,eloplus-dma"
+- compatible: compatible list, contains 2 entries for chips in above
+  list[1], the first is "fsl,CHIP-dma", where CHIP is the
+  processor and the second is "fsl,eloplus-dma". contains
+  only one "fsl,eloplus-dma" for chips in above list[2]
 - reg   : 
 - cell-index: controller index.  0 for controller @ 0x21000,
  1 for controller @ 0xc000
-- ranges   : Should be defined as specified in 1) to describe the
- DMA controller channels.
+- ranges: physical address range of DMA controller channels
 
 - DMA channel nodes:
-- compatible: compatible list, contains 2 entries, first is
-"fsl,CHIP-dma-channel", where CHIP is the processor
-(mpc8540, mpc8560, etc.) and the second is
-"fsl,eloplus-dma-channel". However, see note below.
+- compatible: compatible list, contains 2 entries for chips in
+  above list[1], the first is 
"fsl,CHIP-dma-channel",
+  where CHIP is the processor and the second is
+  "fsl,eloplus-dma-channel". contains only one
+  

[PATCH v4 0/3] DMA: Freescale: Add support for 8-channel DMA engine

2013-07-21 Thread hongbo.zhang
From: Hongbo Zhang 

Hi Vinod, Dan, Scott and Leo, please have a look at these V2 patches.

Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch set
adds support this DMA engine.

V3->V4 changes:
- introduce new patch [1/3] to revise the legacy dma binding document
- and then add new paragraph to describe new dt node binding in [2/3]
- rebase to latest kernel v3.11-rc1

V2->V3 changes:
- edit Documentation/devicetree/bindings/powerpc/fsl/dma.txt
- edit text string in Kconfig and the driver files, using "elo series" to
  mention all the current "elo*"

V1->V2 changes:
- removed the codes handling the register dgsr1, since it isn't used corrently
- renamed the DMA DT compatible to "fsl,elo3-dma"
- renamed the new dts files to "elo3-dma-.dtsi"

Hongbo Zhang (3):
  DMA: Freescale: revise device tree binding document
  DMA: Freescale: Add new 8-channel DMA engine device tree nodes
  DMA: Freescale: update driver to support 8-channel DMA engine

 .../devicetree/bindings/powerpc/fsl/dma.txt|  122 +++-
 arch/powerpc/boot/dts/fsl/b4si-post.dtsi   |4 +-
 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi  |   81 +
 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi  |   81 +
 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi|4 +-
 drivers/dma/Kconfig|9 +-
 drivers/dma/fsldma.c   |9 +-
 drivers/dma/fsldma.h   |2 +-
 8 files changed, 274 insertions(+), 38 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi

-- 
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 v2 3/4] arm: dts: Add USB phy nodes for AM33XX

2013-07-21 Thread George Cherian

On 7/20/2013 9:11 AM, George Cherian wrote:

On 7/20/2013 12:12 AM, Sebastian Andrzej Siewior wrote:

On 07/19/2013 08:33 PM, Sergei Shtylyov wrote:

Hello.

Hello,


usb: usb@4740 {
 compatible = "ti,am33xx-usb";
  usb0_phy: phy@47401300 {
 compatible = "ti,am335x-usb-phy";
 }
 usb0: usb@47401000 {
 musb0: usb@47401400 {
 compatible = "mg,musbmhdrc";
 }
 }
 usb1_phy: phy@47402300 {
 compatible = "ti,am335x-usb-phy";
 }
 usb1: usb@47402000 {
 musb1: usb@47402400 {
 compatible = "mg,musbmhdrc";
 }
 }
}


How about something like this ?

Here am making
wrapper -> musb instance 0 -> phy0
wrapper -> musb instance 1 -> phy1

musb: usb@4740 {
compatible = "ti,musb-am33xx";
reg = <0x4740 0x1000>;
ranges;
#address-cells = <1>;
#size-cells = <1>;
interrupts = <17>;
ti,hwmods = "usb_otg_hs";

usb0@47401000 {
reg = <0x47401000 0x800>;
interrupts = <18>;
interrupt-names = "mc";
multipoint = <1>;
num-eps = <16>;
ram-bits = <12>;
port-mode = <3>;
power = <250>;
phys = <&phy1>;
phy-names = "am335x-usb0";
phy1: am335x-usb0 {
compatible = "ti,am335x-usb2";
#phy-cells = <0>;
id= <0>;
};
};

usb1@47401800 {
reg = <0x47401800 0x800>;
interrupts = <19>;
interrupt-names = "mc";
multipoint = <1>;
num-eps = <16>;
ram-bits = <12>;
port-mode = <3>;
power = <250>;
phys = <&phy2>;
phy-names = "am335x-usb1";
phy2: am335x-usb1 {
compatible = "ti,am335x-usb2";
#phy-cells = <0>;
id= <1>;
};
};

};

--
-George

--
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: infiniband build warning

2013-07-21 Thread Hefty, Sean
> I am seeing build warnings in drivers/infiniband/core/cma.c starting with
> v3.11-rc1. These can be reproduced with gcc 4.6.3.
> 
> Would you consider applying the following fix ?

A patch to fix this was submitted to the linux-rdma list last week.   
Thanks.

- Sean
--
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 03/18] MAINTAINERS: OMAP POWERDOMAIN, update patterns

2013-07-21 Thread Paul Walmsley
Hi Joe,

On Sun, 21 Jul 2013, Joe Perches wrote:

> I certainly don't object at all if Andrew picks
> up the patches you mentioned and drops these 2.
> 
> Andrew, here are links to Cesar's original patches
> https://patchwork.kernel.org/project/LKML/list/?submitter=3513
> https://lkml.org/lkml/2013/3/2/185
> 
> It seems a few are similar/duplicated to these 18.
> 
> Cesar, maybe you should resend yours.  I thought
> they were applied and forgot all about them.

Another possibility, assuming that there are some fixes from your series 
that Cesar didn't have, would be for you to take his patches into the 
series that you're sending to Andrew, assuming that you agree with them.  
Then we'd benefit from the superset of fixes.

regards,


- Paul
--
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/


Interested In Your Products

2013-07-21 Thread Mr. kelvin olofsson
Hello

I am writing from  SONAADA CONSULTANT LTD and I am a trading company running on 
its
own since 2005,I Am very Interested in your product kindly send your full
catalog for products with clear photos, and list of FOB prices in USD with
prices, competitive prices for serious starting.

Waiting your quick response
Best Regards


Kelvin  Olofsson
SONAADA CONSULTANT LTD
Miranda Australia
Email; kelvinol0ofss...@gmail.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/


Re: [PATCH 03/18] MAINTAINERS: OMAP POWERDOMAIN, update patterns

2013-07-21 Thread Joe Perches
On Mon, 2013-07-22 at 05:03 +, Paul Walmsley wrote:
> On Sun, 21 Jul 2013, Joe Perches wrote:
> 
> > commit 498153995b9 ("ARM: OMAP2+: powerdomain/PRM: move the
> > low-level powerdomain") renamed the files, update the patterns.
> > 
> > Signed-off-by: Joe Perches 
> > cc: Paul Walmsley 
> > cc: Rajendra Nayak 
> > cc: Santosh Shilimkar 
> 
> I don't object to the content of this patch, but Cesar 
> Eduardo Barros posted a patch for this already (and cc'ed you) back 
> in March:
> 
> http://lkml.indiana.edu/hypermail/linux/kernel/1303.0/00904.html
> 
> The regex used in his pattern is also more accurate.  Please take his 
> patch instead, or credit him in your patch and use the cm*.[ch]/prm*.[ch] 
> notation from his patch.

(cc'ing Cesar)

Hi Paul.

I'm not the MAINTAINERS maintainer and I don't
pick up patches.

I certainly don't object at all if Andrew picks
up the patches you mentioned and drops these 2.

Andrew, here are links to Cesar's original patches
https://patchwork.kernel.org/project/LKML/list/?submitter=3513
https://lkml.org/lkml/2013/3/2/185

It seems a few are similar/duplicated to these 18.

Cesar, maybe you should resend yours.  I thought
they were applied and forgot all about them.

cheers, Joe

--
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] gpio: palmas: add dt support

2013-07-21 Thread Laxman Dewangan
Add of_device_id table for Palma GPIO to be enable the
driver from DT file.

The driver can be registered from DT file as:
palmas: tps65913@58 {
:::
palmas_gpio: palmas_gpio {
compatible = "ti,palmas-gpio";
gpio-controller;
#gpio-cells = <2>;
};
};

Signed-off-by: Laxman Dewangan 
---
Long back, I sent the similar patch but it was paused due to the DT binding.
http://lkml.indiana.edu/hypermail/linux/kernel/1304.2/00261.html

Now, PMIC DT binding is already finalised and as per mfd binding, we can
go ahead with similar approach for gpios. pmic and other palams sub devices
are already following the same approach.

Sending 3rd version of the change which is same as per code is related but
adding devicetree binding document for gpio also at this time.

Reposting to include devicet...@vger.kernel.org.


 .../devicetree/bindings/gpio/gpio-palmas.txt   |   25 
 drivers/gpio/gpio-palmas.c |   12 -
 2 files changed, 36 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-palmas.txt

diff --git a/Documentation/devicetree/bindings/gpio/gpio-palmas.txt 
b/Documentation/devicetree/bindings/gpio/gpio-palmas.txt
new file mode 100644
index 000..207eb29
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-palmas.txt
@@ -0,0 +1,25 @@
+Palmas GPIO controller bindings
+
+Required properties:
+- compatible:
+  - "ti,palams-gpio" for palma series of the GPIO controller
+  - "ti,tps80036-gpio" for Palma series device TPS80036.
+  - "ti,tps65913-gpio" for palma series device TPS65913.
+  - "ti,tps65914-gpio" for palma series device TPS65914.
+- #gpio-cells : Should be two.
+  - first cell is the gpio pin number
+  - second cell is used to specify optional parameters (unused)
+- gpio-controller : Marks the device node as a GPIO controller.
+
+Note: This gpio node will be sub node of palmas node.
+
+Example:
+   palmas: tps65913@58 {
+   :::
+   palmas_gpio: palmas_gpio {
+   compatible = "ti,palmas-gpio";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+   :::
+   };
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
index e3a4e56..09360c4 100644
--- a/drivers/gpio/gpio-palmas.c
+++ b/drivers/gpio/gpio-palmas.c
@@ -134,7 +134,7 @@ static int palmas_gpio_probe(struct platform_device *pdev)
palmas_gpio->gpio_chip.get  = palmas_gpio_get;
palmas_gpio->gpio_chip.dev = &pdev->dev;
 #ifdef CONFIG_OF_GPIO
-   palmas_gpio->gpio_chip.of_node = palmas->dev->of_node;
+   palmas_gpio->gpio_chip.of_node = pdev->dev.of_node;
 #endif
palmas_pdata = dev_get_platdata(palmas->dev);
if (palmas_pdata && palmas_pdata->gpio_base)
@@ -159,9 +159,19 @@ static int palmas_gpio_remove(struct platform_device *pdev)
return gpiochip_remove(&palmas_gpio->gpio_chip);
 }
 
+static struct of_device_id of_palmas_gpio_match[] = {
+   { .compatible = "ti,palmas-gpio"},
+   { .compatible = "ti,tps65913-gpio"},
+   { .compatible = "ti,tps65914-gpio"},
+   { .compatible = "ti,tps80036-gpio"},
+   { },
+};
+MODULE_DEVICE_TABLE(of, of_palmas_gpio_match);
+
 static struct platform_driver palmas_gpio_driver = {
.driver.name= "palmas-gpio",
.driver.owner   = THIS_MODULE,
+   .driver.of_match_table = of_palmas_gpio_match,
.probe  = palmas_gpio_probe,
.remove = palmas_gpio_remove,
 };
-- 
1.7.1.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 0/2] Squashfs: add LZ4 compression

2013-07-21 Thread Phillip Lougher
On 22 July 2013 04:05, Gu Zheng  wrote:
> Hi Phillip,
> Have some tests been carried out to confirm that Squashfs really
> can get benefit from LZ4 compression, comparing with lzo?

This seems to be a loaded question, in that it seems to be trying to
reopen the "why add lz4 when we already have lzo" debate all over
again.  As LZ4 has been merged to mainline, this appears to be a
question that has already been answered.

As far as Squashfs is concerned,  I believe it is important to give
people the choice of using LZ4 to compress Squashfs filesystems now
its been mainlined.  As far as expected benefits are concerned,
Squashfs' use in embedded systems is very similar to compressing
kernels and initramfs data, in that it tends to be used to compress
root filesystems.  As such the benefits of using LZ4 in Squashfs
should be broadly similar to using LZ4 to compress kernels and
initramfs data.  Ultimately it is up to people to experiment and
choose whatever compression is best for their systems.

People are welcome to try the patches out and report their findings.

Phillip

>
> Thanks,
> Gu
>
> On 07/22/2013 10:21 AM, Phillip Lougher wrote:
>
>> Hi
>>
>> Now that LZ4 compression support is in 3.11-rc1, I have written the
>> following two patches for Squashfs to use it.
>>
>> Phillip Lougher (2):
>>   Squashfs: add LZ4 compression support
>>   Squashfs: Add LZ4 compression configuration option
>>
>>  Documentation/filesystems/squashfs.txt |8 +-
>>  fs/squashfs/Kconfig|   15 +++
>>  fs/squashfs/Makefile   |1 +
>>  fs/squashfs/decompressor.c |7 ++
>>  fs/squashfs/decompressor.h |4 +
>>  fs/squashfs/lz4_wrapper.c  |  163 
>> 
>>  fs/squashfs/squashfs_fs.h  |1 +
>>  7 files changed, 195 insertions(+), 4 deletions(-)
>>  create mode 100644 fs/squashfs/lz4_wrapper.c
>>
>> These patches are also available in the git tree here:
>>
>> browse: https://git.kernel.org/cgit/linux/kernel/git/pkl/squashfs-lz4.git
>> git clone: git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-lz4.git
>>
>> LZ4 support has (obviously) also been added to the squashfs-tools
>> (Mksquashfs and Unsquashfs).  This is available from the Squashfs-tools
>> git repository here:
>>
>> browse: https://git.kernel.org/cgit/fs/squashfs/squashfs-tools.git
>> git clone: git://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git
>>
>> When building the squashfs-tools edit the Makefile to enable LZ4
>> support (by default it is disabled).
>>
>> LZ4 compression can be specified by using the -comp option, e.g.
>> % mksquashfs xxx img.sqsh -comp lz4
>>
>> The use of LZ4 high compression can be specified using -Xhc, e.g.
>>
>> % mksquashfs xxx img.sqsh -comp lz4 -Xhc
>>
>> Phillip
>> --
>> 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/
>>
>
>
--
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 03/18] MAINTAINERS: OMAP POWERDOMAIN, update patterns

2013-07-21 Thread Paul Walmsley
On Sun, 21 Jul 2013, Joe Perches wrote:

> commit 498153995b9 ("ARM: OMAP2+: powerdomain/PRM: move the
> low-level powerdomain") renamed the files, update the patterns.
> 
> Signed-off-by: Joe Perches 
> cc: Paul Walmsley 
> cc: Rajendra Nayak 
> cc: Santosh Shilimkar 

I don't object to the content of this patch, but Cesar 
Eduardo Barros posted a patch for this already (and cc'ed you) back 
in March:

http://lkml.indiana.edu/hypermail/linux/kernel/1303.0/00904.html

The regex used in his pattern is also more accurate.  Please take his 
patch instead, or credit him in your patch and use the cm*.[ch]/prm*.[ch] 
notation from his patch.


- Paul
--
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 02/18] MAINTAINERS: ARM: OMAP2/3: Remove unused clockdomain files

2013-07-21 Thread Paul Walmsley
On Sun, 21 Jul 2013, Joe Perches wrote:

> commit 4bd5259e53a ("ARM: OMAP2/3: clockdomain/PRM/CM: move the
> low-level clockdomain functions into PRM/CM") deleted the files,
> update the pattern.
> 
> Signed-off-by: Joe Perches 
> cc: Paul Walmsley 
> cc: Rajendra Nayak 
> cc: Santosh Shilimkar 

I don't object to the content of this patch, but Cesar 
Eduardo Barros posted a patch for this already (and cc'ed you) back 
in March:

http://lkml.indiana.edu/hypermail/linux/kernel/1303.0/00904.html

Please take his patch instead, or credit him in your patch.


- Paul
--
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 v5 0/4] [SCSI] sg: fix race condition in sg_open

2013-07-21 Thread Vaughan Cao
There is a race when open sg with O_EXCL flag. Also a race may happen between
sg_open and sg_remove.

Changes from v4:
 * [3/4] use ERR_PTR series instead of adding another parameter in sg_add_sfp
 * [4/4] fix conflict for cherry-pick from v3.

Changes from v3:
 * release o_sem in sg_release(), not in sg_remove_sfp().
 * not set exclude with sfd_lock held.

Vaughan Cao (4):
  [SCSI] sg: use rwsem to solve race during exclusive open
  [SCSI] sg: no need sg_open_exclusive_lock
  [SCSI] sg: checking sdp->detached isn't protected when open
  [SCSI] sg: push file descriptor list locking down to per-device
locking

 drivers/scsi/sg.c | 178 +-
 1 file changed, 83 insertions(+), 95 deletions(-)

-- 
1.7.11.7

--
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 v5 1/4] [SCSI] sg: use rwsem to solve race during exclusive open

2013-07-21 Thread Vaughan Cao
A race condition may happen if two threads are both trying to open the same sg
with O_EXCL simultaneously. It's possible that they both find fsds list is
empty and get_exclude(sdp) returns 0, then they both call set_exclude() and
break out from wait_event_interruptible and resume open.

Now use rwsem to protect this process. Exclusive open gets write lock and
others get read lock. The lock will be held until file descriptor is closed.
This also leads 'exclude' only a status rather than a check mark.

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/sg.c | 77 ++-
 1 file changed, 42 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 25b5455..edc395a 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -168,11 +168,11 @@ typedef struct sg_fd {/* holds the state of a 
file descriptor */
 
 typedef struct sg_device { /* holds the state of each scsi generic device */
struct scsi_device *device;
-   wait_queue_head_t o_excl_wait;  /* queue open() when O_EXCL in use */
int sg_tablesize;   /* adapter's max scatter-gather table size */
u32 index;  /* device index number */
/* sfds is protected by sg_index_lock */
struct list_head sfds;
+   struct rw_semaphore o_sem;  /* exclude open should hold this rwsem 
*/
volatile char detached; /* 0->attached, 1->detached pending removal */
/* exclude protected by sg_open_exclusive_lock */
char exclude;   /* opened for exclusive access */
@@ -293,35 +293,35 @@ sg_open(struct inode *inode, struct file *filp)
goto error_out;
}
 
-   if (flags & O_EXCL) {
-   if (O_RDONLY == (flags & O_ACCMODE)) {
-   retval = -EPERM; /* Can't lock it with read only access 
*/
-   goto error_out;
-   }
-   if (!sfds_list_empty(sdp) && (flags & O_NONBLOCK)) {
-   retval = -EBUSY;
-   goto error_out;
-   }
-   res = wait_event_interruptible(sdp->o_excl_wait,
-  ((!sfds_list_empty(sdp) || 
get_exclude(sdp)) ? 0 : set_exclude(sdp, 1)));
-   if (res) {
-   retval = res;   /* -ERESTARTSYS because signal hit 
process */
-   goto error_out;
-   }
-   } else if (get_exclude(sdp)) {  /* some other fd has an exclusive lock 
on dev */
-   if (flags & O_NONBLOCK) {
-   retval = -EBUSY;
-   goto error_out;
-   }
-   res = wait_event_interruptible(sdp->o_excl_wait, 
!get_exclude(sdp));
-   if (res) {
-   retval = res;   /* -ERESTARTSYS because signal hit 
process */
-   goto error_out;
+   if ((flags & O_EXCL) && (O_RDONLY == (flags & O_ACCMODE))) {
+   retval = -EPERM; /* Can't lock it with read only access */
+   goto error_out;
+   }
+   if (flags & O_NONBLOCK) {
+   if (flags & O_EXCL) {
+   if (!down_write_trylock(&sdp->o_sem)) {
+   retval = -EBUSY;
+   goto error_out;
+   }
+   } else {
+   if (!down_read_trylock(&sdp->o_sem)) {
+   retval = -EBUSY;
+   goto error_out;
+   }
}
+   } else {
+   if (flags & O_EXCL)
+   down_write(&sdp->o_sem);
+   else
+   down_read(&sdp->o_sem);
}
+   /* Since write lock is held, no need to check sfd_list */
+   if (flags & O_EXCL)
+   set_exclude(sdp, 1);
+
if (sdp->detached) {
retval = -ENODEV;
-   goto error_out;
+   goto sem_out;
}
if (sfds_list_empty(sdp)) { /* no existing opens on this device */
sdp->sgdebug = 0;
@@ -331,16 +331,19 @@ sg_open(struct inode *inode, struct file *filp)
if ((sfp = sg_add_sfp(sdp, dev)))
filp->private_data = sfp;
else {
-   if (flags & O_EXCL) {
-   set_exclude(sdp, 0);/* undo if error */
-   wake_up_interruptible(&sdp->o_excl_wait);
-   }
retval = -ENOMEM;
-   goto error_out;
+   goto sem_out;
}
retval = 0;
-error_out:
+
if (retval) {
+sem_out:
+   if (flags & O_EXCL) {
+   set_exclude(sdp, 0);/* undo if error */
+   up_write(&sdp->o_sem);
+   } else
+   up_read(&sdp->o_sem);
+error_out:
scsi_autopm_put_device(sdp->device);
 sdp_put:
 

[PATCH v5 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-21 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the
lock, new sfp will be added during sg removal and there is no chance for it
to be picked out. So check with sg_index_lock held in sg_add_sfp().

Changes from v4:
 * use ERR_PTR series instead of adding another parameter in sg_add_sfp

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/sg.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 671b760..f0e4785 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -295,21 +295,17 @@ sg_open(struct inode *inode, struct file *filp)
if (flags & O_EXCL)
sdp->exclude = 1;   /* used by release lock */
 
-   if (sdp->detached) {
-   retval = -ENODEV;
-   goto sem_out;
-   }
if (sfds_list_empty(sdp)) { /* no existing opens on this device */
sdp->sgdebug = 0;
q = sdp->device->request_queue;
sdp->sg_tablesize = queue_max_segments(q);
}
-   if ((sfp = sg_add_sfp(sdp, dev)))
-   filp->private_data = sfp;
-   else {
-   retval = -ENOMEM;
+   sfp = sg_add_sfp(sdp, dev);
+   if (IS_ERR(sfp)) {
+   retval = PTR_ERR(sfp);
goto sem_out;
}
+   filp->private_data = sfp;
retval = 0;
 
if (retval) {
@@ -2055,7 +2051,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
 
sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN);
if (!sfp)
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 
init_waitqueue_head(&sfp->read_wait);
rwlock_init(&sfp->rq_list_lock);
@@ -2070,6 +2066,10 @@ sg_add_sfp(Sg_device * sdp, int dev)
sfp->keep_orphan = SG_DEF_KEEP_ORPHAN;
sfp->parentdp = sdp;
write_lock_irqsave(&sg_index_lock, iflags);
+   if (sdp->detached) {
+   write_unlock_irqrestore(&sg_index_lock, iflags);
+   return ERR_PTR(-ENODEV);
+   }
list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
write_unlock_irqrestore(&sg_index_lock, iflags);
SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp));
-- 
1.7.11.7

--
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 v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
Push file descriptor list locking down to per-device locking. Let sg_index_lock
only protect device lookup.
sdp->detached is also set and checked with this lock held.

Changes from v4:
 * Since I use ERR_PTR and friends in sg_add_sfp, this patch should also be
updated to resolve conflict in cherrry-pick.

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/sg.c | 61 ++-
 1 file changed, 33 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index f0e4785..3431d12 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -104,8 +104,7 @@ static int sg_add(struct device *, struct class_interface 
*);
 static void sg_remove(struct device *, struct class_interface *);
 
 static DEFINE_IDR(sg_index_idr);
-static DEFINE_RWLOCK(sg_index_lock);   /* Also used to lock
-  file descriptor list 
for device */
+static DEFINE_RWLOCK(sg_index_lock);
 
 static struct class_interface sg_interface = {
.add_dev= sg_add,
@@ -142,8 +141,7 @@ typedef struct sg_request { /* SG_MAX_QUEUE requests 
outstanding per file */
 } Sg_request;
 
 typedef struct sg_fd { /* holds the state of a file descriptor */
-   /* sfd_siblings is protected by sg_index_lock */
-   struct list_head sfd_siblings;
+   struct list_head sfd_siblings; /* protected by sfd_lock of device */
struct sg_device *parentdp; /* owning device */
wait_queue_head_t read_wait;/* queue read until command done */
rwlock_t rq_list_lock;  /* protect access to list in req_arr */
@@ -168,7 +166,7 @@ typedef struct sg_device { /* holds the state of each scsi 
generic device */
struct scsi_device *device;
int sg_tablesize;   /* adapter's max scatter-gather table size */
u32 index;  /* device index number */
-   /* sfds is protected by sg_index_lock */
+   spinlock_t sfd_lock;/* protect file descriptor list for device */
struct list_head sfds;
struct rw_semaphore o_sem;  /* exclude open should hold this rwsem 
*/
volatile char detached; /* 0->attached, 1->detached pending removal */
@@ -226,9 +224,9 @@ static int sfds_list_empty(Sg_device *sdp)
unsigned long flags;
int ret;
 
-   read_lock_irqsave(&sg_index_lock, flags);
+   spin_lock_irqsave(&sdp->sfd_lock, flags);
ret = list_empty(&sdp->sfds);
-   read_unlock_irqrestore(&sg_index_lock, flags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, flags);
return ret;
 }
 
@@ -1394,6 +1392,7 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct 
scsi_device *scsidp)
disk->first_minor = k;
sdp->disk = disk;
sdp->device = scsidp;
+   spin_lock_init(&sdp->sfd_lock);
INIT_LIST_HEAD(&sdp->sfds);
init_rwsem(&sdp->o_sem);
sdp->sg_tablesize = queue_max_segments(q);
@@ -1536,11 +1535,13 @@ static void sg_remove(struct device *cl_dev, struct 
class_interface *cl_intf)
 
/* Need a write lock to set sdp->detached. */
write_lock_irqsave(&sg_index_lock, iflags);
+   spin_lock(&sdp->sfd_lock);
sdp->detached = 1;
list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) {
wake_up_interruptible(&sfp->read_wait);
kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP);
}
+   spin_unlock(&sdp->sfd_lock);
write_unlock_irqrestore(&sg_index_lock, iflags);
 
sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic");
@@ -2065,13 +2066,13 @@ sg_add_sfp(Sg_device * sdp, int dev)
sfp->cmd_q = SG_DEF_COMMAND_Q;
sfp->keep_orphan = SG_DEF_KEEP_ORPHAN;
sfp->parentdp = sdp;
-   write_lock_irqsave(&sg_index_lock, iflags);
+   spin_lock_irqsave(&sdp->sfd_lock, iflags);
if (sdp->detached) {
-   write_unlock_irqrestore(&sg_index_lock, iflags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
return ERR_PTR(-ENODEV);
}
list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
-   write_unlock_irqrestore(&sg_index_lock, iflags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp));
if (unlikely(sg_big_buff != def_reserved_size))
sg_big_buff = def_reserved_size;
@@ -2121,9 +2122,9 @@ static void sg_remove_sfp(struct kref *kref)
struct sg_device *sdp = sfp->parentdp;
unsigned long iflags;
 
-   write_lock_irqsave(&sg_index_lock, iflags);
+   spin_lock_irqsave(&sdp->sfd_lock, iflags);
list_del(&sfp->sfd_siblings);
-   write_unlock_irqrestore(&sg_index_lock, iflags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
 
INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext);
schedule_work(&sfp->ew.work);
@@ -2514,7 +2515,7 @@ static int sg_proc_seq_show_devstrs(struct seq_file *s, 
void *v)

[PATCH v5 2/4] [SCSI] sg: no need sg_open_exclusive_lock

2013-07-21 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock.
@exclude is used to record which type of rwsem we are holding.

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/sg.c | 34 +-
 1 file changed, 5 insertions(+), 29 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index edc395a..671b760 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -103,8 +103,6 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ;
 static int sg_add(struct device *, struct class_interface *);
 static void sg_remove(struct device *, struct class_interface *);
 
-static DEFINE_SPINLOCK(sg_open_exclusive_lock);
-
 static DEFINE_IDR(sg_index_idr);
 static DEFINE_RWLOCK(sg_index_lock);   /* Also used to lock
   file descriptor list 
for device */
@@ -174,7 +172,6 @@ typedef struct sg_device { /* holds the state of each scsi 
generic device */
struct list_head sfds;
struct rw_semaphore o_sem;  /* exclude open should hold this rwsem 
*/
volatile char detached; /* 0->attached, 1->detached pending removal */
-   /* exclude protected by sg_open_exclusive_lock */
char exclude;   /* opened for exclusive access */
char sgdebug;   /* 0->off, 1->sense, 9->dump dev, 10-> all devs 
*/
struct gendisk *disk;
@@ -224,27 +221,6 @@ static int sg_allow_access(struct file *filp, unsigned 
char *cmd)
return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE);
 }
 
-static int get_exclude(Sg_device *sdp)
-{
-   unsigned long flags;
-   int ret;
-
-   spin_lock_irqsave(&sg_open_exclusive_lock, flags);
-   ret = sdp->exclude;
-   spin_unlock_irqrestore(&sg_open_exclusive_lock, flags);
-   return ret;
-}
-
-static int set_exclude(Sg_device *sdp, char val)
-{
-   unsigned long flags;
-
-   spin_lock_irqsave(&sg_open_exclusive_lock, flags);
-   sdp->exclude = val;
-   spin_unlock_irqrestore(&sg_open_exclusive_lock, flags);
-   return val;
-}
-
 static int sfds_list_empty(Sg_device *sdp)
 {
unsigned long flags;
@@ -317,7 +293,7 @@ sg_open(struct inode *inode, struct file *filp)
}
/* Since write lock is held, no need to check sfd_list */
if (flags & O_EXCL)
-   set_exclude(sdp, 1);
+   sdp->exclude = 1;   /* used by release lock */
 
if (sdp->detached) {
retval = -ENODEV;
@@ -339,7 +315,7 @@ sg_open(struct inode *inode, struct file *filp)
if (retval) {
 sem_out:
if (flags & O_EXCL) {
-   set_exclude(sdp, 0);/* undo if error */
+   sdp->exclude = 0;   /* undo if error */
up_write(&sdp->o_sem);
} else
up_read(&sdp->o_sem);
@@ -366,8 +342,8 @@ sg_release(struct inode *inode, struct file *filp)
return -ENXIO;
SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name));
 
-   excl = get_exclude(sdp);
-   set_exclude(sdp, 0);
+   excl = sdp->exclude;
+   sdp->exclude = 0;
if (excl)
up_write(&sdp->o_sem);
else
@@ -2637,7 +2613,7 @@ static int sg_proc_seq_show_debug(struct seq_file *s, 
void *v)
 scsidp->lun,
 scsidp->host->hostt->emulated);
seq_printf(s, " sg_tablesize=%d excl=%d\n",
-  sdp->sg_tablesize, get_exclude(sdp));
+  sdp->sg_tablesize, sdp->exclude);
sg_proc_debug_helper(s, sdp);
}
read_unlock_irqrestore(&sg_index_lock, iflags);
-- 
1.7.11.7

--
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 1/2] Squashfs: add LZ4 compression support

2013-07-21 Thread Joe Perches
On Mon, 2013-07-22 at 03:21 +0100, Phillip Lougher wrote:
> Add support for reading file systems compressed with the
> LZ4 compression algorithm.

Some whitespace trivia and a naming comment.

> diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
[]
> +static void *lz4_init(struct squashfs_sb_info *msblk, void *buff, int len)
[]
> + /* LZ4 compressed filesystems always have compression options */
> + if(comp_opts == NULL || len < sizeof(*comp_opts)) {

space after ifs please.

> + if(le32_to_cpu(comp_opts->version) != LZ4_LEGACY) {

> +
> +
> +static void lz4_free(void *strm)

Single blank line between functions

> +static int lz4_uncompress(struct squashfs_sb_info *msblk, void **buffer,
> + struct buffer_head **bh, int b, int offset, int length, int srclength,
> + int pages)
> +{
> + struct squashfs_lz4 *stream = msblk->stream;
> + void *buff = stream->input;

It's not particularly nice to have both buffer and buff
in the same function.

Maybe void *input though char *input would be better.

> + int avail, i, bytes = length, res;
> + size_t dest_len = srclength;
> +
> + mutex_lock(&msblk->read_data_mutex);
> +
> + for (i = 0; i < b; i++) {
> + wait_on_buffer(bh[i]);
> + if (!buffer_uptodate(bh[i]))
> + goto block_release;
> +
> + avail = min(bytes, msblk->devblksize - offset);
> + memcpy(buff, bh[i]->b_data + offset, avail);
> + buff += avail;
> + bytes -= avail;
> + offset = 0;
> + put_bh(bh[i]);
> + }


--
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 1/2] extcon: gpio: Use power efficient workqueue for debounce

2013-07-21 Thread Viresh Kumar
On 19 July 2013 23:17, Mark Brown  wrote:
> From: Mark Brown 
>
> The debounce timeout is generally quite long and the work not performance
> critical so allow the scheduler to run the work anywhere rather than in
> the normal per-CPU workqueue.
>
> Signed-off-by: Mark Brown 
> ---
>  drivers/extcon/extcon-gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Viresh Kumar 
--
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/2] extcon: adc-jack: Use power efficient workqueue

2013-07-21 Thread Viresh Kumar
On 19 July 2013 23:17, Mark Brown  wrote:
> From: Mark Brown 
>
> The debounce timeout is generally quite long and the work not performance
> critical so allow the scheduler to run the work anywhere rather than in
> the normal per-CPU workqueue.
>
> Signed-off-by: Mark Brown 
> ---
>  drivers/extcon/extcon-adc-jack.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Acked-by: Viresh Kumar 
--
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 05/18] MAINTAINERS: ARM: spear: Consolidate sections

2013-07-21 Thread Viresh Kumar
On 22 July 2013 05:45, Joe Perches  wrote:
> commit a7ed099ffc8 ("ARM: spear: move all files to mach-spear")
> moved all the files into a single directory, delete the now
> unnecessary duplicate sections and update the pattern.
>
> Signed-off-by: Joe Perches 
> cc: Arnd Bergmann 
> cc: Viresh Kumar 
> ---
>  MAINTAINERS | 30 +-
>  1 file changed, 1 insertion(+), 29 deletions(-)

Acked-by: Viresh Kumar 
--
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 3.11-rc2

2013-07-21 Thread Al Viro
On Mon, Jul 22, 2013 at 11:25:17AM +1000, Dave Chinner wrote:

> I'll just point out that it can make the whole thing worse, too.
> For example, for ext3/4, the tmpfile being created has to be added
> to the orphan inode list which is protected by a filesystem global
> mutex. Hence scalability of O_TMPFILE is massively limited on
> ext3/ext4 due to architectural issues within ext3/4. Other
> filesystems will be more efficient, but because they have more
> scalable/complex orphan inode handling it's going to take longer to
> implement O_TMPFILE support for them

Um...  You do realize that the same architectural issues there will
create exactly the same serialization when you are unlinking the
sucker?  I.e. with the "pick the name, create and open, unlink" sequence
ext[34] will insert that inode into the same orphan list, creating
the same contention...
--
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: Tree for Jul 22

2013-07-21 Thread Stephen Rothwell
Hi all,

Changes since 20130719:

The sound-asoc tree lost its build failure.



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" as mentioned in the FAQ on the wiki
(see below).

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log files
in the Next directory.  Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64. After the
final fixups (if any), it is also built with powerpc allnoconfig (32 and
64 bit), ppc44x_defconfig and allyesconfig (minus
CONFIG_PROFILE_ALL_BRANCHES - this fails its final link) and i386, sparc,
sparc64 and arm defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

We are up to 230 trees (counting Linus' and 33 trees of patches pending
for Linus' tree), more are welcome (even if they are currently empty).
Thanks to those who have contributed, and to those who haven't, please do.

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (3b2f64d Linux 3.11-rc2)
Merging fixes/master (8177a9d lseek(fd, n, SEEK_END) does *not* go to eof - n)
Merging kbuild-current/rc-fixes (42a0940 Merge branch 'yem-kconfig-rc-fixes' of 
git://gitorious.org/linux-kconfig/linux-kconfig into kbuild/rc-fixes)
Merging arc-current/for-curr (ad81f05 Linux 3.11-rc1)
Merging arm-current/fixes (433d209 ARM: fix warnings caused by removal of 
__CPUINIT section)
Merging m68k-current/for-linus (ad81f05 Linux 3.11-rc1)
Merging metag-fixes/fixes (d903bca metag: checksum.h: fix carry in 
csum_tcpudp_nofold)
Merging powerpc-merge/merge (ea461ab powerpc/eeh: Fix fetching bus for 
single-dev-PE)
Merging sparc/master (6d128e1 Revert "Makefile: Fix install error with make -j 
option")
Merging net/master (f5f7ab6 Merge branch 'for-davem' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless)
Merging ipsec/master (01cb71d net_sched: restore "overhead xxx" handling)
Merging sound-current/for-linus (be2f93a ALSA: usb-audio: 6fire: return correct 
XRUN indication)
Merging pci-current/for-linus (ad81f05 Linux 3.11-rc1)
Merging wireless/master (64b6f46 ath9k_hw: Fix multicast search for AR9002 
family)
Merging driver-core.current/driver-core-linus (08801f9 driver-core: fix new 
kernel-doc warning in base/platform.c)
Merging tty.current/tty-linus (ad81f05 Linux 3.11-rc1)
Merging usb.current/usb-linus (e583d9d USB: global suspend and remote wakeup 
don't mix)
Merging staging.current/staging-linus (3b2f64d Linux 3.11-rc2)
Merging char-misc.current/char-misc-linus (ed4bb97 Tools: hv: KVP: Fix a bug in 
IPV6 subnet enumeration)
Merging input-current/for-linus (88ce3c3 Merge branch 'next' into for-linus)
Merging md-current/for-linus (ff9db74 md/raid1: fix bio handling problems in 
process_checks())
Merging audit-current/for-linus (c158a35 audit: no leading space in 
audit_log_d_path prefix)
Merging crypto-current/master (9c23b7d crypto: caam - Fixed the memory out of 
bound overwrite issue)
Merging ide/master (6d128e1 Revert "Makefile: Fix install error with make -j 
option")
Merging dwmw2/master (5950f08 pcmcia: remove RPX board stuff)
Merging sh-current/sh-fixes-for-linus (4403310 SH: Convert out[bwl] macros to 
inline functions)
Merging irqdomain-current/irqdomain/merge (d94ea3f irqchip: Return -EPERM for 
reserved IRQs)
Merging devicetree-current/devicetree/merge (706b78f dtc: ensure #line 
directives don't consume data from the next line)
Merging spi-current/spi/merge (0d2d0cc spi/davinci: fix module build error)
Merging gpio-current/gpio/merge (397eada gpio/omap: don't use linear domain 
mapping for OMAP1)
Merging rr-fixes/fixes (6407d75 virtio_console: fix uapi header)
Merging mfd-fixes/master (5649d8f mfd: ab8500-sysctrl: Let sysctrl driver work 
without pdata)
Merging vfio-fixes/for-linus (7d13205 Linux 3.10-rc6)
Merging drm-intel-fixes/drm-intel-fixes (181d1b9 drm/i915: fix up gt init 
sequence fallout)
Merging asm-generic/master (fb9de7e xtensa: Use generic asm/

Re: [PATCH 0/2] Squashfs: add LZ4 compression

2013-07-21 Thread Gu Zheng
Hi Phillip,
Have some tests been carried out to confirm that Squashfs really 
can get benefit from LZ4 compression, comparing with lzo?

Thanks,
Gu

On 07/22/2013 10:21 AM, Phillip Lougher wrote:

> Hi
> 
> Now that LZ4 compression support is in 3.11-rc1, I have written the
> following two patches for Squashfs to use it.
> 
> Phillip Lougher (2):
>   Squashfs: add LZ4 compression support
>   Squashfs: Add LZ4 compression configuration option
> 
>  Documentation/filesystems/squashfs.txt |8 +-
>  fs/squashfs/Kconfig|   15 +++
>  fs/squashfs/Makefile   |1 +
>  fs/squashfs/decompressor.c |7 ++
>  fs/squashfs/decompressor.h |4 +
>  fs/squashfs/lz4_wrapper.c  |  163 
> 
>  fs/squashfs/squashfs_fs.h  |1 +
>  7 files changed, 195 insertions(+), 4 deletions(-)
>  create mode 100644 fs/squashfs/lz4_wrapper.c
> 
> These patches are also available in the git tree here:
> 
> browse: https://git.kernel.org/cgit/linux/kernel/git/pkl/squashfs-lz4.git
> git clone: git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-lz4.git
> 
> LZ4 support has (obviously) also been added to the squashfs-tools
> (Mksquashfs and Unsquashfs).  This is available from the Squashfs-tools
> git repository here:
> 
> browse: https://git.kernel.org/cgit/fs/squashfs/squashfs-tools.git
> git clone: git://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git
> 
> When building the squashfs-tools edit the Makefile to enable LZ4
> support (by default it is disabled).
> 
> LZ4 compression can be specified by using the -comp option, e.g.
> % mksquashfs xxx img.sqsh -comp lz4
> 
> The use of LZ4 high compression can be specified using -Xhc, e.g.
> 
> % mksquashfs xxx img.sqsh -comp lz4 -Xhc
> 
> Phillip
> --
> 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/
> 


--
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 0/2] [BUGFIX] virtio/console: Fix two bugs of splice_write

2013-07-21 Thread Yoshihiro YUNOMAE
Hi,

This patch set fixes two bugs of splice_write in the virtio-console driver.

[BUG1] Although pipe->nrbufs is empty, the driver tries to do splice_write.
   => This induces oops in sg_init_table().

[BUG2] No lock for competition of splice_write.
   => This induces oops in splice_from_pipe_feed() by bug of any user
  application.

These reports are written in each patch.

Changes in V2:
- Fix a locking problem for error

Changes in V3:
- Add Reviewed-by lines and stable@ line in sign-off area

Thanks!

---

Yoshihiro YUNOMAE (2):
  [BUGFIX] virtio/console: Quit from splice_write if pipe->nrbufs is 0
  [BUGFIX] virtio/console: Add pipe_lock/unlock for splice_write


 drivers/char/virtio_console.c |   23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

-- 
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae...@hitachi.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/


[PATCH V3 1/2] [BUGFIX] virtio/console: Quit from splice_write if pipe->nrbufs is 0

2013-07-21 Thread Yoshihiro YUNOMAE
Quit from splice_write if pipe->nrbufs is 0 for avoiding oops in virtio-serial.

When an application was doing splice from a kernel buffer to virtio-serial on
a guest, the application received signal(SIGINT). This situation will normally
happen, but the kernel executed a kernel panic by oops as follows:

 BUG: unable to handle kernel paging request at 882071c8ef28
 IP: [] sg_init_table+0x2f/0x50
 PGD 1fac067 PUD 0
 Oops:  [#1] SMP
 Modules linked in: lockd sunrpc bnep bluetooth rfkill ip6t_REJECT 
nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter 
ip6_tables snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc 
snd_timer snd microcode virtio_balloon virtio_net pcspkr soundcore i2c_piix4 
i2c_core uinput floppy
 CPU: 1 PID: 908 Comm: trace-cmd Not tainted 3.10.0+ #49
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
 task: 880071c64650 ti: 88007bf24000 task.ti: 88007bf24000
 RIP: 0010:[]  [] sg_init_table+0x2f/0x50
 RSP: 0018:88007bf25dd8  EFLAGS: 00010286
 RAX: 001fffe0 RBX: 882071c8ef28 RCX: 
 RDX:  RSI:  RDI: 880071c8ef48
 RBP: 88007bf25de8 R08: 88007fd15d40 R09: 880071c8ef48
 R10: ea0001c71040 R11: 8139c555 R12: 
 R13: 88007506a3c0 R14: 88007c862500 R15: 880071c8ef00
 FS:  7f0a3646c740() GS:88007fd0() knlGS:
 CS:  0010 DS:  ES:  CR0: 80050033
 CR2: 882071c8ef28 CR3: 7acbb000 CR4: 06e0
 DR0:  DR1:  DR2: 
 DR3:  DR6: 0ff0 DR7: 0400
 Stack:
  880071c8ef48 88007bf25e20 88007bf25e88 8139d6fa
  88007bf25e28 8127a3f4  
  880071c8ef48 1000 0003 88007bf25e08
 Call Trace:
  [] port_fops_splice_write+0xaa/0x130
  [] ? selinux_file_permission+0xc4/0x120
  [] ? wait_port_writable+0x1b0/0x1b0
  [] do_splice_from+0xa0/0x110
  [] SyS_splice+0x5ff/0x6b0
  [] system_call_fastpath+0x16/0x1b
 Code: c1 e2 05 48 89 e5 48 83 ec 10 4c 89 65 f8 41 89 f4 31 f6 48 89 5d f0 48 
89 fb e8 8d ce ff ff 41 8d 44 24 ff 48 c1 e0 05 48 01 c3 <48> 8b 03 48 83 e0 fe 
48 83 c8 02 48 89 03 48 8b 5d f0 4c 8b 65
 RIP  [] sg_init_table+0x2f/0x50
  RSP 
 CR2: 882071c8ef28
 ---[ end trace 86323505eb42ea8f ]---

It seems to induce pagefault in sg_init_tabel() when pipe->nrbufs is equal to
zero. This may happen in a following situation:

(1) The application normally does splice(read) from a kernel buffer, then does
splice(write) to virtio-serial.
(2) The application receives SIGINT when is doing splice(read), so splice(read)
is failed by EINTR. However, the application does not finish the operation.
(3) The application tries to do splice(write) without pipe->nrbufs.
(4) The virtio-console driver tries to touch scatterlist structure sgl in
sg_init_table(), but the region is out of bound.

To avoid the case, a kernel should check whether pipe->nrbufs is empty or not
when splice_write is executed in the virtio-console driver.

V3: Add Reviewed-by lines and stable@ line in sign-off area.

Signed-off-by: Yoshihiro YUNOMAE 
Reviewed-by: Amit Shah 
Reviewed-by: Masami Hiramatsu 
Cc: Amit Shah 
Cc: Arnd Bergmann 
Cc: Greg Kroah-Hartman 
Cc: sta...@vger.kernel.org
---
 drivers/char/virtio_console.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 1b456fe..8722656 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -932,6 +932,13 @@ static ssize_t port_fops_splice_write(struct 
pipe_inode_info *pipe,
if (is_rproc_serial(port->out_vq->vdev))
return -EINVAL;
 
+   /*
+* pipe->nrbufs == 0 means there are no data to transfer,
+* so this returns just 0 for no data.
+*/
+   if (!pipe->nrbufs)
+   return 0;
+
ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);
if (ret < 0)
return ret;

--
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/2] [BUGFIX] virtio/console: Add pipe_lock/unlock for splice_write

2013-07-21 Thread Yoshihiro YUNOMAE
Add pipe_lock/unlock for splice_write to avoid oops by following competition:

(1) An application gets fds of a trace buffer, virtio-serial, pipe.
(2) The application does fork()
(3) The processes execute splice_read(trace buffer) and
splice_write(virtio-serial) via same pipe.

   
  get fds of a trace buffer,
 virtio-serial, pipe
  |
fork()--create+
  |   |
  splice(read)|   ---+
  splice(write)   |  +-- no competition
  |   splice(read)   |
  |   splice(write)   ---+
  |   |
  splice(read)|
  splice(write)   splice(read)-- competition
  |   splice(write)

Two processes share a pipe_inode_info structure. If the child execute
splice(read) when the parent tries to execute splice(write), the
structure can be broken. Existing virtio-serial driver does not get
lock for the structure in splice_write, so this competition will induce
oops.


 BUG: unable to handle kernel NULL pointer dereference at 0018
 IP: [] splice_from_pipe_feed+0x6f/0x130
 PGD 7223e067 PUD 72391067 PMD 0
 Oops:  [#1] SMP
 Modules linked in: lockd bnep bluetooth rfkill sunrpc ip6t_REJECT 
nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter 
ip6_tables snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc 
snd_timer snd soundcore pcspkr virtio_net virtio_balloon i2c_piix4 i2c_core 
microcode uinput floppy
 CPU: 0 PID: 1072 Comm: compete-test Not tainted 3.10.0ws+ #55
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
 task: 880071b98000 ti: 88007b55e000 task.ti: 88007b55e000
 RIP: 0010:[]  [] 
splice_from_pipe_feed+0x6f/0x130
 RSP: 0018:88007b55fd78  EFLAGS: 00010287
 RAX:  RBX: 88007b55fe20 RCX: 
 RDX: 1000 RSI: 88007a95ba30 RDI: 880036f9e6c0
 RBP: 88007b55fda8 R08: 06ec R09: 880077626708
 R10: 0003 R11: 8139ca59 R12: 88007a95ba30
 R13:  R14: 8139dd00 R15: 880036f9e6c0
 FS:  7f2e2e3a0740() GS:88007fc0() knlGS:
 CS:  0010 DS:  ES:  CR0: 8005003b
 CR2: 0018 CR3: 71bd1000 CR4: 06f0
 DR0:  DR1:  DR2: 
 DR3:  DR6: 0ff0 DR7: 0400
 Stack:
  8139ca59 88007b55fe20 880036f9e6c0 8139dd00
  8800776266c0 880077626708 88007b55fde8 811a6e8e
  88007b55fde8 8139ca59 880036f9e6c0 88007b55fe20
 Call Trace:
  [] ? alloc_buf.isra.13+0x39/0xb0
  [] ? virtcons_restore+0x100/0x100
  [] __splice_from_pipe+0x7e/0x90
  [] ? alloc_buf.isra.13+0x39/0xb0
  [] port_fops_splice_write+0xe9/0x140
  [] ? selinux_file_permission+0xc4/0x120
  [] ? wait_port_writable+0x1b0/0x1b0
  [] do_splice_from+0xa0/0x110
  [] SyS_splice+0x5ff/0x6b0
  [] tracesys+0xdd/0xe2
 Code: 49 8b 87 80 00 00 00 4c 8d 24 d0 8b 53 04 41 8b 44 24 0c 4d 8b 6c 24 10 
39 d0 89 03 76 02 89 13 49 8b 44 24 10 4c 89 e6 4c 89 ff  50 18 85 c0 0f 85 
aa 00 00 00 48 89 da 4c 89 e6 4c 89 ff 41
 RIP  [] splice_from_pipe_feed+0x6f/0x130
  RSP 
 CR2: 0018
 ---[ end trace 24572beb7764de59 ]---

V2: Fix a locking problem for error
V3: Add Reviewed-by lines and stable@ line in sign-off area

Signed-off-by: Yoshihiro YUNOMAE 
Reviewed-by: Amit Shah 
Reviewed-by: Masami Hiramatsu 
Cc: Amit Shah 
Cc: Arnd Bergmann 
Cc: Greg Kroah-Hartman 
Cc: sta...@vger.kernel.org
---
 drivers/char/virtio_console.c |   20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 8722656..8a15af3 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -936,16 +936,21 @@ static ssize_t port_fops_splice_write(struct 
pipe_inode_info *pipe,
 * pipe->nrbufs == 0 means there are no data to transfer,
 * so this returns just 0 for no data.
 */
-   if (!pipe->nrbufs)
-   return 0;
+   pipe_lock(pipe);
+   if (!pipe->nrbufs) {
+   ret = 0;
+   goto error_out;
+   }
 
ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);
if (ret < 0)
-   return ret;
+   goto error_out;
 
buf = alloc_buf(port->out_vq, 0, pipe->nrbufs);
-   if (!buf)
-   return -ENOMEM;
+   if (!buf) {
+   ret = -ENOMEM;
+   goto error_out;
+   }
 
sgl.n = 0;
sgl.len = 0;
@@ -953,12 +958,17 @@ static ssize_t port_fops_splice_write(struct 
pipe_inode_info *pipe,
sgl.sg = buf->sg;
sg_init_table(sgl.sg, sgl.size);
 

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
Push file descriptor list locking down to per-device locking. Let sg_index_lock
only protect device lookup.
sdp->detached is also set and checked with this lock held.

Changes from v4:
 * Since I use ERR_PTR and friends in sg_add_sfp, this patch should also be
updated to resolve conflict in cherrry-pick.

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/sg.c | 61 ++-
 1 file changed, 33 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index f0e4785..3431d12 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -104,8 +104,7 @@ static int sg_add(struct device *, struct class_interface 
*);
 static void sg_remove(struct device *, struct class_interface *);
 
 static DEFINE_IDR(sg_index_idr);
-static DEFINE_RWLOCK(sg_index_lock);   /* Also used to lock
-  file descriptor list 
for device */
+static DEFINE_RWLOCK(sg_index_lock);
 
 static struct class_interface sg_interface = {
.add_dev= sg_add,
@@ -142,8 +141,7 @@ typedef struct sg_request { /* SG_MAX_QUEUE requests 
outstanding per file */
 } Sg_request;
 
 typedef struct sg_fd { /* holds the state of a file descriptor */
-   /* sfd_siblings is protected by sg_index_lock */
-   struct list_head sfd_siblings;
+   struct list_head sfd_siblings; /* protected by sfd_lock of device */
struct sg_device *parentdp; /* owning device */
wait_queue_head_t read_wait;/* queue read until command done */
rwlock_t rq_list_lock;  /* protect access to list in req_arr */
@@ -168,7 +166,7 @@ typedef struct sg_device { /* holds the state of each scsi 
generic device */
struct scsi_device *device;
int sg_tablesize;   /* adapter's max scatter-gather table size */
u32 index;  /* device index number */
-   /* sfds is protected by sg_index_lock */
+   spinlock_t sfd_lock;/* protect file descriptor list for device */
struct list_head sfds;
struct rw_semaphore o_sem;  /* exclude open should hold this rwsem 
*/
volatile char detached; /* 0->attached, 1->detached pending removal */
@@ -226,9 +224,9 @@ static int sfds_list_empty(Sg_device *sdp)
unsigned long flags;
int ret;
 
-   read_lock_irqsave(&sg_index_lock, flags);
+   spin_lock_irqsave(&sdp->sfd_lock, flags);
ret = list_empty(&sdp->sfds);
-   read_unlock_irqrestore(&sg_index_lock, flags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, flags);
return ret;
 }
 
@@ -1394,6 +1392,7 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct 
scsi_device *scsidp)
disk->first_minor = k;
sdp->disk = disk;
sdp->device = scsidp;
+   spin_lock_init(&sdp->sfd_lock);
INIT_LIST_HEAD(&sdp->sfds);
init_rwsem(&sdp->o_sem);
sdp->sg_tablesize = queue_max_segments(q);
@@ -1536,11 +1535,13 @@ static void sg_remove(struct device *cl_dev, struct 
class_interface *cl_intf)
 
/* Need a write lock to set sdp->detached. */
write_lock_irqsave(&sg_index_lock, iflags);
+   spin_lock(&sdp->sfd_lock);
sdp->detached = 1;
list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) {
wake_up_interruptible(&sfp->read_wait);
kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP);
}
+   spin_unlock(&sdp->sfd_lock);
write_unlock_irqrestore(&sg_index_lock, iflags);
 
sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic");
@@ -2065,13 +2066,13 @@ sg_add_sfp(Sg_device * sdp, int dev)
sfp->cmd_q = SG_DEF_COMMAND_Q;
sfp->keep_orphan = SG_DEF_KEEP_ORPHAN;
sfp->parentdp = sdp;
-   write_lock_irqsave(&sg_index_lock, iflags);
+   spin_lock_irqsave(&sdp->sfd_lock, iflags);
if (sdp->detached) {
-   write_unlock_irqrestore(&sg_index_lock, iflags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
return ERR_PTR(-ENODEV);
}
list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
-   write_unlock_irqrestore(&sg_index_lock, iflags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp));
if (unlikely(sg_big_buff != def_reserved_size))
sg_big_buff = def_reserved_size;
@@ -2121,9 +2122,9 @@ static void sg_remove_sfp(struct kref *kref)
struct sg_device *sdp = sfp->parentdp;
unsigned long iflags;
 
-   write_lock_irqsave(&sg_index_lock, iflags);
+   spin_lock_irqsave(&sdp->sfd_lock, iflags);
list_del(&sfp->sfd_siblings);
-   write_unlock_irqrestore(&sg_index_lock, iflags);
+   spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
 
INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext);
schedule_work(&sfp->ew.work);
@@ -2514,7 +2515,7 @@ static int sg_proc_seq_show_devstrs(struct seq_file *s, 
void *v)

[PATCH v5 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-21 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the
lock, new sfp will be added during sg removal and there is no chance for it
to be picked out. So check with sg_index_lock held in sg_add_sfp().

Changes from v4:
 * use ERR_PTR series instead of adding another parameter in sg_add_sfp

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/sg.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 671b760..f0e4785 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -295,21 +295,17 @@ sg_open(struct inode *inode, struct file *filp)
if (flags & O_EXCL)
sdp->exclude = 1;   /* used by release lock */
 
-   if (sdp->detached) {
-   retval = -ENODEV;
-   goto sem_out;
-   }
if (sfds_list_empty(sdp)) { /* no existing opens on this device */
sdp->sgdebug = 0;
q = sdp->device->request_queue;
sdp->sg_tablesize = queue_max_segments(q);
}
-   if ((sfp = sg_add_sfp(sdp, dev)))
-   filp->private_data = sfp;
-   else {
-   retval = -ENOMEM;
+   sfp = sg_add_sfp(sdp, dev);
+   if (IS_ERR(sfp)) {
+   retval = PTR_ERR(sfp);
goto sem_out;
}
+   filp->private_data = sfp;
retval = 0;
 
if (retval) {
@@ -2055,7 +2051,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
 
sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN);
if (!sfp)
-   return NULL;
+   return ERR_PTR(-ENOMEM);
 
init_waitqueue_head(&sfp->read_wait);
rwlock_init(&sfp->rq_list_lock);
@@ -2070,6 +2066,10 @@ sg_add_sfp(Sg_device * sdp, int dev)
sfp->keep_orphan = SG_DEF_KEEP_ORPHAN;
sfp->parentdp = sdp;
write_lock_irqsave(&sg_index_lock, iflags);
+   if (sdp->detached) {
+   write_unlock_irqrestore(&sg_index_lock, iflags);
+   return ERR_PTR(-ENODEV);
+   }
list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
write_unlock_irqrestore(&sg_index_lock, iflags);
SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp));
-- 
1.7.11.7

--
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 4/8] minnowboard: Add base platform driver for the MinnowBoard

2013-07-21 Thread Darren Hart
On Mon, 2013-07-22 at 01:09 +0100, Grant Likely wrote:
> On Thu, Jul 4, 2013 at 5:26 PM, Mark Brown  wrote:
> > On Thu, Jun 27, 2013 at 10:43:38PM -0700, Darren Hart wrote:
> >
> >> minnow_hwid() just returns an int that the minnowboard platform driver
> >> read from the GPIO. This seems like a proper abstraction to me. Do you
> >> object to this one as well?
> >
> > We should really have a subsystem for this too - the general idea idea
> > of identifying boards, fit options and so on by looking at things like
> > GPIOs or numbers in flash is really common.
> 
> And yet this is a platform with ACPI. I would expect the ACPI to
> identify the board, not a custom driver. The newest ACPI spec adds a
> lot of nice useful things like GPIO and SPI bindings. Talk to Al Stone
> about the progress his team has made on adding GPIO support to ACPICA.
> 
> This driver shouldn't be merged into mainline. Keep it as an
> out-of-tree patch until the proper solution is implemented. That
> shouldn't be too onerous since we now have available not one, but two
> mechanisms for describing exactly what you want to do; ACPI or FDT.

Yes, that is the current plan. I have isolated the necessary patches for
bug fixes (merged, serial support (merged) and networking support (under
review). I am exploring different options with ACPI for how to best
handle the GPIO (LEDs and Keys) and the Lure device descriptions.

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel


--
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 1/1] Drivers: base: memory: Export symbols for onlining memory blocks

2013-07-21 Thread Jason Wang
On 07/20/2013 03:23 AM, K. Y. Srinivasan wrote:
> The current machinery for hot-adding memory requires having udev
> rules to bring the memory segments online. Export the necessary functionality
> to to bring the memory segment online without involving user space code. 

According to udev guys, udev won't provide unconditional, always enabled
kernel
policy in udev. This is really useful for driver to online the pages
without user-space involvement.

Acked-by: Jason Wang 
> Signed-off-by: K. Y. Srinivasan 
> ---
>  drivers/base/memory.c  |5 -
>  include/linux/memory.h |4 
>  2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 2b7813e..a8204ac 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -328,7 +328,7 @@ static int __memory_block_change_state_uevent(struct 
> memory_block *mem,
>   return ret;
>  }
>  
> -static int memory_block_change_state(struct memory_block *mem,
> +int memory_block_change_state(struct memory_block *mem,
>   unsigned long to_state, unsigned long from_state_req,
>   int online_type)
>  {
> @@ -341,6 +341,8 @@ static int memory_block_change_state(struct memory_block 
> *mem,
>  
>   return ret;
>  }
> +EXPORT_SYMBOL(memory_block_change_state);
> +
>  static ssize_t
>  store_mem_state(struct device *dev,
>   struct device_attribute *attr, const char *buf, size_t count)
> @@ -540,6 +542,7 @@ struct memory_block *find_memory_block(struct mem_section 
> *section)
>  {
>   return find_memory_block_hinted(section, NULL);
>  }
> +EXPORT_SYMBOL(find_memory_block);
>  
>  static struct attribute *memory_memblk_attrs[] = {
>   &dev_attr_phys_index.attr,
> diff --git a/include/linux/memory.h b/include/linux/memory.h
> index 85c31a8..8e3ede5 100644
> --- a/include/linux/memory.h
> +++ b/include/linux/memory.h
> @@ -115,6 +115,10 @@ extern void unregister_memory_notifier(struct 
> notifier_block *nb);
>  extern int register_memory_isolate_notifier(struct notifier_block *nb);
>  extern void unregister_memory_isolate_notifier(struct notifier_block *nb);
>  extern int register_new_memory(int, struct mem_section *);
> +extern int memory_block_change_state(struct memory_block *mem,
> + unsigned long to_state, unsigned long from_state_req,
> + int online_type);
> +
>  #ifdef CONFIG_MEMORY_HOTREMOVE
>  extern int unregister_memory_section(struct mem_section *);
>  #endif

--
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: scatterlist: sg_set_buf() argument must be in linear mapping (sha1: ac4e97abce9b80c020e7113325f49e58b7b15e3f)

2013-07-21 Thread Rusty Russell
Michal Simek  writes:
> Hi Rusty and Jens,
>
> I am getting problem with your patch which you have added to the kernel.
> The problem is with my arm zynq remoteproc driver where
> I use dma_declare_coherent_memory() to specify memory for remoteproc
> which is ioremap to the vmalloc area.
>
> Based on that buf addr is not inside ram even this coherent memory is in ram.
> That's why virt_addr_valid(buf) is failing.

But sg_set_buf() calls virt_to_page(buf).  So does that work?

I would think calling sg_set_page() directly would be what you want
here...

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: [PATH v4] itimers: Remove bogus NULL pointer check in sys_getitimer()

2013-07-21 Thread Chen Gang
Hello Maintainers:

Please help check this patch, when you have time.

Thanks.

On 07/05/2013 09:28 AM, Chen Gang wrote:
> Hello Maintainers:
> 
> Is this patch under the normal work flow (or I should need a little more
> patience) ?
> 
> Thanks.
> 
> On 06/25/2013 09:16 AM, Chen Gang wrote:
>> People might be tricked into assuming that the return value for a
>> failed NULL pointer check should be -EINVAL instead of -EFAULT.
>>
>> Remove the misleading NULL pointer check to fix this nuisance.
>>
>> Aside of that this patch fixes the problem of NOMMU kernels, where
>> a NULL pointer dereference is a valid operation. This allows to
>> boot NOMMU kernels without working around the shortcomings of the
>> getitimer() system call, which have been ignored since this NULL
>> pointer check was introduced in Linux 0.96a.
>>
>> Signed-off-by: Chen Gang 
>> ---
>>  kernel/itimer.c |   13 ++---
>>  1 files changed, 6 insertions(+), 7 deletions(-)
>>
>> diff --git a/kernel/itimer.c b/kernel/itimer.c
>> index 8d262b4..3b12271 100644
>> --- a/kernel/itimer.c
>> +++ b/kernel/itimer.c
>> @@ -102,15 +102,14 @@ int do_getitimer(int which, struct itimerval *value)
>>  
>>  SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value)
>>  {
>> -int error = -EFAULT;
>> +int error;
>>  struct itimerval get_buffer;
>>  
>> -if (value) {
>> -error = do_getitimer(which, &get_buffer);
>> -if (!error &&
>> -copy_to_user(value, &get_buffer, sizeof(get_buffer)))
>> -error = -EFAULT;
>> -}
>> +error = do_getitimer(which, &get_buffer);
>> +if (!error &&
>> +copy_to_user(value, &get_buffer, sizeof(get_buffer)))
>> +error = -EFAULT;
>> +
>>  return error;
>>  }
>>  
>>
> 
> 


-- 
Chen Gang
--
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 00/21] Arrange hotpluggable memory as ZONE_MOVABLE.

2013-07-21 Thread Tang Chen

Hi,

Forgot to mention, this patch-set is based on linux-3.10 release.

Thanks. :)

On 07/19/2013 03:59 PM, Tang Chen wrote:

This patch-set aims to solve some problems at system boot time
to enhance memory hotplug functionality.

[Background]

The Linux kernel cannot migrate pages used by the kernel because
of the kernel direct mapping. Since va = pa + PAGE_OFFSET, if the
physical address is changed, we cannot simply update the kernel
pagetable. On the contrary, we have to update all the pointers
pointing to the virtual address, which is very difficult to do.

In order to do memory hotplug, we should prevent the kernel to use
hotpluggable memory.

In ACPI, there is a table named SRAT(System Resource Affinity Table).
It contains system NUMA info (CPUs, memory ranges, PXM), and also a
flag field indicating which memory ranges are hotpluggable.


[Problem to be solved]

At the very early time when the system is booting, we use a bootmem
allocator, named memblock, to allocate memory for the kernel.
memblock will start to work before the kernel parse SRAT, which
means memblock won't know which memory is hotpluggable before SRAT
is parsed.

So at this time, memblock could allocate hotpluggable memory for
the kernel to use permanently. For example, the kernel may allocate
pagetables in hotpluggable memory, which cannot be freed when the
system is up.

So we have to prevent memblock allocating hotpluggable memory for
the kernel at the early boot time.


[Earlier solutions]>
We have tried to parse SRAT earlier, before memblock is ready. To
do this, we also have to do ACPI_INITRD_TABLE_OVERRIDE earlier.
Otherwise the override tables won't be able to effect.

This is not that easy to do because memblock is ready before direct
mapping is setup. So Yinghai split the ACPI_INITRD_TABLE_OVERRIDE
procedure into two steps: find and copy. Please refer to the
following patch-set:
 https://lkml.org/lkml/2013/6/13/587

To this solution, tj gave a lot of comments and the following
suggestions.


[Suggestion from tj]

tj mainly gave the following suggestions:

1. Necessary reordering is OK, but we should not rely on
reordering to achieve the goal because it makes the kernel
too fragile.

2. Memory allocated to kernel for temporary usage is OK because
it will be freed when the system is up. Doing relocation
for permanent allocated hotpluggable memory will make the
the kernel more robust.

3. Need to enhance memblock to discover and complain if any
hotpluggable memory is allocated to kernel.

After a long thinking, we choose not to do the relocation for
the following reasons:

1. It's easy to find out the allocated hotpluggable memory. But
memblock will merge the adjoined ranges owned by different users
and used for different purposes. It's hard to find the owners.

2. Different memory has different way to be relocated. I think one
function for each kind of memory will make the code too messy.

3. Pagetable could be in hotpluggable memory. Relocating pagetable
is too difficult and risky. We have to update all PUD, PMD pages.
And also, ACPI_INITRD_TABLE_OVERRIDE and parsing SRAT procedures
are not long after pagetable is initialized. If we relocate the
pagetable not long after it was initialized, the code will be
very ugly.


[Solution in this patch-set]

In this patch-set, we still do the reordering, but in a new way.

1. Improve memblock with flags, so that it is able to differentiate
memory regions for different usage. And also a MEMBLOCK_HOTPLUGGABLE
flag to mark hotpluggable memory.
(patch 1 ~ 3)

2. When memblock is ready (memblock_x86_fill() is called), initialize
acpi_gbl_root_table_list, fulfill all the ACPI tables' phys addrs.
Now, we have all the ACPI tables' phys addrs provided by firmware.
(patch 4 ~ 8)

3. Check if there is a SRAT in initrd file used to override the one
provided by firmware. If so, get its phys addr.
(patch 12)

4. If no override SRAT in initrd, get the phys addr of the SRAT
provided by firmware.
(patch 13)

Now, we have the phys addr of the to be used SRAT, the one in
initrd or the one in firmware.

5. Parse only the memory affinities in SRAT, find out all the
hotpluggable memory regions and reserve them in memblock with
MEMBLK_HOTPLUGGABLE flag.
(patch 14 ~ 15)

6. The kernel goes through the current path. Any other related parts,
such as ACPI_INITRD_TABLE_OVERRIDE path, the current parsing ACPI
tables pathes, global variable numa_meminfo, and so on, are not
modified. They work as before.

7. Free memory with MEMBLK_HOTPLUGGABLE flag when memory initialization
is finished.
(patch 16)

8. Introduce movablecore=acpi boot option to allow users to enable
and disable this functionality.
(patch 17 ~ 21)

And patch 9 ~ 11 fix some small problems.


In summary, in order to get hotpluggable memory info as early as possible,
this patch-set only parse memory a

Re: [PATCH v2] kernel/params.c: add/modify failure processing code when sysfs_create_file() fails.

2013-07-21 Thread Chen Gang
Hello Maintainers:

Please help check this patch, when you have time.

Thanks.

On 07/11/2013 12:06 PM, Chen Gang wrote:
> When sysfs_create_file() fails, need consider about it. And process it
> with BUG_ON(), because sysfs_create_file() can fail due to OOM (not at
> boot) or name duplication (not here).
> 
> Also correct the error printing information when failure occurs.
> 
> Signed-off-by: Chen Gang 
> ---
>  kernel/params.c |7 +--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/params.c b/kernel/params.c
> index 440e65d..3d70f90 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -745,12 +745,14 @@ static struct module_kobject * __init 
> locate_module_kobject(const char *name)
>   err = kobject_init_and_add(&mk->kobj, &module_ktype, NULL,
>  "%s", name);
>  #ifdef CONFIG_MODULES
> - if (!err)
> + if (!err) {
>   err = sysfs_create_file(&mk->kobj, &module_uevent.attr);
> + BUG_ON(err);
> + }
>  #endif
>   if (err) {
>   kobject_put(&mk->kobj);
> - pr_crit("Adding module '%s' to sysfs failed (%d), the 
> system may be unstable.\n",
> + pr_crit("Initializing and adding module '%s' failed 
> (%d), the system may be unstable.\n",
>   name, err);
>   return NULL;
>   }
> @@ -845,6 +847,7 @@ static void __init version_sysfs_builtin(void)
>   mk = locate_module_kobject(vattr->module_name);
>   if (mk) {
>   err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
> + BUG_ON(err);
>   kobject_uevent(&mk->kobj, KOBJ_ADD);
>   kobject_put(&mk->kobj);
>   }
> 


-- 
Chen Gang
--
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 3/3] MAINTAINERS: Refactor device tree maintainership

2013-07-21 Thread David Gibson
On Sun, Jul 21, 2013 at 08:46:11AM -0500, Jon Loeliger wrote:
> > On Sat, Jul 20, 2013 at 5:19 AM, Grant Likely  
> > wrote
> > :
> > 
> > > Device tree bindings require a lot more attention than they used to.
> > > We've got a group of volunteers willing to take over maintaining
> > > bindings. This patch adds them to the MAINTAINERS file.
> > >
> > > This group still needs to work out a process for maintainership and how
> > > they are going to work together. I recommend that they set up a shared
> > > tree on git.kernel.org that they each have commit access to similar to
> > > the tip tree or the arm-soc tree, but it is up to them.
> > >
> > > Signed-off-by: Grant Likely 
> > > Cc: Pawel Moll 
> > > Cc: Mark Rutland 
> > > Cc: Stephen Warren 
> > > Cc: Ian Campbell 
> > > Cc: Rob Herring 
> > > Cc: Olof Johansson 
> > > Cc: devicetree-disc...@lists.ozlabs.org
> > > Cc: devicet...@vger.kernel.org
> > 
> > Excellent move.
> > Acked-by: Linus Walleij 
> 
> Perhaps it is time to also place the official repo
> of the Device Tree Compiler on git,kernel.org as well?

Sounds good to me.

Now that I'm no longer at IBM, and don't have the associated
complications with their Legal department, I'd rather like to resume
having direct commit access to the master dtc tree.  So if we could
get Jon and myself, at least, push access to a tree on git.kernel.org,
that would be nice.

(Fwiw, I do have a personal dtc branch tree on github at
https://github.com/dgibson/dtc).

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


pgpz7yLwgXAls.pgp
Description: PGP signature


[PATCH 2/2] Squashfs: Add LZ4 compression configuration option

2013-07-21 Thread Phillip Lougher
Add the glue code, and also update the documentation.

Signed-off-by: Phillip Lougher 
---
 Documentation/filesystems/squashfs.txt |8 
 fs/squashfs/Kconfig|   15 +++
 fs/squashfs/Makefile   |1 +
 fs/squashfs/decompressor.c |7 +++
 fs/squashfs/decompressor.h |4 
 5 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/Documentation/filesystems/squashfs.txt 
b/Documentation/filesystems/squashfs.txt
index 403c090..e5274f8 100644
--- a/Documentation/filesystems/squashfs.txt
+++ b/Documentation/filesystems/squashfs.txt
@@ -2,10 +2,10 @@ SQUASHFS 4.0 FILESYSTEM
 ===
 
 Squashfs is a compressed read-only filesystem for Linux.
-It uses zlib/lzo/xz compression to compress files, inodes and directories.
-Inodes in the system are very small and all blocks are packed to minimise
-data overhead. Block sizes greater than 4K are supported up to a maximum
-of 1Mbytes (default block size 128K).
+It uses zlib, lz4, lzo, or xz compression to compress files, inodes and
+directories.  Inodes in the system are very small and all blocks are packed to
+minimise data overhead. Block sizes greater than 4K are supported up to a
+maximum of 1Mbytes (default block size 128K).
 
 Squashfs is intended for general read-only filesystem use, for archival
 use (i.e. in cases where a .tar.gz file may be used), and in constrained
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index c70111e..257f934 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -48,6 +48,21 @@ config SQUASHFS_ZLIB
 
  If unsure, say Y.
 
+config SQUASHFS_LZ4
+   bool "Include support for LZ4 compressed file systems"
+   depends on SQUASHFS
+   select LZ4_DECOMPRESS
+   help
+ Saying Y here includes support for reading Squashfs file systems
+ compressed with LZ4 compression.  LZ4 compression is mainly
+ aimed at embedded systems with slower CPUs where the overheads
+ of zlib are too high.
+
+ LZ4 is not the standard compression used in Squashfs and so most
+ file systems will be readable without selecting this option.
+
+ If unsure, say N.
+
 config SQUASHFS_LZO
bool "Include support for LZO compressed file systems"
depends on SQUASHFS
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 110b047..4a80ca7 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_SQUASHFS) += squashfs.o
 squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
 squashfs-y += namei.o super.o symlink.o decompressor.o
 squashfs-$(CONFIG_SQUASHFS_XATTR) += xattr.o xattr_id.o
+squashfs-$(CONFIG_SQUASHFS_LZ4) += lz4_wrapper.o
 squashfs-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
 squashfs-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o
 squashfs-$(CONFIG_SQUASHFS_ZLIB) += zlib_wrapper.o
diff --git a/fs/squashfs/decompressor.c b/fs/squashfs/decompressor.c
index 3f6271d..ae60211 100644
--- a/fs/squashfs/decompressor.c
+++ b/fs/squashfs/decompressor.c
@@ -40,6 +40,12 @@ static const struct squashfs_decompressor 
squashfs_lzma_unsupported_comp_ops = {
NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0
 };
 
+#ifndef CONFIG_SQUASHFS_LZ4
+static const struct squashfs_decompressor squashfs_lz4_comp_ops = {
+   NULL, NULL, NULL, LZ4_COMPRESSION, "lz4", 0
+};
+#endif
+
 #ifndef CONFIG_SQUASHFS_LZO
 static const struct squashfs_decompressor squashfs_lzo_comp_ops = {
NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0
@@ -64,6 +70,7 @@ static const struct squashfs_decompressor 
squashfs_unknown_comp_ops = {
 
 static const struct squashfs_decompressor *decompressor[] = {
&squashfs_zlib_comp_ops,
+   &squashfs_lz4_comp_ops,
&squashfs_lzo_comp_ops,
&squashfs_xz_comp_ops,
&squashfs_lzma_unsupported_comp_ops,
diff --git a/fs/squashfs/decompressor.h b/fs/squashfs/decompressor.h
index 330073e..a9fbdd2 100644
--- a/fs/squashfs/decompressor.h
+++ b/fs/squashfs/decompressor.h
@@ -52,6 +52,10 @@ static inline int squashfs_decompress(struct 
squashfs_sb_info *msblk,
 extern const struct squashfs_decompressor squashfs_xz_comp_ops;
 #endif
 
+#ifdef CONFIG_SQUASHFS_LZ4
+extern const struct squashfs_decompressor squashfs_lz4_comp_ops;
+#endif
+
 #ifdef CONFIG_SQUASHFS_LZO
 extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
 #endif
-- 
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 1/2] Squashfs: add LZ4 compression support

2013-07-21 Thread Phillip Lougher
Add support for reading file systems compressed with the
LZ4 compression algorithm.

This patch adds the LZ4 decompressor wrapper code.

Signed-off-by: Phillip Lougher 
---
 fs/squashfs/lz4_wrapper.c |  163 +
 fs/squashfs/squashfs_fs.h |1 +
 2 files changed, 164 insertions(+)
 create mode 100644 fs/squashfs/lz4_wrapper.c

diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
new file mode 100644
index 000..681ed94
--- /dev/null
+++ b/fs/squashfs/lz4_wrapper.c
@@ -0,0 +1,163 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2013
+ * Phillip Lougher 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * lz4_wrapper.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs.h"
+#include "decompressor.h"
+
+#define LZ4_LEGACY 1
+
+struct lz4_comp_opts {
+   __le32 version;
+   __le32 flags;
+};
+
+struct squashfs_lz4 {
+   void *input;
+   void *output;
+};
+
+
+
+static void *lz4_init(struct squashfs_sb_info *msblk, void *buff, int len)
+{
+   struct lz4_comp_opts *comp_opts = buff;
+   int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE);
+   struct squashfs_lz4 *stream;
+   int err = -ENOMEM;
+
+   /* LZ4 compressed filesystems always have compression options */
+   if(comp_opts == NULL || len < sizeof(*comp_opts)) {
+   err = -EIO;
+   goto failed;
+   }
+   if(le32_to_cpu(comp_opts->version) != LZ4_LEGACY) {
+   /* LZ4 format currently used by the kernel is the 'legacy'
+* format */
+   ERROR("Unknown LZ4 version\n");
+   err = -EINVAL;
+   goto failed;
+   }
+
+   stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+   if (stream == NULL)
+   goto failed;
+   stream->input = vmalloc(block_size);
+   if (stream->input == NULL)
+   goto failed2;
+   stream->output = vmalloc(block_size);
+   if (stream->output == NULL)
+   goto failed3;
+
+   return stream;
+
+failed3:
+   vfree(stream->input);
+failed2:
+   kfree(stream);
+failed:
+   ERROR("Failed to initialise LZ4 decompressor\n");
+   return ERR_PTR(err);
+}
+
+
+static void lz4_free(void *strm)
+{
+   struct squashfs_lz4 *stream = strm;
+
+   if (stream) {
+   vfree(stream->input);
+   vfree(stream->output);
+   }
+   kfree(stream);
+}
+
+
+static int lz4_uncompress(struct squashfs_sb_info *msblk, void **buffer,
+   struct buffer_head **bh, int b, int offset, int length, int srclength,
+   int pages)
+{
+   struct squashfs_lz4 *stream = msblk->stream;
+   void *buff = stream->input;
+   int avail, i, bytes = length, res;
+   size_t dest_len = srclength;
+
+   mutex_lock(&msblk->read_data_mutex);
+
+   for (i = 0; i < b; i++) {
+   wait_on_buffer(bh[i]);
+   if (!buffer_uptodate(bh[i]))
+   goto block_release;
+
+   avail = min(bytes, msblk->devblksize - offset);
+   memcpy(buff, bh[i]->b_data + offset, avail);
+   buff += avail;
+   bytes -= avail;
+   offset = 0;
+   put_bh(bh[i]);
+   }
+
+   res = lz4_decompress_unknownoutputsize(stream->input, length,
+   stream->output, &dest_len);
+   if (res)
+   goto failed;
+
+   bytes = dest_len;
+   for (i = 0, buff = stream->output; bytes && i < pages; i++) {
+   avail = min_t(int, bytes, PAGE_CACHE_SIZE);
+   memcpy(buffer[i], buff, avail);
+   buff += avail;
+   bytes -= avail;
+   }
+   if (bytes)
+   goto failed;
+
+   mutex_unlock(&msblk->read_data_mutex);
+   return dest_len;
+
+block_release:
+   for (; i < b; i++)
+   put_bh(bh[i]);
+
+failed:
+   mutex_unlock(&msblk->read_data_mutex);
+
+   ERROR("lz4 decompression failed, data probably corrupt\n");
+   return -EIO;
+}
+
+const struct squashfs_decompressor squashfs_lz4_comp_ops = {
+   .init = lz4_init,
+   .free = lz4

paper supplier

2013-07-21 Thread Hidka
Dear Purchasing manager:
Nice time to you

It is my big pleasure to hear you need A4 paper
If you still need that pls tell me

Then i can send you our best price
Best wishes
Ida

Ida Chen

SALES MANAGER

East Siweite industry Co., Ltd
www.dfswtpaper.com

SKYPE: siweite

Email:s...@swtindustry.comn�Р骒r��yb�X�肚�v�^�)藓{.n�+�伐�{��赙zXФ�≤�}��财�z�&j:+v�����赙zZ+��+zf"�h���~i���z��wア�?�ㄨ��&�)撷f��^j谦y�m��@A�a囤�
0鹅h���i

[PATCH 0/2] Squashfs: add LZ4 compression

2013-07-21 Thread Phillip Lougher
Hi

Now that LZ4 compression support is in 3.11-rc1, I have written the
following two patches for Squashfs to use it.

Phillip Lougher (2):
  Squashfs: add LZ4 compression support
  Squashfs: Add LZ4 compression configuration option

 Documentation/filesystems/squashfs.txt |8 +-
 fs/squashfs/Kconfig|   15 +++
 fs/squashfs/Makefile   |1 +
 fs/squashfs/decompressor.c |7 ++
 fs/squashfs/decompressor.h |4 +
 fs/squashfs/lz4_wrapper.c  |  163 
 fs/squashfs/squashfs_fs.h  |1 +
 7 files changed, 195 insertions(+), 4 deletions(-)
 create mode 100644 fs/squashfs/lz4_wrapper.c

These patches are also available in the git tree here:

browse: https://git.kernel.org/cgit/linux/kernel/git/pkl/squashfs-lz4.git
git clone: git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-lz4.git

LZ4 support has (obviously) also been added to the squashfs-tools
(Mksquashfs and Unsquashfs).  This is available from the Squashfs-tools
git repository here:

browse: https://git.kernel.org/cgit/fs/squashfs/squashfs-tools.git
git clone: git://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git

When building the squashfs-tools edit the Makefile to enable LZ4
support (by default it is disabled).

LZ4 compression can be specified by using the -comp option, e.g.
% mksquashfs xxx img.sqsh -comp lz4

The use of LZ4 high compression can be specified using -Xhc, e.g.

% mksquashfs xxx img.sqsh -comp lz4 -Xhc

Phillip
--
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/


[GIT PULL] Thermal management fixes for v3.11-rc3

2013-07-21 Thread Zhang Rui
Hi, Linus,

Please pull from the git repository at

  git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next

to receive Thermal management fixes for v3.11-rc3 with
top-most commit ace120dcf23b3bbba00d797a898481997381052f:

  Thermal: Fix lockup of cpu_down()

on top of commit 47188d39b5deeebf41f87a02af1b3935866364cf:

  Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

These are fixes collected over the last week, they fixes several
problems caused by the x86_pkg_temp_thermal introduced in 3.11-rc1.

Specifics:

- the x86_pkg_temp_thermal driver causes crash on systems with no
  package MSR support as there is a bug in the logic to check presence
  of DTHERM and PTS feature together. Added a change so that when there
  is no PTS support, module doesn't get loaded.

- fix krealloc() misuse in pkg_temp_thermal_device_add().
  If krealloc() returns NULL, it doesn't free the original. Thus if we
  want to exit because of the krealloc() failure, we must make sure the
  original one is freed.
 
- The error code path of the x86 package temperature thermal driver's
  initialization routine makes an unbalanced call to get_online_cpus(),
  which causes subsequent CPU offline operations, and consequently
  system suspend, to permanently block in cpu_hotplug_begin() on systems
  where get_core_online() returns an error code.
  Remove the extra get_online_cpus() to fix the problem.

Thanks!


Srinivas Pandruvada (2):
  Thermal: x86 package temp thermal crash
  Thermal: x86_pkg_temp: Limit number of pkg temp zones

Steven Rostedt (1):
  Thermal: Fix lockup of cpu_down()

Wei Yongjun (1):
  Thermal: x86_pkg_temp: fix krealloc() misuse in in
pkg_temp_thermal_device_add()

 drivers/thermal/x86_pkg_temp_thermal.c |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)


--
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: [ 37/72] Input: bcm5974 - add support for the 2013 MacBook Air

2013-07-21 Thread Dmitry Torokhov
On Sunday, July 21, 2013 06:42:03 PM Greg Kroah-Hartman wrote:
> On Thu, Jul 18, 2013 at 10:44:45PM -0700, Greg Kroah-Hartman wrote:
> > On Thu, Jul 18, 2013 at 10:40:40PM -0700, Dmitry Torokhov wrote:
> > > Greg,
> > > 
> > > On Thu, Jul 18, 2013 at 10:25:54PM -0700, Greg Kroah-Hartman wrote:
> > > > 3.10-stable review patch.  If anyone has any objections, please let me
> > > > know.
> > > > 
> > > > --
> > > > 
> > > > From: Dmitry Torokhov 
> > > 
> > > Any chance you could change this to read "Henrik Rydberg"? My import
> > > script messed up. And on hid part as well...
> > 
> > Ok, will do.
> 
> And I promptly forgot to do this, and I released 3.10.2 with it as-is,
> sorry about that.

Oh well, it was my screw up to begin with. Hopefully Henrik is not too annoyed 
with me.

-- 
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: [PATCH] lustre:libcfs: remove redundant code.

2013-07-21 Thread Peng, Tao
> -Original Message-
> From: Paul Bolle [mailto:pebo...@tiscali.nl]
> Sent: Saturday, July 20, 2013 12:07 AM
> To: Greg Kroah-Hartman
> Cc: Alexandru Juncu; Pekka Enberg; andreas.dilger; Peng, Tao; driverdev; LKML
> Subject: Re: [PATCH] lustre:libcfs: remove redundant code.
> 
> On Fri, 2013-07-19 at 08:46 -0700, Greg Kroah-Hartman wrote:
> > Doesn't matter, if there are no users, please just remove it.
> 
> Is that, basically, your approach to staging cleanups?
> 
> I ask because I noticed that "drivers/staging/lustre/lustre/ptlrpc/gss/"
> is only built if CONFIG_PTLRPC_GSS is set. But the corresponding Kconfig
> symbol is nowhere to be found.
> 
That's my fault. We certainly _want_ the ptlrpc gss code. I'll get it fixed.

Thanks,
Tao

> Or do you prefer that I poke the people involved in (this case in)
> Lustre before suggesting a drastic cleanup like that?
> 
> 
> Paul Bolle
> 



Linux 3.9.11

2013-07-21 Thread Greg KH
I'm announcing the release of the 3.9.11 kernel.

Note, this is the LAST 3.9-stable kernel.  It is now dead, end-of-life,
not to be touched by me again, please move to 3.10 now, you have been
warned.

All users of the 3.9 kernel series must upgrade.

The updated 3.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.9.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 -
 arch/x86/xen/time.c |   17 +
 drivers/acpi/acpica/hwxfsleep.c |8 --
 drivers/acpi/device_pm.c|   23 ++
 drivers/acpi/ec.c   |4 +++
 drivers/ata/libahci.c   |3 --
 drivers/block/nbd.c |7 -
 drivers/dma/pl330.c |4 +--
 drivers/hv/ring_buffer.c|   10 
 drivers/hv/vmbus_drv.c  |2 -
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.c |2 -
 drivers/net/wireless/rtlwifi/rtl8723ae/sw.c |6 ++--
 drivers/pci/iov.c   |5 +---
 drivers/pci/probe.c |   14 ++-
 drivers/pci/xen-pcifront.c  |7 ++---
 drivers/pcmcia/at91_cf.c|4 +--
 drivers/rtc/rtc-rv3029c2.c  |2 -
 drivers/usb/gadget/f_mass_storage.c |2 +
 drivers/usb/host/xhci-mem.c |4 +++
 drivers/usb/host/xhci-plat.c|1 
 fs/btrfs/ctree.c|3 +-
 fs/btrfs/send.c |   35 
 fs/cifs/cifs_unicode.h  |8 +++---
 fs/cifs/cifsencrypt.c   |6 ++--
 fs/cifs/file.c  |9 +++
 fs/cifs/inode.c |5 
 fs/ext3/namei.c |7 +
 fs/ext4/extents.c   |4 +--
 fs/ext4/file.c  |   14 +--
 fs/ext4/inline.c|2 -
 fs/ext4/inode.c |4 +--
 fs/ext4/mballoc.c   |   11 ++--
 fs/ext4/namei.c |7 +
 fs/ext4/resize.c|4 ---
 fs/jbd2/journal.c   |3 +-
 fs/jbd2/transaction.c   |2 -
 fs/ocfs2/xattr.c|   10 
 include/linux/nbd.h |1 
 kernel/cgroup.c |   25 +++-
 kernel/irq/manage.c |6 ++--
 kernel/timer.c  |8 --
 mm/memcontrol.c |8 --
 mm/page_alloc.c |4 +++
 43 files changed, 195 insertions(+), 118 deletions(-)

Al Viro (1):
  ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree()

Axel Lin (1):
  drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq

Bart Van Assche (1):
  timer: Fix jiffies wrap behavior of round_jiffies_common()

Bartlomiej Zolnierkiewicz (1):
  drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()

Ben Hutchings (1):
  genirq: Fix can_request_irq() for IRQs without an action

George Cherian (1):
  usb: host: xhci-plat: release mem region while removing module

Greg Kroah-Hartman (1):
  Linux 3.9.11

Jan Kara (4):
  ext4: fix data offset overflow on 32-bit archs in 
ext4_inline_data_fiemap()
  ext4: fix overflows in SEEK_HOLE, SEEK_DATA implementations
  ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
  ext4: fix overflow when counting used blocks on 32-bit architectures

Jason Wang (1):
  drivers: hv: switch to use mb() instead of smp_mb()

Jiang Liu (1):
  PCI: Fix refcount issue in pci_create_root_bus() error recovery path

Joachim Eastwood (1):
  pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status

Josef Bacik (2):
  Btrfs: fix estale with btrfs send
  Btrfs: only do the tree_mod_log_free_eb if this is our last ref

Junxiao Bi (1):
  ocfs2: xattr: fix inlined xattr reflink

Konrad Rzeszutek Wilk (1):
  xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state.

Lan Tianyu (1):
  ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan

Larry Finger (2):
  rtlwifi: rtl8723ae: Fix typo in firmware names
  rtlwifi: rtl8192cu: Fix duplicate if test

Laszlo Ersek (1):
  xen/time: remove blocked time accounting from xen "clockchip"

Li Zefan (1):
  cgroup: fix umount vs cgroup_event_remove() race

Lv Zheng (1):
  ACPICA: Do not use extended sleep registers 

Linux 3.10.2

2013-07-21 Thread Greg KH
I'm announcing the release of the 3.10.2 kernel.

All users of the 3.10 kernel series must upgrade.

The updated 3.10.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.10.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/parisc/registers  |8 ++
 Makefile|2 
 arch/arm/boot/dts/imx23.dtsi|8 +-
 arch/arm/boot/dts/imx28.dtsi|8 +-
 arch/arm/boot/dts/imx6dl.dtsi   |2 
 arch/arm/boot/dts/imx6q.dtsi|4 +
 arch/arm/include/asm/mmu_context.h  |   10 ++-
 arch/arm/kernel/perf_event.c|1 
 arch/arm/kernel/smp_tlb.c   |   18 -
 arch/arm/kernel/smp_twd.c   |2 
 arch/arm/mach-shmobile/setup-emev2.c|8 +-
 arch/arm/mach-shmobile/setup-r8a73a4.c  |2 
 arch/arm/mm/context.c   |   55 +---
 arch/arm/mm/init.c  |2 
 arch/c6x/mm/init.c  |1 
 arch/parisc/include/asm/special_insns.h |9 +-
 arch/parisc/include/asm/tlbflush.h  |5 -
 arch/parisc/kernel/cache.c  |2 
 arch/parisc/lib/memcpy.c|   79 +++-
 arch/x86/boot/compressed/eboot.c|   20 +-
 arch/x86/xen/time.c |   17 -
 drivers/acpi/Makefile   |1 
 drivers/acpi/acpi_cmos_rtc.c|   92 
 drivers/acpi/acpica/hwxfsleep.c |8 +-
 drivers/acpi/device_pm.c|   23 +--
 drivers/acpi/ec.c   |4 +
 drivers/acpi/internal.h |5 +
 drivers/acpi/scan.c |1 
 drivers/ata/ahci.c  |2 
 drivers/ata/libahci.c   |3 
 drivers/block/nbd.c |7 +-
 drivers/dma/pl330.c |4 -
 drivers/hid/hid-apple.c |6 +
 drivers/hid/hid-core.c  |6 +
 drivers/hid/hid-ids.h   |3 
 drivers/hv/ring_buffer.c|   10 +--
 drivers/hv/vmbus_drv.c  |2 
 drivers/input/mouse/bcm5974.c   |   36 ++
 drivers/net/wireless/iwlwifi/pcie/tx.c  |   13 +++
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.c |2 
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |1 
 drivers/net/wireless/rtlwifi/rtl8723ae/sw.c |6 -
 drivers/parisc/lba_pci.c|   56 +
 drivers/pci/iov.c   |5 -
 drivers/pci/probe.c |   14 ++--
 drivers/pci/quirks.c|2 
 drivers/pci/xen-pcifront.c  |7 --
 drivers/pcmcia/at91_cf.c|4 -
 drivers/rtc/rtc-rv3029c2.c  |2 
 drivers/tty/serial/pch_uart.c   |5 +
 drivers/usb/gadget/f_mass_storage.c |2 
 drivers/usb/host/ehci-omap.c|   11 ++-
 drivers/usb/host/xhci-mem.c |4 +
 drivers/usb/host/xhci-plat.c|1 
 drivers/usb/serial/option.c |4 -
 drivers/usb/serial/qcserial.c   |8 ++
 fs/btrfs/ctree.c|   13 ++-
 fs/btrfs/send.c |   35 ++
 fs/cifs/cifs_unicode.h  |8 +-
 fs/cifs/cifsencrypt.c   |6 -
 fs/cifs/file.c  |9 +-
 fs/cifs/inode.c |5 +
 fs/ext3/namei.c |7 --
 fs/ext4/balloc.c|4 -
 fs/ext4/extents.c   |4 -
 fs/ext4/file.c  |   14 ++--
 fs/ext4/inline.c|2 
 fs/ext4/inode.c |   15 ++--
 fs/ext4/mballoc.c   |   11 ++-
 fs/ext4/namei.c |7 --
 fs/ext4/resize.c|4 -
 fs/ext4/super.c |   14 +---
 fs/jbd2/journal.c   |3 
 fs/jbd2/transaction.c   |2 
 fs/ocfs2/xattr.c|   10 +++
 fs/ubifs/super.c|2 
 include/linux/cgroup.h  |   58 ++---
 include/linux/nbd.h |1 
 kernel/cgroup.c |   25 +--
 kernel/irq/manage.c |6 -
 kernel/timer.c  |8 +-
 mm/memcontrol.c |8 

Re: Linux 3.9.11

2013-07-21 Thread Greg KH
diff --git a/Makefile b/Makefile
index d0af302..ad368cd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 9
-SUBLEVEL = 10
+SUBLEVEL = 11
 EXTRAVERSION =
 NAME = Black Squirrel Wakeup Call
 
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 054cc01..d50a821 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, 
xen_runstate);
 /* snapshots of runstate info */
 static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
 
-/* unused ns of stolen and blocked time */
+/* unused ns of stolen time */
 static DEFINE_PER_CPU(u64, xen_residual_stolen);
-static DEFINE_PER_CPU(u64, xen_residual_blocked);
 
 /* return an consistent snapshot of 64-bit time/counter value */
 static u64 get64(const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
 {
struct vcpu_runstate_info state;
struct vcpu_runstate_info *snap;
-   s64 blocked, runnable, offline, stolen;
+   s64 runnable, offline, stolen;
cputime_t ticks;
 
get_runstate_snapshot(&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
snap = &__get_cpu_var(xen_runstate_snapshot);
 
/* work out how much time the VCPU has not been runn*ing*  */
-   blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
runnable = state.time[RUNSTATE_runnable] - 
snap->time[RUNSTATE_runnable];
offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
 
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
__this_cpu_write(xen_residual_stolen, stolen);
account_steal_ticks(ticks);
-
-   /* Add the appropriate number of ticks of blocked time,
-  including any left-overs from last time. */
-   blocked += __this_cpu_read(xen_residual_blocked);
-
-   if (blocked < 0)
-   blocked = 0;
-
-   ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
-   __this_cpu_write(xen_residual_blocked, blocked);
-   account_idle_ticks(ticks);
 }
 
 /* Get the TSC speed from Xen */
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 35eebda..09b06e2 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, 
u32 function_id)
&acpi_sleep_dispatch[function_id];
 
 #if (!ACPI_REDUCED_HARDWARE)
-
/*
 * If the Hardware Reduced flag is set (from the FADT), we must
-* use the extended sleep registers
+* use the extended sleep registers (FADT). Note: As per the ACPI
+* specification, these extended registers are to be used for HW-reduced
+* platforms only. They are not general-purpose replacements for the
+* legacy PM register sleep support.
 */
-   if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) {
+   if (acpi_gbl_reduced_hardware) {
status = sleep_functions->extended_function(sleep_state);
} else {
/* Legacy sleep */
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 391010a..a1eb5ef 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -295,14 +295,27 @@ int acpi_bus_update_power(acpi_handle handle, int 
*state_p)
if (result)
return result;
 
-   if (state == ACPI_STATE_UNKNOWN)
+   if (state == ACPI_STATE_UNKNOWN) {
state = ACPI_STATE_D0;
-
-   result = acpi_device_set_power(device, state);
-   if (!result && state_p)
+   result = acpi_device_set_power(device, state);
+   if (result)
+   return result;
+   } else {
+   if (device->power.flags.power_resources) {
+   /*
+* We don't need to really switch the state, bu we need
+* to update the power resources' reference counters.
+*/
+   result = acpi_power_transition(device, state);
+   if (result)
+   return result;
+   }
+   device->power.state = state;
+   }
+   if (state_p)
*state_p = state;
 
-   return result;
+   return 0;
 }
 EXPORT_SYMBOL_GPL(acpi_bus_update_power);
 
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index edc0081..80403c1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -983,6 +983,10 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
ec_enlarge_storm_threshold, "CLEVO hardware", {
DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
+   {
+   ec_skip_dsdt_scan, "HP Folio 13", {
+   DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Pac

Re: Linux 3.4.54

2013-07-21 Thread Greg KH

diff --git a/Makefile b/Makefile
index 104049d..6ca3657 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 4
-SUBLEVEL = 53
+SUBLEVEL = 54
 EXTRAVERSION =
 NAME = Saber-toothed Squirrel
 
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 85d6332..a99ed7a 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -824,6 +824,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, 
struct pt_regs *regs)
struct frame_tail __user *tail;
 
 
+   perf_callchain_store(entry, regs->ARM_pc);
tail = (struct frame_tail __user *)regs->ARM_fp - 1;
 
while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 054cc01..d50a821 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, 
xen_runstate);
 /* snapshots of runstate info */
 static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
 
-/* unused ns of stolen and blocked time */
+/* unused ns of stolen time */
 static DEFINE_PER_CPU(u64, xen_residual_stolen);
-static DEFINE_PER_CPU(u64, xen_residual_blocked);
 
 /* return an consistent snapshot of 64-bit time/counter value */
 static u64 get64(const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
 {
struct vcpu_runstate_info state;
struct vcpu_runstate_info *snap;
-   s64 blocked, runnable, offline, stolen;
+   s64 runnable, offline, stolen;
cputime_t ticks;
 
get_runstate_snapshot(&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
snap = &__get_cpu_var(xen_runstate_snapshot);
 
/* work out how much time the VCPU has not been runn*ing*  */
-   blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
runnable = state.time[RUNSTATE_runnable] - 
snap->time[RUNSTATE_runnable];
offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
 
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
__this_cpu_write(xen_residual_stolen, stolen);
account_steal_ticks(ticks);
-
-   /* Add the appropriate number of ticks of blocked time,
-  including any left-overs from last time. */
-   blocked += __this_cpu_read(xen_residual_blocked);
-
-   if (blocked < 0)
-   blocked = 0;
-
-   ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
-   __this_cpu_write(xen_residual_blocked, blocked);
-   account_idle_ticks(ticks);
 }
 
 /* Get the TSC speed from Xen */
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f9914e5..3251d4b 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -974,6 +974,10 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
ec_enlarge_storm_threshold, "CLEVO hardware", {
DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
+   {
+   ec_skip_dsdt_scan, "HP Folio 13", {
+   DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13"),}, NULL},
{},
 };
 
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 71a4d04..aeb8220 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -284,6 +284,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 
/* AMD */
{ PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
+   { PCI_VDEVICE(AMD, 0x7900), board_ahci }, /* AMD CZ */
/* AMD is using RAID class only for ahci controllers */
{ PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  PCI_CLASS_STORAGE_RAID << 8, 0xff, board_ahci },
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index f9eaa82..47a1fb8 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1543,8 +1543,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 
irq_stat)
u32 fbs = readl(port_mmio + PORT_FBS);
int pmp = fbs >> PORT_FBS_DWE_OFFSET;
 
-   if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
-   ata_link_online(&ap->pmp_link[pmp])) {
+   if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) {
link = &ap->pmp_link[pmp];
fbs_need_dec = true;
}
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 758122f..15a6af8 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2469,10 +2469,10 @@ static void pl330_free_chan_resources(struct dma_chan 
*chan)
struct dma_pl330_chan *pch = to_pchan(chan);
unsigned long flags;
 
-   spin_lock_irqsave(&pch->lock, flags);
-
tasklet_kill(&pch->task);
 
+   spin_lock_irqsave(&pch->lock, flags);
+
pl330_release_channel(pch->pl330_chid);
pch->pl330_chid = NULL;
 
diff --git a/drivers/net/wi

Linux 3.4.54

2013-07-21 Thread Greg KH
I'm announcing the release of the 3.4.54 kernel.

All users of the 3.4 kernel series must upgrade.

The updated 3.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.4.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 +-
 arch/arm/kernel/perf_event.c|1 +
 arch/x86/xen/time.c |   17 ++---
 drivers/acpi/ec.c   |4 
 drivers/ata/ahci.c  |1 +
 drivers/ata/libahci.c   |3 +--
 drivers/dma/pl330.c |4 ++--
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.c |2 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |1 +
 drivers/pci/quirks.c|2 ++
 drivers/pcmcia/at91_cf.c|4 ++--
 drivers/rtc/rtc-rv3029c2.c  |2 +-
 drivers/usb/gadget/f_mass_storage.c |2 ++
 drivers/usb/host/xhci-mem.c |4 
 drivers/usb/host/xhci-plat.c|1 +
 drivers/usb/serial/option.c |4 
 drivers/usb/serial/qcserial.c   |8 +++-
 fs/cifs/cifs_unicode.h  |8 
 fs/cifs/cifsencrypt.c   |6 +++---
 fs/cifs/inode.c |5 +
 fs/ext3/namei.c |7 ++-
 fs/ext4/extents.c   |4 ++--
 fs/ext4/inode.c |4 ++--
 fs/ext4/mballoc.c   |   11 ---
 fs/ext4/namei.c |7 ++-
 fs/jbd2/transaction.c   |2 +-
 fs/ocfs2/xattr.c|   10 ++
 kernel/irq/manage.c |6 +++---
 kernel/timer.c  |8 +---
 29 files changed, 80 insertions(+), 60 deletions(-)

Al Viro (1):
  ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree()

Axel Lin (1):
  drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq

Bart Van Assche (1):
  timer: Fix jiffies wrap behavior of round_jiffies_common()

Bartlomiej Zolnierkiewicz (1):
  drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()

Ben Hutchings (1):
  genirq: Fix can_request_irq() for IRQs without an action

Dan Williams (1):
  USB: option,qcserial: move Novatel Gobi1K IDs to qcserial

George Cherian (1):
  usb: host: xhci-plat: release mem region while removing module

Greg Kroah-Hartman (1):
  Linux 3.4.54

Jan Kara (2):
  ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
  ext4: fix overflow when counting used blocks on 32-bit architectures

Jed Davis (1):
  ARM: 7765/1: perf: Record the user-mode PC in the call chain.

Joachim Eastwood (1):
  pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status

Junxiao Bi (1):
  ocfs2: xattr: fix inlined xattr reflink

Lan Tianyu (1):
  ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan

Larry Finger (2):
  rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND
  rtlwifi: rtl8192cu: Fix duplicate if test

Laszlo Ersek (1):
  xen/time: remove blocked time accounting from xen "clockchip"

Mathias Nyman (1):
  xhci: check for failed dma pool allocation

Shane Huang (2):
  ahci: Add AMD CZ SATA device ID
  ahci: remove pmp link online check in FBS EH

Steve French (2):
  CIFS use sensible file nlink values if unprovided
  Handle big endianness in NTLM (ntlmv2) authentication

Theodore Ts'o (2):
  jbd2: fix theoretical race in jbd2__journal_restart
  ext4: don't allow ext4_free_blocks() to fail due to ENOMEM

UCHINO Satoshi (1):
  usb: gadget: f_mass_storage: add missing memory barrier for 
thread_wakeup_needed



signature.asc
Description: Digital signature


Linux 3.0.87

2013-07-21 Thread Greg KH
I'm announcing the release of the 3.0.87 kernel.

All users of the 3.0 kernel series must upgrade.

The updated 3.0.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.0.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 +-
 arch/arm/kernel/perf_event.c|1 +
 arch/x86/xen/time.c |   17 ++---
 drivers/acpi/ec.c   |4 
 drivers/ata/ahci.c  |1 +
 drivers/ata/libahci.c   |3 +--
 drivers/dma/pl330.c |4 ++--
 drivers/pci/quirks.c|2 ++
 drivers/pcmcia/at91_cf.c|4 ++--
 drivers/rtc/rtc-rv3029c2.c  |2 +-
 drivers/usb/gadget/f_mass_storage.c |2 ++
 drivers/usb/host/xhci-mem.c |4 
 drivers/usb/serial/option.c |4 
 drivers/usb/serial/qcserial.c   |8 +++-
 fs/ext3/namei.c |7 ++-
 fs/ext4/extents.c   |4 ++--
 fs/ext4/inode.c |4 ++--
 fs/ext4/namei.c |7 ++-
 fs/jbd2/transaction.c   |2 +-
 fs/ocfs2/xattr.c|   10 ++
 kernel/irq/manage.c |6 +++---
 kernel/timer.c  |8 +---
 22 files changed, 57 insertions(+), 49 deletions(-)

Al Viro (1):
  ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree()

Axel Lin (1):
  drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq

Bart Van Assche (1):
  timer: Fix jiffies wrap behavior of round_jiffies_common()

Bartlomiej Zolnierkiewicz (1):
  drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()

Ben Hutchings (1):
  genirq: Fix can_request_irq() for IRQs without an action

Dan Williams (1):
  USB: option,qcserial: move Novatel Gobi1K IDs to qcserial

Greg Kroah-Hartman (1):
  Linux 3.0.87

Jan Kara (2):
  ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
  ext4: fix overflow when counting used blocks on 32-bit architectures

Jed Davis (1):
  ARM: 7765/1: perf: Record the user-mode PC in the call chain.

Joachim Eastwood (1):
  pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status

Junxiao Bi (1):
  ocfs2: xattr: fix inlined xattr reflink

Lan Tianyu (1):
  ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan

Laszlo Ersek (1):
  xen/time: remove blocked time accounting from xen "clockchip"

Mathias Nyman (1):
  xhci: check for failed dma pool allocation

Shane Huang (2):
  ahci: Add AMD CZ SATA device ID
  ahci: remove pmp link online check in FBS EH

Theodore Ts'o (1):
  jbd2: fix theoretical race in jbd2__journal_restart

UCHINO Satoshi (1):
  usb: gadget: f_mass_storage: add missing memory barrier for 
thread_wakeup_needed



signature.asc
Description: Digital signature


Re: Linux 3.0.87

2013-07-21 Thread Greg KH

diff --git a/Makefile b/Makefile
index da6a0ca..03aa17e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 0
-SUBLEVEL = 86
+SUBLEVEL = 87
 EXTRAVERSION =
 NAME = Sneaky Weasel
 
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 2b5b142..75373a9 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -741,6 +741,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, 
struct pt_regs *regs)
struct frame_tail __user *tail;
 
 
+   perf_callchain_store(entry, regs->ARM_pc);
tail = (struct frame_tail __user *)regs->ARM_fp - 1;
 
while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 4b0fb29..19568a0 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, 
xen_runstate);
 /* snapshots of runstate info */
 static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
 
-/* unused ns of stolen and blocked time */
+/* unused ns of stolen time */
 static DEFINE_PER_CPU(u64, xen_residual_stolen);
-static DEFINE_PER_CPU(u64, xen_residual_blocked);
 
 /* return an consistent snapshot of 64-bit time/counter value */
 static u64 get64(const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
 {
struct vcpu_runstate_info state;
struct vcpu_runstate_info *snap;
-   s64 blocked, runnable, offline, stolen;
+   s64 runnable, offline, stolen;
cputime_t ticks;
 
get_runstate_snapshot(&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
snap = &__get_cpu_var(xen_runstate_snapshot);
 
/* work out how much time the VCPU has not been runn*ing*  */
-   blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
runnable = state.time[RUNSTATE_runnable] - 
snap->time[RUNSTATE_runnable];
offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
 
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
__this_cpu_write(xen_residual_stolen, stolen);
account_steal_ticks(ticks);
-
-   /* Add the appropriate number of ticks of blocked time,
-  including any left-overs from last time. */
-   blocked += __this_cpu_read(xen_residual_blocked);
-
-   if (blocked < 0)
-   blocked = 0;
-
-   ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
-   __this_cpu_write(xen_residual_blocked, blocked);
-   account_idle_ticks(ticks);
 }
 
 /* Get the TSC speed from Xen */
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 51de186..9cb436a 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -964,6 +964,10 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
ec_enlarge_storm_threshold, "CLEVO hardware", {
DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
+   {
+   ec_skip_dsdt_scan, "HP Folio 13", {
+   DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13"),}, NULL},
{},
 };
 
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 75a8d0f..f3d09f3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -284,6 +284,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 
/* AMD */
{ PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
+   { PCI_VDEVICE(AMD, 0x7900), board_ahci }, /* AMD CZ */
/* AMD is using RAID class only for ahci controllers */
{ PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  PCI_CLASS_STORAGE_RAID << 8, 0xff, board_ahci },
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 41223c7..b64e4a7 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1495,8 +1495,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 
irq_stat)
u32 fbs = readl(port_mmio + PORT_FBS);
int pmp = fbs >> PORT_FBS_DWE_OFFSET;
 
-   if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
-   ata_link_online(&ap->pmp_link[pmp])) {
+   if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) {
link = &ap->pmp_link[pmp];
fbs_need_dec = true;
}
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 6abe1ec..4802aac 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -281,10 +281,10 @@ static void pl330_free_chan_resources(struct dma_chan 
*chan)
struct dma_pl330_chan *pch = to_pchan(chan);
unsigned long flags;
 
-   spin_lock_irqsave(&pch->lock, flags);
-
tasklet_kill(&pch->task);
 
+   spin_lock_irqsave(&pch->lock, flags);
+
pl330_release_channel(pch->pl330_chid);
pch->pl330_chid = NULL;
 
diff --git a/drivers/pci/quirks.c b/dr

Re: [ 37/72] Input: bcm5974 - add support for the 2013 MacBook Air

2013-07-21 Thread Greg Kroah-Hartman
On Thu, Jul 18, 2013 at 10:44:45PM -0700, Greg Kroah-Hartman wrote:
> On Thu, Jul 18, 2013 at 10:40:40PM -0700, Dmitry Torokhov wrote:
> > Greg,
> > 
> > On Thu, Jul 18, 2013 at 10:25:54PM -0700, Greg Kroah-Hartman wrote:
> > > 3.10-stable review patch.  If anyone has any objections, please let me 
> > > know.
> > > 
> > > --
> > > 
> > > From: Dmitry Torokhov 
> > 
> > Any chance you could change this to read "Henrik Rydberg"? My import
> > script messed up. And on hid part as well...
> 
> Ok, will do.

And I promptly forgot to do this, and I released 3.10.2 with it as-is,
sorry about that.

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/


infiniband build warning

2013-07-21 Thread Michel Lespinasse
Hi,

I am seeing build warnings in drivers/infiniband/core/cma.c starting with 
v3.11-rc1. These can be reproduced with gcc 4.6.3.

Would you consider applying the following fix ?
(The compiler warning seems benign as I could easily convince myself that the 
variable won't be used uninitialized, but I'd like to get rid of the compiler 
warning anyway).

- 8< 
infiniband: fix maybe-uninitialized warning in rdma_resolve_addr()

This fixes the following warning:

drivers/infiniband/core/cma.c: In function 'rdma_resolve_addr':
drivers/infiniband/core/cma.c:465:23: error: 'port' may be used uninitialized 
in this function [-Werror=maybe-uninitialized]
drivers/infiniband/core/cma.c:426:5: note: 'port' was declared here

The warning looks benign: port is only used after checking that
cma_dev is not NULL, and all assignments to cma_dev also set port.

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f1c279fabe64..7b2e38ad1243 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -423,7 +423,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private 
*id_priv)
struct sockaddr_ib *addr;
union ib_gid gid, sgid, *dgid;
u16 pkey, index;
-   u8 port, p;
+   u8 port = 0, p;
int i;
 
cma_dev = NULL;

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
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: thermal / x86: Fix init error code path in package temperature driver

2013-07-21 Thread Zhang Rui
On Sun, 2013-07-21 at 15:03 +0200, Rafael J. Wysocki wrote:
> On Saturday, July 20, 2013 11:30:44 PM Srinivas Pandruvada wrote:
> > Hi Rafael,
> > 
> > This is already fixed and currently merged to MM tree. So this should 
> > make to rc2.
> > I don't know whether Rui will push or MM maintainer will push this change.
> 
> Usually Andrew Morton (who maintains -mm) prefers maintainers to push things 
> to
> Linus.
> 
I'll push it for rc2.

thanks,
rui
> Thanks,
> Rafael
> 
> 
> > On 07/20/2013 01:48 PM, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki 
> > >
> > > The error code path of the x86 package temperature thermal driver's
> > > initialization routine, pkg_temp_thermal_init(), makes an unbalanced
> > > call to get_online_cpus(), which causes subsequent CPU offline
> > > operations, and consequently system suspend, to permanently block
> > > in cpu_hotplug_begin() on systems where get_core_online() returns
> > > an error code.
> > >
> > > Remove the extra get_online_cpus() to fix the problem (tested on
> > > Toshiba Portege R500).
> > >
> > > Signed-off-by: Rafael J. Wysocki 
> > > ---
> > >   drivers/thermal/x86_pkg_temp_thermal.c |1 -
> > >   1 file changed, 1 deletion(-)
> > >
> > > Index: linux-pm/drivers/thermal/x86_pkg_temp_thermal.c
> > > ===
> > > --- linux-pm.orig/drivers/thermal/x86_pkg_temp_thermal.c
> > > +++ linux-pm/drivers/thermal/x86_pkg_temp_thermal.c
> > > @@ -592,7 +592,6 @@ static int __init pkg_temp_thermal_init(
> > >   return 0;
> > >   
> > >   err_ret:
> > > - get_online_cpus();
> > >   for_each_online_cpu(i)
> > >   put_core_offline(i);
> > >   put_online_cpus();
> > >
> > >
> > 


--
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: [GIT PULL] ACPI video support fixes for v3.11

2013-07-21 Thread Rafael J. Wysocki
On Sunday, July 21, 2013 10:15:31 AM Linus Torvalds wrote:
> On Sat, Jul 20, 2013 at 5:22 PM, Rafael J. Wysocki  wrote:
> >
> > I'm sending a separate pull request for this as it may be somewhat
> > controversial.
> 
> Ugh. That's an understatement, and I hate the timing.

Sorry about that.

The choice was between sending it now and sitting on it until the 3.12 merge
window pretty much without any additional data points.

> That said, it looks like it should be easy to revert if it causes
> problems, and I guess it won't become better from waiting until the
> next merge window.

Precisely.

> And the problems are hopefully going to be pretty easily pinpointed to
> this.. So I've pulled it.

Thanks a lot!

Rafael

--
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 3.11-rc2

2013-07-21 Thread Dave Chinner
On Sun, Jul 21, 2013 at 12:53:10PM -0700, Linus Torvalds wrote:
> So it's been another week, and -rc2 is out there.
> 
> The patch looks a bit odd, because by bulk 95% of the patch is just
> the removal of the CSR staging driver that wasn't getting any
> traction, so the diffstat (and the dirstat in particular) is not very
> interesting or readable, since that driver removal basically
> overshadows everything else. But I do admit to love seeing code
> removal patches.
> 
> And of the rest of the patch, a noticeable part is all those
> one-liners all over that just remove the __cpuinit markers that people
> agreed were just more pain than gain to maintain. We had already made
> the markers be no-ops earlier, so they didn't matter for code
> generation, and here in rc2 they get actually removed.
> 
> End result: we have two separate events that generate a lot of noise
> in the patch, but aren't really interesting per se. They do make the
> patch harder to read, though.
> 
> Ignoring those noisy parts of the patch, there's a couple of things
> worth noting about rc2. I think most of the patches here are nice
> fixes, but I wanted to give two heads-ups:
> 
>  (a) the O_TMPFILE flag that is new to 3.11 has been going through a
> few ABI/API cleanups (and a few fixes to the implementation too), but
> I think we're done now. So if you're interested in the concept of
> unnamed temporary files, go ahead and test it out. The lack of name
> not only gets rid of races/complications with filename generation, it
> can make the whole thing more efficient since you don't have the
> directory operations that can cause serializing IO etc.

I'll just point out that it can make the whole thing worse, too.
For example, for ext3/4, the tmpfile being created has to be added
to the orphan inode list which is protected by a filesystem global
mutex. Hence scalability of O_TMPFILE is massively limited on
ext3/ext4 due to architectural issues within ext3/4. Other
filesystems will be more efficient, but because they have more
scalable/complex orphan inode handling it's going to take longer to
implement O_TMPFILE support for them

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.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/


[PATCH 2/4] ipc: drop ipc_lock_by_ptr

2013-07-21 Thread Davidlohr Bueso
After previous cleanups and optimizations, this function is no longer
heavily used and we don't have a good reason to keep it. Update the
few remaining callers and get rid of it.

Signed-off-by: Davidlohr Bueso 
---
 ipc/namespace.c | 3 ++-
 ipc/util.c  | 6 --
 ipc/util.h  | 6 --
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ipc/namespace.c b/ipc/namespace.c
index 67dc744..aba9a58 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -89,7 +89,8 @@ void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
perm = idr_find(&ids->ipcs_idr, next_id);
if (perm == NULL)
continue;
-   ipc_lock_by_ptr(perm);
+   rcu_read_lock();
+   ipc_lock_object(perm);
free(ns, perm);
total++;
}
diff --git a/ipc/util.c b/ipc/util.c
index 1ddadcf..9f6aa30 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -205,7 +205,8 @@ static struct kern_ipc_perm *ipc_findkey(struct ipc_ids 
*ids, key_t key)
continue;
}
 
-   ipc_lock_by_ptr(ipc);
+   rcu_read_lock();
+   ipc_lock_object(ipc);
return ipc;
}
 
@@ -838,7 +839,8 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct 
ipc_ids *ids, loff_t pos,
ipc = idr_find(&ids->ipcs_idr, pos);
if (ipc != NULL) {
*new_pos = pos + 1;
-   ipc_lock_by_ptr(ipc);
+   rcu_read_lock();
+   ipc_lock_object(ipc);
return ipc;
}
}
diff --git a/ipc/util.h b/ipc/util.h
index 0a362ff..14b0a2a 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -171,12 +171,6 @@ static inline void ipc_assert_locked_object(struct 
kern_ipc_perm *perm)
assert_spin_locked(&perm->lock);
 }
 
-static inline void ipc_lock_by_ptr(struct kern_ipc_perm *perm)
-{
-   rcu_read_lock();
-   ipc_lock_object(perm);
-}
-
 static inline void ipc_unlock(struct kern_ipc_perm *perm)
 {
ipc_unlock_object(perm);
-- 
1.7.11.7

--
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/4] ipc, shm: guard against non-existant vma in shmdt(2)

2013-07-21 Thread Davidlohr Bueso
When !CONFIG_MMU there's a chance we can derefence a NULL pointer
when the VM area isn't found - check the return value of find_vma().

Also, remove the redundant -EINVAL return: retval is set to the proper
return code and *only* changed to 0, when we actually unmap the segments.

Signed-off-by: Davidlohr Bueso 
---
 ipc/shm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index 59f2194..c7ee2f6 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1288,8 +1288,7 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
 #else /* CONFIG_MMU */
/* under NOMMU conditions, the exact address to be destroyed must be
 * given */
-   retval = -EINVAL;
-   if (vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) {
+   if (vma && vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) {
do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start);
retval = 0;
}
-- 
1.7.11.7

--
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/4] ipc: misc fixes & pending cleanups

2013-07-21 Thread Davidlohr Bueso
Applies on top of linux-next (20130719), please consider them
for 3.12. Very straightforward patchset:

Patch 1: always check the return of find_vma in shmdt(2)
Patch 2-4: remove now mostly unused functions from the previous
   cleanups and optimizations.

Davidlohr Bueso (4):
  ipc, shm: guard against non-existant vma in shmdt(2)
  ipc: drop ipc_lock_by_ptr
  ipc, shm: drop shm_lock_check
  ipc: drop ipc_lock_check

 ipc/namespace.c |  3 ++-
 ipc/shm.c   | 14 +-
 ipc/util.c  | 22 --
 ipc/util.h  |  7 ---
 4 files changed, 7 insertions(+), 39 deletions(-)

-- 
1.7.11.7

--
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/4] ipc, shm: drop shm_lock_check

2013-07-21 Thread Davidlohr Bueso
This function was replaced by a the lockless shm_obtain_object_check(),
and no longer has any users.

Signed-off-by: Davidlohr Bueso 
---
 ipc/shm.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index c7ee2f6..9ffc563 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -167,17 +167,6 @@ static inline void shm_lock_by_ptr(struct shmid_kernel 
*ipcp)
ipc_lock_object(&ipcp->shm_perm);
 }
 
-static inline struct shmid_kernel *shm_lock_check(struct ipc_namespace *ns,
-   int id)
-{
-   struct kern_ipc_perm *ipcp = ipc_lock_check(&shm_ids(ns), id);
-
-   if (IS_ERR(ipcp))
-   return (struct shmid_kernel *)ipcp;
-
-   return container_of(ipcp, struct shmid_kernel, shm_perm);
-}
-
 static inline void shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *s)
 {
ipc_rmid(&shm_ids(ns), &s->shm_perm);
-- 
1.7.11.7

--
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] pinctrl: pinctrl-imx: Remove unneeded check for platform_get_resource()

2013-07-21 Thread Fabio Estevam
From: Fabio Estevam 

As devm_ioremap_resource() is used on probe, there is no need to explicitly 
check the return value from platform_get_resource(), as this is something that
devm_ioremap_resource() takes care by itself.

Signed-off-by: Fabio Estevam 
---
 drivers/pinctrl/pinctrl-imx.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 57a4eb0..dea739a 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -580,9 +580,6 @@ int imx_pinctrl_probe(struct platform_device *pdev,
return -ENOMEM;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res)
-   return -ENOENT;
-
ipctl->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ipctl->base))
return PTR_ERR(ipctl->base);
-- 
1.8.1.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 4/4] ipc: drop ipc_lock_check

2013-07-21 Thread Davidlohr Bueso
No remaining users, we now use ipc_obtain_object_check().

Signed-off-by: Davidlohr Bueso 
---
 ipc/util.c | 16 
 ipc/util.h |  1 -
 2 files changed, 17 deletions(-)

diff --git a/ipc/util.c b/ipc/util.c
index 9f6aa30..e829da9 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -686,22 +686,6 @@ out:
return out;
 }
 
-struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, int id)
-{
-   struct kern_ipc_perm *out;
-
-   out = ipc_lock(ids, id);
-   if (IS_ERR(out))
-   return out;
-
-   if (ipc_checkid(out, id)) {
-   ipc_unlock(out);
-   return ERR_PTR(-EIDRM);
-   }
-
-   return out;
-}
-
 /**
  * ipcget - Common sys_*get() code
  * @ns : namsepace
diff --git a/ipc/util.h b/ipc/util.h
index 14b0a2a..c5f3338b 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -177,7 +177,6 @@ static inline void ipc_unlock(struct kern_ipc_perm *perm)
rcu_read_unlock();
 }
 
-struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, int id);
 struct kern_ipc_perm *ipc_obtain_object_check(struct ipc_ids *ids, int id);
 int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids,
struct ipc_ops *ops, struct ipc_params *params);
-- 
1.7.11.7

--
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 1/3] mfd: add LP3943 MFD driver

2013-07-21 Thread Kim, Milo
> This needs to be reviewed by the devicetree people.
> Please break out the bindings separately and include
> devicet...@vger.kernel.org on that review.

OK, thanks.
 
> > +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
> > @@ -0,0 +1,23 @@
> > +Bindings for TI/National Semiconductor LP3943 Driver
> > +
> > +Required properties:
> > +  - compatible: "ti,lp3943"
> > +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
> > +
> > +Optional properties:
> > +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
> > +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 =
> > +LED15
> > +
> > +Datasheet
> > +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
> > +
> > +Application note: How to use LP3943 as a GPIO expander and PWM
> > +generator
> > +  http://www.ti.com/lit/an/snva287a/snva287a.pdf
> 
> Do we usually put these things into bindings?

Actually I want to put this information in the driver document, but
I've not found which part is the best place for the MFD documentation.

> > +Example:
> > +
> > +   lp3943@60 {
> > +   compatible = "ti,lp3943";
> > +   reg = <0x60>;
> > +   pwm1 = /bits/ 8 <2>;/* use LED1 output as PWM #1 */
> > +   };
> 
> OK so there is a way to state which lines are used for PWM.
> 
> I think you should also specify which lines are used for GPIO, and which
> lines are used for LEDs.
>
> And I'd like the masks to be passed to each subdriver, so we can avoid the
> scenario where one and the same line gets used for GPIO, LED and PWM at the
> same time.

Good idea. This is my missing point - I was writing the LP3943 DT is only used 
for the definition of the platform data.
Thanks.

Regards,
Milo
--
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/3] gpio: add LP3943 I2C GPIO expander driver

2013-07-21 Thread Kim, Milo
Hi Linus,
Thanks for both of GPIO patch reviews.
I'll fix them.

> I forgot one thing:
> 
> On Tue, Jul 16, 2013 at 4:38 AM, Kim, Milo  wrote:
> 
> > +static int lp3943_gpio_probe(struct platform_device *pdev)
> > +{
> > +   struct lp3943 *l = dev_get_drvdata(pdev->dev.parent);
> > +   struct lp3943_gpio *lg;
> > +   int ret;
> 
> This is where I want you to assign to a member of struct
> lp3943 another u16 mask which tells which lines are
> actually available for GPIO, and you should also add code to
> make sure that lines that are not available fail gpio_request().
> 
> This configuration can probably be read out from the device
> tree if you add the compatible node to the MFD cell when
> registering it.
> 
> Yours,
> Linus Walleij

Regards,
Milo
--
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] imx-drm: imx-tve: Remove unneeded check for platform_get_resource()

2013-07-21 Thread Fabio Estevam
From: Fabio Estevam 

As devm_ioremap_resource() is used on probe, there is no need to explicitly 
check the return value from platform_get_resource(), as this is something that
devm_ioremap_resource() takes care by itself.

Signed-off-by: Fabio Estevam 
---
 drivers/staging/imx-drm/imx-tve.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-tve.c 
b/drivers/staging/imx-drm/imx-tve.c
index a56797d..8232cea 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -623,11 +623,6 @@ static int imx_tve_probe(struct platform_device *pdev)
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(&pdev->dev, "failed to get memory region\n");
-   return -ENOENT;
-   }
-
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
-- 
1.8.1.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: [PATCH 0/3] LP3943 MFD driver for a GPIO expander and a PWM generator

2013-07-21 Thread Kim, Milo
Hi Linus,
Thanks for your review.

> On Tue, Jul 16, 2013 at 4:38 AM, Kim, Milo  wrote:
> 
> > LP3943 is an integrated device capable of driving 16 output channels.
> > It supports a GPIO expander and a PWM generator.
> 
> But actually the data sheet describes it as a LED driver with PWM
> chip.
> 
> Do you have use cases not using it for LEDs but other thing or why
> do you want to model the 16 LED lines as GPIO lines?
> Why can't you just have a drivers/leds/* as for any other LED
> chip?

We have two ways to provide LED functions.

(a) Creating LP3943 LED driver.
This is what you mentioned.
LP3943 MFD will consist of GPIO, LED and PWM drivers

(b) Using a LED PWM driver with the PWM generator
With LP3943 PWM driver, we can control LEDs by using LED PWM driver
under drivers/leds/leds-pwm.c
Then, the MFD consists of just two drivers - GPIO and PWM.
LP3943 PWM driver can be used as general usages -
Not only simple LED drivers but also the PWM signal input for a backlight 
device.
That's why I prefer to the second way.

> Atleast some good explanation of this needs to be found in the
> patch text and also as comments in Kconfig and the code I think.

I should describe the usage of the 'leds-pwm' driver for LED lighting.
Thanks for this guideline.

Regards,
Milo
--
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 1/3] mfd: add LP3943 MFD driver

2013-07-21 Thread Kim, Milo
Hi Lee,
Thanks for your detailed review.

> > diff --git a/Documentation/devicetree/bindings/mfd/lp3943.txt
> b/Documentation/devicetree/bindings/mfd/lp3943.txt
> > new file mode 100644
> > index 000..4eb251d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
> > @@ -0,0 +1,23 @@
> > +Bindings for TI/National Semiconductor LP3943 Driver
> > +
> > +Required properties:
> > +  - compatible: "ti,lp3943"
> > +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
> > +
> > +Optional properties:
> > +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
> > +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
>  No space here ^  ^ comma here
> 
> This is actually pretty confusing.

Thanks for catching this. my ugly formatting :(

> Any way you can put the invalid entry at the end so, 0 == LED0?
> 
> > +Datasheet
> > +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
> 
> Ah, I see So the above are pins, rather than arbitrary channel Nos.
> 
> Would it make sense to use pinctrl instead then?

I'm not familiar with the PINCTRL subsystem. I'll check it.

> > +int lp3943_read_byte(struct lp3943 *l, u8 reg, u8 *read)
> 
> Not sure I like 'l' as a variable name. The function is small enough
> to get away with it in this context, but it would probably be better
> if it were renamed to something more meaningful.

LP3943 consists of two devices - GPIO and PWM drivers.
So each private data was defined as 

struct lp3943 *l;   /* MFD device */
struct lp3943_gpio *lg; /* GPIO driver */
struct lp3943_pwm *lp;  /* PWM driver */

As you pointed, the 'l' may look like a list of something.
I'll rename them as below.

struct lp3943 *lp3943;
struct lp3943_gpio *lp3943_gpio;
struct lp3943_pwm *lp3943_pwm;

> > +static const struct i2c_device_id lp3943_ids[] = {
> > +   {"lp3943", 0},
> 
> Lack of consistency ...

I don't know exactly what it means. Do you mean the name of I2C device?

Regards,
Milo


Re: [x86] Kernel panic - not syncing: Fatal exception in interrupt

2013-07-21 Thread Fengguang Wu
Hi Jiri,

> What I am however wondering whether can't be case here is that the jump 
> label was used before int3_notifier has been registered.
> I am thinking about ways around this, but we'll probably have to do the 
> same ftrace is doing, i.e. hook into do_int3() directly instead of relying 
> on the notifier to be registered in time.
> 
> Fengguang, as I am not able to reproduce this bug locally, could you do me 
> a favor and test whether the patch below works the problem around, just 
> for the sake of testing the hypothesis?

I tested 1000 boots with the patch and find no more boot problem.

Thanks,
Fengguang

> From: Jiri Kosina 
> Subject: [PATCH] x86: call out into int3 handler directly instead of using 
> notifier
> 
> ---
>  arch/x86/include/asm/alternative.h |2 ++
>  arch/x86/kernel/alternative.c  |   22 +-
>  arch/x86/kernel/traps.c|4 
>  3 files changed, 27 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/include/asm/alternative.h 
> b/arch/x86/include/asm/alternative.h
> index 3abf8dd..c22a41d 100644
> --- a/arch/x86/include/asm/alternative.h
> +++ b/arch/x86/include/asm/alternative.h
> @@ -5,6 +5,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  /*
>   * Alternative inline assembly for SMP.
> @@ -232,6 +233,7 @@ struct text_poke_param {
>   size_t len;
>  };
>  
> +extern int poke_bp_int3_handler(struct pt_regs *regs);
>  extern void *text_poke(void *addr, const void *opcode, size_t len);
>  extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void 
> *handler);
>  extern void *text_poke_smp(void *addr, const void *opcode, size_t len);
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 0ab4936..e1088f2 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -605,6 +605,24 @@ static void do_sync_core(void *info)
>  static bool bp_patching_in_progress;
>  static void *bp_int3_handler, *bp_int3_addr;
>  
> +int poke_bp_int3_handler(struct pt_regs *regs)
> +{
> + /* bp_patching_in_progress */
> + smp_rmb();
> +
> + if (likely(!bp_patching_in_progress))
> + return 0;
> +
> + if (user_mode_vm(regs) || regs->ip != (unsigned long)bp_int3_addr)
> + return 0;
> +
> + /* set up the specified breakpoint handler */
> + regs->ip = (unsigned long) bp_int3_handler;
> +
> + return 1;
> +
> +}
> +
>  static int int3_notify(struct notifier_block *self, unsigned long val, void 
> *data)
>  {
>   struct die_args *args = data;
> @@ -689,6 +707,7 @@ void *text_poke_bp(void *addr, const void *opcode, size_t 
> len, void *handler)
>   return addr;
>  }
>  
> +#if 0
>  /* this one needs to run before anything else handles it as a
>   * regular exception */
>  static struct notifier_block int3_nb = {
> @@ -700,8 +719,9 @@ static int __init int3_init(void)
>  {
>   return register_die_notifier(&int3_nb);
>  }
> -
>  arch_initcall(int3_init);
> +#endif
> +
>  /*
>   * Cross-modifying kernel text with stop_machine().
>   * This code originally comes from immediate value.
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 772e2a8..e464764 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -58,6 +58,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #ifdef CONFIG_X86_64
>  #include 
> @@ -324,6 +325,9 @@ dotraplinkage void __kprobes notrace do_int3(struct 
> pt_regs *regs, long error_co
>   ftrace_int3_handler(regs))
>   return;
>  #endif
> + if (poke_bp_int3_handler(regs))
> + return;
> +
>   prev_state = exception_enter();
>  #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
>   if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
> 
> -- 
> Jiri Kosina
> SUSE Labs
--
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: Re: [PATCH V2 0/2] [BUGFIX] virtio/console: Fix two bugs of splice_write

2013-07-21 Thread Yoshihiro YUNOMAE

Hi Amit,

Sorry for the late reply.

(2013/07/19 19:05), Amit Shah wrote:

On (Fri) 19 Jul 2013 [18:19:51], Yoshihiro YUNOMAE wrote:

Hi,

This patch set fixes two bugs of splice_write in the virtio-console driver.

[BUG1] Although pipe->nrbufs is empty, the driver tries to do splice_write.
=> This induces oops in sg_init_table().

[BUG2] No lock for competition of splice_write.
=> This induces oops in splice_from_pipe_feed() by bug of any user
   application.

These reports are written in each patch.

Changes in V2:
- Fix a locking problem for error

Thanks!


Reviewed-by: Amit Shah 


Thank you for reviewing this patch set.


For the patches to be picked up in the stable trees, you need to
include CC:  in the sign-off area of the
patches, just cc'ing in the patch posting doesn't help.  See
Documentation/stable_kernel_rules.txt.

Can you submit a v3 with that change, and also add my reviewed-by
line?


Sure. I'll add stable@ line, your reviewed-by line, and Masami's
reviewed-by line in sign-off area for each patch.

Thanks,
Yoshihiro YUNOMAE

--
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae...@hitachi.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/


Re: [PATCH] hugepage: allow parallelization of the hugepage fault path

2013-07-21 Thread Joonsoo Kim
On Fri, Jul 19, 2013 at 02:24:15PM -0700, Davidlohr Bueso wrote:
> On Fri, 2013-07-19 at 17:14 +1000, David Gibson wrote:
> > On Thu, Jul 18, 2013 at 05:42:35PM +0900, Joonsoo Kim wrote:
> > > On Wed, Jul 17, 2013 at 12:50:25PM -0700, Davidlohr Bueso wrote:
> > > > From: David Gibson 
> > > > 
> > > > At present, the page fault path for hugepages is serialized by a
> > > > single mutex. This is used to avoid spurious out-of-memory conditions
> > > > when the hugepage pool is fully utilized (two processes or threads can
> > > > race to instantiate the same mapping with the last hugepage from the
> > > > pool, the race loser returning VM_FAULT_OOM).  This problem is
> > > > specific to hugepages, because it is normal to want to use every
> > > > single hugepage in the system - with normal pages we simply assume
> > > > there will always be a few spare pages which can be used temporarily
> > > > until the race is resolved.
> > > > 
> > > > Unfortunately this serialization also means that clearing of hugepages
> > > > cannot be parallelized across multiple CPUs, which can lead to very
> > > > long process startup times when using large numbers of hugepages.
> > > > 
> > > > This patch improves the situation by replacing the single mutex with a
> > > > table of mutexes, selected based on a hash, which allows us to know
> > > > which page in the file we're instantiating. For shared mappings, the
> > > > hash key is selected based on the address space and file offset being 
> > > > faulted.
> > > > Similarly, for private mappings, the mm and virtual address are used.
> > > > 
> > > 
> > > Hello.
> > > 
> > > With this table mutex, we cannot protect region tracking structure.
> > > See below comment.
> > > 
> > > /*
> > >  * Region tracking -- allows tracking of reservations and instantiated 
> > > pages
> > >  *across the pages in a mapping.
> > >  *
> > >  * The region data structures are protected by a combination of the 
> > > mmap_sem
> > >  * and the hugetlb_instantion_mutex.  To access or modify a region the 
> > > caller
> > >  * must either hold the mmap_sem for write, or the mmap_sem for read and
> > >  * the hugetlb_instantiation mutex:
> > >  *
> > >  *  down_write(&mm->mmap_sem);
> > >  * or
> > >  *  down_read(&mm->mmap_sem);
> > >  *  mutex_lock(&hugetlb_instantiation_mutex);
> > >  */
> > 
> > Ugh.  Who the hell added that.  I guess you'll need to split of
> > another mutex for that purpose, afaict there should be no interaction
> > with the actual, intended purpose of the instantiation mutex.
> 
> This was added in commit 84afd99b. One way to go would be to add a
> spinlock to protect changes to the regions - however reading the
> changelog, and based on David's previous explanation for the
> instantiation mutex, I don't see why it was added. In fact several
> places modify regions without holding the instantiation mutex, ie:
> hugetlb_reserve_pages()
> 
> Am I missing something here?

hugetlb_reserve_pages() is called with down_write(mmap_sem),
so fault flow which require down_read(mmap_sem) cannot interfere
to change the region.

Thanks.
--
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 3/3] MAINTAINERS: Refactor device tree maintainership

2013-07-21 Thread Grant Likely
On Mon, Jul 22, 2013 at 1:43 AM, Joe Perches  wrote:
> On Mon, 2013-07-22 at 01:36 +0100, Grant Likely wrote:
>> On Sun, Jul 21, 2013 at 10:46 AM, Grant Likely  
>> wrote:
>> > On Sun, Jul 21, 2013 at 1:29 AM, Joe Perches  wrote:
>> >> On Sat, 2013-07-20 at 17:17 -0700, Olof Johansson wrote:
>> >>> On Fri, Jul 19, 2013 at 8:19 PM, Grant Likely  
>> >>> wrote:
>> >>> > Device tree bindings require a lot more attention than they used to.
>> >>> > We've got a group of volunteers willing to take over maintaining
>> >>> > bindings. This patch adds them to the MAINTAINERS file.
>> >> []
>> >>> > diff --git a/MAINTAINERS b/MAINTAINERS
>> >> []
>> >>> > +OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
>> >> []
>> >>> > +F: arch/*/
>> >> []
>> >>> This seems a bit broad.
>> >>
>> >> Yep, that's every file anywhere under arch.
>> >
>> > yeah, that was a c/p mistake. I'll drop that line before committing.
>>
>> In fact, if things go well with the schema tool, it would be possible
>> to leave out the .dts files entirely as far as binding review goes.
>> The binding would be the important part and the .dts files would be
>> checked against that. That's something for the future though.
>
> btw: please add a terminating slash to
>  the file pattern directories
>
> +F: Documentation/devicetree/
> +F: arch/*/boot/dts/
> +F: include/dt-bindings/

Done.

g.
--
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] ASoC: generic: add simple card with devicetree support

2013-07-21 Thread Kuninori Morimoto

Hi

> > On Sat, 20 Jul 2013 22:23:36 +0200
> > Daniel Mack  wrote:
> > 
> >> There is a simple-card driver in the tree already, and there were
> >> several attempts to add DT bindings for it in the past - have you seen
> >> that? Search for "ASoC: add simple-card DT support" in the archives ...
> > 
> > Hi Daniel,
> > 
> > Thanks, that is what I was searching.
> > 
> > I will wait for Kuninori.
> 
> Well, Kuninori recently stated he's currently too busy to continue.
> Given his permission, it might be an option to pick up where he left off
> and finish the open topics. Depends on how urgent your need is I guess.

I'm sorry, but I'm busy now. and I'm happy if someone try to support 
simple-card DT.

In my understanding, latest plan (agreement with ALSA ML ?) of simple-card DT 
support are...

   1) current snd_soc_register_codec() will replaced to use 
snd_soc_register_component().
   2) snd_soc_register_component() will have name <-> id exchange function for 
DT suport.
   3) simple-card supports DT by using above name <-> id exchange

Most biggest and difficult is 1) I think.
It needs more discussion how to do 1) ?

But someone (I forgot who is) is already trying to implement it ?
I'm not sure...

Best regards
---
Kuninori Morimoto
--
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/


  1   2   3   >