Re: [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time.

2014-09-02 Thread Chanwoo Choi
On 09/03/2014 02:50 PM, Jonghwa Lee wrote:
> When it writes some value other than 0 to BTLDset and JIGset, muic device
> will be reset automatically. And it happens during updating ADC debounce time,
> because it shares same register. To update ADC debounce time without reset,
> set value only to ADCDbset and 0 to BTLDset and JIGset.
> 
> Signed-off-by: Jonghwa Lee 
> ---
>  drivers/extcon/extcon-max77693.c |   11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-max77693.c 
> b/drivers/extcon/extcon-max77693.c
> index 77460f2..661a3bb 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -255,10 +255,15 @@ static int max77693_muic_set_debounce_time(struct 
> max77693_muic_info *info,
>   case ADC_DEBOUNCE_TIME_10MS:
>   case ADC_DEBOUNCE_TIME_25MS:
>   case ADC_DEBOUNCE_TIME_38_62MS:
> - ret = regmap_update_bits(info->max77693->regmap_muic,
> + /*
> +  * Don't touch BTLDset, JIGset when you want to change adc
> +  * debounce time. BTLDset, JIGset reflects actual pin status
> +  * and are not configurable.
> +  */
> + ret = regmap_write_bits(info->max77693->regmap_muic,
> MAX77693_MUIC_REG_CTRL3,
> -   CONTROL3_ADCDBSET_MASK,
> -   time << CONTROL3_ADCDBSET_SHIFT);
> +   (CONTROL3_ADCDBSET_MASK &
> +   time << CONTROL3_ADCDBSET_SHIFT));

Do you make this patch on extcon-next branch?

The max77693_muic_set_debounce_time() of extcon-max77693.c
use regmap_update_bits instead of regmap_write_bits as following:

switch (time) {
case ADC_DEBOUNCE_TIME_5MS:
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
ret = regmap_update_bits(info->max77693->regmap_muic,
  MAX77693_MUIC_REG_CTRL3,
  CONTROL3_ADCDBSET_MASK,
  time << CONTROL3_ADCDBSET_SHIFT);
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n");
return ret;
}


Thanks,
Chanwoo Choi


--
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] zbud: avoid accessing in last unused freelist

2014-09-02 Thread Chao Yu
For now, there are NCHUNKS of 64 freelists in zbud_pool, the last unbuddied[63]
freelist linked with all zbud pages which have free chunks of 63. Calculating
according to context of num_free_chunks(), our max chunk number of unbuddied
zbud page is 62, so none of zbud pages will be added/removed in last freelist,
but still we will try to find an unbuddied zbud page in the last unused
freelist, it is unneeded.

This patch redefines NCHUNKS to 63 as free chunk number in one zbud page, hence
we can decrease size of zpool and avoid accessing the last unused freelist
whenever failing to allocate zbud from freelist in zbud_alloc.

Signed-off-by: Chao Yu 
---
 mm/zbud.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/mm/zbud.c b/mm/zbud.c
index f26e7fc..ecf1dbe 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -60,15 +60,17 @@
  * NCHUNKS_ORDER determines the internal allocation granularity, effectively
  * adjusting internal fragmentation.  It also determines the number of
  * freelists maintained in each pool. NCHUNKS_ORDER of 6 means that the
- * allocation granularity will be in chunks of size PAGE_SIZE/64, and there
- * will be 64 freelists per pool.
+ * allocation granularity will be in chunks of size PAGE_SIZE/64. As one chunk
+ * in allocated page is occupied by zbud header, NCHUNKS will be calculated to
+ * 63 which shows the max number of free chunks in zbud page, also there will 
be
+ * 63 freelists per pool.
  */
 #define NCHUNKS_ORDER  6
 
 #define CHUNK_SHIFT(PAGE_SHIFT - NCHUNKS_ORDER)
 #define CHUNK_SIZE (1 << CHUNK_SHIFT)
-#define NCHUNKS(PAGE_SIZE >> CHUNK_SHIFT)
 #define ZHDR_SIZE_ALIGNED CHUNK_SIZE
+#define NCHUNKS((PAGE_SIZE - ZHDR_SIZE_ALIGNED) >> CHUNK_SHIFT)
 
 /**
  * struct zbud_pool - stores metadata for each zbud pool
@@ -268,10 +270,9 @@ static int num_free_chunks(struct zbud_header *zhdr)
 {
/*
 * Rather than branch for different situations, just use the fact that
-* free buddies have a length of zero to simplify everything. -1 at the
-* end for the zbud header.
+* free buddies have a length of zero to simplify everything.
 */
-   return NCHUNKS - zhdr->first_chunks - zhdr->last_chunks - 1;
+   return NCHUNKS - zhdr->first_chunks - zhdr->last_chunks;
 }
 
 /*
-- 
2.0.1.474.g72c7794


--
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] mm: clear __GFP_FS when PF_MEMALLOC_NOIO is set

2014-09-02 Thread Junxiao Bi
commit 21caf2fc1931 ("mm: teach mm by current context info to not do I/O during 
memory allocation")
introduces PF_MEMALLOC_NOIO flag to avoid doing I/O inside memory allocation, 
__GFP_IO is cleared
when this flag is set, but __GFP_FS implies __GFP_IO, it should also be 
cleared. Or it may still
run into I/O, like in superblock shrinker.

Signed-off-by: Junxiao Bi 
Cc: joyce.xue 
Cc: Ming Lei 
---
 include/linux/sched.h |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5c2c885..2fb2c47 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1936,11 +1936,13 @@ extern void thread_group_cputime_adjusted(struct 
task_struct *p, cputime_t *ut,
 #define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
 #define used_math() tsk_used_math(current)
 
-/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */
+/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags
+ * __GFP_FS is also cleared as it implies __GFP_IO.
+ */
 static inline gfp_t memalloc_noio_flags(gfp_t flags)
 {
if (unlikely(current->flags & PF_MEMALLOC_NOIO))
-   flags &= ~__GFP_IO;
+   flags &= ~(__GFP_IO | __GFP_FS);
return flags;
 }
 
-- 
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] memfd_test: Make it work on 32-bit systems

2014-09-02 Thread David Herrmann
Hi

On Mon, Sep 1, 2014 at 7:08 PM, Pranith Kumar  wrote:
> This test currently fails on 32-bit systems since we use u64 type to pass the
> flags to fcntl.
>
> This commit changes this to use 'unsigned int' type for flags to fcntl making 
> it
> work on 32-bit systems.
>
> Signed-off-by: Pranith Kumar 
> ---
> v2: use 'unsigned int' instead of u32
>
>  tools/testing/selftests/memfd/memfd_test.c | 30 
> ++
>  1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/tools/testing/selftests/memfd/memfd_test.c 
> b/tools/testing/selftests/memfd/memfd_test.c
> index 3634c90..6f1385a 100644
> --- a/tools/testing/selftests/memfd/memfd_test.c
> +++ b/tools/testing/selftests/memfd/memfd_test.c
> @@ -59,9 +59,9 @@ static void mfd_fail_new(const char *name, unsigned int 
> flags)
> }
>  }
>
> -static __u64 mfd_assert_get_seals(int fd)
> +static int mfd_assert_get_seals(int fd)
>  {
> -   long r;
> +   int r;

This function can be declared as returning "unsigned int", but keep
"r" as int. negative return codes cause an abort(), so we're fine.

>
> r = fcntl(fd, F_GET_SEALS);
> if (r < 0) {
> @@ -72,36 +72,34 @@ static __u64 mfd_assert_get_seals(int fd)
> return r;
>  }
>
> -static void mfd_assert_has_seals(int fd, __u64 seals)
> +static void mfd_assert_has_seals(int fd, unsigned int seals)
>  {
> -   __u64 s;
> +   int s;
>
> s = mfd_assert_get_seals(fd);
> if (s != seals) {
> -   printf("%llu != %llu = GET_SEALS(%d)\n",
> -  (unsigned long long)seals, (unsigned long long)s, fd);
> +   printf("%u != %u = GET_SEALS(%d)\n",
> +   seals, (unsigned int)s, fd);

By making mfd_assert_get_seals() return "unsigned int", you can
declare 's' as unsigned, too, and drop this cast.

> abort();
> }
>  }
>
> -static void mfd_assert_add_seals(int fd, __u64 seals)
> +static void mfd_assert_add_seals(int fd, unsigned int seals)
>  {
> -   long r;
> -   __u64 s;
> +   int r, s;
>
> s = mfd_assert_get_seals(fd);
> r = fcntl(fd, F_ADD_SEALS, seals);
> if (r < 0) {
> -   printf("ADD_SEALS(%d, %llu -> %llu) failed: %m\n",
> -  fd, (unsigned long long)s, (unsigned long long)seals);
> +   printf("ADD_SEALS(%d, %u -> %u) failed: %m\n",
> +   fd, (unsigned int)s, seals);

same here

> abort();
> }
>  }
>
> -static void mfd_fail_add_seals(int fd, __u64 seals)
> +static void mfd_fail_add_seals(int fd, unsigned int seals)
>  {
> -   long r;
> -   __u64 s;
> +   int r, s;
>
> r = fcntl(fd, F_GET_SEALS);
> if (r < 0)
> @@ -111,8 +109,8 @@ static void mfd_fail_add_seals(int fd, __u64 seals)
>
> r = fcntl(fd, F_ADD_SEALS, seals);
> if (r >= 0) {
> -   printf("ADD_SEALS(%d, %llu -> %llu) didn't fail as 
> expected\n",
> -  fd, (unsigned long long)s, (unsigned long long)seals);
> +   printf("ADD_SEALS(%d, %u -> %u) didn't fail as expected\n",
> +   fd, (unsigned int)s, seals);

same here

Sorry for the bike-shedding. Patch looks good, otherwise. With, or
without, this changed, this is:

Reviewed-by: David Herrmann 

Thanks
David

> abort();
> }
>  }
> --
> 2.1.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] extcon: max77693: Fix a bug occured at changing ADC debounce time.

2014-09-02 Thread Jonghwa Lee
When it writes some value other than 0 to BTLDset and JIGset, muic device
will be reset automatically. And it happens during updating ADC debounce time,
because it shares same register. To update ADC debounce time without reset,
set value only to ADCDbset and 0 to BTLDset and JIGset.

Signed-off-by: Jonghwa Lee 
---
 drivers/extcon/extcon-max77693.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 77460f2..661a3bb 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -255,10 +255,15 @@ static int max77693_muic_set_debounce_time(struct 
max77693_muic_info *info,
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
-   ret = regmap_update_bits(info->max77693->regmap_muic,
+   /*
+* Don't touch BTLDset, JIGset when you want to change adc
+* debounce time. BTLDset, JIGset reflects actual pin status
+* and are not configurable.
+*/
+   ret = regmap_write_bits(info->max77693->regmap_muic,
  MAX77693_MUIC_REG_CTRL3,
- CONTROL3_ADCDBSET_MASK,
- time << CONTROL3_ADCDBSET_SHIFT);
+ (CONTROL3_ADCDBSET_MASK &
+ time << CONTROL3_ADCDBSET_SHIFT));
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n");
return ret;
-- 
1.7.9.5

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


[PATCH v2] irqchip: exynos-combiner: Fix compilation error on ARM64

2014-09-02 Thread Naveen Krishna Chatradhi
The following compilation error occurs on 64-bit Exynos7 SoC:

drivers/irqchip/exynos-combiner.c: In function ‘combiner_irq_domain_map’:
drivers/irqchip/exynos-combiner.c:162:2: error: implicit declaration of 
function ‘set_irq_flags’ [-Werror=implicit-function-declaration]
  set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
  ^
drivers/irqchip/exynos-combiner.c:162:21: error: ‘IRQF_VALID’ undeclared (first 
use in this function)
  set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
 ^
drivers/irqchip/exynos-combiner.c:162:21: note: each undeclared identifier is 
reported only once for each function it appears in
drivers/irqchip/exynos-combiner.c:162:34: error: ‘IRQF_PROBE’ undeclared (first 
use in this function)
  set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);

Fix the build error by including linux/interrupt.h.

Signed-off-by: Naveen Krishna Chatradhi 
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Cc: Sudeep Holla 
---
Changes since v1:
Used linux/interrupt.h instead of asm/hardirq.h

 drivers/irqchip/exynos-combiner.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/exynos-combiner.c 
b/drivers/irqchip/exynos-combiner.c
index f8636a6..5945223 100644
--- a/drivers/irqchip/exynos-combiner.c
+++ b/drivers/irqchip/exynos-combiner.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-- 
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: Bogus error in checkpatch.pl

2014-09-02 Thread Joe Perches
On Wed, 2014-09-03 at 00:29 -0400, Pranith Kumar wrote:
> Hi Joe,

Hello Pranith.

> On Wed, Sep 3, 2014 at 12:25 AM, Joe Perches  wrote:
> > You need to use parentheses around the description like:
> > commit  ("commit description")
> > For your case:
> > Commit 615cc2c9cf95 ("Documentation/memory-barriers.txt: fix important
> > typo re memory barriers")
> Ah, OK. But the error message does not say anything about missing
> paranetheses and only stresses on chars in the id:
> 
> $ ./scripts/checkpatch.pl
> patch_dir/0001-doc-memory-barriers.txt-Correct-example-for-reorderi.patch
> ERROR: Please use 12 or more chars for the git commit ID like: 'Commit
> 615cc2c9cf95 ("Documentation/memory-barriers.txt: fix important typo
> re memory barriers")'
> #8:
> Commit 615cc2c9cf95 "Documentation/memory-barriers.txt: fix important typo re
> Is it possible to make it a bit clearer, perhaps?

Maybe.  Suggest a modified message.

--
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: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread li.xi...@freescale.com
> Subject: Re: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add
> asoc_simple_card_fmt_master() to simplify the code.
> 
> 
> Hi Xiubo
> 
> > Yes your patch has fixed the bug Jyri has pointed out.
> >
> > So I has discard my [PATCHv2 1/4] patch.
> >
> > Please send your patch out to replace this one.
> (snip)
> > Please send it out of your local patch.
> >
> > Please also consider the ideas about Jyri, Jean-Francios, Varka and
> > Takashi's advice as previous emails about my patch.
> 
> OK, will do.
> To avoid confusion/conflict, I will post it after Mark applied it.
> Because many simple-card patches are posted in these days...
> 

Yes, Get it.

Thanks,

BRs
Xiubo

--
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] fix bugs with stale or corrupt MMIO caches

2014-09-02 Thread Xiao Guangrong
On 09/02/2014 11:42 PM, Paolo Bonzini wrote:
> Il 29/08/2014 12:31, Paolo Bonzini ha scritto:
>> David and Xiao, here's my take on the MMIO generation patches.  Now
>> with documentation, too. :)  Please review!
>>
>> David Matlack (2):
>>   kvm: fix potentially corrupt mmio cache
>>   kvm: x86: fix stale mmio cache bug
>>
>> Paolo Bonzini (1):
>>   KVM: do not bias the generation number in kvm_current_mmio_generation
>>
>>  Documentation/virtual/kvm/mmu.txt | 14 ++
>>  arch/x86/include/asm/kvm_host.h   |  1 +
>>  arch/x86/kvm/mmu.c| 29 ++---
>>  arch/x86/kvm/x86.h| 20 +++-
>>  virt/kvm/kvm_main.c   | 30 +++---
>>  5 files changed, 67 insertions(+), 27 deletions(-)
>>
> 
> Ping?

Looks good to me.

Reviewed-by: Xiao Guangrong 

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


Re: [RFC PATCH] netlink: Safer deletion of sk_bind_node

2014-09-02 Thread David Miller
From: Harish Jenny Kandiga Nagaraj 
Date: Wed, 3 Sep 2014 10:49:59 +0530

> If that is the case , then subscriptions of netlink_sock should have
> been updated after netlink_remove or netlink_release.  I don't see
> that happening.

Please do not top-post.  First provide the quoted context, then provide
your response afterwards, rather than the other way around.

The point I was trying to make is that all code paths that operate
on this list have to follow this rule, if there is a code path that
is not then that is your bug and that is where the fix belongs.

We're unexpectedly having double deletes occur on this list, I would
prefer if we don't paper over it by allowing it to silently succeed.
--
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 0/5] PHY: Fixes for 3.17 -rc cycle

2014-09-02 Thread Kishon Vijay Abraham I
Hi Greg,

On Thursday 28 August 2014 03:55 PM, Kishon Vijay Abraham I wrote:
> Hi Greg,
> 
> Please find the pull request for this -rc cycle. It consistes of a regression
> fix to runtime PM on OMAP (cc'ed stable) and few other minor fixes.
> 
> Please consider merging it in this -rc cycle.
> Let me know If I have to make any changes.

Can we have this merged in this -rc cycle?

Thanks
Kishon

> 
> Cheers
> Kishon
> 
> The following changes since commit 451fd72219dd6f3355e2d036c598544c760ee532:
> 
>   Merge tag 'pwm/for-3.17-rc2' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm 
> (2014-08-22 14:50:21 -0700)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git 
> tags/for-3.17-rc
> 
> for you to fetch changes up to fbb1a770039d3900f5130bab949b757f6f7fb373:
> 
>   phy: miphy365x: Select GENERIC_PHY instead of depending on it (2014-08-28 
> 11:17:43 +0530)
> 
> 
> for_3.17-rc
> 
> Fix regressions to runtime PM on OMAP and other minor fixes.
> 
> 
> Kamil Debski (1):
>   MAINTAINERS: add entry for the Samsung USB2 PHY driver
> 
> Lee Jones (1):
>   phy: miphy365x: Select GENERIC_PHY instead of depending on it
> 
> Sjoerd Simons (1):
>   phy: exynos5-usbdrd: Add MODULE_DEVICE_TABLE entry
> 
> Tony Lindgren (2):
>   usb: phy: twl4030-usb: Fix regressions to runtime PM on omaps
>   usb: phy: twl4030-usb: Fix lost interrupts after ID pin goes down
> 
>  MAINTAINERS  |   13 
>  drivers/phy/Kconfig  |2 +-
>  drivers/phy/phy-exynos5-usbdrd.c |1 +
>  drivers/phy/phy-twl4030-usb.c|  121 
> +++---
>  4 files changed, 88 insertions(+), 49 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: [RFC PATCH] netlink: Safer deletion of sk_bind_node

2014-09-02 Thread Harish Jenny Kandiga Nagaraj
If that is the case , then subscriptions of netlink_sock should have been 
updated after netlink_remove or netlink_release.
I don't see that happening.

On Wednesday 03 September 2014 12:22 AM, David Miller wrote:
> From: Harish Jenny Kandiga Nagaraj 
> Date: Tue, 2 Sep 2014 14:14:38 +0530
>
>> In one of our random test runs we observed the crash mentioned in the 
>> previous mail.
>>
>> After debugging we found out that the call flow of the inline and static 
>> functions were
>> netlink_release
>> -netlink_remove
>> -__sk_del_bind_node
>> --__hlist_del
>>
>> *pprev was NULL in __hlist_del function while deleting >sk_bind_node 
>> hlist_node. Hence the patch was given.
>>
>> In netlink_remove function , first the sk_del_node_init function will be 
>> called. This internally calls __sk_del_node_init function. While deleting 
>> >sk_node hlist_node using __sk_del_node function there is a NULL check 
>> with sk_hashed function.
>>
>> Why there is no NULL check for *pprev while deleting >sk_bind_node ?
> Because if ->subscriptions is non-zero, it must be on a list, and therefore
> pprev must be non-NULL.

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


Re: [RFC PATCH] pm: prevent suspend until power supply events are processed

2014-09-02 Thread Viresh Kumar
On Wed, Sep 3, 2014 at 10:09 AM, Viresh Kumar  wrote:
> Don't have Zoran's new email address, but probably other might have
> answers to my queries.

Got Zoran's email id finally :)

> I have just started with the power-supply framework a day or two back
> and so my understanding might not be good enough :)
>
> On Sat, Aug 3, 2013 at 2:08 AM, Zoran Markovic
>  wrote:
>> diff --git a/drivers/power/power_supply_core.c 
>> b/drivers/power/power_supply_core.c
>> index 3b2d5df..e68d598 100644
>> --- a/drivers/power/power_supply_core.c
>> +++ b/drivers/power/power_supply_core.c
>> @@ -67,23 +67,41 @@ static int __power_supply_changed_work(struct device 
>> *dev, void *data)
>>
>>  static void power_supply_changed_work(struct work_struct *work)
>>  {
>> +   unsigned long flags;
>> struct power_supply *psy = container_of(work, struct power_supply,
>> changed_work);
>>
>> dev_dbg(psy->dev, "%s\n", __func__);
>>
>> -   class_for_each_device(power_supply_class, NULL, psy,
>> - __power_supply_changed_work);
>> -
>> -   power_supply_update_leds(psy);
>> -
>> -   kobject_uevent(>dev->kobj, KOBJ_CHANGE);
>> +   spin_lock_irqsave(>changed_lock, flags);
>> +   if (psy->changed) {
>
> Can this be false here? We have reached here as the work was
> scheduled after setting it to true..
>
> Maybe a WARN_ON(psy->changed) is more sensible here ?
>
>> +   psy->changed = false;
>> +   spin_unlock_irqrestore(>changed_lock, flags);
>> +   class_for_each_device(power_supply_class, NULL, psy,
>> + __power_supply_changed_work);
>> +   power_supply_update_leds(psy);
>> +   kobject_uevent(>dev->kobj, KOBJ_CHANGE);
>> +   spin_lock_irqsave(>changed_lock, flags);
>> +   }
>> +   /* dependent power supplies (e.g. battery) may have changed
>> +* state as a result of this event, so poll again and hold
>> +* the wakeup_source until all events are processed.
>> +*/
>> +   if (!psy->changed)
>> +   pm_relax(psy->dev);
>
> I got a bit confused here. Does the above comment say this:
>
> The supplies dependent on 'psy' may change states and that *may*
> change the state of 'psy' again? And so psy->changed is set to true
> again?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] f2fs: handle bug cases by letting fsck.f2fs initiate

2014-09-02 Thread Jaegeuk Kim
This patch adds to handle corner buggy cases for fsck.f2fs.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/segment.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 46586d3..853c8f5 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -317,6 +317,10 @@ static void __locate_dirty_segment(struct f2fs_sb_info 
*sbi, unsigned int segno,
struct seg_entry *sentry = get_seg_entry(sbi, segno);
enum dirty_type t = sentry->type;
 
+   if (unlikely(t >= DIRTY)) {
+   f2fs_bug_on(sbi, 1);
+   return;
+   }
if (!test_and_set_bit(segno, dirty_i->dirty_segmap[t]))
dirty_i->nr_dirty[t]++;
}
@@ -1745,8 +1749,12 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
break;
offset = segno + 1;
valid_blocks = get_valid_blocks(sbi, segno, 0);
-   if (valid_blocks >= sbi->blocks_per_seg || !valid_blocks)
+   if (valid_blocks == sbi->blocks_per_seg || !valid_blocks)
continue;
+   if (valid_blocks > sbi->blocks_per_seg) {
+   f2fs_bug_on(sbi, 1);
+   continue;
+   }
mutex_lock(_i->seglist_lock);
__locate_dirty_segment(sbi, segno, DIRTY);
mutex_unlock(_i->seglist_lock);
-- 
1.8.5.2 (Apple Git-48)

--
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/6] f2fs: introduce F2FS_I_SB, F2FS_M_SB, and F2FS_P_SB

2014-09-02 Thread Jaegeuk Kim
This patch adds three inline functions to clean up dirty casting codes.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c | 18 +++---
 fs/f2fs/data.c   | 31 ++-
 fs/f2fs/dir.c| 13 +
 fs/f2fs/f2fs.h   | 23 +++
 fs/f2fs/file.c   | 20 ++--
 fs/f2fs/inline.c | 13 +
 fs/f2fs/inode.c  |  8 
 fs/f2fs/namei.c  | 21 ++---
 fs/f2fs/node.c   | 43 +--
 fs/f2fs/node.h   |  3 +--
 fs/f2fs/recovery.c   |  2 +-
 fs/f2fs/segment.c| 14 ++
 fs/f2fs/segment.h|  2 +-
 fs/f2fs/xattr.c  |  6 +++---
 14 files changed, 103 insertions(+), 114 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index ec3b7a5..cb5cb4c 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -151,8 +151,7 @@ out:
 static int f2fs_write_meta_page(struct page *page,
struct writeback_control *wbc)
 {
-   struct inode *inode = page->mapping->host;
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_P_SB(page);
 
trace_f2fs_writepage(page, META);
 
@@ -177,7 +176,7 @@ redirty_out:
 static int f2fs_write_meta_pages(struct address_space *mapping,
struct writeback_control *wbc)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_M_SB(mapping);
long diff, written;
 
trace_f2fs_writepages(mapping->host, wbc, META);
@@ -259,15 +258,12 @@ continue_unlock:
 
 static int f2fs_set_meta_page_dirty(struct page *page)
 {
-   struct address_space *mapping = page->mapping;
-   struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
-
trace_f2fs_set_page_dirty(page, META);
 
SetPageUptodate(page);
if (!PageDirty(page)) {
__set_page_dirty_nobuffers(page);
-   inc_page_count(sbi, F2FS_DIRTY_META);
+   inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_META);
return 1;
}
return 0;
@@ -619,7 +615,7 @@ fail_no_cp:
 
 static int __add_dirty_inode(struct inode *inode, struct dir_inode_entry *new)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 
if (is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR))
return -EEXIST;
@@ -633,7 +629,7 @@ static int __add_dirty_inode(struct inode *inode, struct 
dir_inode_entry *new)
 
 void set_dirty_dir_page(struct inode *inode, struct page *page)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct dir_inode_entry *new;
int ret = 0;
 
@@ -656,7 +652,7 @@ void set_dirty_dir_page(struct inode *inode, struct page 
*page)
 
 void add_dirty_dir_inode(struct inode *inode)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct dir_inode_entry *new =
f2fs_kmem_cache_alloc(inode_entry_slab, GFP_NOFS);
int ret = 0;
@@ -674,7 +670,7 @@ void add_dirty_dir_inode(struct inode *inode)
 
 void remove_dirty_dir_inode(struct inode *inode)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct dir_inode_entry *entry;
 
if (!S_ISDIR(inode->i_mode))
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 76de83e..8eb6fca 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -236,7 +236,7 @@ static void __set_data_blkaddr(struct dnode_of_data *dn, 
block_t new_addr)
 
 int reserve_new_block(struct dnode_of_data *dn)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode);
 
if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC)))
return -EPERM;
@@ -396,7 +396,6 @@ end_update:
 
 struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
struct address_space *mapping = inode->i_mapping;
struct dnode_of_data dn;
struct page *page;
@@ -429,7 +428,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t 
index, bool sync)
return page;
}
 
-   err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr,
+   err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, dn.data_blkaddr,
sync ? READ_SYNC : READA);
if (err)
return ERR_PTR(err);
@@ -451,7 +450,6 @@ struct page *find_data_page(struct inode *inode, pgoff_t 
index, bool sync)
  */
 struct page *get_lock_data_page(struct inode *inode, pgoff_t index)
 {
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
struct address_space *mapping = 

[PATCH 3/6] f2fs: need fsck.f2fs when f2fs_bug_on is triggered

2014-09-02 Thread Jaegeuk Kim
If any f2fs_bug_on is triggered, fsck.f2fs is needed.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c |  6 +++---
 fs/f2fs/data.c   |  4 ++--
 fs/f2fs/dir.c|  4 ++--
 fs/f2fs/f2fs.h   | 26 ++-
 fs/f2fs/file.c   |  2 +-
 fs/f2fs/inline.c |  4 ++--
 fs/f2fs/inode.c  |  2 +-
 fs/f2fs/node.c   | 58 ++--
 fs/f2fs/recovery.c   |  8 
 fs/f2fs/segment.c| 17 +++
 fs/f2fs/xattr.c  |  2 +-
 11 files changed, 70 insertions(+), 63 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 5af97d9..935a56e 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -374,7 +374,7 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
 void release_orphan_inode(struct f2fs_sb_info *sbi)
 {
spin_lock(>ino_lock[ORPHAN_INO]);
-   f2fs_bug_on(sbi->n_orphans == 0);
+   f2fs_bug_on(sbi, sbi->n_orphans == 0);
sbi->n_orphans--;
spin_unlock(>ino_lock[ORPHAN_INO]);
 }
@@ -394,7 +394,7 @@ void remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t 
ino)
 static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 {
struct inode *inode = f2fs_iget(sbi->sb, ino);
-   f2fs_bug_on(IS_ERR(inode));
+   f2fs_bug_on(sbi, IS_ERR(inode));
clear_nlink(inode);
 
/* truncate all the data during iput */
@@ -455,7 +455,7 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, 
block_t start_blk)
list_for_each_entry(orphan, head, list) {
if (!page) {
page = find_get_page(META_MAPPING(sbi), start_blk++);
-   f2fs_bug_on(!page);
+   f2fs_bug_on(sbi, !page);
orphan_blk =
(struct f2fs_orphan_block *)page_address(page);
memset(orphan_blk, 0, sizeof(*orphan_blk));
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8eb6fca..64d8550 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -258,7 +258,7 @@ int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t 
index)
int err;
 
/* if inode_page exists, index should be zero */
-   f2fs_bug_on(!need_put && index);
+   f2fs_bug_on(F2FS_I_SB(dn->inode), !need_put && index);
 
err = get_dnode_of_data(dn, index, ALLOC_NODE);
if (err)
@@ -321,7 +321,7 @@ void update_extent_cache(block_t blk_addr, struct 
dnode_of_data *dn)
block_t start_blkaddr, end_blkaddr;
int need_update = true;
 
-   f2fs_bug_on(blk_addr == NEW_ADDR);
+   f2fs_bug_on(F2FS_I_SB(dn->inode), blk_addr == NEW_ADDR);
fofs = start_bidx_of_node(ofs_of_node(dn->node_page), fi) +
dn->ofs_in_node;
 
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index c242904..f1ceeb2 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -126,7 +126,7 @@ static struct f2fs_dir_entry *find_in_block(struct page 
*dentry_page,
 * For the most part, it should be a bug when name_len is zero.
 * We stop here for figuring out where the bugs has occurred.
 */
-   f2fs_bug_on(!de->name_len);
+   f2fs_bug_on(F2FS_P_SB(dentry_page), !de->name_len);
 
bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len));
}
@@ -151,7 +151,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode 
*dir,
bool room = false;
int max_slots = 0;
 
-   f2fs_bug_on(level > MAX_DIR_HASH_DEPTH);
+   f2fs_bug_on(F2FS_I_SB(dir), level > MAX_DIR_HASH_DEPTH);
 
nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level);
nblock = bucket_blocks(level);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 210c62d..b389ced 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -21,10 +21,16 @@
 #include 
 
 #ifdef CONFIG_F2FS_CHECK_FS
-#define f2fs_bug_on(condition) BUG_ON(condition)
+#define f2fs_bug_on(sbi, condition)BUG_ON(condition)
 #define f2fs_down_write(x, y)  down_write_nest_lock(x, y)
 #else
-#define f2fs_bug_on(condition) WARN_ON(condition)
+#define f2fs_bug_on(sbi, condition)\
+   do {\
+   if (unlikely(condition)) {  \
+   WARN_ON(1); \
+   sbi->need_fsck = true;  \
+   }   \
+   } while (0)
 #define f2fs_down_write(x, y)  down_write(x)
 #endif
 
@@ -719,8 +725,8 @@ static inline void dec_valid_block_count(struct 
f2fs_sb_info *sbi,
blkcnt_t count)
 {
spin_lock(>stat_lock);
-   f2fs_bug_on(sbi->total_valid_block_count < (block_t) count);
-   f2fs_bug_on(inode->i_blocks < count);
+   

[PATCH 6/6] f2fs: need fsck.f2fs if the recovery was failed

2014-09-02 Thread Jaegeuk Kim
If the roll-forward recovery was failed, we'd better conduct fsck.f2fs.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a692304..3275e73 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1083,6 +1083,9 @@ try_onemore:
if (err)
goto free_proc;
 
+   if (!retry)
+   sbi->need_fsck = true;
+
/* recover fsynced data */
if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) {
err = recover_fsync_data(sbi);
-- 
1.8.5.2 (Apple Git-48)

--
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/6] f2fs: add BUG cases to initiate fsck.f2fs

2014-09-02 Thread Jaegeuk Kim
This patch replaces BUG cases with f2fs_bug_on to remain fsck.f2fs information.
And it implements some void functions to initiate fsck.f2fs too.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/segment.c |  4 ++--
 fs/f2fs/segment.h | 38 +++---
 2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index abfbbca..46586d3 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -526,10 +526,10 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, 
block_t blkaddr, int del)
/* Update valid block bitmap */
if (del > 0) {
if (f2fs_set_bit(offset, se->cur_valid_map))
-   BUG();
+   f2fs_bug_on(sbi, 1);
} else {
if (!f2fs_clear_bit(offset, se->cur_valid_map))
-   BUG();
+   f2fs_bug_on(sbi, 1);
}
if (!f2fs_test_bit(offset, se->ckpt_valid_map))
se->ckpt_valid_blocks += del;
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 793ca27..d163fc8 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -583,9 +583,41 @@ static inline void check_block_count(struct f2fs_sb_info 
*sbi,
BUG_ON(GET_SIT_VBLOCKS(raw_sit) != valid_blocks);
 }
 #else
-#define check_seg_range(sbi, segno)
-#define verify_block_addr(sbi, blk_addr)
-#define check_block_count(sbi, segno, raw_sit)
+static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int 
segno)
+{
+   unsigned int end_segno = SM_I(sbi)->segment_count - 1;
+
+   if (segno > end_segno)
+   sbi->need_fsck = true;
+}
+
+static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t 
blk_addr)
+{
+   struct f2fs_sm_info *sm_info = SM_I(sbi);
+   block_t total_blks = sm_info->segment_count << sbi->log_blocks_per_seg;
+   block_t start_addr = sm_info->seg0_blkaddr;
+   block_t end_addr = start_addr + total_blks - 1;
+
+   if (blk_addr < start_addr || blk_addr > end_addr)
+   sbi->need_fsck = true;
+}
+
+/*
+ * Summary block is always treated as an invalid block
+ */
+static inline void check_block_count(struct f2fs_sb_info *sbi,
+   int segno, struct f2fs_sit_entry *raw_sit)
+{
+   unsigned int end_segno = SM_I(sbi)->segment_count - 1;
+
+   /* check segment usage */
+   if (GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg)
+   sbi->need_fsck = true;
+
+   /* check boundary of a given segment number */
+   if (segno > end_segno)
+   sbi->need_fsck = true;
+}
 #endif
 
 static inline pgoff_t current_sit_addr(struct f2fs_sb_info *sbi,
-- 
1.8.5.2 (Apple Git-48)

--
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] fs/super.c: do not shrink fs slab during direct memory reclaim

2014-09-02 Thread Dave Chinner
On Wed, Sep 03, 2014 at 12:21:24PM +0800, Junxiao Bi wrote:
> On 09/03/2014 11:10 AM, Dave Chinner wrote:
> > On Wed, Sep 03, 2014 at 09:38:31AM +0800, Junxiao Bi wrote:
> >> Hi Jiufei,
> >>
> >> On 09/02/2014 05:03 PM, Xue jiufei wrote:
> >>> Hi, Dave
> >>> On 2014/9/2 7:51, Dave Chinner wrote:
>  On Fri, Aug 29, 2014 at 05:57:22PM +0800, Xue jiufei wrote:
> > The patch trys to solve one deadlock problem caused by cluster
> > fs, like ocfs2. And the problem may happen at least in the below
> > situations:
> > 1)Receiving a connect message from other nodes, node queues a
> > work_struct o2net_listen_work.
> > 2)o2net_wq processes this work and calls sock_alloc() to allocate
> > memory for a new socket.
> > 3)It would do direct memory reclaim when available memory is not
> > enough and trigger the inode cleanup. That inode being cleaned up
> > is happened to be ocfs2 inode, so call evict()->ocfs2_evict_inode()
> > ->ocfs2_drop_lock()->dlmunlock()->o2net_send_message_vec(),
> > and wait for the unlock response from master.
> > 4)tcp layer received the response, call o2net_data_ready() and
> > queue sc_rx_work, waiting o2net_wq to process this work.
> > 5)o2net_wq is a single thread workqueue, it process the work one by
> > one. Right now it is still doing o2net_listen_work and cannot handle
> > sc_rx_work. so we deadlock.
> >
> > It is impossible to set GFP_NOFS for memory allocation in sock_alloc().
> > So we use PF_FSTRANS to avoid the task reentering filesystem when
> > available memory is not enough.
> >
> > Signed-off-by: joyce.xue 
> 
>  For the second time: use memalloc_noio_save/memalloc_noio_restore.
>  And please put a great big comment in the code explaining why you
>  need to do this special thing with memory reclaim flags.
> 
>  Cheers,
> 
>  Dave.
> 
> >>> Thanks for your reply. But I am afraid that memalloc_noio_save/
> >>> memalloc_noio_restore can not solve my problem. __GFP_IO is cleared
> >>> if PF_MEMALLOC_NOIO is set and can avoid doing IO in direct memory
> >>> reclaim. However, __GFP_FS is still set that can not avoid pruning
> >>> dcache and icache in memory allocation, resulting in the deadlock I
> >>> described.
> >>
> >> You can use PF_MEMALLOC_NOIO to replace PF_FSTRANS, set this flag in
> >> ocfs2 and check it in sb shrinker.
> > 
> > No changes to the superblock shrinker, please. The flag should
> > modify the gfp_mask in the struct shrink_control passed to the
> > shrinker, just like the noio flag is used in the rest of the mm
> > code.
> __GFP_FS seemed imply __GFP_IO,

Now you are starting to understand. Check what GFP_NOIO actually
means, then tell me why memalloc_noio_flags() is not fully correct,
needs fixing, and needs to be applied to all of reclaim.

Hint: there's a heirarchy involved

> can superblock shrinker check
> !(sc->gfp_mask & __GFP_IO) and stop?

No. Go back and read what I said about the initial setting of
sc->gfp_mask.

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/6] f2fs: remain inconsistency information to initiate fsck.f2fs

2014-09-02 Thread Jaegeuk Kim
This patch adds sbi->need_fsck to conduct fsck.f2fs later.
This flag is only able to be removed by fsck.f2fs.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c| 3 +++
 fs/f2fs/f2fs.h  | 1 +
 fs/f2fs/super.c | 1 +
 include/linux/f2fs_fs.h | 1 +
 4 files changed, 6 insertions(+)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index cb5cb4c..5af97d9 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -882,6 +882,9 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool 
is_umount)
else
clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);
 
+   if (sbi->need_fsck)
+   set_ckpt_flags(ckpt, CP_FSCK_FLAG);
+
/* update SIT/NAT bitmap */
get_sit_bitmap(sbi, __bitmap_ptr(sbi, SIT_BITMAP));
get_nat_bitmap(sbi, __bitmap_ptr(sbi, NAT_BITMAP));
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 222ff5b..210c62d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -434,6 +434,7 @@ struct f2fs_sb_info {
struct buffer_head *raw_super_buf;  /* buffer head of raw sb */
struct f2fs_super_block *raw_super; /* raw super block pointer */
int s_dirty;/* dirty flag for checkpoint */
+   bool need_fsck; /* need fsck.f2fs to fix */
 
/* for node-related operations */
struct f2fs_nm_info *nm_info;   /* node manager */
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 41bdf51..a692304 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -849,6 +849,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
atomic_set(>nr_pages[i], 0);
 
sbi->dir_level = DEF_DIR_LEVEL;
+   sbi->need_fsck = false;
 }
 
 /*
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 08ed2b0..9ca1ff3 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -85,6 +85,7 @@ struct f2fs_super_block {
 /*
  * For checkpoint
  */
+#define CP_FSCK_FLAG   0x0010
 #define CP_ERROR_FLAG  0x0008
 #define CP_COMPACT_SUM_FLAG0x0004
 #define CP_ORPHAN_PRESENT_FLAG 0x0002
-- 
1.8.5.2 (Apple Git-48)

--
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] V4L: uvcvideo: Add support for pan/tilt speed controls

2014-09-02 Thread Pawel Osciak
On Wed, Jul 9, 2014 at 8:49 AM, Vincent Palatin  wrote:
> Map V4L2_CID_TILT_SPEED and V4L2_CID_PAN_SPEED to the standard UVC
> CT_PANTILT_RELATIVE_CONTROL terminal control request.
>
> Tested by plugging a Logitech ConferenceCam C3000e USB camera
> and controlling pan/tilt from the userspace using the VIDIOC_S_CTRL ioctl.
> Verified that it can pan and tilt at the same time in both directions.
>
> Signed-off-by: Vincent Palatin 

Reviewed-by: Pawel Osciak 

> Change-Id: I7b70b228e5c0126683f5f0be34ffd2807f5783dc
> ---
>  drivers/media/usb/uvc/uvc_ctrl.c | 58 
> +---
>  1 file changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c 
> b/drivers/media/usb/uvc/uvc_ctrl.c
> index 0eb82106..d703cb0 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -309,9 +309,8 @@ static struct uvc_control_info uvc_ctrls[] = {
> .selector   = UVC_CT_PANTILT_RELATIVE_CONTROL,
> .index  = 12,
> .size   = 4,
> -   .flags  = UVC_CTRL_FLAG_SET_CUR | 
> UVC_CTRL_FLAG_GET_MIN
> -   | UVC_CTRL_FLAG_GET_MAX | 
> UVC_CTRL_FLAG_GET_RES
> -   | UVC_CTRL_FLAG_GET_DEF
> +   .flags  = UVC_CTRL_FLAG_SET_CUR
> +   | UVC_CTRL_FLAG_GET_RANGE
> | UVC_CTRL_FLAG_AUTO_UPDATE,
> },
> {
> @@ -391,6 +390,35 @@ static void uvc_ctrl_set_zoom(struct uvc_control_mapping 
> *mapping,
> data[2] = min((int)abs(value), 0xff);
>  }
>
> +static __s32 uvc_ctrl_get_rel_speed(struct uvc_control_mapping *mapping,
> +   __u8 query, const __u8 *data)
> +{
> +   int first = mapping->offset / 8;
> +   __s8 rel = (__s8)data[first];
> +
> +   switch (query) {
> +   case UVC_GET_CUR:
> +   return (rel == 0) ? 0 : (rel > 0 ? data[first+1]
> +: -data[first+1]);
> +   case UVC_GET_MIN:
> +   return -data[first+1];
> +   case UVC_GET_MAX:
> +   case UVC_GET_RES:
> +   case UVC_GET_DEF:
> +   default:
> +   return data[first+1];
> +   }
> +}
> +
> +static void uvc_ctrl_set_rel_speed(struct uvc_control_mapping *mapping,
> +   __s32 value, __u8 *data)
> +{
> +   int first = mapping->offset / 8;
> +
> +   data[first] = value == 0 ? 0 : (value > 0) ? 1 : 0xff;
> +   data[first+1] = min_t(int, abs(value), 0xff);
> +}
> +
>  static struct uvc_control_mapping uvc_ctrl_mappings[] = {
> {
> .id = V4L2_CID_BRIGHTNESS,
> @@ -677,6 +705,30 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
> .data_type  = UVC_CTRL_DATA_TYPE_SIGNED,
> },
> {
> +   .id = V4L2_CID_PAN_SPEED,
> +   .name   = "Pan (Speed)",
> +   .entity = UVC_GUID_UVC_CAMERA,
> +   .selector   = UVC_CT_PANTILT_RELATIVE_CONTROL,
> +   .size   = 16,
> +   .offset = 0,
> +   .v4l2_type  = V4L2_CTRL_TYPE_INTEGER,
> +   .data_type  = UVC_CTRL_DATA_TYPE_SIGNED,
> +   .get= uvc_ctrl_get_rel_speed,
> +   .set= uvc_ctrl_set_rel_speed,
> +   },
> +   {
> +   .id = V4L2_CID_TILT_SPEED,
> +   .name   = "Tilt (Speed)",
> +   .entity = UVC_GUID_UVC_CAMERA,
> +   .selector   = UVC_CT_PANTILT_RELATIVE_CONTROL,
> +   .size   = 16,
> +   .offset = 16,
> +   .v4l2_type  = V4L2_CTRL_TYPE_INTEGER,
> +   .data_type  = UVC_CTRL_DATA_TYPE_SIGNED,
> +   .get= uvc_ctrl_get_rel_speed,
> +   .set= uvc_ctrl_set_rel_speed,
> +   },
> +   {
> .id = V4L2_CID_PRIVACY,
> .name   = "Privacy",
> .entity = UVC_GUID_UVC_CAMERA,
> --
> 2.0.0.526.g5318336
>
--
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 1/2] [media] V4L: Add camera pan/tilt speed controls

2014-09-02 Thread Pawel Osciak
On Sat, Aug 16, 2014 at 4:08 AM, Vincent Palatin  wrote:
>
> The V4L2_CID_PAN_SPEED and V4L2_CID_TILT_SPEED controls allow to move the
> camera by setting its rotation speed around its axis.
>
> Signed-off-by: Vincent Palatin 

Reviewed-by: Pawel Osciak 

>
> ---
> Changes from v1:
> - update the documentation wording according to Pawel suggestion.
>
>  Documentation/DocBook/media/v4l/compat.xml   | 10 ++
>  Documentation/DocBook/media/v4l/controls.xml | 21 +
>  drivers/media/v4l2-core/v4l2-ctrls.c |  2 ++
>  include/uapi/linux/v4l2-controls.h   |  2 ++
>  4 files changed, 35 insertions(+)
>
> diff --git a/Documentation/DocBook/media/v4l/compat.xml 
> b/Documentation/DocBook/media/v4l/compat.xml
> index eee6f0f..21910e9 100644
> --- a/Documentation/DocBook/media/v4l/compat.xml
> +++ b/Documentation/DocBook/media/v4l/compat.xml
> @@ -2545,6 +2545,16 @@ fields changed from _s32 to _u32.
>
>  
>
> +
> +  V4L2 in Linux 3.17

This will need a bump.

>
> +  
> +   
> + Added V4L2_CID_PAN_SPEED and
> + V4L2_CID_TILT_SPEED camera controls.
> +   
> +  
> +
> +
>  
>Relation of V4L2 to other Linux multimedia APIs
>
> diff --git a/Documentation/DocBook/media/v4l/controls.xml 
> b/Documentation/DocBook/media/v4l/controls.xml
> index 47198ee..be88e64 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -3914,6 +3914,27 @@ by exposure, white balance or focus controls.
>   
>   
>
> + 
> +spanname="id">V4L2_CID_PAN_SPEED
> +   integer
> + This control turns the
> +camera horizontally at the specific speed. The unit is undefined. A
> +positive value moves the camera to the right (clockwise when viewed
> +from above), a negative value to the left. A value of zero stops the motion
> +if one is in progress and has no effect otherwise.
> + 
> + 
> +
> + 
> +spanname="id">V4L2_CID_TILT_SPEED
> +   integer
> + This control turns the
> +camera vertically at the specified speed. The unit is undefined. A
> +positive value moves the camera up, a negative value down. A value of zero
> +stops the motion if one is in progress and has no effect otherwise.
> + 
> + 
> +
> 
>
>  
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
> b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 55c6832..57ddaf4 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -787,6 +787,8 @@ const char *v4l2_ctrl_get_name(u32 id)
> case V4L2_CID_AUTO_FOCUS_STOP:  return "Auto Focus, Stop";
> case V4L2_CID_AUTO_FOCUS_STATUS:return "Auto Focus, Status";
> case V4L2_CID_AUTO_FOCUS_RANGE: return "Auto Focus, Range";
> +   case V4L2_CID_PAN_SPEED:return "Pan, Speed";
> +   case V4L2_CID_TILT_SPEED:   return "Tilt, Speed";
>
> /* FM Radio Modulator control */
> /* Keep the order of the 'case's the same as in videodev2.h! */
> diff --git a/include/uapi/linux/v4l2-controls.h 
> b/include/uapi/linux/v4l2-controls.h
> index 2ac5597..5576044 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -745,6 +745,8 @@ enum v4l2_auto_focus_range {
> V4L2_AUTO_FOCUS_RANGE_INFINITY  = 3,
>  };
>
> +#define V4L2_CID_PAN_SPEED 
> (V4L2_CID_CAMERA_CLASS_BASE+32)
> +#define V4L2_CID_TILT_SPEED
> (V4L2_CID_CAMERA_CLASS_BASE+33)
>
>  /* FM Modulator class control IDs */
>
> --
> 2.1.0.rc2.206.gedb03e5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH] pm: prevent suspend until power supply events are processed

2014-09-02 Thread Viresh Kumar
Don't have Zoran's new email address, but probably other might have
answers to my queries.

I have just started with the power-supply framework a day or two back
and so my understanding might not be good enough :)

On Sat, Aug 3, 2013 at 2:08 AM, Zoran Markovic
 wrote:
> diff --git a/drivers/power/power_supply_core.c 
> b/drivers/power/power_supply_core.c
> index 3b2d5df..e68d598 100644
> --- a/drivers/power/power_supply_core.c
> +++ b/drivers/power/power_supply_core.c
> @@ -67,23 +67,41 @@ static int __power_supply_changed_work(struct device 
> *dev, void *data)
>
>  static void power_supply_changed_work(struct work_struct *work)
>  {
> +   unsigned long flags;
> struct power_supply *psy = container_of(work, struct power_supply,
> changed_work);
>
> dev_dbg(psy->dev, "%s\n", __func__);
>
> -   class_for_each_device(power_supply_class, NULL, psy,
> - __power_supply_changed_work);
> -
> -   power_supply_update_leds(psy);
> -
> -   kobject_uevent(>dev->kobj, KOBJ_CHANGE);
> +   spin_lock_irqsave(>changed_lock, flags);
> +   if (psy->changed) {

Can this be false here? We have reached here as the work was
scheduled after setting it to true..

Maybe a WARN_ON(psy->changed) is more sensible here ?

> +   psy->changed = false;
> +   spin_unlock_irqrestore(>changed_lock, flags);
> +   class_for_each_device(power_supply_class, NULL, psy,
> + __power_supply_changed_work);
> +   power_supply_update_leds(psy);
> +   kobject_uevent(>dev->kobj, KOBJ_CHANGE);
> +   spin_lock_irqsave(>changed_lock, flags);
> +   }
> +   /* dependent power supplies (e.g. battery) may have changed
> +* state as a result of this event, so poll again and hold
> +* the wakeup_source until all events are processed.
> +*/
> +   if (!psy->changed)
> +   pm_relax(psy->dev);

I got a bit confused here. Does the above comment say this:

The supplies dependent on 'psy' may change states and that *may*
change the state of 'psy' again? And so psy->changed is set to true
again?
--
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] f2fs bug fixes for v3.17-rc4

2014-09-02 Thread Jaegeuk Kim
Hi Linus,

This is a pull request on the f2fs bug fixes for v3.17-rc4.
Most of things are related to recovery and error handling routines.
Please pull these patches.

Thank you very much,

The following changes since commit 63d871cb0b9e4207044ced0322aa34d859fa463d:

  Merge tag 'md/3.17-fixes' of git://neil.brown.name/md (2014-08-19 09:47:01 
-0500)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git 
tags/for-f2fs-3.17-rc4

for you to fetch changes up to b73e52824c8920a5ff754e3c8ff68466a7dd61f9:

  f2fs: reposition unlock_new_inode to prevent accessing invalid inode 
(2014-09-02 00:22:24 -0700)


f2fs bug fixes for 3.17-rc4

This series includes patches to:
 o fix recovery routines
 o fix bugs related to inline_data/xattr
 o fix when casting the dentry names
 o handle EIO or ENOMEM correctly
 o fix memory leak
 o fix lock coverage


Chao Yu (4):
  f2fs: fix incorrect calculation with total/free inode num
  f2fs: introduce need_do_checkpoint for readability
  f2fs: use macro for code readability
  f2fs: reposition unlock_new_inode to prevent accessing invalid inode

Dan Carpenter (1):
  f2fs: simplify by using a literal

Jaegeuk Kim (22):
  f2fs: should convert inline_data during the mkwrite
  f2fs: make clear on test condition and return types
  f2fs: fix the initial inode page for recovery
  f2fs: clear FI_INC_LINK during the recovery
  f2fs: should clear the inline_xattr flag
  f2fs: fix to recover inline_xattr/data and blocks
  f2fs: avoid bug_on when error is occurred
  f2fs: don't skip checkpoint if there is no dirty node pages
  f2fs: trigger release_dirty_inode in f2fs_put_super
  f2fs: give a chance to mount again when encountering errors
  f2fs: introduce f2fs_cp_error for readability
  f2fs: unlock_page when node page is redirtied out
  f2fs: check s_dirty under cp_mutex
  f2fs: handle EIO not to break fs consistency
  f2fs: add WARN_ON in f2fs_bug_on
  f2fs: prevent checkpoint during roll-forward
  f2fs: avoid double lock in truncate_blocks
  f2fs: remove rewrite_node_page
  f2fs: skip if inline_data was converted already
  f2fs: remove rename and use rename2
  f2fs: truncate stale block for inline_data
  f2fs: fix wrong casting for dentry name

arter97 (1):
  f2fs: fix typo

 fs/f2fs/Kconfig |  4 +--
 fs/f2fs/checkpoint.c| 80 +++--
 fs/f2fs/data.c  | 19 
 fs/f2fs/debug.c |  4 +--
 fs/f2fs/dir.c   |  6 ++--
 fs/f2fs/f2fs.h  | 26 
 fs/f2fs/file.c  | 60 +++--
 fs/f2fs/gc.c|  8 ++---
 fs/f2fs/gc.h|  2 +-
 fs/f2fs/hash.c  |  7 +++--
 fs/f2fs/inline.c| 38 +--
 fs/f2fs/namei.c | 23 --
 fs/f2fs/node.c  | 80 +++--
 fs/f2fs/recovery.c  | 30 ++-
 fs/f2fs/segment.c   | 53 ++--
 fs/f2fs/segment.h   |  2 +-
 fs/f2fs/super.c | 32 ++--
 fs/f2fs/xattr.c |  2 +-
 include/linux/f2fs_fs.h | 16 --
 19 files changed, 261 insertions(+), 231 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: Bogus error in checkpatch.pl

2014-09-02 Thread Pranith Kumar
Hi Joe,

On Wed, Sep 3, 2014 at 12:25 AM, Joe Perches  wrote:
>
> You need to use parentheses around the description like:
> commit  ("commit description")
>
> For your case:
>
> Commit 615cc2c9cf95 ("Documentation/memory-barriers.txt: fix important
> typo re memory barriers")
>

Ah, OK. But the error message does not say anything about missing
paranetheses and only stresses on chars in the id:

$ ./scripts/checkpatch.pl
patch_dir/0001-doc-memory-barriers.txt-Correct-example-for-reorderi.patch
ERROR: Please use 12 or more chars for the git commit ID like: 'Commit
615cc2c9cf95 ("Documentation/memory-barriers.txt: fix important typo
re memory barriers")'
#8:
Commit 615cc2c9cf95 "Documentation/memory-barriers.txt: fix important typo re


Is it possible to make it a bit clearer, perhaps?

Thanks!
-- 
Pranith
--
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: Bogus error in checkpatch.pl

2014-09-02 Thread Joe Perches
On Wed, 2014-09-03 at 00:03 -0400, Pranith Kumar wrote:
> I receive an ERROR when running checkpatch.pl on a patch containing
> the following line:
> 
> Commit 615cc2c9cf95 "Documentation/memory-barriers.txt: fix important typo re
> 
> saying that the commit ID should be 12 or more characters when the
> commit ID is indeed 12 characters. I tried fixing it, but my perl is
> not up-to-par.

You need to use parentheses around the description like:
commit  ("commit description")

For your case:

Commit 615cc2c9cf95 ("Documentation/memory-barriers.txt: fix important
typo re memory barriers")




--
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] fs/super.c: do not shrink fs slab during direct memory reclaim

2014-09-02 Thread Junxiao Bi
On 09/03/2014 11:10 AM, Dave Chinner wrote:
> On Wed, Sep 03, 2014 at 09:38:31AM +0800, Junxiao Bi wrote:
>> Hi Jiufei,
>>
>> On 09/02/2014 05:03 PM, Xue jiufei wrote:
>>> Hi, Dave
>>> On 2014/9/2 7:51, Dave Chinner wrote:
 On Fri, Aug 29, 2014 at 05:57:22PM +0800, Xue jiufei wrote:
> The patch trys to solve one deadlock problem caused by cluster
> fs, like ocfs2. And the problem may happen at least in the below
> situations:
> 1)Receiving a connect message from other nodes, node queues a
> work_struct o2net_listen_work.
> 2)o2net_wq processes this work and calls sock_alloc() to allocate
> memory for a new socket.
> 3)It would do direct memory reclaim when available memory is not
> enough and trigger the inode cleanup. That inode being cleaned up
> is happened to be ocfs2 inode, so call evict()->ocfs2_evict_inode()
> ->ocfs2_drop_lock()->dlmunlock()->o2net_send_message_vec(),
> and wait for the unlock response from master.
> 4)tcp layer received the response, call o2net_data_ready() and
> queue sc_rx_work, waiting o2net_wq to process this work.
> 5)o2net_wq is a single thread workqueue, it process the work one by
> one. Right now it is still doing o2net_listen_work and cannot handle
> sc_rx_work. so we deadlock.
>
> It is impossible to set GFP_NOFS for memory allocation in sock_alloc().
> So we use PF_FSTRANS to avoid the task reentering filesystem when
> available memory is not enough.
>
> Signed-off-by: joyce.xue 

 For the second time: use memalloc_noio_save/memalloc_noio_restore.
 And please put a great big comment in the code explaining why you
 need to do this special thing with memory reclaim flags.

 Cheers,

 Dave.

>>> Thanks for your reply. But I am afraid that memalloc_noio_save/
>>> memalloc_noio_restore can not solve my problem. __GFP_IO is cleared
>>> if PF_MEMALLOC_NOIO is set and can avoid doing IO in direct memory
>>> reclaim. However, __GFP_FS is still set that can not avoid pruning
>>> dcache and icache in memory allocation, resulting in the deadlock I
>>> described.
>>
>> You can use PF_MEMALLOC_NOIO to replace PF_FSTRANS, set this flag in
>> ocfs2 and check it in sb shrinker.
> 
> No changes to the superblock shrinker, please. The flag should
> modify the gfp_mask in the struct shrink_control passed to the
> shrinker, just like the noio flag is used in the rest of the mm
> code.
__GFP_FS seemed imply __GFP_IO, can superblock shrinker check
!(sc->gfp_mask & __GFP_IO) and stop?

Thanks,
Junxiao.
> 
> Cheers,
> 
> Dave.
> 

--
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] blk-merge: fix blk_recount_segments

2014-09-02 Thread Ming Lei
On Tue, 02 Sep 2014 10:24:24 -0600
Jens Axboe  wrote:

> On 09/02/2014 10:21 AM, Christoph Hellwig wrote:
> > Btw, one thing we should reconsider is where we set
> > QUEUE_FLAG_NO_SG_MERGE.  At least for virtio-blk it seems to me that
> > doing the S/G merge should be a lot cheaper than fanning out into the
> > indirect descriptors.

Indirect is always considered first no matter SG merge is off or on,
at least from current virtio-blk implementation.

But it is a good idea to try direct descriptor first, the below simple
change can improve randread(libaio, O_DIRECT, multi-queue) 7% in my test,
and 77% transfer starts to use direct descriptor, and almost all transfer
uses indirect descriptor only in current upstream implementation.

>From 8803341503dedab282c15f2801fdb6d7420cea6f Mon Sep 17 00:00:00 2001
From: Ming Lei 
Date: Wed, 3 Sep 2014 10:42:32 +0800
Subject: [PATCH] virtio_ring: use direct descriptor as far as possible

Direct descriptor can avoid one kmalloc() and should have
better cache utilization, so try to use it if there are enough
free direct descriptors.

Suggested-by: Christoph Hellwig 
Signed-off-by: Ming Lei 
---
 drivers/virtio/virtio_ring.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 4d08f45a..c76b7a4 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -224,9 +224,13 @@ static inline int virtqueue_add(struct virtqueue *_vq,
 
total_sg = total_in + total_out;
 
-   /* If the host supports indirect descriptor tables, and we have multiple
-* buffers, then go indirect. FIXME: tune this threshold */
-   if (vq->indirect && total_sg > 1 && vq->vq.num_free) {
+   /*
+* If the host supports indirect descriptor tables, and we have
+* multiple buffers, then go indirect only if free descriptors
+* are less than 16.
+*/
+   if (vq->indirect && total_sg > 1 && vq->vq.num_free &&
+   vq->vq.num_free < 16) {
head = vring_add_indirect(vq, sgs, next, total_sg, total_out,
  total_in,
  out_sgs, in_sgs, gfp);
-- 
1.7.9.5

 

> 
> And we might consider flipping the default, as most would probably like
> to have the sg merging on.
>

With this patch, I think SG merge can be kept as off at default if there is
no extra cost introduced for handling more segments by driver or HW.

If SG merge is changed to on in my above virtio-blk fio test, small throughput
drop can be observed. 


Thanks,
-- 
Ming Lei
--
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: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread Kuninori Morimoto

Hi Xiubo

> Yes your patch has fixed the bug Jyri has pointed out.
> 
> So I has discard my [PATCHv2 1/4] patch.
> 
> Please send your patch out to replace this one.
(snip)
> Please send it out of your local patch.
>
> Please also consider the ideas about Jyri, Jean-Francios, Varka and
> Takashi's advice as previous emails about my patch.

OK, will do.
To avoid confusion/conflict, I will post it after Mark applied it.
Because many simple-card patches are posted in these days...

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/


Re: [Xen-devel] [PATCH] Solved the Xen PV/KASLR riddle

2014-09-02 Thread Juergen Gross

On 09/02/2014 09:22 PM, Konrad Rzeszutek Wilk wrote:

On Mon, Sep 01, 2014 at 06:03:06AM +0200, Juergen Gross wrote:

On 08/29/2014 04:55 PM, Konrad Rzeszutek Wilk wrote:

On Fri, Aug 29, 2014 at 03:44:06PM +0100, Jan Beulich wrote:

On 29.08.14 at 16:27,  wrote:

Sure. Btw, someone also contacted me saying they have the same problem
without
changing the layout but having really big initrd (500M). While that feels
like
it should be impossible (if the kernel+initrd+xen stuff has to fix the 512M
kernel image size area then). But if it can happen, then surely it does
cause
mappings to be where the module space starts then.


Since the initrd doesn't really need to be mapped into the (limited)
virtual address space a pv guest starts with, we specifically got

/*
  * Whether or not the guest can deal with being passed an initrd not
  * mapped through its initial page tables.
  */
#define XEN_ELFNOTE_MOD_START_PFN 16

to deal with that situation. The hypervisor side for Dom0 is in place,
and the kernel side works in our (classic) kernels. Whether it got
implemented for DomU meanwhile I don't know; I'm pretty certain
pv-ops kernels don't support it so far.


Correct - Not implemented. Here is what I had mentioned in the past:
(see http://lists.xen.org/archives/html/xen-devel/2014-03/msg00580.html)


XEN_ELFNOTE_INIT_P2M, XEN_ELFNOTE_MOD_START_PFN - I had been looking
 at that but I can't figure out a nice way of implementing this
 without the usage of SPARSEMAP_VMAP virtual addresses - which is how
 the classic Xen does it. But then - I don't know who is using huge PV
 guests - as the PVHVM does a fine job? But then with PVH, now you can
 boot with large amount of memory (1TB?) - so some of these issues
 would go away? Except the 'large ramdisk' as that would eat in the
 MODULES_VADDR I think? Needs more thinking.

.. and then I left it and to my suprise saw on Luis's slides that
Jurgen is going to take a look at that (500GB support).


I have a patch which should do the job. It is based on the classic
kernel patch Jan mentioned above. The system is coming up with it, I
haven't tested it with a huge initrd up to now. My plan was to post the
patch together with the rest of the >500GB support, but I can send it
on it's own if required.


Oooh goodies! I think it makes sense to post it whenever you think
it is in the right state to be posted.

Now that your pvSCSI drivers are in, you have tons of free time
I suspect :-)


Oh yeah. Only one or two lines missing in xl to support it. :-)

I hope to have the >500GB patch ready for testing soon. I'd prefer to
combine this and the large initrd patch in one series, as both need the
same headers to be synced with Xen. In case I'm meeting some serious
issues I'll post the large initrd patch on Friday.

Juergen

--
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] autofs4: use ACCESS_ONCE rather than rcu_dereference for dentry->d_inode

2014-09-02 Thread NeilBrown


As the kbuild test robot reports, rcu_dereference() isn't really
appropriate here - we don't need a memory barrier, just a guard
against accidentally dereferencing NULL.

This can be merged into
 autofs4: d_manage() should return -EISDIR when appropriate in rcu-walk mode.
in 'mm'.

Signed-off-by: NeilBrown 

diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 71e4413d65c8..d76d083f2f06 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -463,7 +463,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool 
rcu_walk)
return 0;
if (d_mountpoint(dentry))
return 0;
-   inode = rcu_dereference(dentry->d_inode);
+   inode = ACCESS_ONCE(dentry->d_inode);
if (inode && S_ISLNK(inode->i_mode))
return -EISDIR;
if (list_empty(>d_subdirs))


signature.asc
Description: PGP signature


Bogus error in checkpatch.pl

2014-09-02 Thread Pranith Kumar
I receive an ERROR when running checkpatch.pl on a patch containing
the following line:

Commit 615cc2c9cf95 "Documentation/memory-barriers.txt: fix important typo re

saying that the commit ID should be 12 or more characters when the
commit ID is indeed 12 characters. I tried fixing it, but my perl is
not up-to-par.

Please fix! Thanks.

-- 
Pranith
--
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 5/5] phy: exynos5-usbdrd: Adding Kconfig dependency for Exynos7

2014-09-02 Thread Vivek Gautam
On Tue, Sep 2, 2014 at 8:07 PM, Felipe Balbi  wrote:
> On Mon, Sep 01, 2014 at 01:30:21PM +0530, Vivek Gautam wrote:
>> On Thu, Aug 28, 2014 at 8:36 PM, Daniele Forsi  wrote:
>> > 2014-08-28 10:02 GMT+02:00 Vivek Gautam:
>> >
>> >> This USB 3.0 PHY controller is also present on Exynos7
>> >> platform, so adding the dependency on ARCH_EXYNOS7 for this driver.
>> >
>> >> +++ b/drivers/phy/Kconfig
>> >> @@ -186,7 +186,7 @@ config PHY_EXYNOS5250_USB2
>> >>
>> >>  config PHY_EXYNOS5_USBDRD
>> >> tristate "Exynos5 SoC series USB DRD PHY driver"
>> >> -   depends on ARCH_EXYNOS5 && OF
>> >> +   depends on (ARCH_EXYNOS5 || ARCH_EXYNOS7) && OF
>> >
>> > shouldn't that prompt and its help text be updated to mention also Exynos7?
>>
>> Right, even that has to be updated accordingly. Will update the same in next
>> version of the patch. Thanks for pointing this.
>
> I would rather change that to ARCH_EXYNOS, unless Kishon doesn't like
> that idea. The thing is that this will likely need to be patches for
> exynos8, 9, 10, 11...

Yes, after we have the 2nd version of Exynos7 support patches, it makes
more sense to keep dependency on ARCH_EXYNOS.




-- 
Best Regards
Vivek Gautam
Samsung R Institute, Bangalore
India
--
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] net: treewide: Fix typo found in DocBook/networking.xml

2014-09-02 Thread Masanari Iida
This patch fix spelling typo found in DocBook/networking.xml.
It is because the neworking.xml is generated from comments
in the source, I have to fix typo in comments within the source.

Signed-off-by: Masanari Iida 
---
 include/linux/netdevice.h  | 4 ++--
 include/net/wimax.h| 2 +-
 include/trace/events/irq.h | 4 ++--
 net/core/datagram.c| 2 +-
 net/core/gen_estimator.c   | 2 +-
 net/core/gen_stats.c   | 2 +-
 net/core/skbuff.c  | 4 ++--
 net/core/sock.c| 4 ++--
 net/socket.c   | 2 +-
 9 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 039b237..d2b1704 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3249,7 +3249,7 @@ static inline int __dev_uc_sync(struct net_device *dev,
 }
 
 /**
- *  __dev_uc_unsync - Remove synchonized addresses from device
+ *  __dev_uc_unsync - Remove synchronized addresses from device
  *  @dev:  device to sync
  *  @unsync: function to call if address should be removed
  *
@@ -3293,7 +3293,7 @@ static inline int __dev_mc_sync(struct net_device *dev,
 }
 
 /**
- *  __dev_mc_unsync - Remove synchonized addresses from device
+ *  __dev_mc_unsync - Remove synchronized addresses from device
  *  @dev:  device to sync
  *  @unsync: function to call if address should be removed
  *
diff --git a/include/net/wimax.h b/include/net/wimax.h
index e52ef53..c52b685 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -290,7 +290,7 @@ struct wimax_dev;
  * This operation has to be synchronous, and return only when the
  * reset is complete. In case of having had to resort to bus/cold
  * reset implying a device disconnection, the call is allowed to
- * return inmediately.
+ * return immediately.
  * NOTE: wimax_dev->mutex is NOT locked when this op is being
  * called; however, wimax_dev->mutex_reset IS locked to ensure
  * serialization of calls to wimax_reset().
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 1c09820..0db9838 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(softirq,
  * @vec_nr:  softirq vector number
  *
  * When used in combination with the softirq_exit tracepoint
- * we can determine the softirq handler runtine.
+ * we can determine the softirq handler runtime.
  */
 DEFINE_EVENT(softirq, softirq_entry,
 
@@ -121,7 +121,7 @@ DEFINE_EVENT(softirq, softirq_entry,
  * @vec_nr:  softirq vector number
  *
  * When used in combination with the softirq_entry tracepoint
- * we can determine the softirq handler runtine.
+ * we can determine the softirq handler runtime.
  */
 DEFINE_EVENT(softirq, softirq_exit,
 
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 488dd1a..fdbc9a8 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -775,7 +775,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
 EXPORT_SYMBOL(__skb_checksum_complete);
 
 /**
- * skb_copy_and_csum_datagram_iovec - Copy and checkum skb to user iovec.
+ * skb_copy_and_csum_datagram_iovec - Copy and checksum skb to user iovec.
  * @skb: skbuff
  * @hlen: hardware length
  * @iov: io vector
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 6b5b6e7..9d33dff 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -197,7 +197,7 @@ struct gen_estimator *gen_find_node(const struct 
gnet_stats_basic_packed *bstats
  * as destination. A new timer with the interval specified in the
  * configuration TLV is created. Upon each interval, the latest statistics
  * will be read from  and the estimated rate will be stored in
- * _est with the statistics lock grabed during this period.
+ * _est with the statistics lock grabbed during this period.
  *
  * Returns 0 on success or a negative error code.
  *
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 9d3d9e7..2ddbce4 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -206,7 +206,7 @@ EXPORT_SYMBOL(gnet_stats_copy_queue);
  * @st: application specific statistics data
  * @len: length of data
  *
- * Appends the application sepecific statistics to the top level TLV created by
+ * Appends the application specific statistics to the top level TLV created by
  * gnet_stats_start_copy() and remembers the data for XSTATS if the dumping
  * handle is in backward compatibility mode.
  *
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index adfc7ee..2d9f117 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2647,7 +2647,7 @@ EXPORT_SYMBOL(skb_prepare_seq_read);
  * skb_seq_read() will return the remaining part of the block.
  *
  * Note 1: The size of each block of data returned can be arbitrary,
- *   this limitation is the cost for zerocopy seqeuental
+ *   this limitation is the cost for zerocopy sequential
  *   reads of potentially non linear data.
  *
  * Note 2: Fragment lists 

Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel

2014-09-02 Thread Guenter Roeck
On Wed, Sep 03, 2014 at 08:09:28AM +0800, Xuetao Guan  wrote:
> 
> [...]
> > > 
> > > > 
> > > > unicore32: Add ocd console and qemu-defconfig to support qemu simulator
> > > > This patch adds a primitive OCD console to communicate with 
> > > > qemu.
> > > > The same code is already used for early console support.
> > > 
> > > Do you mean there's the same/similar code in QEMU.
> > > 
> > No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
> > used by both earlyprintk and the ocd console code.
> Yes. By the way, it's only for qemu and fpga debug.
> 
> > 
> > > > 
> > > > With this patch added, and with qemu_defconfig as provided by the same 
> > > > patch,
> > > > it is possible to build and load a unicore32 image in qemu using the 
> > > > following
> > > > qemu command line.
> > > > 
> > > > qemu-system-unicore32 -curses -M puv3 -m 512 -kernel 
> > > > arch/unicore32/boot/zImage
> > > > 
> > > > Caveats:
> > > > - The use of -nographic instead of -curses causes a qemu crash
> > > Yes, since qemu curses code was modified to meet the simple OCD console 
> > > requirement.
> > > 
> > The lack of support for -nographic is a problem for scripted testing.
> > The issue is that we have to interpret console output for scripted testing,
> > and having to go through curses makes that a bit difficult.
> > 
> > Wonder if '-nographic' can be modeled as '-curses' with no available 
> > terminal
> > configuration. At least in theory that should work, but executing the above
> > command with TERM=dumb yields no output. Wonder how difficult it would be to
> > change that.
> 
> I see. I'll try to make -nographic work anyway.
> 
Please try the following patch. That seems to do it.
I am sure it can be improved, but it is a start.

Thanks,
Guenter

---
>From a7c89177b3c00e4c16bea25a0b4b2f9dc511e07b Mon Sep 17 00:00:00 2001
From: Guenter Roeck 
Date: Tue, 2 Sep 2014 20:55:02 -0700
Subject: [PATCH] qemu: unicore32: Add support for non-curses display

Add basic support for DT_NONE and DT_NOGRAPHIC display types.

Signed-off-by: Guenter Roeck 
---
 target-unicore32/helper.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index e5ebbf4..dda3772 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -13,6 +13,7 @@
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
+#include "sysemu/sysemu.h"
 #ifndef CONFIG_USER_ONLY
 #include "ui/console.h"
 #endif
@@ -223,7 +224,18 @@ static void putc_on_screen(unsigned char ch)
 
 void helper_cp1_putc(target_ulong x)
 {
-putc_on_screen((unsigned char)x);   /* Output to screen */
+switch(display_type) {
+case DT_CURSES:
+   putc_on_screen((unsigned char)x);   /* Output to screen */
+   break;
+case DT_NOGRAPHIC:
+case DT_NONE:
+   putchar((int)x);
+   break;
+default:
+   break;
+}
+
 DPRINTF("%c", x);   /* Output to stdout */
 }
 #endif
-- 
1.9.1

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


Re: [PATCH 4/5] usb: dwc3: Adding Kconfig dependency for Exynos7

2014-09-02 Thread Vivek Gautam
On Fri, Aug 29, 2014 at 12:58 AM, Felipe Balbi  wrote:
> On Thu, Aug 28, 2014 at 01:31:59PM +0530, Vivek Gautam wrote:
>> The Exynos-DWC3 USB 3.0 DRD controller is also present on
>> Exynos7 platform, so adding the dependency on ARCH_EXYNOS7
>> for this driver.
>>
>> Signed-off-by: Vivek Gautam 
>> ---
>>  drivers/usb/dwc3/Kconfig |2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>> index 785510a..e235894 100644
>> --- a/drivers/usb/dwc3/Kconfig
>> +++ b/drivers/usb/dwc3/Kconfig
>> @@ -55,7 +55,7 @@ config USB_DWC3_OMAP
>>
>>  config USB_DWC3_EXYNOS
>>   tristate "Samsung Exynos Platform"
>> - depends on ARCH_EXYNOS || COMPILE_TEST
>> + depends on (ARCH_EXYNOS || ARCH_EXYNOS7) || COMPILE_TEST
>
> wait when building for ARCH_EXYNOS7 you don't get ARCH_EXYNOS ?

Right, we do get it now in V2 patch series for Exynos7 [1],
but it wasn't available in the first series [2].
Will drop this patch now.

[1] http://www.spinics.net/lists/linux-samsung-soc/msg36378.html
[2] http://www.spinics.net/lists/arm-kernel/msg357382.html



-- 
Best Regards
Vivek Gautam
Samsung R Institute, Bangalore
India
--
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 v7 3/5] RTC: RK808: add RTC driver for RK808

2014-09-02 Thread Doug Anderson
Hi,

On Tue, Sep 2, 2014 at 8:52 PM, Doug Anderson  wrote:
> Chris,
>
> On Tue, Sep 2, 2014 at 7:01 PM, Chris Zhong  wrote:
>>
>> On 09/02/2014 11:58 AM, Doug Anderson wrote:

 +static int rk808_rtc_probe(struct platform_device *pdev)
 >+{
 >+   struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
 >+   struct rk808_rtc *rk808_rtc;
 >+   struct rtc_time tm;
 >+   int ret;
 >+
 >+   rk808_rtc = devm_kzalloc(>dev, sizeof(*rk808_rtc),
 > GFP_KERNEL);
 >+   if (rk808_rtc == NULL)
 >+   return -ENOMEM;
 >+
 >+   platform_set_drvdata(pdev, rk808_rtc);
 >+   rk808_rtc->rk808 = rk808;
 >+
 >+   /* start rtc running by default, and use shadowed timer. */
 >+   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
 >+BIT_RTC_CTRL_REG_STOP_RTC_M |
 >+BIT_RTC_CTRL_REG_RTC_READSEL_M,
 >+BIT_RTC_CTRL_REG_RTC_READSEL_M);
>>>
>>> I think this should still be setting to 0, not to
>>> BIT_RTC_CTRL_REG_RTC_READSEL_M.  Otherwise the first read of the time
>>> will return that time that was frozen at probe time, right?  AKA: if
>>> probe happens at 11:00:00 and then we read the time at 11:00:05 we'll
>>> still read 11:00:00 the first time.
>>>
>>  Sorry, I did not describe correctly, in the previous mail.
>>  Actually, RK808 has a "GET_TIME" switch bit. When "GET_TIME" bit rising
>> thansiton to 1,
>>  the current time will save in a shadowed register.
>>  If "READSEL" = 1, read rtc time register, return the frozen time.
>>  If we need the real time, clr this "READSEL" bit.
>
> Oh!  I see.  I clearly didn't look closely enough at the whole
> register description in the user manual.  I think you've got it right,
> then.
>
> I think this would be more obvious if you added a comment and you set
> both the high and low bits at the same time.  AKA:
>
> +   /* Force an update of the shadowed registers right now */
> +   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
> +BIT_RTC_CTRL_REG_RTC_GET_TIME,
> +BIT_RTC_CTRL_REG_RTC_GET_TIME);
> +   if (ret) {
> +   dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
> +   return ret;
> +   }
> +
> +   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
> +BIT_RTC_CTRL_REG_RTC_GET_TIME,
> +BIT_RTC_CTRL_REG_RTC_GET_TIME);

Doh, this one was supposed to be setting it back to 0.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 3/5] RTC: RK808: add RTC driver for RK808

2014-09-02 Thread Doug Anderson
Chris,

On Tue, Sep 2, 2014 at 7:01 PM, Chris Zhong  wrote:
>
> On 09/02/2014 11:58 AM, Doug Anderson wrote:
>>>
>>> +static int rk808_rtc_probe(struct platform_device *pdev)
>>> >+{
>>> >+   struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
>>> >+   struct rk808_rtc *rk808_rtc;
>>> >+   struct rtc_time tm;
>>> >+   int ret;
>>> >+
>>> >+   rk808_rtc = devm_kzalloc(>dev, sizeof(*rk808_rtc),
>>> > GFP_KERNEL);
>>> >+   if (rk808_rtc == NULL)
>>> >+   return -ENOMEM;
>>> >+
>>> >+   platform_set_drvdata(pdev, rk808_rtc);
>>> >+   rk808_rtc->rk808 = rk808;
>>> >+
>>> >+   /* start rtc running by default, and use shadowed timer. */
>>> >+   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
>>> >+BIT_RTC_CTRL_REG_STOP_RTC_M |
>>> >+BIT_RTC_CTRL_REG_RTC_READSEL_M,
>>> >+BIT_RTC_CTRL_REG_RTC_READSEL_M);
>>
>> I think this should still be setting to 0, not to
>> BIT_RTC_CTRL_REG_RTC_READSEL_M.  Otherwise the first read of the time
>> will return that time that was frozen at probe time, right?  AKA: if
>> probe happens at 11:00:00 and then we read the time at 11:00:05 we'll
>> still read 11:00:00 the first time.
>>
>  Sorry, I did not describe correctly, in the previous mail.
>  Actually, RK808 has a "GET_TIME" switch bit. When "GET_TIME" bit rising
> thansiton to 1,
>  the current time will save in a shadowed register.
>  If "READSEL" = 1, read rtc time register, return the frozen time.
>  If we need the real time, clr this "READSEL" bit.

Oh!  I see.  I clearly didn't look closely enough at the whole
register description in the user manual.  I think you've got it right,
then.

I think this would be more obvious if you added a comment and you set
both the high and low bits at the same time.  AKA:

+   /* Force an update of the shadowed registers right now */
+   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+BIT_RTC_CTRL_REG_RTC_GET_TIME,
+BIT_RTC_CTRL_REG_RTC_GET_TIME);
+   if (ret) {
+   dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
+   return ret;
+   }
+
+   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+BIT_RTC_CTRL_REG_RTC_GET_TIME,
+BIT_RTC_CTRL_REG_RTC_GET_TIME);
+   if (ret) {
+   dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
+   return ret;
+   }

...doing them both at the same time makes it obvious that this is a
one-time copy triggered by the "rising edge" of this bit.  It also
means you don't need any "goto" for error handling.

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


RE: [PATCH 0/5] Clocksource: Flextimer: Merged to LS1

2014-09-02 Thread li.xi...@freescale.com
Ping :)

Thanks,

BRs
Xiubo




> -Original Message-
> From: Xiubo Li [mailto:li.xi...@freescale.com]
> Sent: Tuesday, August 26, 2014 1:46 PM
> To: daniel.lezc...@linaro.org; t...@linutronix.de
> Cc: Wang Dongsheng-B40534; linux-kernel@vger.kernel.org; Xiubo Li-B47053
> Subject: [PATCH 0/5] Clocksource: Flextimer: Merged to LS1
> 
> 
> Xiubo Li (5):
>   Clocksource: Flextimer: Set cpumask to cpu_possible_mask
>   Clocksource: Flextimer: Use internal clocksource read API.
>   Clocksource: Flextimer: Remove the useless code.
>   Clocksource: Flextimer: Fix counter clock prescaler calculation.
>   Clocksource: Flextimer: Use Macro for clock source selection.
> 
>  drivers/clocksource/fsl_ftm_timer.c | 20 +---
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> --
> 1.8.5

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


[PATCH/v2] perf/documentation: Fix typo in perf/Documentation

2014-09-02 Thread Masanari Iida
This patch fix spelling typo found in tool/perf/Documentation.

Signed-off-by: Masanari Iida 
---
 tools/perf/Documentation/perf-diff.txt  | 6 +++---
 tools/perf/Documentation/perf-kvm.txt   | 4 ++--
 tools/perf/Documentation/perf-list.txt  | 2 +-
 tools/perf/Documentation/perf-record.txt| 2 +-
 tools/perf/Documentation/perf-script-perl.txt   | 4 ++--
 tools/perf/Documentation/perf-script-python.txt | 6 +++---
 tools/perf/Documentation/perf-script.txt| 2 +-
 tools/perf/Documentation/perf-test.txt  | 2 +-
 tools/perf/Documentation/perf-trace.txt | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt 
b/tools/perf/Documentation/perf-diff.txt
index b3b8aba..e463caa 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -196,10 +196,10 @@ If specified the 'Weighted diff' column is displayed with 
value 'd' computed as:
 
   - period being the hist entry period value
 
-  - WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option
+  - WEIGHT-A/WEIGHT-B being user supplied weights in the the '-c' option
 behind ':' separator like '-c wdiff:1,2'.
-- WIEGHT-A being the weight of the data file
-- WIEGHT-B being the weight of the baseline data file
+- WEIGHT-A being the weight of the data file
+- WEIGHT-B being the weight of the baseline data file
 
 SEE ALSO
 
diff --git a/tools/perf/Documentation/perf-kvm.txt 
b/tools/perf/Documentation/perf-kvm.txt
index 6e689dc..4edbc2b 100644
--- a/tools/perf/Documentation/perf-kvm.txt
+++ b/tools/perf/Documentation/perf-kvm.txt
@@ -100,7 +100,7 @@ OPTIONS
 STAT REPORT OPTIONS
 ---
 --vcpu=::
-   analyze events which occures on this vcpu. (default: all vcpus)
+   analyze events which occurs on this vcpu. (default: all vcpus)
 
 --event=::
event to be analyzed. Possible values: vmexit, mmio (x86 only),
@@ -134,7 +134,7 @@ STAT LIVE OPTIONS
 Analyze events only for given process ID(s) (comma separated list).
 
 --vcpu=::
-   analyze events which occures on this vcpu. (default: all vcpus)
+   analyze events which occurs on this vcpu. (default: all vcpus)
 
 
 --event=::
diff --git a/tools/perf/Documentation/perf-list.txt 
b/tools/perf/Documentation/perf-list.txt
index 6fce6a6..cbb4f74 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -19,7 +19,7 @@ various perf commands with the -e option.
 EVENT MODIFIERS
 ---
 
-Events can optionally have a modifer by appending a colon and one or
+Events can optionally have a modifier by appending a colon and one or
 more modifiers. Modifiers allow the user to restrict the events to be
 counted. The following modifiers exist:
 
diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index d460049..398f8d5 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -146,7 +146,7 @@ the thread executes on the designated CPUs. Default is to 
monitor all CPUs.
 
 -N::
 --no-buildid-cache::
-Do not update the builid cache. This saves some overhead in situations
+Do not update the buildid cache. This saves some overhead in situations
 where the information in the perf.data file (which includes buildids)
 is sufficient.
 
diff --git a/tools/perf/Documentation/perf-script-perl.txt 
b/tools/perf/Documentation/perf-script-perl.txt
index d00bef2..dfbb506 100644
--- a/tools/perf/Documentation/perf-script-perl.txt
+++ b/tools/perf/Documentation/perf-script-perl.txt
@@ -181,8 +181,8 @@ strings for flag and symbolic fields.  These correspond to 
the strings
 and values parsed from the 'print fmt' fields of the event format
 files:
 
-  flag_str($event_name, $field_name, $field_value) - returns the string 
represention corresponding to $field_value for the flag field $field_name of 
event $event_name
-  symbol_str($event_name, $field_name, $field_value) - returns the string 
represention corresponding to $field_value for the symbolic field $field_name 
of event $event_name
+  flag_str($event_name, $field_name, $field_value) - returns the string 
representation corresponding to $field_value for the flag field $field_name of 
event $event_name
+  symbol_str($event_name, $field_name, $field_value) - returns the string 
representation corresponding to $field_value for the symbolic field $field_name 
of event $event_name
 
 Perf::Trace::Context Module
 ~~~
diff --git a/tools/perf/Documentation/perf-script-python.txt 
b/tools/perf/Documentation/perf-script-python.txt
index 9f1f054..54acba2 100644
--- a/tools/perf/Documentation/perf-script-python.txt
+++ b/tools/perf/Documentation/perf-script-python.txt
@@ -263,7 +263,7 @@ and having the counts we've tallied as values.
 
 The print_syscall_totals() function iterates over the entries in the
 dictionary and 

Re: [PATCH v2] mfd: syscon: Decouple syscon interface from platform devices

2014-09-02 Thread Vivek Gautam
On Tue, Sep 2, 2014 at 8:12 PM, Pankaj Dubey  wrote:
> Currently a syscon entity can only be registered directly through a
> platform device that binds to a dedicated syscon driver. However in
> certain cases it is required to bind a device with it's dedicated
> driver rather than binding with syscon driver.
>
> For example, certain SoCs (e.g. Exynos) contain system controller
> blocks which perform various functions such as power domain control,
> CPU power management, low power mode control, but in addition contain
> certain IP integration glue, such as various signal masks,
> coprocessor power control, etc. In such case, there is a need to have
> a dedicated driver for such system controller but also share registers
> with other drivers. The latter is where the syscon interface is helpful.
>
> This patch decouples syscon object from syscon platform driver, and
> allows to create syscon objects first time when it is required by
> calling of syscon_regmap_lookup_by APIs and keeps a list of such syscon
> objects along with syscon provider device_nodes and regmap handles.
>
> Signed-off-by: Pankaj Dubey 
> Signed-off-by: Tomasz Figa 
> ---
> V1 of this patchset [1] and related discussion can be found here [1].
>
> Changes since v1:
>  - Removed of_syscon_unregister function.
>  - Modified of_syscon_register function and it will be used by syscon.c
>to create syscon objects whenever required.
>  - Removed platform device support from syscon.
>  - Removed syscon_regmap_lookup_by_pdevname API support.
>  - As there are significant changes w.r.t patchset v1, I am taking over
>author for this patchset from Tomasz Figa.
>
> Note: Current kernel has clps711x user of syscon_regmap_lookup_by_pdevname and
> will be broken after this patch. As per discussion over here [1], patches
> for making these drivers DT based are ready and once that is done they can use
> syscon_regmap_lookup_by_phandle or syscon_regmap_lookup_by_compatible.
>
> [1]: https://lkml.org/lkml/2014/8/22/81

[snip]

Tested on smdk5250 board with 3.17-rc3 for USB 2.0 and USB 3.0, since USB takes
syscon phandle for handling some of the pmu registers.
Things work fine with all the dt side changes in this patch.

Tested-by: Vivek Gautam 



-- 
Best Regards
Vivek Gautam
Samsung R Institute, Bangalore
India
--
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 rcu/urgent] Fix for 3.17

2014-09-02 Thread Paul E. McKenney
Hello, Ingo,

This series contains a single commit fixing an initialization bug
reported by Amit Shah and fixed by Pranith Kumar (and tested by Amit).
This bug results in a boot-time hang in callback-offloaded configurations
where callbacks were posted before the offloading ("rcuo") kthreads
were created.  This has been exposed to -next testing, and is available
in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/urgent

for you to fetch changes up to 11ed7f934cb807f26da09547b5946c2e534d1dac:

  rcu: Make nocb leader kthreads process pending callbacks after spawning 
(2014-08-28 05:59:59 -0700)


Pranith Kumar (1):
  rcu: Make nocb leader kthreads process pending callbacks after spawning

 kernel/rcu/tree.h|  2 +-
 kernel/rcu/tree_plugin.h | 22 +++---
 2 files changed, 12 insertions(+), 12 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: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread li.xi...@freescale.com
> Subject: Re: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add
> asoc_simple_card_fmt_master() to simplify the code.
> 
> 
> Hi Xiubo
> 
> > Yes, I think it make sense to set all fmt in one function, and will
> > Be more readable.
> >
> > I agree with you, could you please just wait, because there has many
> > Replications and good Ideas about this patch, and I will revise it.
> > Then you can improve it as your patch blow.
> 
> Thank you for your help
> I don't care so much about my local patch.
> You can re-use it if you want.
> Of course I can do it if you want
> 

Please send it out of your local patch.

Please also consider the ideas about Jyri, Jean-Francios, Varka and
Takashi's advice as previous emails about my patch.


BRs
Xiubo

--
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: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread Kuninori Morimoto

Hi Xiubo

> Yes, I think it make sense to set all fmt in one function, and will
> Be more readable.
> 
> I agree with you, could you please just wait, because there has many
> Replications and good Ideas about this patch, and I will revise it.
> Then you can improve it as your patch blow.

Thank you for your help
I don't care so much about my local patch.
You can re-use it if you want.
Of course I can do it if you want

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/


RE: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread li.xi...@freescale.com
Hi Kuninori-san,

Yes your patch has fixed the bug Jyri has pointed out.

So I has discard my [PATCHv2 1/4] patch.

Please send your patch out to replace this one.

Thanks,

BRs
Xiubo



> -Original Message-
> From: Xiubo Li-B47053
> Sent: Wednesday, September 03, 2014 10:22 AM
> To: 'Kuninori Morimoto'
> Cc: broo...@kernel.org; pe...@perex.cz; lgirdw...@gmail.com; ti...@suse.de;
> moin...@free.fr; and...@lunn.ch; kuninori.morimoto...@renesas.com;
> jsa...@ti.com; devicet...@vger.kernel.org; alsa-de...@alsa-project.org;
> robh...@kernel.org; pawel.m...@arm.com; mark.rutl...@arm.com;
> ijc+devicet...@hellion.org.uk; ga...@codeaurora.org; linux-
> ker...@vger.kernel.org
> Subject: RE: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add
> asoc_simple_card_fmt_master() to simplify the code.
> 
> Hi Kuninori-san,
> 
> Yes, I think it make sense to set all fmt in one function, and will
> Be more readable.
> 
> I agree with you, could you please just wait, because there has many
> Replications and good Ideas about this patch, and I will revise it.
> Then you can improve it as your patch blow.
> 
> 
> Thanks,
> 
> BRs
> Xiubo
> 
> 
> > Subject: Re: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add
> > asoc_simple_card_fmt_master() to simplify the code.
> >
> >
> > Hi Xiubo
> >
> > I was very surprised about this patch
> > because the idea is same as my local patch
> > (I was planned to send it to ML :)
> >
> > I attached my local patch to sharing idea.
> >
> > > +static inline unsigned int
> > > +asoc_simple_card_fmt_master(struct device_node *np,
> > > + struct device_node *bitclkmaster,
> > > + struct device_node *framemaster)
> > > +{
> > > + switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
> > > + case 0x11:
> > > + return SND_SOC_DAIFMT_CBS_CFS;
> > > + case 0x10:
> > > + return SND_SOC_DAIFMT_CBS_CFM;
> > > + case 0x01:
> > > + return SND_SOC_DAIFMT_CBM_CFS;
> > > + default:
> > > + return SND_SOC_DAIFMT_CBM_CFM;
> > > + }
> > > +
> > > + /* Shouldn't be here */
> > > + return -EINVAL;
> > > +}
> >
> > I think this concept is nice,
> > but setting all fmt in this function is good for me
> > see my local patch
> >
> > --
> > From 85562eb1587e5c184e4f4e0b183bd7063aaa81b7 Mon Sep 17 00:00:00 2001
> > From: Kuninori Morimoto 
> > Date: Thu, 28 Aug 2014 19:20:14 +0900
> > Subject: [PATCH] ASoC: simple-card: add asoc_simple_card_parse_daifmt()
> >
> > Current daifmt setting method in simple-card driver is
> > placed to many places, and using un-readable/confusable method.
> > This patch adds new asoc_simple_card_parse_daifmt()
> > and tidyup code.
> >
> > Signed-off-by: Kuninori Morimoto 
> >
> > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-
> card.c
> > index bea5901..c932103 100644
> > --- a/sound/soc/generic/simple-card.c
> > +++ b/sound/soc/generic/simple-card.c
> > @@ -167,6 +167,64 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
> > return 0;
> >  }
> >
> > +static int asoc_simple_card_parse_daifmt(struct device_node *node,
> > +struct simple_card_data *priv,
> > +struct device_node *cpu,
> > +struct device_node *codec,
> > +char *prefix, int idx)
> > +{
> > +   struct device *dev = simple_priv_to_dev(priv);
> > +   struct device_node *bitclkmaster = NULL;
> > +   struct device_node *framemaster = NULL;
> > +   struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
> > +   struct asoc_simple_dai *cpu_dai = _props->cpu_dai;
> > +   struct asoc_simple_dai *codec_dai = _props->codec_dai;
> > +   unsigned int daifmt;
> > +
> > +   daifmt = snd_soc_of_parse_daifmt(node, prefix,
> > +, );
> > +   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
> > +
> > +   if (strlen(prefix) && !bitclkmaster && !framemaster) {
> > +   /*
> > +* No dai-link level and master setting was not found from
> > +* sound node level, revert back to legacy DT parsing and
> > +* take the settings from codec node.
> > +*/
> > +   dev_dbg(dev, "Revert to legacy daifmt parsing\n");
> > +
> > +   cpu_dai->fmt = codec_dai->fmt =
> > +   snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
> > +   (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
> > +   } else {
> > +
> > +   switch (((codec == bitclkmaster) << 4) | (codec == framemaster))
> > {
> > +   case 0x11:
> > +   daifmt |= SND_SOC_DAIFMT_CBM_CFM;
> > +   break;
> > +   case 0x10:
> > +   daifmt |= SND_SOC_DAIFMT_CBM_CFS;
> > +   break;
> > +   case 0x01:
> > +   daifmt |= SND_SOC_DAIFMT_CBS_CFM;
> > +   break;
> > +   default:
> > +   

[PATCH v2] doc: memory-barriers.txt: Correct example for reorderings

2014-09-02 Thread Pranith Kumar
Correct the example of memory orderings in memory-barriers.txt

Commit 615cc2c9cf95 "Documentation/memory-barriers.txt: fix important typo re
memory barriers" changed the assignment to x and y. Change the rest of the
example to match this change.

Reported-by: Ganesh Rapolu 
Signed-off-by: Pranith Kumar 
---
 Documentation/memory-barriers.txt | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/memory-barriers.txt 
b/Documentation/memory-barriers.txt
index a4de88f..02f5de8 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -121,22 +121,22 @@ For example, consider the following sequence of events:
 The set of accesses as seen by the memory system in the middle can be arranged
 in 24 different combinations:
 
-   STORE A=3,  STORE B=4,  x=LOAD A->3,y=LOAD B->4
-   STORE A=3,  STORE B=4,  y=LOAD B->4,x=LOAD A->3
-   STORE A=3,  x=LOAD A->3,STORE B=4,  y=LOAD B->4
-   STORE A=3,  x=LOAD A->3,y=LOAD B->2,STORE B=4
-   STORE A=3,  y=LOAD B->2,STORE B=4,  x=LOAD A->3
-   STORE A=3,  y=LOAD B->2,x=LOAD A->3,STORE B=4
-   STORE B=4,  STORE A=3,  x=LOAD A->3,y=LOAD B->4
+   STORE A=3,  STORE B=4,  y=LOAD A->3,x=LOAD B->4
+   STORE A=3,  STORE B=4,  x=LOAD B->4,y=LOAD A->3
+   STORE A=3,  y=LOAD A->3,STORE B=4,  x=LOAD B->4
+   STORE A=3,  y=LOAD A->3,x=LOAD B->2,STORE B=4
+   STORE A=3,  x=LOAD B->2,STORE B=4,  y=LOAD A->3
+   STORE A=3,  x=LOAD B->2,y=LOAD A->3,STORE B=4
+   STORE B=4,  STORE A=3,  y=LOAD A->3,x=LOAD B->4
STORE B=4, ...
...
 
 and can thus result in four different combinations of values:
 
-   x == 1, y == 2
-   x == 1, y == 4
-   x == 3, y == 2
-   x == 3, y == 4
+   x == 2, y == 1
+   x == 2, y == 3
+   x == 4, y == 1
+   x == 4, y == 3
 
 
 Furthermore, the stores committed by a CPU to the memory system may not be
-- 
2.1.0

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


Re: [PATCH] doc: memory-barriers.txt: Correct example for reorderings

2014-09-02 Thread Pranith Kumar
On Tue, Sep 2, 2014 at 12:08 PM, Paul E. McKenney
 wrote:

> Could you please adjust in this way?  Again, the point is to be the
> first few items in a full set of permutations, not to illustrate selected
> orderings/outcomes.
>

OK, if that is the case then replacing x with y is much easier. I will
send an updated patch. Thanks!

-- 
Pranith
--
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] fs/super.c: do not shrink fs slab during direct memory reclaim

2014-09-02 Thread Xue jiufei
Hi Junxiao
On 2014/9/3 9:38, Junxiao Bi wrote:
> Hi Jiufei,
> 
> On 09/02/2014 05:03 PM, Xue jiufei wrote:
>> Hi, Dave
>> On 2014/9/2 7:51, Dave Chinner wrote:
>>> On Fri, Aug 29, 2014 at 05:57:22PM +0800, Xue jiufei wrote:
 The patch trys to solve one deadlock problem caused by cluster
 fs, like ocfs2. And the problem may happen at least in the below
 situations:
 1)Receiving a connect message from other nodes, node queues a
 work_struct o2net_listen_work.
 2)o2net_wq processes this work and calls sock_alloc() to allocate
 memory for a new socket.
 3)It would do direct memory reclaim when available memory is not
 enough and trigger the inode cleanup. That inode being cleaned up
 is happened to be ocfs2 inode, so call evict()->ocfs2_evict_inode()
 ->ocfs2_drop_lock()->dlmunlock()->o2net_send_message_vec(),
 and wait for the unlock response from master.
 4)tcp layer received the response, call o2net_data_ready() and
 queue sc_rx_work, waiting o2net_wq to process this work.
 5)o2net_wq is a single thread workqueue, it process the work one by
 one. Right now it is still doing o2net_listen_work and cannot handle
 sc_rx_work. so we deadlock.

 It is impossible to set GFP_NOFS for memory allocation in sock_alloc().
 So we use PF_FSTRANS to avoid the task reentering filesystem when
 available memory is not enough.

 Signed-off-by: joyce.xue 
>>>
>>> For the second time: use memalloc_noio_save/memalloc_noio_restore.
>>> And please put a great big comment in the code explaining why you
>>> need to do this special thing with memory reclaim flags.
>>>
>>> Cheers,
>>>
>>> Dave.
>>>
>> Thanks for your reply. But I am afraid that memalloc_noio_save/
>> memalloc_noio_restore can not solve my problem. __GFP_IO is cleared
>> if PF_MEMALLOC_NOIO is set and can avoid doing IO in direct memory
>> reclaim. However, __GFP_FS is still set that can not avoid pruning
>> dcache and icache in memory allocation, resulting in the deadlock I
>> described.
> 
> You can use PF_MEMALLOC_NOIO to replace PF_FSTRANS, set this flag in
> ocfs2 and check it in sb shrinker.
> 
Thanks for your advice. But I think using another process flag is better.
Do you think so? I will send another patch later.

Thanks,
XueJiufei 

> Thanks,
> Junxiao.
>>

>> Thanks.
>> XueJiufei
>>
>>
>>
> 
> .
> 


--
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] mmc: sdhci-esdhc-imx: Enable boot partition access from DT

2014-09-02 Thread Dong Aisheng
On Tue, Sep 02, 2014 at 05:49:37PM +0200, Jean-Michel Hautbois wrote:
> This property is useful when we don't want to access boot partitions on eMMC
> 

Any special reason why not access boot partitions on eMMC?
Not allow user to access it?

> Signed-off-by: Jean-Michel Hautbois 
> ---
>  Documentation/devicetree/bindings/mmc/mmc.txt | 1 +
>  drivers/mmc/host/sdhci-esdhc-imx.c| 8 
>  include/linux/platform_data/mmc-esdhc-imx.h   | 1 +
>  3 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt 
> b/Documentation/devicetree/bindings/mmc/mmc.txt
> index 431716e..59cc854 100644
> --- a/Documentation/devicetree/bindings/mmc/mmc.txt
> +++ b/Documentation/devicetree/bindings/mmc/mmc.txt
> @@ -40,6 +40,7 @@ Optional properties:
>  - mmc-hs200-1_2v: eMMC HS200 mode(1.2V I/O) is supported
>  - mmc-hs400-1_8v: eMMC HS400 mode(1.8V I/O) is supported
>  - mmc-hs400-1_2v: eMMC HS400 mode(1.2V I/O) is supported
> +- no-boot-part : when preset, tells to access boot partitions

The file you changed is common mmc binding doc.
You may also want to add the support in mmc_of_parse.

And since sdhci-esdhc-imx is not using mmc_of_parse currently, maybe it's time
to convert to it.

Regards
Dong Aisheng

> 
>  *NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers 
> line
>  polarity properties, we have to fix the meaning of the "normal" and 
> "inverted"
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c 
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index ccec0e3..439e663 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -942,6 +942,11 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
>   if (of_property_read_u32(np, "fsl,delay-line", >delay_line))
>   boarddata->delay_line = 0;
> 
> + if (of_find_property(np, "no-boot-part", NULL))
> + boarddata->access_boot_part = false;
> + else
> + boarddata->access_boot_part = true;
> +
>   return 0;
>  }
>  #else
> @@ -1119,6 +1124,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device 
> *pdev)
>   host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>   }
> 
> + if (!boarddata->access_boot_part)
> + host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC;
> +
>   err = sdhci_add_host(host);
>   if (err)
>   goto disable_clk;
> diff --git a/include/linux/platform_data/mmc-esdhc-imx.h 
> b/include/linux/platform_data/mmc-esdhc-imx.h
> index 75f70f6..a34ee9e 100644
> --- a/include/linux/platform_data/mmc-esdhc-imx.h
> +++ b/include/linux/platform_data/mmc-esdhc-imx.h
> @@ -46,5 +46,6 @@ struct esdhc_platform_data {
>   unsigned int f_max;
>   bool support_vsel;
>   unsigned int delay_line;
> + bool access_boot_part;
>  };
>  #endif /* __ASM_ARCH_IMX_ESDHC_H */
> 
> 2.0.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 v9 net-next 2/4] net: filter: split filter.h and expose eBPF to user space

2014-09-02 Thread Alexei Starovoitov
allow user space to generate eBPF programs

uapi/linux/bpf.h: eBPF instruction set definition

linux/filter.h: the rest

This patch only moves macro definitions, but practically it freezes existing
eBPF instruction set, though new instructions can still be added in the future.

These eBPF definitions cannot go into uapi/linux/filter.h, since the names
may conflict with existing applications.

Full eBPF ISA description is in Documentation/networking/filter.txt

Signed-off-by: Alexei Starovoitov 
---
 include/linux/filter.h|   56 +-
 include/uapi/linux/Kbuild |1 +
 include/uapi/linux/bpf.h  |   65 +
 3 files changed, 67 insertions(+), 55 deletions(-)
 create mode 100644 include/uapi/linux/bpf.h

diff --git a/include/linux/filter.h b/include/linux/filter.h
index bf323da77950..8f82ef3f1cdd 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -10,58 +10,12 @@
 #include 
 #include 
 #include 
+#include 
 
 struct sk_buff;
 struct sock;
 struct seccomp_data;
 
-/* Internally used and optimized filter representation with extended
- * instruction set based on top of classic BPF.
- */
-
-/* instruction classes */
-#define BPF_ALU64  0x07/* alu mode in double word width */
-
-/* ld/ldx fields */
-#define BPF_DW 0x18/* double word */
-#define BPF_XADD   0xc0/* exclusive add */
-
-/* alu/jmp fields */
-#define BPF_MOV0xb0/* mov reg to reg */
-#define BPF_ARSH   0xc0/* sign extending arithmetic shift right */
-
-/* change endianness of a register */
-#define BPF_END0xd0/* flags for endianness conversion: */
-#define BPF_TO_LE  0x00/* convert to little-endian */
-#define BPF_TO_BE  0x08/* convert to big-endian */
-#define BPF_FROM_LEBPF_TO_LE
-#define BPF_FROM_BEBPF_TO_BE
-
-#define BPF_JNE0x50/* jump != */
-#define BPF_JSGT   0x60/* SGT is signed '>', GT in x86 */
-#define BPF_JSGE   0x70/* SGE is signed '>=', GE in x86 */
-#define BPF_CALL   0x80/* function call */
-#define BPF_EXIT   0x90/* function return */
-
-/* Register numbers */
-enum {
-   BPF_REG_0 = 0,
-   BPF_REG_1,
-   BPF_REG_2,
-   BPF_REG_3,
-   BPF_REG_4,
-   BPF_REG_5,
-   BPF_REG_6,
-   BPF_REG_7,
-   BPF_REG_8,
-   BPF_REG_9,
-   BPF_REG_10,
-   __MAX_BPF_REG,
-};
-
-/* BPF has 10 general purpose 64-bit registers and stack frame. */
-#define MAX_BPF_REG__MAX_BPF_REG
-
 /* ArgX, context and stack frame pointer register positions. Note,
  * Arg1, Arg2, Arg3, etc are used as argument mappings of function
  * calls in BPF_CALL instruction.
@@ -322,14 +276,6 @@ enum {
 #define SK_RUN_FILTER(filter, ctx) \
(*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
 
-struct bpf_insn {
-   __u8code;   /* opcode */
-   __u8dst_reg:4;  /* dest register */
-   __u8src_reg:4;  /* source register */
-   __s16   off;/* signed offset */
-   __s32   imm;/* signed immediate constant */
-};
-
 #ifdef CONFIG_COMPAT
 /* A struct sock_filter is architecture independent. */
 struct compat_sock_fprog {
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 24e9033f8b3f..fb3f7b675229 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -67,6 +67,7 @@ header-y += bfs_fs.h
 header-y += binfmts.h
 header-y += blkpg.h
 header-y += blktrace_api.h
+header-y += bpf.h
 header-y += bpqether.h
 header-y += bsg.h
 header-y += btrfs.h
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
new file mode 100644
index ..479ed0b6be16
--- /dev/null
+++ b/include/uapi/linux/bpf.h
@@ -0,0 +1,65 @@
+/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ */
+#ifndef _UAPI__LINUX_BPF_H__
+#define _UAPI__LINUX_BPF_H__
+
+#include 
+
+/* Extended instruction set based on top of classic BPF */
+
+/* instruction classes */
+#define BPF_ALU64  0x07/* alu mode in double word width */
+
+/* ld/ldx fields */
+#define BPF_DW 0x18/* double word */
+#define BPF_XADD   0xc0/* exclusive add */
+
+/* alu/jmp fields */
+#define BPF_MOV0xb0/* mov reg to reg */
+#define BPF_ARSH   0xc0/* sign extending arithmetic shift right */
+
+/* change endianness of a register */
+#define BPF_END0xd0/* flags for endianness conversion: */
+#define BPF_TO_LE  0x00/* convert to little-endian */
+#define BPF_TO_BE  0x08/* convert to big-endian */
+#define BPF_FROM_LEBPF_TO_LE
+#define BPF_FROM_BEBPF_TO_BE
+
+#define BPF_JNE0x50/* jump != */
+#define BPF_JSGT   0x60/* 

[PATCH RFC v9 net-next 3/4] net: filter: move eBPF instruction macros

2014-09-02 Thread Alexei Starovoitov
move instruction macros (like BPF_MOV64_REG or BPF_ALU32_IMM)
from linux/filter.h into uapi/linux/bpf.h
so that userspace programs can use them.

verifier testsuite (in later patches) will be using them.

Signed-off-by: Alexei Starovoitov 
---
 include/linux/filter.h   |  226 --
 include/uapi/linux/bpf.h |  226 ++
 2 files changed, 226 insertions(+), 226 deletions(-)

diff --git a/include/linux/filter.h b/include/linux/filter.h
index ff77842af3e1..c220b27b10df 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -37,232 +37,6 @@ struct bpf_prog_info;
 /* BPF program can access up to 512 bytes of stack space. */
 #define MAX_BPF_STACK  512
 
-/* Helper macros for filter block array initializers. */
-
-/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
-
-#define BPF_ALU64_REG(OP, DST, SRC)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU64 | BPF_OP(OP) | BPF_X,\
-   .dst_reg = DST, \
-   .src_reg = SRC, \
-   .off   = 0, \
-   .imm   = 0 })
-
-#define BPF_ALU32_REG(OP, DST, SRC)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU | BPF_OP(OP) | BPF_X,  \
-   .dst_reg = DST, \
-   .src_reg = SRC, \
-   .off   = 0, \
-   .imm   = 0 })
-
-/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */
-
-#define BPF_ALU64_IMM(OP, DST, IMM)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU64 | BPF_OP(OP) | BPF_K,\
-   .dst_reg = DST, \
-   .src_reg = 0,   \
-   .off   = 0, \
-   .imm   = IMM })
-
-#define BPF_ALU32_IMM(OP, DST, IMM)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU | BPF_OP(OP) | BPF_K,  \
-   .dst_reg = DST, \
-   .src_reg = 0,   \
-   .off   = 0, \
-   .imm   = IMM })
-
-/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */
-
-#define BPF_ENDIAN(TYPE, DST, LEN) \
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU | BPF_END | BPF_SRC(TYPE), \
-   .dst_reg = DST, \
-   .src_reg = 0,   \
-   .off   = 0, \
-   .imm   = LEN })
-
-/* Short form of mov, dst_reg = src_reg */
-
-#define BPF_MOV64_REG(DST, SRC)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU64 | BPF_MOV | BPF_X,   \
-   .dst_reg = DST, \
-   .src_reg = SRC, \
-   .off   = 0, \
-   .imm   = 0 })
-
-#define BPF_MOV32_REG(DST, SRC)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU | BPF_MOV | BPF_X, \
-   .dst_reg = DST, \
-   .src_reg = SRC, \
-   .off   = 0, \
-   .imm   = 0 })
-
-/* Short form of mov, dst_reg = imm32 */
-
-#define BPF_MOV64_IMM(DST, IMM)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU64 | BPF_MOV | BPF_K,   \
-   .dst_reg = DST, \
-   .src_reg = 0,   \
-   .off   = 0, \
-   .imm   = IMM })
-
-#define BPF_MOV32_IMM(DST, IMM)\
-   ((struct bpf_insn) {\
-   .code  = BPF_ALU | BPF_MOV | BPF_K, \
-   .dst_reg = DST, \
-   .src_reg = 0,   \
-   .off   = 0, \
-   .imm   = IMM })
-
-/* 

[PATCH RFC v9 net-next 4/4] net: filter: move common defines into bpf_common.h

2014-09-02 Thread Alexei Starovoitov
userspace programs that wish to use eBPF instruction macros
(like BPF_MOV64_REG or BPF_ALU32_IMM) need to include two files:
uapi/linux/filter.h and uapi/linux/bpf.h
Move common macro definitions that are shared between
classic BPF and eBPF into uapi/linux/bpf_common.h

Signed-off-by: Alexei Starovoitov 
---
 include/uapi/linux/Kbuild   |1 +
 include/uapi/linux/bpf.h|1 +
 include/uapi/linux/bpf_common.h |   55 ++
 include/uapi/linux/filter.h |   56 +--
 4 files changed, 58 insertions(+), 55 deletions(-)
 create mode 100644 include/uapi/linux/bpf_common.h

diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index fb3f7b675229..abd0a85cedc7 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -68,6 +68,7 @@ header-y += binfmts.h
 header-y += blkpg.h
 header-y += blktrace_api.h
 header-y += bpf.h
+header-y += bpf_common.h
 header-y += bpqether.h
 header-y += bsg.h
 header-y += btrfs.h
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 97edd23622fc..df9c9bdaa8a0 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -8,6 +8,7 @@
 #define _UAPI__LINUX_BPF_H__
 
 #include 
+#include 
 
 /* Extended instruction set based on top of classic BPF */
 
diff --git a/include/uapi/linux/bpf_common.h b/include/uapi/linux/bpf_common.h
new file mode 100644
index ..e2d8b1ca3730
--- /dev/null
+++ b/include/uapi/linux/bpf_common.h
@@ -0,0 +1,55 @@
+#ifndef _UAPI__LINUX_BPF_COMMON_H__
+#define _UAPI__LINUX_BPF_COMMON_H__
+
+/* Instruction classes */
+#define BPF_CLASS(code) ((code) & 0x07)
+#define BPF_LD  0x00
+#define BPF_LDX 0x01
+#define BPF_ST  0x02
+#define BPF_STX 0x03
+#define BPF_ALU 0x04
+#define BPF_JMP 0x05
+#define BPF_RET 0x06
+#define BPF_MISC0x07
+
+/* ld/ldx fields */
+#define BPF_SIZE(code)  ((code) & 0x18)
+#define BPF_W   0x00
+#define BPF_H   0x08
+#define BPF_B   0x10
+#define BPF_MODE(code)  ((code) & 0xe0)
+#define BPF_IMM 0x00
+#define BPF_ABS 0x20
+#define BPF_IND 0x40
+#define BPF_MEM 0x60
+#define BPF_LEN 0x80
+#define BPF_MSH 0xa0
+
+/* alu/jmp fields */
+#define BPF_OP(code)((code) & 0xf0)
+#define BPF_ADD 0x00
+#define BPF_SUB 0x10
+#define BPF_MUL 0x20
+#define BPF_DIV 0x30
+#define BPF_OR  0x40
+#define BPF_AND 0x50
+#define BPF_LSH 0x60
+#define BPF_RSH 0x70
+#define BPF_NEG 0x80
+#defineBPF_MOD 0x90
+#defineBPF_XOR 0xa0
+
+#define BPF_JA  0x00
+#define BPF_JEQ 0x10
+#define BPF_JGT 0x20
+#define BPF_JGE 0x30
+#define BPF_JSET0x40
+#define BPF_SRC(code)   ((code) & 0x08)
+#define BPF_K   0x00
+#define BPF_X   0x08
+
+#ifndef BPF_MAXINSNS
+#define BPF_MAXINSNS 4096
+#endif
+
+#endif /* _UAPI__LINUX_BPF_COMMON_H__ */
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 253b4d42cf2b..47785d5ecf17 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -7,7 +7,7 @@
 
 #include 
 #include 
-
+#include 
 
 /*
  * Current version of the filter code architecture.
@@ -32,56 +32,6 @@ struct sock_fprog {  /* Required for SO_ATTACH_FILTER. */
struct sock_filter __user *filter;
 };
 
-/*
- * Instruction classes
- */
-
-#define BPF_CLASS(code) ((code) & 0x07)
-#define BPF_LD  0x00
-#define BPF_LDX 0x01
-#define BPF_ST  0x02
-#define BPF_STX 0x03
-#define BPF_ALU 0x04
-#define BPF_JMP 0x05
-#define BPF_RET 0x06
-#define BPF_MISC0x07
-
-/* ld/ldx fields */
-#define BPF_SIZE(code)  ((code) & 0x18)
-#define BPF_W   0x00
-#define BPF_H   0x08
-#define BPF_B   0x10
-#define BPF_MODE(code)  ((code) & 0xe0)
-#define BPF_IMM 0x00
-#define BPF_ABS 0x20
-#define BPF_IND 0x40
-#define BPF_MEM 0x60
-#define BPF_LEN 0x80
-#define BPF_MSH 0xa0
-
-/* alu/jmp fields */
-#define BPF_OP(code)((code) & 0xf0)
-#define BPF_ADD 0x00
-#define BPF_SUB 0x10
-#define BPF_MUL 0x20
-#define BPF_DIV 0x30
-#define BPF_OR  0x40
-#define BPF_AND 0x50
-#define BPF_LSH 0x60
-#define BPF_RSH 0x70
-#define BPF_NEG 0x80
-#define  

[PATCH v9 net-next 1/4] net: filter: add "load 64-bit immediate" eBPF instruction

2014-09-02 Thread Alexei Starovoitov
add BPF_LD_IMM64 instruction to load 64-bit immediate value into a register.
All previous instructions were 8-byte. This is first 16-byte instruction.
Two consecutive 'struct bpf_insn' blocks are interpreted as single instruction:
insn[0].code = BPF_LD | BPF_DW | BPF_IMM
insn[0].dst_reg = destination register
insn[0].imm = lower 32-bit
insn[1].code = 0
insn[1].imm = upper 32-bit
All unused fields must be zero.

Classic BPF has similar instruction: BPF_LD | BPF_W | BPF_IMM
which loads 32-bit immediate value into a register.

x64 JITs it as single 'movabsq %rax, imm64'
arm64 may JIT as sequence of four 'movk x0, #imm16, lsl #shift' insn

Note that old eBPF programs are binary compatible with new interpreter.

It helps eBPF programs load 64-bit constant into a register with one
instruction instead of using two registers and 4 instructions:
BPF_MOV32_IMM(R1, imm32)
BPF_ALU64_IMM(BPF_LSH, R1, 32)
BPF_MOV32_IMM(R2, imm32)
BPF_ALU64_REG(BPF_OR, R1, R2)

User space generated programs will use this instruction to load constants only.

To tell kernel that user space needs a pointer the _pseudo_ variant of
this instruction may be added later, which will use extra bits of encoding
to indicate what type of pointer user space is asking kernel to provide.
For example 'off' or 'src_reg' fields can be used for such purpose.
src_reg = 1 could mean that user space is asking kernel to validate and
load in-kernel map pointer.
src_reg = 2 could mean that user space needs readonly data section pointer
src_reg = 3 could mean that user space needs a pointer to per-cpu local data
All such future pseudo instructions will not be carrying the actual pointer
as part of the instruction, but rather will be treated as a request to kernel
to provide one. The kernel will verify the request_for_a_pointer, then
will drop _pseudo_ marking and will store actual internal pointer inside
the instruction, so the end result is the interpreter and JITs never
see pseudo BPF_LD_IMM64 insns and only operate on generic BPF_LD_IMM64 that
loads 64-bit immediate into a register. User space never operates on direct
pointers and verifier can easily recognize request_for_pointer vs other
instructions.

Signed-off-by: Alexei Starovoitov 
---
 Documentation/networking/filter.txt |8 +++-
 arch/x86/net/bpf_jit_comp.c |   17 +
 include/linux/filter.h  |   18 ++
 kernel/bpf/core.c   |5 +
 lib/test_bpf.c  |   21 +
 5 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/Documentation/networking/filter.txt 
b/Documentation/networking/filter.txt
index c48a9704bda8..81916ab5d96f 100644
--- a/Documentation/networking/filter.txt
+++ b/Documentation/networking/filter.txt
@@ -951,7 +951,7 @@ Size modifier is one of ...
 
 Mode modifier is one of:
 
-  BPF_IMM  0x00  /* classic BPF only, reserved in eBPF */
+  BPF_IMM  0x00  /* used for 32-bit mov in classic BPF and 64-bit in eBPF */
   BPF_ABS  0x20
   BPF_IND  0x40
   BPF_MEM  0x60
@@ -995,6 +995,12 @@ BPF_XADD | BPF_DW | BPF_STX: lock xadd *(u64 *)(dst_reg + 
off16) += src_reg
 Where size is one of: BPF_B or BPF_H or BPF_W or BPF_DW. Note that 1 and
 2 byte atomic increments are not supported.
 
+eBPF has one 16-byte instruction: BPF_LD | BPF_DW | BPF_IMM which consists
+of two consecutive 'struct bpf_insn' 8-byte blocks and interpreted as single
+instruction that loads 64-bit immediate value into a dst_reg.
+Classic BPF has similar instruction: BPF_LD | BPF_W | BPF_IMM which loads
+32-bit immediate value into a register.
+
 Testing
 ---
 
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 39ccfbb4a723..06f8c17f5484 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -393,6 +393,23 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, 
u8 *image,
EMIT1_off32(add_1reg(0xB8, dst_reg), imm32);
break;
 
+   case BPF_LD | BPF_IMM | BPF_DW:
+   if (insn[1].code != 0 || insn[1].src_reg != 0 ||
+   insn[1].dst_reg != 0 || insn[1].off != 0) {
+   /* verifier must catch invalid insns */
+   pr_err("invalid BPF_LD_IMM64 insn\n");
+   return -EINVAL;
+   }
+
+   /* movabsq %rax, imm64 */
+   EMIT2(add_1mod(0x48, dst_reg), add_1reg(0xB8, dst_reg));
+   EMIT(insn[0].imm, 4);
+   EMIT(insn[1].imm, 4);
+
+   insn++;
+   i++;
+   break;
+
/* dst %= src, dst /= src, dst %= imm32, dst /= imm32 */
case BPF_ALU | BPF_MOD | BPF_X:
case BPF_ALU | BPF_DIV | BPF_X:
diff --git a/include/linux/filter.h b/include/linux/filter.h
index c78994593355..bf323da77950 

[PATCH v9 net-next 0/4] load imm64 insn and uapi/linux/bpf.h

2014-09-02 Thread Alexei Starovoitov
Hi,

V8->V9
- rebase on top of Hannes's patch in the same area [1]
- no changes to patches 1 and 2
- added patches 3 and 4 as RFC to address Daniel's concern.
  patch 3 moves eBPF instruction macros and
  patch 4 split macros which are shared between classic and eBPF
  into bpf_common.h
  3 and 4 will be used by verifier testsuite and will be reposted later
  during stage III

V8 thread with 'why' reasoning and end goal:
https://lkml.org/lkml/2014/8/27/628

Original set [2] of ~28 patches I'm planning to present in 4 stages:

  I. this 2 patches to fork off llvm upstreaming
 II. bpf syscall with manpage and map implementation
III. bpf program load/unload with verifier testsuite (1st user of
 instruction macros from bpf.h and 1st user of load imm64 insn)
 IV. tracing, etc

[1] http://patchwork.ozlabs.org/patch/385266/
[2] https://lkml.org/lkml/2014/8/26/859

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


[PATCHv3 0/3] ASoC: simple-card: simplify the code.

2014-09-02 Thread Xiubo Li
Any comment and advice are welcome.

Change in v3:
- Fix binding from Jean's comment.
- Remove 'ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the 
code.'
  and will send it separately later.

Change in v2:
- Maintian compatibility with the old DTs.

Change in v1:
- Add simple-card dts node patches.
- Fix format parsing bug from Jean-Francois's comment.
- Rebase to Kuninori-san's newest changes in next branch.




Xiubo Li (3):
  ASoC: simple-card: Merge single and muti DAI link(s) code.
  ASoC: simple-card: Adjust the comments of simple card.
  ASoC: simple-card: binding: update binding to support the new style.

 .../devicetree/bindings/sound/simple-card.txt  | 183 ++---
 sound/soc/generic/simple-card.c|  70 
 2 files changed, 161 insertions(+), 92 deletions(-)

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


[PATCHv3 2/3] ASoC: simple-card: Adjust the comments of simple card.

2014-09-02 Thread Xiubo Li
Signed-off-by: Xiubo Li 
---
 sound/soc/generic/simple-card.c | 48 -
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 1597a24..07f7fb6 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -120,7 +120,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
int ret;
 
/*
-* get node via "sound-dai = < port>"
+* Get node via "sound-dai = < port>"
 * it will be used as xxx_of_node on soc_bind_dai_link()
 */
node = of_parse_phandle(np, "sound-dai", 0);
@@ -128,19 +128,19 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
return -ENODEV;
*p_node = node;
 
-   /* get dai->name */
+   /* Get dai->name */
ret = snd_soc_of_get_dai_name(np, name);
if (ret < 0)
return ret;
 
-   /* parse TDM slot */
+   /* Parse TDM slot */
ret = snd_soc_of_parse_tdm_slot(np, >slots, >slot_width);
if (ret)
return ret;
 
/*
-* dai->sysclk come from
-*  "clocks = <>" (if system has common clock)
+* Parse dai->sysclk come from "clocks = <>"
+* (if system has common clock)
 *  or "system-clock-frequency = "
 *  or device's module clock.
 */
@@ -232,9 +232,11 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
goto dai_link_of_err;
 
if (strlen(prefix) && !bitclkmaster && !framemaster) {
-   /* No dai-link level and master setting was not found from
-  sound node level, revert back to legacy DT parsing and
-  take the settings from codec node. */
+   /*
+* No DAI link level and master setting was found
+* from sound node level, revert back to legacy DT
+* parsing and take the settings from codec node.
+*/
dev_dbg(dev, "%s: Revert to legacy daifmt parsing\n",
__func__);
dai_props->cpu_dai.fmt = dai_props->codec_dai.fmt =
@@ -263,10 +265,10 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
goto dai_link_of_err;
}
 
-   /* simple-card assumes platform == cpu */
+   /* Simple Card assumes platform == cpu */
dai_link->platform_of_node = dai_link->cpu_of_node;
 
-   /* Link name is created from CPU/CODEC dai name */
+   /* DAI link name is created from CPU/CODEC dai name */
name = devm_kzalloc(dev,
strlen(dai_link->cpu_dai_name)   +
strlen(dai_link->codec_dai_name) + 2,
@@ -288,11 +290,11 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
dai_props->codec_dai.sysclk);
 
/*
-* soc_bind_dai_link() will check cpu name
-* after of_node matching if dai_link has cpu_dai_name.
-* but, it will never match if name was created by fmt_single_name()
-* remove cpu_dai_name to escape name matching.
-* see
+* In soc_bind_dai_link() will check cpu name after
+* of_node matching if dai_link has cpu_dai_name.
+* but, it will never match if name was created by
+* fmt_single_name() remove cpu_dai_name to escape
+* name matching. Please see:
 *  fmt_single_name()
 *  fmt_multiple_name()
 */
@@ -320,10 +322,10 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
if (!node)
return -EINVAL;
 
-   /* parsing the card name from DT */
+   /* Parse the card name from DT */
snd_soc_of_parse_card_name(>snd_card, "simple-audio-card,name");
 
-   /* off-codec widgets */
+   /* The off-codec widgets */
if (of_property_read_bool(node, "simple-audio-card,widgets")) {
ret = snd_soc_of_parse_audio_simple_widgets(>snd_card,
"simple-audio-card,widgets");
@@ -378,7 +380,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
return 0;
 }
 
-/* update the reference count of the devices nodes at end of probe */
+/* Decrease the reference count of the device nodes */
 static int asoc_simple_card_unref(struct platform_device *pdev)
 {
struct snd_soc_card *card = platform_get_drvdata(pdev);
@@ -407,29 +409,27 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
struct device *dev = >dev;
int num_links, ret;
 
-   /* get the number of DAI links */
+   /* Get the number of DAI links */
if (np && of_get_child_by_name(np, "simple-audio-card,dai-link"))
num_links = of_get_child_count(np);
else
num_links = 1;
 
-   /* allocate the private data and the DAI link array */
+  

Re: regression caused by cgroups optimization in 3.17-rc2

2014-09-02 Thread Dave Hansen
On 09/02/2014 06:33 PM, Johannes Weiner wrote:
> kfree isn't eating 56% of "all cpu time" here, and it wasn't clear to
> me whether Dave filtered symbols from only memcontrol.o, memory.o, and
> mmap.o in a similar way.  I'm not arguing against the regression, I'm
> just trying to make sense of the numbers from the *patched* kernel.

I guess I could have included it in the description, but that was a
pretty vanilla run:

perf top --call-graph=fp --stdio > foo.txt

I didn't use any filtering.  I didn't even know I _could_ filter. :)

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


[PATCHv3 1/3] ASoC: simple-card: Merge single and muti DAI link(s) code.

2014-09-02 Thread Xiubo Li
This patch will split the DT node into old style and new style:
The new style will merge the single DAI link and muti DAI links code
together, the new style will be easier to add muti DAI links from old
single DAI link DTs.

This patch will maintian compatibility with the old DTs.

Signed-off-by: Xiubo Li 
---
 sound/soc/generic/simple-card.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 986d2c7..1597a24 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -178,6 +178,7 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
char *prefix = "";
int ret;
 
+   /* For single DAI link & old style of DT node */
if (is_top_level_node)
prefix = "simple-audio-card,";
 
@@ -309,14 +310,16 @@ dai_link_of_err:
 
 static int asoc_simple_card_parse_of(struct device_node *node,
 struct simple_card_data *priv,
-struct device *dev,
-int multi)
+struct device *dev)
 {
struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
struct simple_dai_props *dai_props = priv->dai_props;
u32 val;
int ret;
 
+   if (!node)
+   return -EINVAL;
+
/* parsing the card name from DT */
snd_soc_of_parse_card_name(>snd_card, "simple-audio-card,name");
 
@@ -344,7 +347,8 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
priv->snd_card.name : "");
 
-   if (multi) {
+   /* Single/Muti DAI link(s) & New style of DT node */
+   if (of_get_child_by_name(node, "simple-audio-card,dai-link")) {
struct device_node *np = NULL;
int i = 0;
 
@@ -361,6 +365,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
i++;
}
} else {
+   /* For single DAI link & old style of DT node */
ret = asoc_simple_card_dai_link_of(node, dev,
   dai_link, dai_props, true);
if (ret < 0)
@@ -400,16 +405,13 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
struct snd_soc_dai_link *dai_link;
struct device_node *np = pdev->dev.of_node;
struct device *dev = >dev;
-   int num_links, multi, ret;
+   int num_links, ret;
 
/* get the number of DAI links */
-   if (np && of_get_child_by_name(np, "simple-audio-card,dai-link")) {
+   if (np && of_get_child_by_name(np, "simple-audio-card,dai-link"))
num_links = of_get_child_count(np);
-   multi = 1;
-   } else {
+   else
num_links = 1;
-   multi = 0;
-   }
 
/* allocate the private data and the DAI link array */
priv = devm_kzalloc(dev,
@@ -436,7 +438,7 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
 
if (np && of_device_is_available(np)) {
 
-   ret = asoc_simple_card_parse_of(np, priv, dev, multi);
+   ret = asoc_simple_card_parse_of(np, priv, dev);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "parse error %d\n", ret);
-- 
1.8.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/


[PATCHv3 3/3] ASoC: simple-card: binding: update binding to support the new style.

2014-09-02 Thread Xiubo Li
This update patch will split the DT node into old style and new style:
The new style will will be easier to add muti DAI links from old single
DAI link DTs.

This patch will maintian compatibility with the old DTs.

Signed-off-by: Xiubo Li 
---
 .../devicetree/bindings/sound/simple-card.txt  | 183 ++---
 1 file changed, 125 insertions(+), 58 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt 
b/Documentation/devicetree/bindings/sound/simple-card.txt
index c2e9841..8c1bd30 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -1,15 +1,19 @@
-Simple-Card:
+Device-Tree bindings for Simple Card
 
 Simple-Card specifies audio DAI connections of SoC <-> codec.
 
-Required properties:
+=== Top level's properties and subnodes ===
 
+*** Required properties ***
 - compatible   : "simple-audio-card"
 
-Optional properties:
-
+*** Optional properties ***
 - simple-audio-card,name   : User specified audio sound card name, 
one string
  property.
+- simple-audio-card,format : CPU/CODEC common audio format.
+ "i2s", "right_j", "left_j" , "dsp_a"
+ "dsp_b", "ac97", "pdm", "msb", "lsb"
+ (This is used for single DAI link & 
old style.)
 - simple-audio-card,widgets: Please refer to widgets.txt.
 - simple-audio-card,routing: A list of the connections between 
audio components.
  Each entry is a pair of strings, the 
first being the
@@ -17,63 +21,85 @@ Optional properties:
  source.
 - simple-audio-card,mclk-fs : Multiplication factor between stream 
rate and codec
  mclk.
-
-Optional subnodes:
-
-- simple-audio-card,dai-link   : Container for dai-link level
- properties and the CPU and CODEC
- sub-nodes. This container may be
- omitted when the card has only one
- DAI link. See the examples and the
- section bellow.
-
-Dai-link subnode properties and subnodes:
-
-If dai-link subnode is omitted and the subnode properties are directly
-under "sound"-node the subnode property and subnode names have to be
-prefixed with "simple-audio-card,"-prefix.
-
-Required dai-link subnodes:
-
-- cpu  : CPU   sub-node
-- codec: CODEC sub-node
-
-Optional dai-link subnode properties:
-
+- simple-audio-card,frame-master   : Indicates DAI link frame master. One 
phandle to a cpu
+ or codec subnode.
+ (This is used for single DAI link & 
old style.)
+- simple-audio-card,bitclock-master: Indicates DAI link bit clock master. 
One phandle to a
+ cpu or codec subnode.
+ (This is used for single DAI link & 
old style.)
+
+*** Optional subnodes ***
+- simple-audio-card,dai-link   : Container for DAI link level 
properties and the CPU
+ and CODEC sub-nodes. This container 
may be omitted
+ when the card has only one DAI link 
and using the old
+ style. See the examples and the 
section bellow.
+- simple-audio-card,cpu: CPU DAI sub-node.
+ (This is used for single DAI link & 
old style.)
+- simple-audio-card,codec  : CODEC DAI sub-node.
+ (This is used for single DAI link & 
old style.)
+
+=== DAI link node's properties and its subnodes ===
+
+*** Required subnodes ***
+- cpu  : CPU DAI sub-node
+- codec: CODEC DAI sub-node
+
+*** Optional properties ***
 - format   : CPU/CODEC common audio format.
  "i2s", "right_j", "left_j" , "dsp_a"
  "dsp_b", "ac97", "pdm", "msb", "lsb"
-- frame-master : Indicates dai-link frame master.
- phandle to a cpu or codec subnode.
-- bitclock-master  : Indicates dai-link bit clock master.
- phandle to a cpu or codec subnode.
-- bitclock-inversion   : bool property. Add this if the
- dai-link uses bit 

Re: [RFC PATCH 0/5] module: Remove stop_machine from module unloading

2014-09-02 Thread Masami Hiramatsu
Ping? :)

(2014/08/25 19:55), Masami Hiramatsu wrote:
> Hi,
> 
> Here is a series of patches which remove stop_machine() from
> module unloading.
> 
> Currently, each module unloading calls stop_machine()s 2 times.
> One is for safely removing module from lists and one is to
> check the reference counter. However, both are not necessary
> for those purposes (required by current implementation).
> 
> First, we can use RCU for the list operation, we just need
> a synchronize_rcu right before cleaning up.
> Second, the reference counter can be checked atomically by
> using atomic_t, instead of per-cpu module_ref. Of course,
> for BIG SMP machines, atomic operation is not efficient.
> However, they usually don't need to remove most of modules too.
> 
> In this series, I just fixed to use RCU for the module(and
> bugs) list for the first stop_machine.
> And for the second one, I replaced module_ref with atomic_t
> and introduced a "module lockup" module load option, which
> makes a module un-removable (lock up the module in kernel).
> The lockup modules can not be removed except forced, and the
> kernel skips module refcounting on those modules. Thus we
> can minimize the performance impact on the BIG SMP machines.
> 
> BTW, of course this requires to update libkmod to support
> new MODULE_INIT_LOCKUP_MODULE flag. I'm not sure where is
> good to send the patches I have. Sould I better sending
> kmod patches on LKML?
> 
> Thank you,
> 
> ---
> 
> Masami Hiramatsu (5):
>   module: Wait for RCU synchronizing before releasing a module
>   module: Unlink module with RCU synchronizing instead of stop_machine
>   lib/bug: Use RCU list ops for module_bug_list
>   module: Lock up a module when loading with a LOCLUP flag
>   module: Remove stop_machine from module unloading
> 
> 
>  include/linux/module.h|   22 ++
>  include/trace/events/module.h |2 -
>  include/uapi/linux/module.h   |1 
>  kernel/module.c   |  147 
> +
>  lib/bug.c |   20 --
>  5 files changed, 85 insertions(+), 107 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/
> 


-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@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] fs/super.c: do not shrink fs slab during direct memory reclaim

2014-09-02 Thread Dave Chinner
On Wed, Sep 03, 2014 at 09:38:31AM +0800, Junxiao Bi wrote:
> Hi Jiufei,
> 
> On 09/02/2014 05:03 PM, Xue jiufei wrote:
> > Hi, Dave
> > On 2014/9/2 7:51, Dave Chinner wrote:
> >> On Fri, Aug 29, 2014 at 05:57:22PM +0800, Xue jiufei wrote:
> >>> The patch trys to solve one deadlock problem caused by cluster
> >>> fs, like ocfs2. And the problem may happen at least in the below
> >>> situations:
> >>> 1)Receiving a connect message from other nodes, node queues a
> >>> work_struct o2net_listen_work.
> >>> 2)o2net_wq processes this work and calls sock_alloc() to allocate
> >>> memory for a new socket.
> >>> 3)It would do direct memory reclaim when available memory is not
> >>> enough and trigger the inode cleanup. That inode being cleaned up
> >>> is happened to be ocfs2 inode, so call evict()->ocfs2_evict_inode()
> >>> ->ocfs2_drop_lock()->dlmunlock()->o2net_send_message_vec(),
> >>> and wait for the unlock response from master.
> >>> 4)tcp layer received the response, call o2net_data_ready() and
> >>> queue sc_rx_work, waiting o2net_wq to process this work.
> >>> 5)o2net_wq is a single thread workqueue, it process the work one by
> >>> one. Right now it is still doing o2net_listen_work and cannot handle
> >>> sc_rx_work. so we deadlock.
> >>>
> >>> It is impossible to set GFP_NOFS for memory allocation in sock_alloc().
> >>> So we use PF_FSTRANS to avoid the task reentering filesystem when
> >>> available memory is not enough.
> >>>
> >>> Signed-off-by: joyce.xue 
> >>
> >> For the second time: use memalloc_noio_save/memalloc_noio_restore.
> >> And please put a great big comment in the code explaining why you
> >> need to do this special thing with memory reclaim flags.
> >>
> >> Cheers,
> >>
> >> Dave.
> >>
> > Thanks for your reply. But I am afraid that memalloc_noio_save/
> > memalloc_noio_restore can not solve my problem. __GFP_IO is cleared
> > if PF_MEMALLOC_NOIO is set and can avoid doing IO in direct memory
> > reclaim. However, __GFP_FS is still set that can not avoid pruning
> > dcache and icache in memory allocation, resulting in the deadlock I
> > described.
> 
> You can use PF_MEMALLOC_NOIO to replace PF_FSTRANS, set this flag in
> ocfs2 and check it in sb shrinker.

No changes to the superblock shrinker, please. The flag should
modify the gfp_mask in the struct shrink_control passed to the
shrinker, just like the noio flag is used in the rest of the mm
code.

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/


[PATCHv6 1/2] thermal: exynos: Add support for many TRIMINFO_CTRL registers

2014-09-02 Thread Chanwoo Choi
This patch support many TRIMINFO_CTRL registers if specific Exynos SoC
has one more TRIMINFO_CTRL registers. Also this patch uses proper 'RELOAD'
shift/mask bit operation to set RELOAD feature instead of static value.

Signed-off-by: Chanwoo Choi 
Acked-by: Kyungmin Park 
Cc: Zhang Rui 
Cc: Eduardo Valentin 
Cc: Amit Daniel Kachhap 
Reviewed-by: Amit Daniel Kachhap 
---
 drivers/thermal/samsung/exynos_thermal_common.h |  1 +
 drivers/thermal/samsung/exynos_tmu.c| 15 ---
 drivers/thermal/samsung/exynos_tmu.h|  7 +--
 drivers/thermal/samsung/exynos_tmu_data.c   |  4 +++-
 drivers/thermal/samsung/exynos_tmu_data.h   |  1 +
 5 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.h 
b/drivers/thermal/samsung/exynos_thermal_common.h
index cd44719..158f5aa 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.h
+++ b/drivers/thermal/samsung/exynos_thermal_common.h
@@ -27,6 +27,7 @@
 #define SENSOR_NAME_LEN16
 #define MAX_TRIP_COUNT 8
 #define MAX_COOLING_DEVICE 4
+#define MAX_TRIMINFO_CTRL_REG  2
 
 #define ACTIVE_INTERVAL 500
 #define IDLE_INTERVAL 1
diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 35437df..092ab69 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -127,7 +127,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct exynos_tmu_platform_data *pdata = data->pdata;
const struct exynos_tmu_registers *reg = pdata->registers;
-   unsigned int status, trim_info = 0, con;
+   unsigned int status, trim_info = 0, con, ctrl;
unsigned int rising_threshold = 0, falling_threshold = 0;
int ret = 0, threshold_code, i;
 
@@ -144,8 +144,17 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
}
}
 
-   if (TMU_SUPPORTS(pdata, TRIM_RELOAD))
-   __raw_writel(1, data->base + reg->triminfo_ctrl);
+   if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) {
+   for (i = 0; i < reg->triminfo_ctrl_count; i++) {
+   if (pdata->triminfo_reload[i]) {
+   ctrl = readl(data->base +
+   reg->triminfo_ctrl[i]);
+   ctrl |= pdata->triminfo_reload[i];
+   writel(ctrl, data->base +
+   reg->triminfo_ctrl[i]);
+   }
+   }
+   }
 
/* Save trimming info in order to perform calibration */
if (data->soc == SOC_ARCH_EXYNOS5440) {
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index d503f35..f67203b 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -78,6 +78,7 @@ enum soc_type {
  * slightly across different exynos SOC's.
  * @triminfo_data: register containing 2 pont trimming data
  * @triminfo_ctrl: trim info controller register.
+ * @triminfo_ctrl_count: the number of trim info controller register.
  * @tmu_ctrl: TMU main controller register.
  * @test_mux_addr_shift: shift bits of test mux address.
  * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
@@ -112,8 +113,8 @@ enum soc_type {
 struct exynos_tmu_registers {
u32 triminfo_data;
 
-   u32 triminfo_ctrl;
-   u32 triminfo_ctrl1;
+   u32 triminfo_ctrl[MAX_TRIMINFO_CTRL_REG];
+   u32 triminfo_ctrl_count;
 
u32 tmu_ctrl;
u32 test_mux_addr_shift;
@@ -200,6 +201,7 @@ struct exynos_tmu_registers {
  * @second_point_trim: temp value of the second point trimming
  * @default_temp_offset: default temperature offset in case of no trimming
  * @test_mux; information if SoC supports test MUX
+ * @triminfo_reload: reload value to read TRIMINFO register
  * @cal_type: calibration type for temperature
  * @freq_clip_table: Table representing frequency reduction percentage.
  * @freq_tab_count: Count of the above table as frequency reduction may
@@ -230,6 +232,7 @@ struct exynos_tmu_platform_data {
u8 second_point_trim;
u8 default_temp_offset;
u8 test_mux;
+   u8 triminfo_reload[MAX_TRIMINFO_CTRL_REG];
 
enum calibration_type cal_type;
enum soc_type type;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 177ada5..362a1e1 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -169,7 +169,8 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.triminfo_data = EXYNOS_TMU_REG_TRIMINFO,

[PATCHv6 0/2] thermal: exynos: Add support for TRIMINFO feature of Exynos3250

2014-09-02 Thread Chanwoo Choi
This patchset add the support of TRIMINFO_RELOAD feature for Exynos3250.
But Exynos3250 has two TRIMINFO_CTRL register instead other Exynos has only one
TRIMINFO_CTRL register. So, this patchset support the some Exynos SoC which
has more than one TRIMINF_CTRL.

Also, this patchset fix wrong value of TRIMINFO_RELOAD_SHIFT and remove
duplicate code when reading triminfo register of Exynos5440.

Changes from v5:
- Rebase this patchset on next branch of linux-soc-thermal.git

Changes from v4:
- Remove un-necessary triminfo_ctrl_{shift, mask} field
- Includes Bartlomiej's patch[1] that Exynos5260 / Exynos5420 should not use
TRIM_RELOAD flag
[2] https://lkml.org/lkml/2014/8/20/481

Changes from v3:
- Add reviewed message of Amit Daniel Kachhap 
- Split RELOAD patch as two patch
- Fix 'TRIMINFO_RELOAD_SHIFT' value
- This series includes separate patch[1]
[1] https://lkml.org/lkml/2014/8/20/5
- Drop ACTIME bit setting because TRM includes not enough information of ACTIME 
bit.

Changes from v2:
- Fix build break because of missing 'or' operation.

Changes from v1:
- Add missing 'TMU_SUPPORT_TRIM_RELOAD' features

Chanwoo Choi (2):
  thermal: exynos: Add support for many TRIMINFO_CTRL registers
  thermal: exynos: Add support for TRIM_RELOAD feature at Exynos3250

 drivers/thermal/samsung/exynos_thermal_common.h |  1 +
 drivers/thermal/samsung/exynos_tmu.c| 15 ---
 drivers/thermal/samsung/exynos_tmu.h|  7 +--
 drivers/thermal/samsung/exynos_tmu_data.c   | 11 +--
 drivers/thermal/samsung/exynos_tmu_data.h   |  8 ++--
 5 files changed, 33 insertions(+), 9 deletions(-)

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


[PATCHv6 2/2] thermal: exynos: Add support for TRIM_RELOAD feature at Exynos3250

2014-09-02 Thread Chanwoo Choi
This patch add support for TRIM_RELOAD feature at Exynos3250. The TMu of
Exynos3250 has two TRIMINFO_CON register and must need to set RELOAD bit
before reading TRIMINFO register.

Signed-off-by: Chanwoo Choi 
Acked-by: Kyungmin Park 
Cc: Zhang Rui 
Cc: Eduardo Valentin 
Cc: Amit Daniel Kachhap 
Reviewed-by: Amit Daniel Kachhap 
---
 drivers/thermal/samsung/exynos_tmu_data.c | 9 +++--
 drivers/thermal/samsung/exynos_tmu_data.h | 7 +--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 362a1e1..8bae170 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -87,6 +87,9 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
 #if defined(CONFIG_SOC_EXYNOS3250)
 static const struct exynos_tmu_registers exynos3250_tmu_registers = {
.triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
+   .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON1,
+   .triminfo_ctrl[1] = EXYNOS_TMU_TRIMINFO_CON2,
+   .triminfo_ctrl_count = 2,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
.test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
@@ -147,8 +150,10 @@ static const struct exynos_tmu_registers 
exynos3250_tmu_registers = {
.temp_level = 95, \
}, \
.freq_tab_count = 2, \
+   .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
+   .triminfo_reload[1] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
.registers = _tmu_registers, \
-   .features = (TMU_SUPPORT_EMULATION | \
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
TMU_SUPPORT_EMUL_TIME)
 #endif
@@ -169,7 +174,7 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
-   .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON,
+   .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON2,
.triminfo_ctrl_count = 1,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
.test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h 
b/drivers/thermal/samsung/exynos_tmu_data.h
index 6b47a17..4b8f33c 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -39,14 +39,17 @@
 #define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8
 #define EXYNOS_TMU_CORE_EN_SHIFT   0
 
+/* Exynos3250 specific registers */
+#define EXYNOS_TMU_TRIMINFO_CON1   0x10
+
 /* Exynos4210 specific registers */
 #define EXYNOS4210_TMU_REG_THRESHOLD_TEMP  0x44
 #define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50
 
 #define EXYNOS4210_TMU_TRIG_LEVEL_MASK 0x
 
-/* Exynos5250 and Exynos4412 specific registers */
-#define EXYNOS_TMU_TRIMINFO_CON0x14
+/* Exynos5250, Exynos4412, Exynos3250 specific registers */
+#define EXYNOS_TMU_TRIMINFO_CON2   0x14
 #define EXYNOS_THD_TEMP_RISE   0x50
 #define EXYNOS_THD_TEMP_FALL   0x54
 #define EXYNOS_EMUL_CON0x80
-- 
1.8.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 net-next v2 2/2] r8152: use eth_hw_addr_random

2014-09-02 Thread Hayes Wang
If the hw doesn't have a valid MAC address, give a random one and
set it to the hw.

Signed-off-by: Hayes Wang 
---
 drivers/net/usb/r8152.c | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index b5ff933..443eb9e 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -992,32 +992,37 @@ static int rtl8152_set_mac_address(struct net_device 
*netdev, void *p)
return 0;
 }
 
-static inline void set_ethernet_addr(struct r8152 *tp)
+static int set_ethernet_addr(struct r8152 *tp)
 {
struct net_device *dev = tp->netdev;
+   struct sockaddr sa;
int ret;
-   u8 node_id[8] = {0};
 
if (tp->version == RTL_VER_01)
-   ret = pla_ocp_read(tp, PLA_IDR, sizeof(node_id), node_id);
+   ret = pla_ocp_read(tp, PLA_IDR, 8, sa.sa_data);
else
-   ret = pla_ocp_read(tp, PLA_BACKUP, sizeof(node_id), node_id);
+   ret = pla_ocp_read(tp, PLA_BACKUP, 8, sa.sa_data);
 
if (ret < 0) {
-   netif_notice(tp, probe, dev, "inet addr fail\n");
+   netif_err(tp, probe, dev, "Get ether addr fail\n");
+   } else if (!is_valid_ether_addr(sa.sa_data)) {
+   netif_err(tp, probe, dev, "Invalid ether addr %pM\n",
+ sa.sa_data);
+   eth_hw_addr_random(dev);
+   ether_addr_copy(sa.sa_data, dev->dev_addr);
+   ret = rtl8152_set_mac_address(dev, );
+   netif_info(tp, probe, dev, "Random ether addr %pM\n",
+  sa.sa_data);
} else {
-   if (tp->version != RTL_VER_01) {
-   ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR,
-  CRWECR_CONFIG);
-   pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES,
- sizeof(node_id), node_id);
-   ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR,
-  CRWECR_NORAML);
-   }
+   if (tp->version == RTL_VER_01)
+   ether_addr_copy(dev->dev_addr, sa.sa_data);
+   else
+   ret = rtl8152_set_mac_address(dev, );
 
-   memcpy(dev->dev_addr, node_id, dev->addr_len);
-   memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
+   ether_addr_copy(dev->perm_addr, dev->dev_addr);
}
+
+   return ret;
 }
 
 static void read_bulk_callback(struct urb *urb)
-- 
1.9.3

--
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 net-next v2 0/2] r8152: random MAC address

2014-09-02 Thread Hayes Wang
If the interface has invalid MAC address, it couldn't
be used. In order to let it work normally, give a
random one.

v2:
  Use "%pM" format specifier for printing a MAC address.

Hayes Wang (2):
  r8152: change the location of rtl8152_set_mac_address
  r8152: use eth_hw_addr_random

 drivers/net/usb/r8152.c | 65 -
 1 file changed, 37 insertions(+), 28 deletions(-)

-- 
1.9.3

--
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 net-next v2 1/2] r8152: change the location of rtl8152_set_mac_address

2014-09-02 Thread Hayes Wang
Exchange the location of rtl8152_set_mac_address() and
set_ethernet_addr(). Then, the set_ethernet_addr() could
set the MAC address by calling rtl8152_set_mac_address()
later.

Signed-off-by: Hayes Wang 
---
 drivers/net/usb/r8152.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 80b0179..b5ff933 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -975,6 +975,23 @@ void write_mii_word(struct net_device *netdev, int phy_id, 
int reg, int val)
 static int
 r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags);
 
+static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
+{
+   struct r8152 *tp = netdev_priv(netdev);
+   struct sockaddr *addr = p;
+
+   if (!is_valid_ether_addr(addr->sa_data))
+   return -EADDRNOTAVAIL;
+
+   memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
+
+   ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG);
+   pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES, 8, addr->sa_data);
+   ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML);
+
+   return 0;
+}
+
 static inline void set_ethernet_addr(struct r8152 *tp)
 {
struct net_device *dev = tp->netdev;
@@ -1003,23 +1020,6 @@ static inline void set_ethernet_addr(struct r8152 *tp)
}
 }
 
-static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
-{
-   struct r8152 *tp = netdev_priv(netdev);
-   struct sockaddr *addr = p;
-
-   if (!is_valid_ether_addr(addr->sa_data))
-   return -EADDRNOTAVAIL;
-
-   memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
-
-   ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG);
-   pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES, 8, addr->sa_data);
-   ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML);
-
-   return 0;
-}
-
 static void read_bulk_callback(struct urb *urb)
 {
struct net_device *netdev;
-- 
1.9.3

--
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/1] i2c: designware: add support of platform data to set I2C mode

2014-09-02 Thread Raymond Tan
From: "Tan, Raymond" 

Use the platform data to set the clk_freq when there is no DT configuration
available. The clk_freq in turn will determine the I2C speed mode.

In Quark, there is currently no other configuration mechanism other than
board files.

Signed-off-by: Raymond Tan 
Reviewed-by: Mika Westerberg 
Reviewed-by: Hock Leong Kweh 
---
 drivers/i2c/busses/i2c-designware-platdrv.c  |6 ++
 include/linux/platform_data/i2c-designware.h |   21 +
 2 files changed, 27 insertions(+)
 create mode 100644 include/linux/platform_data/i2c-designware.h

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c 
b/drivers/i2c/busses/i2c-designware-platdrv.c
index b543fe1..ce3f779 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "i2c-designware-core.h"
 
 static struct i2c_algorithm i2c_dw_algo = {
@@ -121,6 +122,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev;
struct i2c_adapter *adap;
struct resource *mem;
+   struct dw_i2c_platform_data *pdata;
int irq, r;
u32 clk_freq;
 
@@ -181,6 +183,10 @@ static int dw_i2c_probe(struct platform_device *pdev)
dev_err(>dev, "Only 100kHz and 400kHz supported");
return -EINVAL;
}
+   } else {
+   pdata = dev_get_platdata(>dev);
+   if (pdata)
+   clk_freq = pdata->i2c_scl_freq;
}
 
dev->functionality =
diff --git a/include/linux/platform_data/i2c-designware.h 
b/include/linux/platform_data/i2c-designware.h
new file mode 100644
index 000..7a61fb2
--- /dev/null
+++ b/include/linux/platform_data/i2c-designware.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ */
+
+#ifndef I2C_DESIGNWARE_H
+#define I2C_DESIGNWARE_H
+
+struct dw_i2c_platform_data {
+   unsigned int i2c_scl_freq;
+};
+
+#endif
-- 
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 0/1] i2c: designware: Add support for Intel Quark X1000

2014-09-02 Thread Raymond Tan
From: "Tan, Raymond" 

Hi,
This patch is for enabling support of Intel Quark X1000 i2c controller. The
Quark designware i2c controller is registered as a MFD device, and Quark
exports a single PCI device with both I2C and GPIO functions.

In Quark, there is currently no other configuration mechanism other than
board files to configure the I2C mode for the the controller.

This patch is built upon the changes made by Romain Baeriswyl, titled
[PATCH V3 2/2] i2c designware add support of I2C standard mode, at
https://lkml.org/lkml/2014/3/25/135

Tan, Raymond (1):
  i2c: designware: add support of platform data to set I2C mode

 drivers/i2c/busses/i2c-designware-platdrv.c  |6 ++
 include/linux/platform_data/i2c-designware.h |   21 +
 2 files changed, 27 insertions(+)
 create mode 100644 include/linux/platform_data/i2c-designware.h

-- 
1.7.9.5

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


[PATCH v2] hwmon: ntc_thermistor: Add ntc thermistor to thermal subsystem as a sensor.

2014-09-02 Thread Jonghwa Lee
To get more comprehensive and integrated thermal management, it adds ntc
thermistor to thermal framework as a thermal sensor. It's governed thermal
susbsystem only if it is described in DT node. Otherwise, it just notifies
temperature to userspace via sysfs as it used to be.

Signed-off-by: Jonghwa Lee 
---
Updates in v2
 - Remove NULL pointer checking already done by 
thermal_zone_of_sensor_unregister().

 .../devicetree/bindings/hwmon/ntc_thermistor.txt   |3 +++
 drivers/hwmon/ntc_thermistor.c |   25 
 2 files changed, 28 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt 
b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
index 2391e5c..fcca8e7 100644
--- a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
+++ b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
@@ -25,6 +25,9 @@ Requires node properties:
 - "io-channels"Channel node of ADC to be used for
conversion.
 
+Optional node properties:
+- "#thermal-sensor-cells" Used to expose itself to thermal fw.
+
 Read more about iio bindings at
Documentation/devicetree/bindings/iio/iio-bindings.txt
 
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index bd41072..4ff89b2 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -38,6 +38,7 @@
 
 #include 
 #include 
+#include 
 
 struct ntc_compensation {
int temp_c;
@@ -182,6 +183,7 @@ struct ntc_data {
struct device *dev;
int n_comp;
char name[PLATFORM_NAME_SIZE];
+   struct thermal_zone_device *tz;
 };
 
 #if defined(CONFIG_OF) && IS_ENABLED(CONFIG_IIO)
@@ -428,6 +430,20 @@ static int ntc_thermistor_get_ohm(struct ntc_data *data)
return -EINVAL;
 }
 
+static int ntc_read_temp(void *dev, long *temp)
+{
+   struct ntc_data *data = dev_get_drvdata(dev);
+   int ohm;
+
+   ohm = ntc_thermistor_get_ohm(data);
+   if (ohm < 0)
+   return ohm;
+
+   *temp = get_temp_mc(data, ohm);
+
+   return 0;
+}
+
 static ssize_t ntc_show_name(struct device *dev,
struct device_attribute *attr, char *buf)
 {
@@ -562,6 +578,13 @@ static int ntc_thermistor_probe(struct platform_device 
*pdev)
dev_info(>dev, "Thermistor type: %s successfully probed.\n",
pdev_id->name);
 
+   data->tz = thermal_zone_of_sensor_register(data->dev, 0, data->dev,
+   ntc_read_temp, NULL);
+   if (IS_ERR(data->tz)) {
+   dev_dbg(>dev, "Failed to register to thermal fw.\n");
+   data->tz = NULL;
+   }
+
return 0;
 err_after_sysfs:
sysfs_remove_group(>dev->kobj, _attr_group);
@@ -578,6 +601,8 @@ static int ntc_thermistor_remove(struct platform_device 
*pdev)
sysfs_remove_group(>dev->kobj, _attr_group);
ntc_iio_channel_release(pdata);
 
+   thermal_zone_of_sensor_unregister(data->dev, data->tz);
+
return 0;
 }
 
-- 
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 0/3] clk: zynq: Clean up

2014-09-02 Thread Mike Turquette
Quoting Soren Brinkmann (2014-09-02 16:02:06)
> Hi,
> 
> triggered by that discussion whether checkpatch should be used to check
> files, I ran checkpatch on Zynq's clock code. A few of the reported
> issues I found worth fixing.

Applied to clk-next.

Regards,
Mike

> 
> Thanks,
> Sören
> 
> Soren Brinkmann (3):
>   clk: zynq: Remove unnecessary OOM message
>   clk: zynq: Remove pointless return at end of void function
>   clk: zynq: Move const initdata into correct code section
> 
>  drivers/clk/zynq/clkc.c | 30 ++
>  drivers/clk/zynq/pll.c  |  4 +---
>  2 files changed, 15 insertions(+), 19 deletions(-)
> 
> -- 
> 2.1.0.1.g27b9230
> 
--
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: [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread li.xi...@freescale.com
> Subject: Re: [PATCHv2 1/4] ASoC: simple-card: add 
> asoc_simple_card_fmt_master()
> to simplify the code.
> 
> On 09/02/2014 12:26 PM, Xiubo Li wrote:
> > Signed-off-by: Xiubo Li 
> > ---
> >   sound/soc/generic/simple-card.c | 61 -
> 
> >   1 file changed, 29 insertions(+), 32 deletions(-)
> >
> > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-
> card.c
> > index 986d2c7..cad2b30 100644
> > --- a/sound/soc/generic/simple-card.c
> > +++ b/sound/soc/generic/simple-card.c
> > @@ -163,6 +163,26 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
> > return 0;
> >   }
> >
> > +static inline unsigned int
> > +asoc_simple_card_fmt_master(struct device_node *np,
> > +   struct device_node *bitclkmaster,
> > +   struct device_node *framemaster)
> > +{
> > +   switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
> > +   case 0x11:
> > +   return SND_SOC_DAIFMT_CBS_CFS;
> > +   case 0x10:
> > +   return SND_SOC_DAIFMT_CBS_CFM;
> > +   case 0x01:
> > +   return SND_SOC_DAIFMT_CBM_CFS;
> > +   default:
> > +   return SND_SOC_DAIFMT_CBM_CFM;
> > +   }
> > +
> > +   /* Shouldn't be here */
> > +   return -EINVAL;
> > +}
> > +
> 
> > +   fmt = asoc_simple_card_fmt_master(np, bitclkmaster, framemaster);
> > +   dai_props->cpu_dai.fmt = daifmt | fmt;
> ...
> > +   fmt = asoc_simple_card_fmt_master(np, bitclkmaster,
> > + framemaster);
> > +   dai_props->codec_dai.fmt = daifmt | fmt;
> 
> This won't work. The logic for cpu node needs to be negated for codec node.
> 

Yes, actually it should be.

As my previous patches about this:

Since from the DAI format micro SND_SOC_DAIFMT_CBx_CFx, the 'CBx'
mean Codec's bit clock is as master/slave and the 'CFx' mean Codec's
frame clock is as master/slave.

So these same DAI formats should be informed to CPU and CODE DAIs at
the same time. For the Codec driver will set the bit clock and frame
clock as the DAI formats said, but for the CPU driver, if the the
bit clock or frame clock is as Codec master, so it should be set CPU
DAI device as bit clock or frame clock as slave, and vice versa.

The old code will cause confusion, and we should be clear that the
letter 'C' here mean to Codec.


For the master format, no matter for CPU or CODEC, it always means Codec
is master or slave for bit/frame clock, not means the local DAI device's
bit/frame clock as master or slave.

So your CPU DAI device driver should negate this locally as the existed
Ones do.

Thanks,

BRs
Xiubo



--
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: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

2014-09-02 Thread Dinh Nguyen
Hi DTS maintainers,

If possible, can I please get an Acked-by for this patch?

Many thanks...

Dinh

On 8/11/14, 10:18 AM, ttha...@opensource.altera.com wrote:
> From: Thor Thayer 
> 
> Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC 
> project.
> 
> Signed-off-by: Thor Thayer 
> ---
> v2: Changes to SoC SDRAM EDAC code.
> 
> v3: Implement code suggestions for SDRAM EDAC code.
> 
> v4: Remove syscon from SDRAM controller bindings.
> 
> v5: No Change, bump version for consistency.
> 
> v6: Only map the ctrlcfg register as syscon.
> 
> v7: No change. Bump for consistency.
> 
> v8: No change. Bump for consistency.
> 
> v9: Changes to support a MFD SDRAM controller with nested EDAC.
> 
> v10: Revert to using syscon based on feedback.
> ---
>  .../bindings/arm/altera/socfpga-sdram-edac.txt |   15 +++
>  arch/arm/boot/dts/socfpga.dtsi |   11 +++
>  2 files changed, 26 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt 
> b/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
> new file mode 100644
> index 000..d0ce01d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
> @@ -0,0 +1,15 @@
> +Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
> +The EDAC accesses a range of registers in the SDRAM controller.
> +
> +Required properties:
> +- compatible : should contain "altr,sdram-edac";
> +- altr,sdr-syscon : phandle of the sdr module
> +- interrupts : Should contain the SDRAM ECC IRQ in the
> + appropriate format for the IRQ controller.
> +
> +Example:
> + sdramedac {
> + compatible = "altr,sdram-edac";
> + altr,sdr-syscon = <>;
> + interrupts = <0 39 4>;
> + };
> diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
> index 4676f25..45b361e 100644
> --- a/arch/arm/boot/dts/socfpga.dtsi
> +++ b/arch/arm/boot/dts/socfpga.dtsi
> @@ -603,6 +603,17 @@
>   };
>   };
>  
> + sdr: sdr@ffc25000 {
> + compatible = "syscon";
> + reg = <0xffc25000 0x1000>;
> + };
> +
> + sdramedac {
> + compatible = "altr,sdram-edac";
> + altr,sdr-syscon = <>;
> + interrupts = <0 39 4>;
> + };
> +
>   L2: l2-cache@fffef000 {
>   compatible = "arm,pl310-cache";
>   reg = <0xfffef000 0x1000>;
> 
--
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: [alsa-devel] [PATCHv2 3/4] ASoC: simple-card: Adjust the comments of simple card.

2014-09-02 Thread li.xi...@freescale.com
> Subject: Re: [alsa-devel] [PATCHv2 3/4] ASoC: simple-card: Adjust the comments
> of simple card.
> 
> 
> Hi Xiubo
> 
> > > > /*
> > > > -* soc_bind_dai_link() will check cpu name
> > > > -* after of_node matching if dai_link has cpu_dai_name.
> > > > -* but, it will never match if name was created by
> fmt_single_name()
> > > > -* remove cpu_dai_name to escape name matching.
> > > > -* see
> > > > +* In soc_bind_dai_link() will check cpu name after
> > > > +* of_node matching if dai_link has cpu_dai_name.
> > > > +* but, it will never match if name was created by
> > > > +* fmt_single_name() remove cpu_dai_name to escape
> > > > +* name matching. Please see:
> > > >  *  fmt_single_name()
> > > >  *  fmt_multiple_name()
> > > >  */
> > >
> > > The patch done by Kuninori, setting the cpu_dai_name to NULL in all
> > > cases, does not work. This sequence should be replaced where is was
> > > previously.
> > >
> >
> > If so, it should be another issue here, should we send another patch for
> > It ?
> 
> I posted patch yesterday, and Jean tested it
> 
> Subject: [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case
> Date: Tue, 02 Sep 2014 20:05:32 +0900
> 

Nice.

I think I just missed it.

Thanks,

BRs
Xiubo


--
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: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

2014-09-02 Thread li.xi...@freescale.com
Hi Kuninori-san,

Yes, I think it make sense to set all fmt in one function, and will
Be more readable.

I agree with you, could you please just wait, because there has many
Replications and good Ideas about this patch, and I will revise it.
Then you can improve it as your patch blow.


Thanks,

BRs
Xiubo


> Subject: Re: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add
> asoc_simple_card_fmt_master() to simplify the code.
> 
> 
> Hi Xiubo
> 
> I was very surprised about this patch
> because the idea is same as my local patch
> (I was planned to send it to ML :)
> 
> I attached my local patch to sharing idea.
> 
> > +static inline unsigned int
> > +asoc_simple_card_fmt_master(struct device_node *np,
> > +   struct device_node *bitclkmaster,
> > +   struct device_node *framemaster)
> > +{
> > +   switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
> > +   case 0x11:
> > +   return SND_SOC_DAIFMT_CBS_CFS;
> > +   case 0x10:
> > +   return SND_SOC_DAIFMT_CBS_CFM;
> > +   case 0x01:
> > +   return SND_SOC_DAIFMT_CBM_CFS;
> > +   default:
> > +   return SND_SOC_DAIFMT_CBM_CFM;
> > +   }
> > +
> > +   /* Shouldn't be here */
> > +   return -EINVAL;
> > +}
> 
> I think this concept is nice,
> but setting all fmt in this function is good for me
> see my local patch
> 
> --
> From 85562eb1587e5c184e4f4e0b183bd7063aaa81b7 Mon Sep 17 00:00:00 2001
> From: Kuninori Morimoto 
> Date: Thu, 28 Aug 2014 19:20:14 +0900
> Subject: [PATCH] ASoC: simple-card: add asoc_simple_card_parse_daifmt()
> 
> Current daifmt setting method in simple-card driver is
> placed to many places, and using un-readable/confusable method.
> This patch adds new asoc_simple_card_parse_daifmt()
> and tidyup code.
> 
> Signed-off-by: Kuninori Morimoto 
> 
> diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
> index bea5901..c932103 100644
> --- a/sound/soc/generic/simple-card.c
> +++ b/sound/soc/generic/simple-card.c
> @@ -167,6 +167,64 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
>   return 0;
>  }
> 
> +static int asoc_simple_card_parse_daifmt(struct device_node *node,
> +  struct simple_card_data *priv,
> +  struct device_node *cpu,
> +  struct device_node *codec,
> +  char *prefix, int idx)
> +{
> + struct device *dev = simple_priv_to_dev(priv);
> + struct device_node *bitclkmaster = NULL;
> + struct device_node *framemaster = NULL;
> + struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
> + struct asoc_simple_dai *cpu_dai = _props->cpu_dai;
> + struct asoc_simple_dai *codec_dai = _props->codec_dai;
> + unsigned int daifmt;
> +
> + daifmt = snd_soc_of_parse_daifmt(node, prefix,
> +  , );
> + daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
> +
> + if (strlen(prefix) && !bitclkmaster && !framemaster) {
> + /*
> +  * No dai-link level and master setting was not found from
> +  * sound node level, revert back to legacy DT parsing and
> +  * take the settings from codec node.
> +  */
> + dev_dbg(dev, "Revert to legacy daifmt parsing\n");
> +
> + cpu_dai->fmt = codec_dai->fmt =
> + snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
> + (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
> + } else {
> +
> + switch (((codec == bitclkmaster) << 4) | (codec == framemaster))
> {
> + case 0x11:
> + daifmt |= SND_SOC_DAIFMT_CBM_CFM;
> + break;
> + case 0x10:
> + daifmt |= SND_SOC_DAIFMT_CBM_CFS;
> + break;
> + case 0x01:
> + daifmt |= SND_SOC_DAIFMT_CBS_CFM;
> + break;
> + default:
> + daifmt |= SND_SOC_DAIFMT_CBS_CFS;
> + break;
> + }
> +
> + cpu_dai->fmt = daifmt;
> + codec_dai->fmt = daifmt;
> + }
> +
> + if (bitclkmaster)
> + of_node_put(bitclkmaster);
> + if (framemaster)
> + of_node_put(framemaster);
> +
> + return 0;
> +}
> +
>  static int asoc_simple_card_dai_link_of(struct device_node *node,
>   struct simple_card_data *priv,
>   int idx,
> @@ -175,10 +233,8 @@ static int asoc_simple_card_dai_link_of(struct
> device_node *node,
>   struct device *dev = simple_priv_to_dev(priv);
>   struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
>   struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
> - struct device_node *np = NULL;
> - struct device_node *bitclkmaster = NULL;

Re: [alsa-devel] [PATCHv2 3/4] ASoC: simple-card: Adjust the comments of simple card.

2014-09-02 Thread Kuninori Morimoto

Hi Xiubo

> > >   /*
> > > -  * soc_bind_dai_link() will check cpu name
> > > -  * after of_node matching if dai_link has cpu_dai_name.
> > > -  * but, it will never match if name was created by fmt_single_name()
> > > -  * remove cpu_dai_name to escape name matching.
> > > -  * see
> > > +  * In soc_bind_dai_link() will check cpu name after
> > > +  * of_node matching if dai_link has cpu_dai_name.
> > > +  * but, it will never match if name was created by
> > > +  * fmt_single_name() remove cpu_dai_name to escape
> > > +  * name matching. Please see:
> > >*  fmt_single_name()
> > >*  fmt_multiple_name()
> > >*/
> > 
> > The patch done by Kuninori, setting the cpu_dai_name to NULL in all
> > cases, does not work. This sequence should be replaced where is was
> > previously.
> > 
> 
> If so, it should be another issue here, should we send another patch for
> It ?

I posted patch yesterday, and Jean tested it

Subject: [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case
Date: Tue, 02 Sep 2014 20:05:32 +0900

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/


Re: [PATCH] mmc: core: sdio: Fix unconditional wake_up_process() on sdio thread

2014-09-02 Thread Jaehoon Chung
Hi,

On 09/03/2014 11:10 AM, Fu, Zhonghui wrote:
> 
> Hi,Uffe
> 
> Could you please tell me into which git repository this patch is merged now?

I knew it was merged into Ulf's git repository.
You can refer to below git.

url = http://git.linaro.org/git/people/ulf.hansson/mmc.git


Best Regards,
Jaehoon Chung
> 
> 
> 
> Thanks,
> Zhonghui 
> 
> 
> 
> On 2014/8/26 0:10, Fu, Zhonghui wrote:
>>
>> Many thanks for your helps.
>>
>>
>>
>> Thanks,
>> Zhonghui
>>
>>
>> On 2014/8/18 20:07, Ulf Hansson wrote:
>>> On 18 August 2014 05:04, Fu, Zhonghui  wrote:
 From 21266249bbbaf9407c1e88cd5950e06ac88aeebf Mon Sep 17 00:00:00 2001
 From: Fu Zhonghui 
 Date: Mon, 18 Aug 2014 10:48:14 +0800
 Subject: [PATCH] mmc: core: sdio: Fix unconditional wake_up_process() on 
 sdio thread

 781e989cf59 ("mmc: sdhci: convert to new SDIO IRQ handling") and
 bf3b5ec66bd ("mmc: sdio_irq: rework sdio irq handling") disabled
 the use of our own custom threaded IRQ handler, but left in an
 unconditional wake_up_process() on that handler at resume-time.
 Link: https://bugzilla.kernel.org/show_bug.cgi?id=80151

 In addition, the check for MMC_CAP_SDIO_IRQ capability is added
 before enable sdio IRQ.

 Signed-off-by: Jaehoon Chung 
 Signed-off-by: Chris Ball 
 Signed-off-by: Ulf Hansson 
 Signed-off-by: Fu Zhonghui 
>>> Thanks! Applied for next and added a stable tag for v3.16+.
>>>
>>> Kind regards
>>> Uffe
>>>
 ---
  drivers/mmc/core/sdio.c |   12 ++--
  drivers/mmc/core/sdio_irq.c |4 ++--
  2 files changed, 12 insertions(+), 4 deletions(-)

 diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
 index e636d9e..3fc40a7 100644
 --- a/drivers/mmc/core/sdio.c
 +++ b/drivers/mmc/core/sdio.c
 @@ -992,8 +992,16 @@ static int mmc_sdio_resume(struct mmc_host *host)
 }
 }

 -   if (!err && host->sdio_irqs)
 -   wake_up_process(host->sdio_irq_thread);
 +   if (!err && host->sdio_irqs) {
 +   if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
 +   wake_up_process(host->sdio_irq_thread);
 +   } else if (host->caps & MMC_CAP_SDIO_IRQ) {
 +   mmc_host_clk_hold(host);
 +   host->ops->enable_sdio_irq(host, 1);
 +   mmc_host_clk_release(host);
 +   }
 +   }
 +
 mmc_release_host(host);

 host->pm_flags &= ~MMC_PM_KEEP_POWER;
 diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
 index 5cc13c8..696eca4 100644
 --- a/drivers/mmc/core/sdio_irq.c
 +++ b/drivers/mmc/core/sdio_irq.c
 @@ -208,7 +208,7 @@ static int sdio_card_irq_get(struct mmc_card *card)
 host->sdio_irqs--;
 return err;
 }
 -   } else {
 +   } else if (host->caps & MMC_CAP_SDIO_IRQ) {
 mmc_host_clk_hold(host);
 host->ops->enable_sdio_irq(host, 1);
 mmc_host_clk_release(host);
 @@ -229,7 +229,7 @@ static int sdio_card_irq_put(struct mmc_card *card)
 if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
 atomic_set(>sdio_irq_thread_abort, 1);
 kthread_stop(host->sdio_irq_thread);
 -   } else {
 +   } else if (host->caps & MMC_CAP_SDIO_IRQ) {
 mmc_host_clk_hold(host);
 host->ops->enable_sdio_irq(host, 0);
 mmc_host_clk_release(host);
 -- 1.7.1

 On 2014/8/12 18:23, Ulf Hansson wrote:
> On 11 August 2014 07:49, Fu, Zhonghui  wrote:
>> From 6cee984e1d76ba0a3320430f8cf4318ab65fcf06 Mon Sep 17 00:00:00 2001
>> From: Fu Zhonghui 
>> Date: Tue, 5 Aug 2014 12:44:38 +0800
>> Subject: [PATCH] mmc: core: sdio: Fix unconditional wake_up_process() on 
>> sdio thread
>>
>> 781e989cf59 ("mmc: sdhci: convert to new SDIO IRQ handling") and
>> bf3b5ec66bd ("mmc: sdio_irq: rework sdio irq handling") disabled
>> the use of our own custom threaded IRQ handler, but left in an
>> unconditional wake_up_process() on that handler at resume-time.
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=80151
>>
>> In addition, the check for MMC_CAP_SDIO_IRQ capability is added
>> before enable sdio IRQ.
>>
>> Signed-off-by: Jaehoon Chung 
>> Signed-off-by: Chris Ball 
>> Signed-off-by: Fu Zhonghui 
>> ---
>>  drivers/mmc/core/sdio.c |   14 --
>>  drivers/mmc/core/sdio_irq.c |4 ++--
>>  2 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git 

Re: [RFC] dynticks: dynticks_idle is only modified locally use this_cpu ops

2014-09-02 Thread Paul E. McKenney
On Tue, Sep 02, 2014 at 06:22:52PM -0500, Christoph Lameter wrote:
> On Tue, 2 Sep 2014, Paul E. McKenney wrote:
> 
> > Yep, these two have been on my "when I am feeling insanely gutsy" list
> > for quite some time.
> >
> > But I have to ask...  On x86, is a pair of mfence instructions really
> > cheaper than an atomic increment?
> 
> Not sure why you would need an mfence instruction?

Because otherwise RCU can break.  As soon as the grace-period machinery
sees that the value of this variable is even, it assumes a quiescent
state.  If there are no memory barriers, the non-quiescent code might
not have completed executing, and your kernel's actuarial statistics
become sub-optimal.

Thanx, Paul

> > > If the first patch I send gets merged then a lot of other this_cpu related
> > > optimizations become possible regardless of the ones in the RFC.
> >
> > Yep, I am queuing that one.
> 
> Great.
> 
> > But could you please do future patches against the rcu/dev branch of
> > git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git?
> > I had to hand-apply due to conflicts.  Please see below for my version,
> > and please check to make sure that I didn't mess something up in the
> > translation.
> 
> Looks ok. Will use the correct tree next time.
> 
> 

--
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/4] ARM: dts: add main Thermal info to rk3288

2014-09-02 Thread Caesar Wang
Signed-off-by: Caesar Wang 
---
 arch/arm/boot/dts/rk3288.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 36be7bb..3d672e3 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -224,6 +224,17 @@
status = "disabled";
};
 
+   tsadc: tsadc@ff28 {
+   compatible = "rockchip,rk3288-tsadc";
+   reg = <0xff28 0x100>;
+   interrupts = ;
+   clocks = < SCLK_TSADC>, < PCLK_TSADC>;
+   clock-names = "tsadc", "apb_pclk";
+   pinctrl-names = "default";
+   pinctrl-1 = <_int>;
+   status = "disabled";
+   };
+
/* NOTE: ohci@ff52 doesn't actually work on hardware */
 
usb_hsic: usb@ff5c {
@@ -611,5 +622,12 @@
rockchip,pins = <5 15 3 _pull_none>;
};
};
+
+   tsadc {
+   tsadc_int: tsadc-int {
+   rockchip,pins = <0 10 RK_FUNC_1 _pull_up>;
+   };
+   };
+
};
 };
-- 
1.9.1


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


[PATCH v4 1/4] thermal: rockchip: add driver for thermal

2014-09-02 Thread Caesar Wang
Thermal is TS-ADC Controller module supports
user-defined mode and automatic mode.

User-defined mode refers,TSADC all the control signals entirely by
software writing to register for direct control.

Automaic mode refers to the module automatically poll TSADC output,
and the results were checked.If you find that the temperature High
in a period of time,an interrupt is generated to the processor
down-measures taken;if the temperature over a period of time High,
the resulting TSHUT gave CRU module,let it reset the entire chip,
or via GPIO give PMIC.

Signed-off-by: zhaoyifeng 
Signed-off-by: Caesar Wang 
---
 drivers/thermal/Kconfig|   9 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/rockchip_thermal.c | 669 +
 3 files changed, 679 insertions(+)
 create mode 100644 drivers/thermal/rockchip_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index f9a1386..a00aa1e 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -133,6 +133,15 @@ config SPEAR_THERMAL
  Enable this to plug the SPEAr thermal sensor driver into the Linux
  thermal framework.
 
+config ROCKCHIP_THERMAL
+   tristate "Rockchip thermal driver"
+   depends on ARCH_ROCKCHIP
+   help
+ Support for Temperature Sensor ADC (TS-ADC) found on Rockchip SoCs.
+ It supports one critical trip point and one passive trip point.  The
+ cpufreq is used as the cooling device to throttle CPUs when the
+ passive trip is crossed.
+
 config RCAR_THERMAL
tristate "Renesas R-Car thermal driver"
depends on ARCH_SHMOBILE || COMPILE_TEST
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index de0636a..b48b817 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -19,6 +19,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
 
 # platform thermal drivers
 obj-$(CONFIG_SPEAR_THERMAL)+= spear_thermal.o
+obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
 obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
 obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
 obj-y  += samsung/
diff --git a/drivers/thermal/rockchip_thermal.c 
b/drivers/thermal/rockchip_thermal.c
new file mode 100644
index 000..011f387
--- /dev/null
+++ b/drivers/thermal/rockchip_thermal.c
@@ -0,0 +1,669 @@
+/*
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ *
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "thermal_core.h"
+
+enum rockchip_thermal_trip {
+   ROCKCHIP_TRIP_PASSIVE,
+   ROCKCHIP_TRIP_CRITICAL,
+   ROCKCHIP_TRIP_NUM,
+};
+
+struct rockchip_thermal_data {
+   const struct rockchip_tsadc_platform_data *pdata;
+   struct thermal_zone_device *tz;
+   struct thermal_cooling_device *cdev;
+   enum thermal_device_mode mode;
+   void __iomem *regs;
+
+   signed long temp_passive;
+   signed long temp_critical;
+   signed long temp_force_shut;
+   signed long alarm_temp;
+   signed long last_temp;
+   bool irq_enabled;
+   int irq;
+   struct clk *clk;
+   struct clk *pclk;
+};
+
+struct rockchip_tsadc_platform_data {
+   u8 irq_en;
+   signed long temp_passive;
+   signed long temp_critical;
+   signed long temp_force_shut;
+   int passive_delay;
+   int polling_delay;
+
+   int (*irq_handle)(void __iomem *reg);
+   int (*initialize)(void __iomem *reg, signed long temp_force_shut);
+   int (*control)(void __iomem *reg, bool on);
+   u32 (*code_to_temp)(int temp);
+   u32 (*temp_to_code)(int temp);
+   void (*set_alarm_temp)(void __iomem *regs, signed long temp);
+};
+
+/*TSADC V2 Sensor info define:*/
+#define TSADCV2_AUTO_CON   0x04
+#define TSADCV2_INT_EN 0x08
+#define TSADCV2_INT_PD 0x0c
+#define TSADCV2_DATA1  0x24
+#define TSADCV2_COMP1_INT  0x34
+#define TSADCV2_COMP1_SHUT 0x44
+#define TSADCV2_AUTO_PERIOD0x68
+#define TSADCV2_AUTO_PERIOD_HT 0x6c
+
+#define TSADCV2_AUTO_SRC1_EN   (1 << 5)
+#define TSADCV2_AUTO_EN(1 << 0)
+#define TSADCV2_AUTO_DISABLE   ~(1 << 0)
+#define TSADCV2_AUTO_STAS_BUSY (1 << 16)
+#define TSADCV2_AUTO_STAS_BUSY_MASK  

[PATCH v4 4/4] ARM: dts: enable Thermal on rk3288-evb board

2014-09-02 Thread Caesar Wang
Signed-off-by: Caesar Wang 
---
 arch/arm/boot/dts/rk3288-evb.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi 
b/arch/arm/boot/dts/rk3288-evb.dtsi
index 2964370..fe85dde 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -101,6 +101,13 @@
status = "okay";
 };
 
+ {
+   passive-temp = <80>;
+   critical-temp = <100>;
+   force-shut-temp = <120>;
+   status = "okay";
+};
+
  {
buttons {
pwrbtn: pwrbtn {
-- 
1.9.1


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


[PATCH v4 0/4] Rockchip soc thermal driver

2014-09-02 Thread Caesar Wang
Changes in v4:
* address comments from Jonathan Cameron,huangtao and zhaoyifeng:
- this series thermal driver still be put in driver/thermal/
- modify the thermal driver description.

Changes in v3:(add dts configure)
* address comments from Dmitry Torokhov and Arnd Bergmann:
- fix clock-names in rockchip-thermal.txt
- remove rockchip_thermal_control() in rockchip_set_mode()
- fix some code style.
- add dts configure.

Changes in v2:
* address comments from Heiko Stubner:
- fix dt-bindings in rockchip-thermal.txt
- remove Author mark
- rename TSADC_XXX->TSADCV2_XXX,it eill ready to merge compatible other 
SoCs.
- fix a identation
- remove clk_set_rate(),it's no necessary.
- fix the SIMPLE_DEV_PM_OPS() function  style.

Tested on rk3288 SDK board

Caesar Wang (4):
  thermal: rockchip: add driver for thermal
  dt-bindings: document Rockchip thermal
  ARM: dts: add main Thermal info to rk3288
  ARM: dts: enable Thermal on rk3288-evb board

 .../bindings/thermal/rockchip-thermal.txt  |  20 +
 arch/arm/boot/dts/rk3288-evb.dtsi  |   7 +
 arch/arm/boot/dts/rk3288.dtsi  |  18 +
 drivers/thermal/Kconfig|   9 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/rockchip_thermal.c | 669 +
 6 files changed, 724 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
 create mode 100644 drivers/thermal/rockchip_thermal.c

-- 
1.9.1


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


[PATCH v4 2/4] dt-bindings: document Rockchip thermal

2014-09-02 Thread Caesar Wang
This add the necessary binding documentation for the thermal
found on Rockchip SoCs

Signed-off-by: zhaoyifeng 
Signed-off-by: Caesar Wang 
---
 .../devicetree/bindings/thermal/rockchip-thermal.txt | 20 
 1 file changed, 20 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt

diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt 
b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
new file mode 100644
index 000..1ed4d4c
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
@@ -0,0 +1,20 @@
+* Temperature Sensor ADC (TSADC) on rockchip SoCs
+
+Required properties:
+- compatible: "rockchip,rk3288-tsadc"
+- reg: physical base address of the controller and length of memory mapped
+   region.
+- interrupts: The interrupt number to the cpu. The interrupt specifier format
+ depends on the interrupt controller.
+- clocks: Must contain an entry for each entry in clock-names.
+- clock-names: Shall be "tsadc" for the converter-clock, and "apb_pclk" for
+  the peripheral clock.
+
+Example:
+tsadc: tsadc@ff28 {
+   compatible = "rockchip,rk3288-tsadc";
+   reg = <0xff28 0x100>;
+   interrupts = ;
+   clocks = < SCLK_TSADC>, < PCLK_TSADC>;
+   clock-names = "tsadc", "apb_pclk";
+};
-- 
1.9.1


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


Re: [PATCH] mmc: core: sdio: Fix unconditional wake_up_process() on sdio thread

2014-09-02 Thread Fu, Zhonghui

Hi,Uffe

Could you please tell me into which git repository this patch is merged now?



Thanks,
Zhonghui 



On 2014/8/26 0:10, Fu, Zhonghui wrote:
>
> Many thanks for your helps.
>
>
>
> Thanks,
> Zhonghui
>
>
> On 2014/8/18 20:07, Ulf Hansson wrote:
>> On 18 August 2014 05:04, Fu, Zhonghui  wrote:
>>> From 21266249bbbaf9407c1e88cd5950e06ac88aeebf Mon Sep 17 00:00:00 2001
>>> From: Fu Zhonghui 
>>> Date: Mon, 18 Aug 2014 10:48:14 +0800
>>> Subject: [PATCH] mmc: core: sdio: Fix unconditional wake_up_process() on 
>>> sdio thread
>>>
>>> 781e989cf59 ("mmc: sdhci: convert to new SDIO IRQ handling") and
>>> bf3b5ec66bd ("mmc: sdio_irq: rework sdio irq handling") disabled
>>> the use of our own custom threaded IRQ handler, but left in an
>>> unconditional wake_up_process() on that handler at resume-time.
>>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=80151
>>>
>>> In addition, the check for MMC_CAP_SDIO_IRQ capability is added
>>> before enable sdio IRQ.
>>>
>>> Signed-off-by: Jaehoon Chung 
>>> Signed-off-by: Chris Ball 
>>> Signed-off-by: Ulf Hansson 
>>> Signed-off-by: Fu Zhonghui 
>> Thanks! Applied for next and added a stable tag for v3.16+.
>>
>> Kind regards
>> Uffe
>>
>>> ---
>>>  drivers/mmc/core/sdio.c |   12 ++--
>>>  drivers/mmc/core/sdio_irq.c |4 ++--
>>>  2 files changed, 12 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
>>> index e636d9e..3fc40a7 100644
>>> --- a/drivers/mmc/core/sdio.c
>>> +++ b/drivers/mmc/core/sdio.c
>>> @@ -992,8 +992,16 @@ static int mmc_sdio_resume(struct mmc_host *host)
>>> }
>>> }
>>>
>>> -   if (!err && host->sdio_irqs)
>>> -   wake_up_process(host->sdio_irq_thread);
>>> +   if (!err && host->sdio_irqs) {
>>> +   if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
>>> +   wake_up_process(host->sdio_irq_thread);
>>> +   } else if (host->caps & MMC_CAP_SDIO_IRQ) {
>>> +   mmc_host_clk_hold(host);
>>> +   host->ops->enable_sdio_irq(host, 1);
>>> +   mmc_host_clk_release(host);
>>> +   }
>>> +   }
>>> +
>>> mmc_release_host(host);
>>>
>>> host->pm_flags &= ~MMC_PM_KEEP_POWER;
>>> diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
>>> index 5cc13c8..696eca4 100644
>>> --- a/drivers/mmc/core/sdio_irq.c
>>> +++ b/drivers/mmc/core/sdio_irq.c
>>> @@ -208,7 +208,7 @@ static int sdio_card_irq_get(struct mmc_card *card)
>>> host->sdio_irqs--;
>>> return err;
>>> }
>>> -   } else {
>>> +   } else if (host->caps & MMC_CAP_SDIO_IRQ) {
>>> mmc_host_clk_hold(host);
>>> host->ops->enable_sdio_irq(host, 1);
>>> mmc_host_clk_release(host);
>>> @@ -229,7 +229,7 @@ static int sdio_card_irq_put(struct mmc_card *card)
>>> if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
>>> atomic_set(>sdio_irq_thread_abort, 1);
>>> kthread_stop(host->sdio_irq_thread);
>>> -   } else {
>>> +   } else if (host->caps & MMC_CAP_SDIO_IRQ) {
>>> mmc_host_clk_hold(host);
>>> host->ops->enable_sdio_irq(host, 0);
>>> mmc_host_clk_release(host);
>>> -- 1.7.1
>>>
>>> On 2014/8/12 18:23, Ulf Hansson wrote:
 On 11 August 2014 07:49, Fu, Zhonghui  wrote:
> From 6cee984e1d76ba0a3320430f8cf4318ab65fcf06 Mon Sep 17 00:00:00 2001
> From: Fu Zhonghui 
> Date: Tue, 5 Aug 2014 12:44:38 +0800
> Subject: [PATCH] mmc: core: sdio: Fix unconditional wake_up_process() on 
> sdio thread
>
> 781e989cf59 ("mmc: sdhci: convert to new SDIO IRQ handling") and
> bf3b5ec66bd ("mmc: sdio_irq: rework sdio irq handling") disabled
> the use of our own custom threaded IRQ handler, but left in an
> unconditional wake_up_process() on that handler at resume-time.
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=80151
>
> In addition, the check for MMC_CAP_SDIO_IRQ capability is added
> before enable sdio IRQ.
>
> Signed-off-by: Jaehoon Chung 
> Signed-off-by: Chris Ball 
> Signed-off-by: Fu Zhonghui 
> ---
>  drivers/mmc/core/sdio.c |   14 --
>  drivers/mmc/core/sdio_irq.c |4 ++--
>  2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index e636d9e..e04a540 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -992,8 +992,18 @@ static int mmc_sdio_resume(struct mmc_host *host)
> }
> }
>
> -   if (!err && host->sdio_irqs)
> -   

Re: [PATCHv5 4/4] thermal: exynos: Remove duplicate code when reading triminfo register of Exynos5440

2014-09-02 Thread Chanwoo Choi
Dear Eduardo,

On 08/30/2014 04:28 AM, Eduardo Valentin wrote:
> Chanwoo,
> 
> On Fri, Aug 29, 2014 at 08:50:41AM +0900, Chanwoo Choi wrote:
>> Dear Eduardo,
>>
>> On 08/28/2014 11:53 PM, Eduardo Valentin wrote:
>>> On Thu, Aug 28, 2014 at 01:25:14PM +0900, Chanwoo Choi wrote:
 Dear Eduardo,

 This patch is wrong. It is my mistake.

 Please ignore only this patch because
 the offset calculation of 'case 0' is different from 'case 2'.
>>>
>>>
>>> Do patches 1 - 3 are still correct? Patch 1, from Barlomiej, seams to be
>>> a common agreement. 
> 
>>
>> Yes, patches 1 - 3 are correct.
>>
> 
> OK. I pulled patch 01 into my next branch.
> 
> Can you please update patches 02 and 03 based on my next brach? They are
> conflicting with the massive cleanups done by Bartlomiej (Thanks
> Bartlomiej). So, please, resend patches 02 and 03 only, refreshed onto
> my next branch.

OK, I'll send new patchset after rebase it.

Best Regards,
Chanwoo Choi

> 
> Cheers.
> 
>> Best Regards,
>> Chanwoo Choi
>>
>>>

 Best Regards,
 Chanwoo Choi

 On 08/26/2014 10:31 AM, Chanwoo Choi wrote:
> This patch remove simply duplicate code when reading triminfo register of 
> Exynos5440.
>
> Signed-off-by: Chanwoo Choi 
> Acked-by: Kyungmin Park 
> Cc: Zhang Rui 
> Cc: Eduardo Valentin 
> Cc: Amit Daniel Kachhap 
> Reviewed-by: Amit Daniel Kachhap 
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c 
> b/drivers/thermal/samsung/exynos_tmu.c
> index 64c702a..5888467 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -187,15 +187,13 @@ static int exynos_tmu_initialize(struct 
> platform_device *pdev)
>*/
>   switch (data->id) {
>   case 0:
> + case 2:
>   trim_info = readl(data->base +
>   EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data);
>   break;
>   case 1:
>   trim_info = readl(data->base + reg->triminfo_data);
>   break;
> - case 2:
> - trim_info = readl(data->base -
> - EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data);
>   }
>   } else {
>   /* On exynos5420 the triminfo register is in the shared space */
>

>>>
>>
> 

--
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 v7 3/5] RTC: RK808: add RTC driver for RK808

2014-09-02 Thread Chris Zhong


On 09/02/2014 11:58 AM, Doug Anderson wrote:

+static int rk808_rtc_probe(struct platform_device *pdev)
>+{
>+   struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
>+   struct rk808_rtc *rk808_rtc;
>+   struct rtc_time tm;
>+   int ret;
>+
>+   rk808_rtc = devm_kzalloc(>dev, sizeof(*rk808_rtc), GFP_KERNEL);
>+   if (rk808_rtc == NULL)
>+   return -ENOMEM;
>+
>+   platform_set_drvdata(pdev, rk808_rtc);
>+   rk808_rtc->rk808 = rk808;
>+
>+   /* start rtc running by default, and use shadowed timer. */
>+   ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
>+BIT_RTC_CTRL_REG_STOP_RTC_M |
>+BIT_RTC_CTRL_REG_RTC_READSEL_M,
>+BIT_RTC_CTRL_REG_RTC_READSEL_M);

I think this should still be setting to 0, not to
BIT_RTC_CTRL_REG_RTC_READSEL_M.  Otherwise the first read of the time
will return that time that was frozen at probe time, right?  AKA: if
probe happens at 11:00:00 and then we read the time at 11:00:05 we'll
still read 11:00:00 the first time.


 Sorry, I did not describe correctly, in the previous mail.
 Actually, RK808 has a "GET_TIME" switch bit. When "GET_TIME" bit rising 
thansiton to 1,
 the current time will save in a shadowed register.
 If "READSEL" = 1, read rtc time register, return the frozen time.
 If we need the real time, clr this "READSEL" bit.


--
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: [PATCHv2 3/4] ASoC: simple-card: Adjust the comments of simple card.

2014-09-02 Thread li.xi...@freescale.com
> Subject: Re: [PATCHv2 3/4] ASoC: simple-card: Adjust the comments of simple
> card.
> 
> On Tue, 2 Sep 2014 17:26:08 +0800
> Xiubo Li  wrote:
> 
> > @@ -285,11 +287,11 @@ static int asoc_simple_card_dai_link_of(struct
> device_node *node,
> > dai_props->codec_dai.sysclk);
> >
> > /*
> > -* soc_bind_dai_link() will check cpu name
> > -* after of_node matching if dai_link has cpu_dai_name.
> > -* but, it will never match if name was created by fmt_single_name()
> > -* remove cpu_dai_name to escape name matching.
> > -* see
> > +* In soc_bind_dai_link() will check cpu name after
> > +* of_node matching if dai_link has cpu_dai_name.
> > +* but, it will never match if name was created by
> > +* fmt_single_name() remove cpu_dai_name to escape
> > +* name matching. Please see:
> >  *  fmt_single_name()
> >  *  fmt_multiple_name()
> >  */
> 
> The patch done by Kuninori, setting the cpu_dai_name to NULL in all
> cases, does not work. This sequence should be replaced where is was
> previously.
> 

If so, it should be another issue here, should we send another patch for
It ?


Thanks,

BRs
Xiubo



Re: [PATCH] fs/super.c: do not shrink fs slab during direct memory reclaim

2014-09-02 Thread Xue jiufei
Hi, Dave
On 2014/9/3 9:02, Dave Chinner wrote:
> On Tue, Sep 02, 2014 at 05:03:27PM +0800, Xue jiufei wrote:
>> Hi, Dave
>> On 2014/9/2 7:51, Dave Chinner wrote:
>>> On Fri, Aug 29, 2014 at 05:57:22PM +0800, Xue jiufei wrote:
 The patch trys to solve one deadlock problem caused by cluster
 fs, like ocfs2. And the problem may happen at least in the below
 situations:
 1)Receiving a connect message from other nodes, node queues a
 work_struct o2net_listen_work.
 2)o2net_wq processes this work and calls sock_alloc() to allocate
 memory for a new socket.
 3)It would do direct memory reclaim when available memory is not
 enough and trigger the inode cleanup. That inode being cleaned up
 is happened to be ocfs2 inode, so call evict()->ocfs2_evict_inode()
 ->ocfs2_drop_lock()->dlmunlock()->o2net_send_message_vec(),
 and wait for the unlock response from master.
 4)tcp layer received the response, call o2net_data_ready() and
 queue sc_rx_work, waiting o2net_wq to process this work.
 5)o2net_wq is a single thread workqueue, it process the work one by
 one. Right now it is still doing o2net_listen_work and cannot handle
 sc_rx_work. so we deadlock.

 It is impossible to set GFP_NOFS for memory allocation in sock_alloc().
 So we use PF_FSTRANS to avoid the task reentering filesystem when
 available memory is not enough.

 Signed-off-by: joyce.xue 
>>>
>>> For the second time: use memalloc_noio_save/memalloc_noio_restore.
>>> And please put a great big comment in the code explaining why you
>>> need to do this special thing with memory reclaim flags.
>>>
>>> Cheers,
>>>
>>> Dave.
>>>
>> Thanks for your reply. But I am afraid that memalloc_noio_save/
>> memalloc_noio_restore can not solve my problem. __GFP_IO is cleared
>> if PF_MEMALLOC_NOIO is set and can avoid doing IO in direct memory
>> reclaim.
> 
> Well, yes. It sets a process flag that is used to avoid re-entrancy
> issues in direct reclaim. Direct reclaim is more than just the
> superblock shrinker - there are lots of other shrinkers, page
> reclaim, etc and I bet there are other paths that can trigger the
> deadlock you are seeing. We need to protect against all those
> cases, not just the one shrinker you see a problem with. i.e. we
> need to clear __GPF_FS from *all* reclaim, not just the superblock
> shrinker.
> 
> Also, PF_FSTRANS is used internally by filesystems, not the
> generic code.  If we start spreading it through generic code like
> this, we start breaking filesystems that rely on it having a
> specific, filesystem internal meaning.  So it's a NACK on that basis
> as well.
> 
>> However, __GFP_FS is still set that can not avoid pruning
>> dcache and icache in memory allocation, resulting in the deadlock I
>> described.
> 
> You have a deadlock in direct reclaim, and we already have a
> template for setting a process flag that is used to indirectly
> control direct reclaim behaviour. If the current process flag
> doesn't provide precisely the coverage, then use that implementation
> as the template to do exactly what is needed for your case.
> 
> Cheers,
> 
> Dave.
> 
Thanks very much for your advise. I will send another patch later.

Thanks,
Xuejiufei

--
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: [PATCHv2 4/4] ASoC: simple-card: binding: update binding to support the new style.

2014-09-02 Thread li.xi...@freescale.com
> Subject: Re: [PATCHv2 4/4] ASoC: simple-card: binding: update binding to
> support the new style.
> 
> On Tue, 2 Sep 2014 17:26:09 +0800
> Xiubo Li  wrote:
> 
> > +Example 4 - many DAI links:
> >  sound {
> > compatible = "simple-audio-card";
> > simple-audio-card,name = "Cubox Audio";
> > @@ -128,6 +195,7 @@ sound {
> > };
> > codec {
> > sound-dai = < 0>;
> > +   frame-inversion;
> > };
> > };
> 
> This is not useful: there is no clock/frame handling in the kirkwood
> audio controller.
> 


Okay, just for one example, if it really matter here I will remove this.

Thanks,

BRs
Xiubo




Re: 回复: Re: 回复: Status of 'unicore32' architecture in Linux kernel

2014-09-02 Thread Guenter Roeck

On 09/02/2014 05:09 PM, Xuetao Guan  wrote:


[...]




unicore32: Add ocd console and qemu-defconfig to support qemu simulator
This patch adds a primitive OCD console to communicate with qemu.
The same code is already used for early console support.


Do you mean there's the same/similar code in QEMU.


No, I mean that the ocd functions in the linux kernel (such as ocd_putc) are
used by both earlyprintk and the ocd console code.

Yes. By the way, it's only for qemu and fpga debug.





With this patch added, and with qemu_defconfig as provided by the same patch,
it is possible to build and load a unicore32 image in qemu using the following
qemu command line.

qemu-system-unicore32 -curses -M puv3 -m 512 -kernel arch/unicore32/boot/zImage

Caveats:
- The use of -nographic instead of -curses causes a qemu crash

Yes, since qemu curses code was modified to meet the simple OCD console 
requirement.


The lack of support for -nographic is a problem for scripted testing.
The issue is that we have to interpret console output for scripted testing,
and having to go through curses makes that a bit difficult.

Wonder if '-nographic' can be modeled as '-curses' with no available terminal
configuration. At least in theory that should work, but executing the above
command with TERM=dumb yields no output. Wonder how difficult it would be to
change that.


I see. I'll try to make -nographic work anyway.


Another possibility would be to support "-display none". Unfortunately that also
causes qemu to crash :-(.

Guenter

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


Re: [PATCH v4 5/6] kvm, mem-hotplug: Reload L1's apic access page on migration when L2 is running.

2014-09-02 Thread tangchen

Hi Gleb,

By the way, when testing nested vm, I started L1 and L2 vm with
-cpu XXX, -x2apic

But with or with out this patch 5/6, when migrating apic access page,
the nested vm didn't corrupt.

We cannot migrate L2 vm because it pinned some other pages in memory.
Without this patch, if we migrate apic access page, I thought L2 vm will
corrupt. But it didn't.

Did I made any mistake you can obviously find out ?

Thanks.

On 08/27/2014 06:17 PM, Tang Chen wrote:

This patch only handle "L1 and L2 vm share one apic access page" situation.

When L1 vm is running, if the shared apic access page is migrated, mmu_notifier 
will
request all vcpus to exit to L0, and reload apic access page physical address 
for
all the vcpus' vmcs (which is done by patch 5/6). And when it enters L2 vm, 
L2's vmcs
will be updated in prepare_vmcs02() called by nested_vm_run(). So we need to do
nothing.

When L2 vm is running, if the shared apic access page is migrated, mmu_notifier 
will
request all vcpus to exit to L0, and reload apic access page physical address 
for
all L2 vmcs. And this patch requests apic access page reload in L2->L1 vmexit.

Signed-off-by: Tang Chen 
---
  arch/x86/include/asm/kvm_host.h |  1 +
  arch/x86/kvm/svm.c  |  6 ++
  arch/x86/kvm/vmx.c  | 32 
  arch/x86/kvm/x86.c  |  3 +++
  virt/kvm/kvm_main.c |  1 +
  5 files changed, 43 insertions(+)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 514183e..13fbb62 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -740,6 +740,7 @@ struct kvm_x86_ops {
void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set);
void (*set_apic_access_page_addr)(struct kvm *kvm, hpa_t hpa);
+   void (*set_nested_apic_page_migrated)(struct kvm_vcpu *vcpu, bool set);
void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
void (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index f2eacc4..da88646 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3624,6 +3624,11 @@ static void svm_set_apic_access_page_addr(struct kvm 
*kvm, hpa_t hpa)
return;
  }
  
+static void svm_set_nested_apic_page_migrated(struct kvm_vcpu *vcpu, bool set)

+{
+   return;
+}
+
  static int svm_vm_has_apicv(struct kvm *kvm)
  {
return 0;
@@ -4379,6 +4384,7 @@ static struct kvm_x86_ops svm_x86_ops = {
.update_cr8_intercept = update_cr8_intercept,
.set_virtual_x2apic_mode = svm_set_virtual_x2apic_mode,
.set_apic_access_page_addr = svm_set_apic_access_page_addr,
+   .set_nested_apic_page_migrated = svm_set_nested_apic_page_migrated,
.vm_has_apicv = svm_vm_has_apicv,
.load_eoi_exitmap = svm_load_eoi_exitmap,
.hwapic_isr_update = svm_hwapic_isr_update,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index da6d55d..9035fd1 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -379,6 +379,16 @@ struct nested_vmx {
 * we must keep them pinned while L2 runs.
 */
struct page *apic_access_page;
+   /*
+* L1's apic access page can be migrated. When L1 and L2 are sharing
+* the apic access page, after the page is migrated when L2 is running,
+* we have to reload it to L1 vmcs before we enter L1.
+*
+* When the shared apic access page is migrated in L1 mode, we don't
+* need to do anything else because we reload apic access page each
+* time when entering L2 in prepare_vmcs02().
+*/
+   bool apic_access_page_migrated;
u64 msr_ia32_feature_control;
  
  	struct hrtimer preemption_timer;

@@ -7098,6 +7108,12 @@ static void vmx_set_apic_access_page_addr(struct kvm 
*kvm, hpa_t hpa)
vmcs_write64(APIC_ACCESS_ADDR, hpa);
  }
  
+static void vmx_set_nested_apic_page_migrated(struct kvm_vcpu *vcpu, bool set)

+{
+   struct vcpu_vmx *vmx = to_vmx(vcpu);
+   vmx->nested.apic_access_page_migrated = set;
+}
+
  static void vmx_hwapic_isr_update(struct kvm *kvm, int isr)
  {
u16 status;
@@ -8796,6 +8812,21 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 
exit_reason,
}
  
  	/*

+* When shared (L1 & L2) apic access page is migrated during L2 is
+* running, mmu_notifier will force to reload the page's hpa for L2
+* vmcs. Need to reload it for L1 before entering L1.
+*/
+   if (vmx->nested.apic_access_page_migrated) {
+   /*
+* Do not call kvm_reload_apic_access_page() because we are now
+* in L2. We should not call make_all_cpus_request() to exit to
+* L0, otherwise we will reload for L2 vmcs again.
+   

Re: [PATCH v3 16/17] drm/exynos/ipp: remove file argument from node related functions

2014-09-02 Thread Joonyoung Shim
On 09/02/2014 09:55 PM, Andrzej Hajda wrote:
> Since file pointer is preserved in c_node passing it
> as argument in node functions is redundant.
> 
> Signed-off-by: Andrzej Hajda 
> ---
> v3:
> - file check moved to next patch
> ---
>  drivers/gpu/drm/exynos/exynos_drm_ipp.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 

About both patch 16 and 17

Reviewed-by: Joonyoung Shim 

Thanks.

> diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c 
> b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> index 05f0f4e..9e9714a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> @@ -529,7 +529,6 @@ static int ipp_put_mem_node(struct drm_device *drm_dev,
>  
>  static struct drm_exynos_ipp_mem_node
>   *ipp_get_mem_node(struct drm_device *drm_dev,
> - struct drm_file *file,
>   struct drm_exynos_ipp_cmd_node *c_node,
>   struct drm_exynos_ipp_queue_buf *qbuf)
>  {
> @@ -560,7 +559,7 @@ static struct drm_exynos_ipp_mem_node
>   dma_addr_t *addr;
>  
>   addr = exynos_drm_gem_get_dma_addr(drm_dev,
> - qbuf->handle[i], file);
> + qbuf->handle[i], c_node->filp);
>   if (IS_ERR(addr)) {
>   DRM_ERROR("failed to get addr.\n");
>   ipp_put_mem_node(drm_dev, c_node, m_node);
> @@ -606,7 +605,6 @@ static void ipp_free_event(struct drm_pending_event 
> *event)
>  }
>  
>  static int ipp_get_event(struct drm_device *drm_dev,
> - struct drm_file *file,
>   struct drm_exynos_ipp_cmd_node *c_node,
>   struct drm_exynos_ipp_queue_buf *qbuf)
>  {
> @@ -618,7 +616,7 @@ static int ipp_get_event(struct drm_device *drm_dev,
>   e = kzalloc(sizeof(*e), GFP_KERNEL);
>   if (!e) {
>   spin_lock_irqsave(_dev->event_lock, flags);
> - file->event_space += sizeof(e->event);
> + c_node->filp->event_space += sizeof(e->event);
>   spin_unlock_irqrestore(_dev->event_lock, flags);
>   return -ENOMEM;
>   }
> @@ -630,7 +628,7 @@ static int ipp_get_event(struct drm_device *drm_dev,
>   e->event.prop_id = qbuf->prop_id;
>   e->event.buf_id[EXYNOS_DRM_OPS_DST] = qbuf->buf_id;
>   e->base.event = >event.base;
> - e->base.file_priv = file;
> + e->base.file_priv = c_node->filp;
>   e->base.destroy = ipp_free_event;
>   mutex_lock(_node->event_lock);
>   list_add_tail(>base.link, _node->event_list);
> @@ -908,7 +906,7 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, 
> void *data,
>   switch (qbuf->buf_type) {
>   case IPP_BUF_ENQUEUE:
>   /* get memory node */
> - m_node = ipp_get_mem_node(drm_dev, file, c_node, qbuf);
> + m_node = ipp_get_mem_node(drm_dev, c_node, qbuf);
>   if (IS_ERR(m_node)) {
>   DRM_ERROR("failed to get m_node.\n");
>   return PTR_ERR(m_node);
> @@ -921,7 +919,7 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, 
> void *data,
>*/
>   if (qbuf->ops_id == EXYNOS_DRM_OPS_DST) {
>   /* get event for destination buffer */
> - ret = ipp_get_event(drm_dev, file, c_node, qbuf);
> + ret = ipp_get_event(drm_dev, c_node, qbuf);
>   if (ret) {
>   DRM_ERROR("failed to get event.\n");
>   goto err_clean_node;
> 

--
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 v4 4/6] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-02 Thread tangchen

Hi Gleb,

On 09/03/2014 12:00 AM, Gleb Natapov wrote:

..
+static void vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu)
+{
+   /*
+* apic access page could be migrated. When the page is being migrated,
+* GUP will wait till the migrate entry is replaced with the new pte
+* entry pointing to the new page.
+*/
+   vcpu->kvm->arch.apic_access_page = gfn_to_page(vcpu->kvm,
+   APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT);
+   kvm_x86_ops->set_apic_access_page_addr(vcpu->kvm,
+   page_to_phys(vcpu->kvm->arch.apic_access_page));
I am a little bit worried that here all vcpus write to 
vcpu->kvm->arch.apic_access_page
without any locking. It is probably benign since pointer write is atomic on 
x86. Paolo?

Do we even need apic_access_page? Why not call
  gfn_to_page(APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT)
  put_page()
on rare occasions we need to know its address?


Isn't it a necessary item defined in hardware spec ?

I didn't read intel spec deeply, but according to the code, the page's 
address is

written into vmcs. And it made me think that we cannnot remove it.

Thanks.




+}
+
  /*
   * Returns 1 to let __vcpu_run() continue the guest execution loop without
   * exiting to the userspace.  Otherwise, the value will be returned to the
@@ -6049,6 +6062,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
kvm_deliver_pmi(vcpu);
if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu))
vcpu_scan_ioapic(vcpu);
+   if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
+   vcpu_reload_apic_access_page(vcpu);
}
  
  	if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a4c33b3..8be076a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -136,6 +136,7 @@ static inline bool is_error_page(struct page *page)
  #define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
  #define KVM_REQ_ENABLE_IBS23
  #define KVM_REQ_DISABLE_IBS   24
+#define KVM_REQ_APIC_PAGE_RELOAD  25
  
  #define KVM_USERSPACE_IRQ_SOURCE_ID		0

  #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID  1
@@ -579,6 +580,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm);
  void kvm_reload_remote_mmus(struct kvm *kvm);
  void kvm_make_mclock_inprogress_request(struct kvm *kvm);
  void kvm_make_scan_ioapic_request(struct kvm *kvm);
+void kvm_reload_apic_access_page(struct kvm *kvm);
  
  long kvm_arch_dev_ioctl(struct file *filp,

unsigned int ioctl, unsigned long arg);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 33712fb..d8280de 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -210,6 +210,11 @@ void kvm_make_scan_ioapic_request(struct kvm *kvm)
make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
  }
  
+void kvm_reload_apic_access_page(struct kvm *kvm)

+{
+   make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
+}
+
  int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
  {
struct page *page;
@@ -294,6 +299,13 @@ static void kvm_mmu_notifier_invalidate_page(struct 
mmu_notifier *mn,
if (need_tlb_flush)
kvm_flush_remote_tlbs(kvm);
  
+	/*

+* The physical address of apic access page is stroed in VMCS.
+* So need to update it when it becomes invalid.
+*/
+   if (address == gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT))
+   kvm_reload_apic_access_page(kvm);
+
spin_unlock(>mmu_lock);
srcu_read_unlock(>srcu, idx);
  }
--
1.8.3.1


--
Gleb.
.



--
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] fs/super.c: do not shrink fs slab during direct memory reclaim

2014-09-02 Thread Junxiao Bi
Hi Jiufei,

On 09/02/2014 05:03 PM, Xue jiufei wrote:
> Hi, Dave
> On 2014/9/2 7:51, Dave Chinner wrote:
>> On Fri, Aug 29, 2014 at 05:57:22PM +0800, Xue jiufei wrote:
>>> The patch trys to solve one deadlock problem caused by cluster
>>> fs, like ocfs2. And the problem may happen at least in the below
>>> situations:
>>> 1)Receiving a connect message from other nodes, node queues a
>>> work_struct o2net_listen_work.
>>> 2)o2net_wq processes this work and calls sock_alloc() to allocate
>>> memory for a new socket.
>>> 3)It would do direct memory reclaim when available memory is not
>>> enough and trigger the inode cleanup. That inode being cleaned up
>>> is happened to be ocfs2 inode, so call evict()->ocfs2_evict_inode()
>>> ->ocfs2_drop_lock()->dlmunlock()->o2net_send_message_vec(),
>>> and wait for the unlock response from master.
>>> 4)tcp layer received the response, call o2net_data_ready() and
>>> queue sc_rx_work, waiting o2net_wq to process this work.
>>> 5)o2net_wq is a single thread workqueue, it process the work one by
>>> one. Right now it is still doing o2net_listen_work and cannot handle
>>> sc_rx_work. so we deadlock.
>>>
>>> It is impossible to set GFP_NOFS for memory allocation in sock_alloc().
>>> So we use PF_FSTRANS to avoid the task reentering filesystem when
>>> available memory is not enough.
>>>
>>> Signed-off-by: joyce.xue 
>>
>> For the second time: use memalloc_noio_save/memalloc_noio_restore.
>> And please put a great big comment in the code explaining why you
>> need to do this special thing with memory reclaim flags.
>>
>> Cheers,
>>
>> Dave.
>>
> Thanks for your reply. But I am afraid that memalloc_noio_save/
> memalloc_noio_restore can not solve my problem. __GFP_IO is cleared
> if PF_MEMALLOC_NOIO is set and can avoid doing IO in direct memory
> reclaim. However, __GFP_FS is still set that can not avoid pruning
> dcache and icache in memory allocation, resulting in the deadlock I
> described.

You can use PF_MEMALLOC_NOIO to replace PF_FSTRANS, set this flag in
ocfs2 and check it in sb shrinker.

Thanks,
Junxiao.
> 
> Thanks.
> XueJiufei
> 
> 
> 

--
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: regression caused by cgroups optimization in 3.17-rc2

2014-09-02 Thread Johannes Weiner
On Tue, Sep 02, 2014 at 05:20:55PM -0700, Linus Torvalds wrote:
> On Tue, Sep 2, 2014 at 5:10 PM, Johannes Weiner  wrote:
> >
> > That looks like a partial profile, where did the page allocator, page
> > zeroing etc. go?  Because the distribution among these listed symbols
> > doesn't seem all that crazy:
> 
> Please argue this *after* the commit has been reverted. You guys can
> try to make the memcontrol batching actually work and scale later.
> It's not appropriate to argue against major regressions when reported
> and bisected by users.

I'll send a clean revert later.

> Showing the spinlock at the top of the profile is very much crazy
> (apparently taking 68% of all cpu time), when it's all useless
> make-believe work. I don't understand why you wouldn't call that
> crazy.

If you limit perf to a subset of symbols, it will show a relative
distribution between them, i.e: perf top --symbols kfree,memset during
some disk access:

   PerfTop:1292 irqs/sec  kernel:84.4%  exact:  0.0% [4000Hz cycles],  
(all, 4 CPUs)
---

56.23%  [kernel]  [k] kfree 
41.86%  [kernel]  [k] memset
 1.91%  libc-2.19.so  [.] memset

kfree isn't eating 56% of "all cpu time" here, and it wasn't clear to
me whether Dave filtered symbols from only memcontrol.o, memory.o, and
mmap.o in a similar way.  I'm not arguing against the regression, I'm
just trying to make sense of the numbers from the *patched* 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 v2] DRBG: remove check for uninitialized DRBG handle

2014-09-02 Thread Stephan Mueller
Am Montag, 1. September 2014, 07:11:20 schrieb Stephan Mueller:

Hi Herbert,

may I ask for consideration of this patch as this covers an oops FIPS mode?

In addition, may I ask for guidance on how to fix the 32 bit code path in 
Linus' tree as asked on 28.8? To quote: "Thus, the fix in 
b9347aff91ce4789619168539f08202d8d6a1177 works. However, this 
patch is based on 05c81ccd9087d238c10b234eadb55632742e5518. So, if we want to 
fix Linus' tree with minimal impact, either these two patches are pushed to 
Linus or I have to port b9347aff91ce4789619168539f08202d8d6a1177 to the 
current Linus tree."

Thanks a lot
Stephan

> The drbg_healthcheck() contained a test to call the DRBG with an
> uninitialized DRBG cipher handle. As this is an inappropriate use of the
> kernel crypto API to try to generate random numbers before
> initialization, checks verifying for an initialized DRBG have been
> removed in previous patches.
> 
> Now, the drbg_healthcheck test must also be removed.
> 
> Changes V2: Added patch marker to email subject line.
> 
> Signed-off-by: Stephan Mueller 
> ---
>  crypto/drbg.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index 39ed918..54cfd48 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1872,9 +1872,6 @@ static inline int __init drbg_healthcheck_sanity(void)
> /* overflow max addtllen with personalization string */
>   ret = drbg_instantiate(drbg, , coreref, pr);
>   BUG_ON(0 == ret);
> - /* test uninstantated DRBG */
> - len = drbg_generate(drbg, buf, (max_request_bytes + 1), NULL);
> - BUG_ON(0 < len);
>   /* all tests passed */
>   rc = 0;


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


[V2 PATCH 1/1] PVH: set EFER.NX and EFER.SCE

2014-09-02 Thread Mukesh Rathor
This patch addresses two things for a pvh boot vcpu:

  - NX bug on intel: It was recenlty discovered that NX is not being
honored in PVH on intel since EFER.NX is not being set.

  - PVH boot hang on newer xen:  Following c/s on xen

c/s 7645640:  x86/PVH: don't set EFER_SCE for pvh guest

removes setting of EFER.SCE for PVH guests. As such, existing intel
pvh guest will no longer boot on xen after that c/s.

Both above changes will be applicable to AMD also when xen support
of AMD pvh is added.

Also, we create a new glue assembly entry point for secondary vcpus
because they come up on kernel page tables that have pte.NX
bits set. As such, before anything is touched in DS/SS, EFER.NX
must be set.

Signed-off-by: Mukesh Rathor 
---
 arch/x86/xen/enlighten.c |  3 +++
 arch/x86/xen/smp.c   | 28 
 arch/x86/xen/smp.h   |  1 +
 arch/x86/xen/xen-head.S  | 29 +
 4 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c0cb11f..e17fa2d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -85,6 +85,8 @@
 
 EXPORT_SYMBOL_GPL(hypercall_page);
 
+extern void xen_pvh_configure_efer(void);
+
 /*
  * Pointer to the xen_vcpu_info structure or
  * _shared_info->vcpu_info[cpu]. See xen_hvm_init_shared_info
@@ -1508,6 +1510,7 @@ static void __init xen_pvh_early_guest_init(void)
return;
 
xen_have_vector_callback = 1;
+   xen_pvh_configure_efer();
xen_pvh_set_cr_flags(0);
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 7005974..073bbf4 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -37,6 +37,7 @@
 #include 
 #include "xen-ops.h"
 #include "mmu.h"
+#include "smp.h"
 
 cpumask_var_t xen_cpu_initialized_map;
 
@@ -99,8 +100,12 @@ static void cpu_bringup(void)
wmb();  /* make sure everything is out */
 }
 
-/* Note: cpu parameter is only relevant for PVH */
-static void cpu_bringup_and_idle(int cpu)
+/*
+ * Note: cpu parameter is only relevant for PVH. The reason for passing it
+ * is we can't do smp_processor_id until the percpu segments are loaded, for
+ * which we need the cpu number! So we pass it in rdi as first parameter.
+ */
+asmlinkage __visible void cpu_bringup_and_idle(int cpu)
 {
 #ifdef CONFIG_X86_64
if (xen_feature(XENFEAT_auto_translated_physmap) &&
@@ -374,11 +379,10 @@ cpu_initialize_context(unsigned int cpu, struct 
task_struct *idle)
ctxt->user_regs.fs = __KERNEL_PERCPU;
ctxt->user_regs.gs = __KERNEL_STACK_CANARY;
 #endif
-   ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
-
memset(>fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
 
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+   ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
ctxt->flags = VGCF_IN_KERNEL;
ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
ctxt->user_regs.ds = __USER_DS;
@@ -416,12 +420,20 @@ cpu_initialize_context(unsigned int cpu, struct 
task_struct *idle)
 #ifdef CONFIG_X86_32
}
 #else
-   } else
-   /* N.B. The user_regs.eip (cpu_bringup_and_idle) is called with
-* %rdi having the cpu number - which means are passing in
-* as the first parameter the cpu. Subtle!
+   } else {
+   /*
+* The vcpu comes on kernel page tables which have the NX pte
+* bit set. This means before DS/SS is touched, NX in
+* EFER must be set. Hence the following assembly glue code.
+*/
+   ctxt->user_regs.eip = (unsigned long)pvh_smp_cpu_bringup;
+
+   /* N.B. The bringup function cpu_bringup_and_idle is called with
+* %rdi having the cpu number - which means we are passing it in
+* as the first parameter. Subtle!
 */
ctxt->user_regs.rdi = cpu;
+   }
 #endif
ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir));
diff --git a/arch/x86/xen/smp.h b/arch/x86/xen/smp.h
index c7c2d89..d6628cb 100644
--- a/arch/x86/xen/smp.h
+++ b/arch/x86/xen/smp.h
@@ -7,5 +7,6 @@ extern void xen_send_IPI_mask_allbutself(const struct cpumask 
*mask,
 extern void xen_send_IPI_allbutself(int vector);
 extern void xen_send_IPI_all(int vector);
 extern void xen_send_IPI_self(int vector);
+extern void pvh_smp_cpu_bringup(int cpu);
 
 #endif
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 485b695..97ee831 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -47,6 +47,35 @@ ENTRY(startup_xen)
 
__FINIT
 
+#ifdef CONFIG_XEN_PVH
+#ifdef CONFIG_X86_64
+.macro PVH_EARLY_SET_EFER
+   /* Gather features to see if NX implemented. */
+   movl

[V2 PATCH 0/1] PVH: set EFER bits

2014-09-02 Thread Mukesh Rathor
Changes from V1:
   - Unify the patches into one
   - Unify the code to set the EFER bits.

thanks,
Mukesh

--
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/1] Drivers: hv: util: Properly pack the data for file copy functionality

2014-09-02 Thread K. Y. Srinivasan
Properly pack the data for file copy functionality. Patch based on
investigation done by Matej Muzila 

Signed-off-by: K. Y. Srinivasan 
Reported-by: q...@redhat.com
Cc: 
---
 include/uapi/linux/hyperv.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index 78e4a86..0a8e6ba 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -137,7 +137,7 @@ struct hv_do_fcopy {
__u64   offset;
__u32   size;
__u8data[DATA_FRAGMENT];
-};
+} __attribute__((packed));
 
 /*
  * An implementation of HyperV key value pair (KVP) functionality for Linux.
-- 
1.7.4.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: Re: [RFC PATCH 07/10] scsi/trace: Use scsi_show_result trace point instead of printk

2014-09-02 Thread Yoshihiro YUNOMAE

Hi Christoph,

Sorry for the late reply.

(2014/08/29 9:50), Christoph Hellwig wrote:

I'm not sure this is the correct way.
Currently we have quite some code duplication in scsi_trace.c and
constants.c, correct.
So I definitely would like to see them both merged.

But constants.c is influenced by CONFIG_SCSI_CONSTANTS, whereas
scsi_trace isn't, and the functions in constants.c are used throughout the
scsi stack.
So I'd rather see to have scsi_trace to be updated to use the functions
from constants.c, and remove the duplicate code in
scsi_trace.


The tracepoints need to use the magic print_flags & co helpers so that
output works properly if using the binary tracebuffer and user space tools that
decoded it (e.g. trace-cmd or perf), so using a kernel function for decoding is
not an option.


Ah, I see.
The "format" files in SCSI traceevents output decoders, so we don't
need to implement own decoders in userland.

I think the current problem is duplicated decoders, so we'll
consolidate those. If we use decoders in constants.c, the decoders are
not output in format file, so user tools cannot decode the binary.
On the other hand, if we use decoders in scsi_trace.c, the output format
of command names is changed and there are unsupported command names.

We would use decoders in scsi_trace.c and add new command names to
decoders in scsi_trace.c, I think.
How do you think about this? Hannes?


As another topic, we found that we cannot decode SCSI traceevents by
using current decoder in format files. For example, format file of
scsi_dispatch_cmd_timeout outputs prot_op as follows:

__print_symbolic(REC->prot_op, { SCSI_PROT_NORMAL, "SCSI_PROT_NORMAL" }, 
{ SCSI_PROT_READ_INSERT, "SCSI_PROT_READ_INSERT" }, { 
SCSI_PROT_WRITE_STRIP, "SCSI_PROT_WRITE_STRIP" }, { 
SCSI_PROT_READ_STRIP, "SCSI_PROT_READ_STRIP" }, { 
SCSI_PROT_WRITE_INSERT, "SCSI_PROT_WRITE_INSERT" }, { 
SCSI_PROT_READ_PASS, "SCSI_PROT_READ_PASS" }, { SCSI_PROT_WRITE_PASS, 
"SCSI_PROT_WRITE_PASS" })


Decoding will fail to do macro expansion here, so we need to fix this.
(We don't use enum for traceevents.)

Thanks,
Yoshihiro YUNOMAE


But we can make these tracepoints dependent on CONFIG_SCSI_CONSTANTS to
still allow building lighter kernels if we really care about it.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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


  1   2   3   4   5   6   7   8   9   10   >