[PATCH v2] x86,setup: Rename myisspace to isspace and move it to ctype.h

2015-01-02 Thread Alexander Kuleshov
Signed-off-by: Alexander Kuleshov 
---
 arch/x86/boot/cmdline.c | 19 +++
 arch/x86/boot/ctype.h   |  5 +
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/x86/boot/cmdline.c b/arch/x86/boot/cmdline.c
index 625d21b..bc1e25f 100644
--- a/arch/x86/boot/cmdline.c
+++ b/arch/x86/boot/cmdline.c
@@ -14,11 +14,6 @@
 
 #include "boot.h"
 
-static inline int myisspace(u8 c)
-{
-   return c <= ' ';/* Close enough approximation */
-}
-
 /*
  * Find a non-boolean option, that is, "option=argument".  In accordance
  * with standard Linux practice, if this option is repeated, this returns
@@ -50,7 +45,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const 
char *option, char *b
while (cptr < 0x1 && (c = rdfs8(cptr++))) {
switch (state) {
case st_wordstart:
-   if (myisspace(c))
+   if (isspace(c))
break;
 
/* else */
@@ -63,7 +58,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const 
char *option, char *b
len = 0;
bufptr = buffer;
state = st_bufcpy;
-   } else if (myisspace(c)) {
+   } else if (isspace(c)) {
state = st_wordstart;
} else if (c != *opptr++) {
state = st_wordskip;
@@ -71,12 +66,12 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const 
char *option, char *b
break;
 
case st_wordskip:
-   if (myisspace(c))
+   if (isspace(c))
state = st_wordstart;
break;
 
case st_bufcpy:
-   if (myisspace(c)) {
+   if (isspace(c)) {
state = st_wordstart;
} else {
if (len < bufsize-1)
@@ -125,7 +120,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, 
const char *option)
case st_wordstart:
if (!c)
return 0;
-   else if (myisspace(c))
+   else if (isspace(c))
break;
 
state = st_wordcmp;
@@ -135,7 +130,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, 
const char *option)
 
case st_wordcmp:
if (!*opptr)
-   if (!c || myisspace(c))
+   if (!c || isspace(c))
return wstart;
else
state = st_wordskip;
@@ -148,7 +143,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, 
const char *option)
case st_wordskip:
if (!c)
return 0;
-   else if (myisspace(c))
+   else if (isspace(c))
state = st_wordstart;
break;
}
diff --git a/arch/x86/boot/ctype.h b/arch/x86/boot/ctype.h
index 25e1340..eb909b5 100644
--- a/arch/x86/boot/ctype.h
+++ b/arch/x86/boot/ctype.h
@@ -18,4 +18,9 @@ static inline int isxdigit(int ch)
return (ch >= 'A') && (ch <= 'F');
 }
 
+static inline int isspace(u8 c)
+{
+   return c <= ' ';/* Close enough approximation */
+}
+
 #endif
-- 
2.2.1.202.g44ae4ee.dirty

--
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] x86,setup: Rename myisspace to isspace and move it to ctype.h

2015-01-02 Thread Alexander Kuleshov
isspace is a subset of ctype.h functionality, so move it to ctype.h

Signed-off-by: Alexander Kuleshov 
---
 arch/x86/boot/cmdline.c | 19 +++
 arch/x86/boot/ctype.h   |  9 +++--
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/x86/boot/cmdline.c b/arch/x86/boot/cmdline.c
index 625d21b..bc1e25f 100644
--- a/arch/x86/boot/cmdline.c
+++ b/arch/x86/boot/cmdline.c
@@ -14,11 +14,6 @@
 
 #include "boot.h"
 
-static inline int myisspace(u8 c)
-{
-   return c <= ' ';/* Close enough approximation */
-}
-
 /*
  * Find a non-boolean option, that is, "option=argument".  In accordance
  * with standard Linux practice, if this option is repeated, this returns
@@ -50,7 +45,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const 
char *option, char *b
while (cptr < 0x1 && (c = rdfs8(cptr++))) {
switch (state) {
case st_wordstart:
-   if (myisspace(c))
+   if (isspace(c))
break;
 
/* else */
@@ -63,7 +58,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const 
char *option, char *b
len = 0;
bufptr = buffer;
state = st_bufcpy;
-   } else if (myisspace(c)) {
+   } else if (isspace(c)) {
state = st_wordstart;
} else if (c != *opptr++) {
state = st_wordskip;
@@ -71,12 +66,12 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const 
char *option, char *b
break;
 
case st_wordskip:
-   if (myisspace(c))
+   if (isspace(c))
state = st_wordstart;
break;
 
case st_bufcpy:
-   if (myisspace(c)) {
+   if (isspace(c)) {
state = st_wordstart;
} else {
if (len < bufsize-1)
@@ -125,7 +120,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, 
const char *option)
case st_wordstart:
if (!c)
return 0;
-   else if (myisspace(c))
+   else if (isspace(c))
break;
 
state = st_wordcmp;
@@ -135,7 +130,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, 
const char *option)
 
case st_wordcmp:
if (!*opptr)
-   if (!c || myisspace(c))
+   if (!c || isspace(c))
return wstart;
else
state = st_wordskip;
@@ -148,7 +143,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, 
const char *option)
case st_wordskip:
if (!c)
return 0;
-   else if (myisspace(c))
+   else if (isspace(c))
state = st_wordstart;
break;
}
diff --git a/arch/x86/boot/ctype.h b/arch/x86/boot/ctype.h
index 25e1340..c172741 100644
--- a/arch/x86/boot/ctype.h
+++ b/arch/x86/boot/ctype.h
@@ -1,6 +1,6 @@
-#ifndef BOOT_ISDIGIT_H
+#ifndef BOOT_CTYPE_H
 
-#define BOOT_ISDIGIT_H
+#define BOOT_CTYPE_H
 
 static inline int isdigit(int ch)
 {
@@ -18,4 +18,9 @@ static inline int isxdigit(int ch)
return (ch >= 'A') && (ch <= 'F');
 }
 
+static inline int isspace(u8 c)
+{
+   return c <= ' ';/* Close enough approximation */
+}
+
 #endif
-- 
2.2.1.202.g44ae4ee.dirty

--
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] x86, setup: Rename BOOT_ISDIGIT_H -> BOOT_CTYPE_H

2015-01-02 Thread Alexander Kuleshov
arch/x86/boot/isdigit.h was renamed to arch/x86/boot/ctype.h at
6238b47b58480cd9c092600c05338dbe261b71ce.

Signed-off-by: Alexander Kuleshov 
---
 arch/x86/boot/ctype.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/ctype.h b/arch/x86/boot/ctype.h
index 25e1340..d249ccc 100644
--- a/arch/x86/boot/ctype.h
+++ b/arch/x86/boot/ctype.h
@@ -1,6 +1,6 @@
-#ifndef BOOT_ISDIGIT_H
+#ifndef BOOT_CTYPE_H
 
-#define BOOT_ISDIGIT_H
+#define BOOT_CTYPE_H
 
 static inline int isdigit(int ch)
 {
-- 
2.2.1.202.g44ae4ee.dirty

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


Re: [PATCH V2 0/2] ARM: l2c: OMAP4/AM437x: Additional register programming support.

2015-01-02 Thread Tomasz Figa
Hi Tony,

2015-01-03 9:23 GMT+09:00 Tony Lindgren :
> * Nishanth Menon  [150102 11:50]:
>> On 01/02/2015 12:46 PM, santosh.shilim...@oracle.com wrote:
>> > On 1/2/15 9:43 AM, Nishanth Menon wrote:
>> >> Hi,
>> >> OMAP4 and AM437x ROM code provides services to program PL310's latency
>> >> registers and AM437x provides service for programming Address filter
>> >> registers.
>> >>
>> >> Provide support in the kernel for the same.
>> >>
>> >> V2 of the series contains documentation update and a bug fix due to a
>> >> typo introduced during patch split :(
>> >>
>> >> Nishanth Menon (2):
>> >>ARM: l2c: OMAP4/AM437x: Introduce support for cache latency
>> >>  programming
>> >>ARM: l2c: AM437x: Introduce support for cache filter programming
>> >>
>> > Looks fine to me ...
>> > Feel free to add my ack if you need one ...
>> >
>> > Minor: The subject looks like I2C though it is L2C ;-)
>> >
>> Yeah, the thought did occur to me, but decided instead to go with the
>> existing $subject conventions of arch/arm/mach-omap2/omap4-common.c
>> ARM: l2c: omap2+: get rid of init call
>> ARM: l2c: omap2+: get rid of redundant cache replacement policy setting
>> ARM: l2c: omap2: remove explicit non-secure access bits
>> ARM: l2c: omap2: remove cache size override
>> ARM: l2c: omap2: remove explicit SMI calls to enable L2 cache
>> ARM: l2c: omap2: implement new write_sec method
>> ARM: l2c: remove platforms/SoCs setting early BRESP
>> ARM: l2c: fix register naming
>> ARM: l2c: omap2: remove ES1.0 support
>>
>> ..
>>
>> If folks feel strongly about this, I can capitalize the same and post
>> a v3 to help confusing fonts on certain mail clients and terminals.
>> let me know if folks want me to.
>
> I guess no need to :)
>
> Looks like these still won't fix the issue we found in the
> series posted by Tomasz though. At least I'm still getting errors
> on am437x with these and the patches from Tomasz applied.

Indeed, as I figured out in the original thread about this issue,
additional patch fixing code unaffected by my series (besides changing
the condition which triggers calling it) is necessary. Namely, the
affected 4 registers need to be written using the write_sec wrapper,
instead of using writel*() directly.

Best regards,
Tomasz
--
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 2/2] ARM: l2c: AM437x: Introduce support for cache filter programming

2015-01-02 Thread Tomasz Figa
Hi Nishanth,

2015-01-03 2:43 GMT+09:00 Nishanth Menon :
> AM437x generation of processors support programming the PL310 L2Cache
> controller's address filter start and end registers using a secure
> montior service.

typo: s/montior/monitor/

[snip]

> +   base = omap4_get_l2cache_base();
> +   filter_start = (reg == L310_ADDR_FILTER_START) ? val :
> +  readl_relaxed(base + L310_ADDR_FILTER_START);
> +   filter_end = (reg == L310_ADDR_FILTER_END) ? val :
> +  readl_relaxed(base + L310_ADDR_FILTER_END);
> +   omap_smc1_2(AM43X_MON_L2X0_SETFILTER_INDEX, filter_start,
> +   filter_end);
> +   return;

I don't have any significant comments about this patch in particular,
but just noticed that you need to do read-backs here (and the typo
thanks to the spell checker of my mailing app). Maybe you should
consider switching to the .configure() API I introduced in my series?
This would let you get rid of the hardcoded static mapping.

Best regards,
Tomasz
--
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] net: wireless: rtlwifi: btcoexist: halbtc8821a2ant: Remove some unused functions

2015-01-02 Thread Larry Finger

On 01/02/2015 02:26 PM, Rickard Strandqvist wrote:

Removes some functions that are not used anywhere:
ex_halbtc8821a2ant_periodical() ex_halbtc8821a2ant_halt_notify()
ex_halbtc8821a2ant_bt_info_notify()
ex_halbtc8821a2ant_special_packet_notify()
ex_halbtc8821a2ant_connect_notify() ex_halbtc8821a2ant_scan_notify()
ex_halbtc8821a2ant_lps_notify() ex_halbtc8821a2ant_ips_notify()
ex_halbtc8821a2ant_display_coex_info() ex_halbtc8821a2ant_init_coex_dm()
ex_halbtc8821a2ant_init_hwconfig()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 


I know that you have been told that including "net: wireless:" in the subject 
line is discouraged. Please do not do this again. The staging directory is 
different as GregKH uses "staging:" in the subject to route patches, but 
wireless does not.


As to the patch, NACK for the simple reason that I am currently working on a 
number of changes to btcoexist. Some of these routines may end up being removed, 
but others will not. Having your patch remove them, and one of mine adding them 
back just constitutes a lot of churning of the source. In addition, it greatly 
increases the probability of the source trees becoming unsynchronized and 
getting merge conflicts.


Larry

--
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] tools: hv: kvp_daemon: make IPv6-only-injection work

2015-01-02 Thread Dexuan Cui
> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Friday, January 2, 2015 22:51 PM
> To: Dexuan Cui
> Cc: gre...@linuxfoundation.org; linux-kernel@vger.kernel.org; driverdev-
> de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com;
> jasow...@redhat.com; KY Srinivasan; Haiyang Zhang
> Subject: Re: [PATCH v2] tools: hv: kvp_daemon: make IPv6-only-injection
> work
> 
> Dexuan Cui  writes:
> 
> >> -Original Message-
> >> From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On
> >> Behalf Of Dexuan Cui
> >> Sent: Wednesday, December 10, 2014 19:33 PM
> >> To: gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> driverdev-
> >> de...@linuxdriverproject.org; vkuzn...@redhat.com; o...@aepfle.de;
> >> a...@canonical.com; jasow...@redhat.com; KY Srinivasan
> >> Cc: Haiyang Zhang
> >> Subject: [PATCH v2] tools: hv: kvp_daemon: make IPv6-only-injection work
> >>
> >> In the case the host only injects an IPv6 address, the dhcp_enabled flag is
> >> true (it's only for IPv4 according to Hyper-V host team), but we still need
> to
> >> proceed to parse the IPv6 information.
> >>
> >> Cc: Vitaly Kuznetsov 
> >> Cc: K. Y. Srinivasan 
> >> Signed-off-by: Dexuan Cui 
> >> ---
> >>
> >> v2: removed the distro-specific logic as Vitaly suggested.
> >>
> >>  tools/hv/hv_kvp_daemon.c | 12 ++--
> >>  1 file changed, 6 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
> >> index 6a6432a..4b3ee35 100644
> >> --- a/tools/hv/hv_kvp_daemon.c
> >> +++ b/tools/hv/hv_kvp_daemon.c
> >> @@ -1308,16 +1308,17 @@ static int kvp_set_ip_info(char *if_name,
> struct
> >> hv_kvp_ipaddr_value *new_val)
> >>if (error)
> >>goto setval_error;
> >>
> >> +  /*
> >> +   * The dhcp_enabled flag is only for IPv4. In the case the host only
> >> +   * injects an IPv6 address, the flag is true, but we still need to
> >> +   * proceed to parse and pass the IPv6 information to the
> >> +   * disto-specific script hv_set_ifconfig.
> >> +   */
> 
> Actually we just relay what was recieved from the host and it's up to
> distro-specific script how to interpret BOOTPROTO=dhcp now. Additional
> IPv4 addresses (in case we receive them from our host) are not skipped
> now as well.
Yes.

> 
> >>if (new_val->dhcp_enabled) {
> >>error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
> >>if (error)
> >>goto setval_error;
> >>
> >> -  /*
> >> -   * We are done!.
> >> -   */
> >> -  goto setval_done;
> >> -
> >>} else {
> >>error = kvp_write_file(file, "BOOTPROTO", "", "none");
> >>if (error)
> >> @@ -1345,7 +1346,6 @@ static int kvp_set_ip_info(char *if_name, struct
> >> hv_kvp_ipaddr_value *new_val)
> >>if (error)
> >>goto setval_error;
> >>
> >> -setval_done:
> >>fclose(file);
> >>
> >>/*
> >> --
> >> 1.9.1
> >
> > Hi Vitaly,
> > Can you please ACK the v2 patch?
> 
> Sorry it took me so long to reply, last 3 weeks I was on vacation. I'm
> not particulary sure I'm in charge here to give an ACK :-), but
It's OK. :-)

Thanks, Vitaly!

> 
> Reviewed-By: Vitaly Kuznetsov 
> 
> > Or, please let me know if you have new comments.
> >

Greg,  may  I have your comment, or do you need me to resend the
patch since it was last sent  3+ weeks ago?

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


Re: [PATCH 1/2] time: settimeofday: Validate the values of tv from user

2015-01-02 Thread Andy Lutomirski
On 01/02/2015 11:51 AM, John Stultz wrote:
> From: Sasha Levin 
> 
> An unvalidated user input is multiplied by a constant, which can result in
> an undefined behaviour for large values. While this is validated later,
> we should avoid triggering undefined behaviour.
> 
> Cc: Thomas Gleixner 
> Cc: Ingo Molnar 
> Cc: stable 
> Signed-off-by: Sasha Levin 
> Signed-off-by: John Stultz 
> ---
>  include/linux/time.h | 13 +
>  kernel/time/time.c   |  4 
>  2 files changed, 17 insertions(+)
> 
> diff --git a/include/linux/time.h b/include/linux/time.h
> index 8c42cf8..7a10ec1 100644
> --- a/include/linux/time.h
> +++ b/include/linux/time.h
> @@ -99,6 +99,19 @@ static inline bool timespec_valid_strict(const struct 
> timespec *ts)
>   return true;
>  }
>  
> +static inline bool timeval_valid(const struct timeval *tv)
> +{
> + /* Dates before 1970 are bogus */
> + if (tv->tv_sec < 0)
> + return false;
> +
> + /* Can't have more miliseconds then a second */

Trivial nit: that should be "microseconds".

--Andy

> + if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
> + return false;
> +
> + return true;
> +}
> +
>  extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
>  
>  #define CURRENT_TIME (current_kernel_time())
> diff --git a/kernel/time/time.c b/kernel/time/time.c
> index a9ae20f..22d5d3b 100644
> --- a/kernel/time/time.c
> +++ b/kernel/time/time.c
> @@ -196,6 +196,10 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, 
> tv,
>   if (tv) {
>   if (copy_from_user(&user_tv, tv, sizeof(*tv)))
>   return -EFAULT;
> +
> + if (!timeval_valid(&user_tv))
> + return -EINVAL;
> +
>   new_ts.tv_sec = user_tv.tv_sec;
>   new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC;
>   }
> 

--
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] s390: include: timex: Use macro CLOCK_STORE_SIZE instead of hard code number

2015-01-02 Thread Chen Gang

Thank you for your work.

In honest, originally, I was not sure whether it would cause bug (do not
know gcc would generic incorrect code for it). :-)

Thanks.

On 01/02/2015 05:46 PM, Heiko Carstens wrote:
> On Thu, Jan 01, 2015 at 10:27:32PM +0800, Chen Gang wrote:
>> For C language, it treats array parameter as a pointer, so sizeof for an
>> array parameter is equal to sizeof for a pointer, which causes compiler
>> warning (with allmodconfig by gcc 5):
>>
>> CC  arch/s390/kernel/asm-offsets.s
>>   In file included from include/linux/timex.h:65:0,
>>from include/linux/sched.h:19,
>>from include/linux/kvm_host.h:15,
>>from arch/s390/kernel/asm-offsets.c:10:
>>   ./arch/s390/include/asm/timex.h: In function 'get_tod_clock_ext':
>>   ./arch/s390/include/asm/timex.h:76:32: warning: 'sizeof' on array function 
>> parameter 'clk' will return size of 'char *' [-Wsizeof-array-argument]
>> typedef struct { char _[sizeof(clk)]; } addrtype;
>>   ^
>>
>> Can use macro CLOCK_STORE_SIZE instead of all related hard code numbers,
>> which also can avoid this warning. And also add a tab to CLOCK_TICK_RATE
>> definition to match coding styles.
>>
>> Signed-off-by: Chen Gang 
> 
> Thanks. I applied the slightly changed version below.
> 
>>From 77e1e6fd8f5ce0d96c035056f9e963ca7d9198b2 Mon Sep 17 00:00:00 2001
> From: Chen Gang 
> Date: Thu, 1 Jan 2015 22:27:32 +0800
> Subject: [PATCH] s390/timex: fix get_tod_clock_ext() inline assembly
> 
> For C language, it treats array parameter as a pointer, so sizeof for an
> array parameter is equal to sizeof for a pointer, which causes compiler
> warning (with allmodconfig by gcc 5):
> 
>   ./arch/s390/include/asm/timex.h: In function 'get_tod_clock_ext':
>   ./arch/s390/include/asm/timex.h:76:32: warning: 'sizeof' on array function 
> parameter 'clk' will return size of 'char *' [-Wsizeof-array-argument]
> typedef struct { char _[sizeof(clk)]; } addrtype;
>   ^
> Can use macro CLOCK_STORE_SIZE instead of all related hard code numbers,
> which also can avoid this warning. And also add a tab to CLOCK_TICK_RATE
> definition to match coding styles.
> 
> [heiko.carst...@de.ibm.com]:
> Chen's patch actually fixes a bug within the get_tod_clock_ext() inline 
> assembly
> where we incorrectly tell the compiler that only 8 bytes of memory get changed
> instead of 16 bytes.
> This would allow gcc to generate incorrect code. Right now this doesn't seem 
> to
> be the case.
> Also slightly changed the patch a bit.
> - renamed CLOCK_STORE_SIZE to STORE_CLOCK_SIZE
> - changed get_tod_clock_ext() to receive a char pointer parameter
> 
> Signed-off-by: Chen Gang 
> Signed-off-by: Heiko Carstens 
> ---
>  arch/s390/hypfs/hypfs_vm.c|  2 +-
>  arch/s390/include/asm/timex.h | 10 ++
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
> index 32040ace00ea..99a3e6b395ab 100644
> --- a/arch/s390/hypfs/hypfs_vm.c
> +++ b/arch/s390/hypfs/hypfs_vm.c
> @@ -231,7 +231,7 @@ failed:
>  struct dbfs_d2fc_hdr {
>   u64 len;/* Length of d2fc buffer without header */
>   u16 version;/* Version of header */
> - chartod_ext[16];/* TOD clock for d2fc */
> + chartod_ext[STORE_CLOCK_SIZE]; /* TOD clock for d2fc */
>   u64 count;  /* Number of VM guests in d2fc buffer */
>   charreserved[30];
>  } __attribute__ ((packed));
> diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
> index 8beee1cceba4..582be106ab4a 100644
> --- a/arch/s390/include/asm/timex.h
> +++ b/arch/s390/include/asm/timex.h
> @@ -67,20 +67,22 @@ static inline void local_tick_enable(unsigned long long 
> comp)
>   set_clock_comparator(S390_lowcore.clock_comparator);
>  }
>  
> -#define CLOCK_TICK_RATE  1193180 /* Underlying HZ */
> +#define CLOCK_TICK_RATE  1193180 /* Underlying HZ */
> +#define STORE_CLOCK_SIZE 16  /* number of bytes store clock writes */
>  
>  typedef unsigned long long cycles_t;
>  
> -static inline void get_tod_clock_ext(char clk[16])
> +static inline void get_tod_clock_ext(char *clk)
>  {
> - typedef struct { char _[sizeof(clk)]; } addrtype;
> + typedef struct { char _[STORE_CLOCK_SIZE]; } addrtype;
>  
>   asm volatile("stcke %0" : "=Q" (*(addrtype *) clk) : : "cc");
>  }
>  
>  static inline unsigned long long get_tod_clock(void)
>  {
> - unsigned char clk[16];
> + unsigned char clk[STORE_CLOCK_SIZE];
> +
>   get_tod_clock_ext(clk);
>   return *((unsigned long long *)&clk[1]);
>  }
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
--
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-inf

linux-next: Tree for Jan 3

2015-01-02 Thread Stephen Rothwell
Hi all,

Changes since 20141231:

The net-next tree gained build failures for which I applied patches.

Non-merge commits (relative to Linus' tree): 937
 1035 files changed, 28764 insertions(+), 16076 deletions(-)



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

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

Below is a summary of the state of the merge.

I am currently merging 236 trees (counting Linus' and 32 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

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

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

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (5e0f872c7d7e Merge branch 'upstream' of 
git://git.infradead.org/users/pcmoore/audit)
Merging fixes/master (b94d525e58dc Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging kbuild-current/rc-fixes (a16c5f99a28c kbuild: Fix removal of the 
debian/ directory)
Merging arc-current/for-curr (2ce7598c9a45 Linux 3.17-rc4)
Merging arm-current/fixes (3f4aa45ceea5 ARM: 8226/1: cacheflush: get rid of 
restarting block)
Merging m68k-current/for-linus (f0b99a643e96 m68k/mm: Eliminate memset after 
alloc_bootmem_pages)
Merging metag-fixes/fixes (ffe6902b66aa asm-generic: remove _STK_LIM_MAX)
Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5)
Merging powerpc-merge/merge (31345e1a071e powerpc/pci: Remove unused 
force_32bit_msi quirk)
Merging powerpc-merge-mpe/fixes (1be6f10f6f9c Revert "powerpc: Secondary CPUs 
must set cpu_callin_map after setting active and online")
Merging sparc/master (66d0f7ec9f10 sparc32: destroy_context() and switch_mm() 
needs to disable interrupts.)
Merging net/master (7824acd92494 qlcnic: Fix return value in qlcnic_probe())
Merging ipsec/master (f855691975bb xfrm6: Fix the nexthdr offset in 
_decode_session6.)
Merging sound-current/for-linus (62f64a880af2 ALSA: pcm: Fix kerneldoc for 
params_*() functions)
Merging pci-current/for-linus (97bf6af1f928 Linux 3.19-rc1)
Merging wireless/master (97bf6af1f928 Linux 3.19-rc1)
Merging wireless-drivers/master (eb46e2215fc6 Merge branch 'for-upstream' of 
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth)
Merging driver-core.current/driver-core-linus (b7392d2247cf Linux 3.19-rc2)
Merging tty.current/tty-linus (b7392d2247cf Linux 3.19-rc2)
Merging usb.current/usb-linus (b3ee8bdcd243 Merge tag 'fixes-for-v3.19-rc2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus)
Merging usb-gadget-fixes/fixes (6785a1034461 usb: gadget: udc: atmel: fix 
possible IN hang issue)
Merging usb-serial-fixes/usb-linus (b5122236bba8 USB: keyspan: fix null-deref 
at probe)
Merging staging.current/staging-linus (97bf6af1f928 Linux 3.19-rc1)
Merging char-misc.current/char-misc-linus (b7392d2247cf Linux 3.19-rc2)
Merging input-current/for-linus (cceeb872d60f Input: hil_kbd - fix incorrect 
use of init_completion)
Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" 
stripe)
Merging crypto-current/master (7e77bdebff5c crypto: af_alg - fix backlog 
handling)
Merging ide/master (f96fe225677b Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff)
Merging devicetree-current/devicetree/merge (094cb98179f1 of/fdt: 
memblock_reserve /memreserve/ regions in the case of partial overlap)
Merging rr-fixes/fixes (3438cf549d2f param: fix crash on bad kernel arguments)
Merging vfio-fixes/for-linus (239a87020b26 Merge branch 
'for-joerg/arm-smmu/fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into for-linus)
Merging kselftest-fixes/fixes (6898b627aab6 selftests/exec: Use %zu to format 
size_t)
Merging drm-intel-fixes/for-linux-next-fixes (f465245df911 dr

Re: linux-next: build failure after merge of the net-next tree

2015-01-02 Thread Stephen Rothwell
Hi all,

On Sat, 3 Jan 2015 09:11:01 +1100 Stephen Rothwell  
wrote:
>
> After merging the net-next tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
> 
> drivers/net/ethernet/mellanox/mlx4/en_clock.c: In function 
> 'mlx4_en_init_timestamp':
> drivers/net/ethernet/mellanox/mlx4/en_clock.c:249:2: error: implicit 
> declaration of function 'CLOCKSOURCE_MASK' 
> [-Werror=implicit-function-declaration]
>   mdev->cycles.mask = CLOCKSOURCE_MASK(48);
>   ^
> drivers/net/ethernet/mellanox/mlx4/en_clock.c:257:3: error: implicit 
> declaration of function 'clocksource_khz2mult' 
> [-Werror=implicit-function-declaration]
>clocksource_khz2mult(1000 * dev->caps.hca_core_clock, mdev->cycles.shift);
>^
> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c: In function 
> 'ixgbe_ptp_start_cyclecounter':
> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c:796:2: error: implicit 
> declaration of function 'CLOCKSOURCE_MASK' 
> [-Werror=implicit-function-declaration]
>   adapter->cc.mask = CLOCKSOURCE_MASK(64);
>   ^
> 

My powerpc allyesconfig build also produced this:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function 
'bnx2x_init_cyclecounter':
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:14613:2: error: implicit 
declaration of function 'CLOCKSOURCE_MASK' 
[-Werror=implicit-function-declaration]
  bp->cyclecounter.mask = CLOCKSOURCE_MASK(64);
  ^

So I added this patch:

From: Stephen Rothwell 
Date: Sat, 3 Jan 2015 12:15:37 +1100
Subject: [PATCH] bnx2x: Include clocksource.h to get CLOCKSOURCE_MASK

Signed-off-by: Stephen Rothwell 
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 2c951326a85d..119c190721da 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -57,6 +57,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "bnx2x.h"
 #include "bnx2x_init.h"
-- 
2.1.4

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


pgpAk8HU6qBtB.pgp
Description: OpenPGP digital signature


[PATCH 4/4] perf diff: Fix to sort by baseline field by default

2015-01-02 Thread Arnaldo Carvalho de Melo
From: Namhyung Kim 

The currently perf diff didn't add the baseline and delta (or other
compute) fields to the sort list so output will be sorted by other
fields like alphabetical order of DSO or symbol as below example.

Fix it by adding hpp formats for the fields and provides default compare
functions.

Before:

  $ perf diff
  # Event 'cycles'
  #
  # BaselineDelta  Shared Object   Symbol
  #   ...  ..  ...
  #
   [bridge][k] ip_sabotage_in
   [btrfs] [k] __etree_search.constprop.47
   0.01%   [btrfs] [k] btrfs_file_mmap
   0.01%   -0.01%  [btrfs] [k] btrfs_getattr
   [e1000e][k] e1000_watchdog
   0.00%   [kernel.vmlinux][k] PageHuge
   0.00%   [kernel.vmlinux][k] __acct_update_integrals
   0.00%   [kernel.vmlinux][k] __activate_page
   [kernel.vmlinux][k] __alloc_fd
   0.02%   +0.02%  [kernel.vmlinux][k] __alloc_pages_nodemask
   ...

After:

  # BaselineDelta  Shared Object   Symbol
  #   ...  ..  
  #
  24.73%   -4.62%  perf[.] append_chain_children
   7.96%   -1.29%  perf[.] dso__find_symbol
   6.97%   -2.07%  libc-2.20.so[.] vfprintf
   4.61%   +0.88%  libc-2.20.so[.] __fprintf_chk
   4.41%   +2.43%  perf[.] sort__comm_cmp
   4.10%   -0.16%  perf[.] comm__str
   4.03%   -0.93%  perf[.] machine__findnew_thread_time
   3.82%   +3.09%  perf[.] __hists__add_entry
   2.95%   -0.18%  perf[.] sort__dso_cmp
   ...

Signed-off-by: Namhyung Kim 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1419656793-32756-1-git-send-email-namhy...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-diff.c | 44 
 1 file changed, 44 insertions(+)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 303c1e151dcf..1fd96c13f199 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -545,6 +545,42 @@ hist_entry__cmp_compute(struct hist_entry *left, struct 
hist_entry *right,
return __hist_entry__cmp_compute(p_left, p_right, c);
 }
 
+static int64_t
+hist_entry__cmp_nop(struct hist_entry *left __maybe_unused,
+   struct hist_entry *right __maybe_unused)
+{
+   return 0;
+}
+
+static int64_t
+hist_entry__cmp_baseline(struct hist_entry *left, struct hist_entry *right)
+{
+   if (sort_compute)
+   return 0;
+
+   if (left->stat.period == right->stat.period)
+   return 0;
+   return left->stat.period > right->stat.period ? 1 : -1;
+}
+
+static int64_t
+hist_entry__cmp_delta(struct hist_entry *left, struct hist_entry *right)
+{
+   return hist_entry__cmp_compute(right, left, COMPUTE_DELTA);
+}
+
+static int64_t
+hist_entry__cmp_ratio(struct hist_entry *left, struct hist_entry *right)
+{
+   return hist_entry__cmp_compute(right, left, COMPUTE_RATIO);
+}
+
+static int64_t
+hist_entry__cmp_wdiff(struct hist_entry *left, struct hist_entry *right)
+{
+   return hist_entry__cmp_compute(right, left, COMPUTE_WEIGHTED_DIFF);
+}
+
 static void insert_hist_entry_by_compute(struct rb_root *root,
 struct hist_entry *he,
 int c)
@@ -1038,27 +1074,35 @@ static void data__hpp_register(struct data__file *d, 
int idx)
fmt->header = hpp__header;
fmt->width  = hpp__width;
fmt->entry  = hpp__entry_global;
+   fmt->cmp= hist_entry__cmp_nop;
+   fmt->collapse = hist_entry__cmp_nop;
 
/* TODO more colors */
switch (idx) {
case PERF_HPP_DIFF__BASELINE:
fmt->color = hpp__color_baseline;
+   fmt->sort  = hist_entry__cmp_baseline;
break;
case PERF_HPP_DIFF__DELTA:
fmt->color = hpp__color_delta;
+   fmt->sort  = hist_entry__cmp_delta;
break;
case PERF_HPP_DIFF__RATIO:
fmt->color = hpp__color_ratio;
+   fmt->sort  = hist_entry__cmp_ratio;
break;
case PERF_HPP_DIFF__WEIGHTED_DIFF:
fmt->color = hpp__color_wdiff;
+   fmt->sort  = hist_entry__cmp_wdiff;
break;
default:
+   fmt->sort  = hist_entry__cmp_nop;
break;
}
 
init_header(d, dfmt);
perf_hpp__column_register(fmt);
+   perf_hpp__register_sort_field(fmt);
 }
 
 static void ui_init(void)
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a m

[PATCH 1/4] perf probe: Fix to fall back to find probe point in symbols

2015-01-02 Thread Arnaldo Carvalho de Melo
From: Masami Hiramatsu 

Fix to fall back to find a probe point in symbols if perf fails to find
it in debuginfo.

This can happen when the target function is an alias of another
function. Such alias doesn't have an entry in debuginfo but in symbols.

David Ahern reported this problem in https://lkml.org/lkml/2014/12/29/355

I ensured the problem and deeper investigation discovers it.
 -
 eu-readelf --debug-dump=info /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so 
| grep \"malloc\" -A6
 name (strp) "malloc"
 decl_file(data1) 25
 decl_line(data2) 466
 prototyped   (flag_present)
 type (ref4) [  81b5]
 declaration  (flag_present)
 [  8f58]  formal_parameter
 --
 name (strp) "malloc"
 decl_file(data1) 23
 decl_line(data2) 466
 prototyped   (flag_present)
 type (ref4) [  9f4a]
 declaration  (flag_present)
 sibling  (ref4) [  bb29]
 ...
 -
All these entires have no instances (all of them are declarations)
This is why the perf probe failed to find it in debuginfo.

However, there are some malloc instances in symbols.
 -
 eu-readelf --symbols /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep 
malloc$
  1181: 00080700   5332 FUNCLOCAL  DEFAULT   12 _int_malloc
  4537: 000831d0339 FUNCLOCAL  DEFAULT   12 
__GI___libc_malloc
  5545: 000831d0339 FUNCLOCAL  DEFAULT   12 __malloc
  6063: 000831d0339 FUNCGLOBAL DEFAULT   12 malloc
  7302: 000831d0339 FUNCGLOBAL DEFAULT   12 __libc_malloc
 -
As you an see, malloc and __libc_malloc have same address, and actually
__libc_malloc has an entry in debuginfo. So you can set up a probe on
__libc_malloc.

To fix this problem shortly, perf probe simply falls back to find probe
point(malloc) in symbols if it is not found in debuginfo.

Reported-by: David Ahern 
Signed-off-by: Masami Hiramatsu 
Acked-by: Namhyung Kim 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: yrl.pp-manager...@hitachi.com
Link: 
http://lkml.kernel.org/r/20141231062747.2087.80961.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/probe-event.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 28eb1417cb2a..7f9b8632e433 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -495,9 +495,11 @@ static int try_to_find_probe_trace_events(struct 
perf_probe_event *pev,
}
 
if (ntevs == 0) {   /* No error but failed to find probe point. */
-   pr_warning("Probe point '%s' not found.\n",
+   pr_warning("Probe point '%s' not found in debuginfo.\n",
   synthesize_perf_probe_point(&pev->point));
-   return -ENOENT;
+   if (need_dwarf)
+   return -ENOENT;
+   return 0;
}
/* Error path : ntevs < 0 */
pr_debug("An error occurred in debuginfo analysis (%d).\n", ntevs);
-- 
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 2/4] perf probe: Fix crash in dwarf_getcfi_elf

2015-01-02 Thread Arnaldo Carvalho de Melo
From: Namhyung Kim 

David reported that perf can segfault when adding an uprobe event like
this:

  $ perf probe -x /lib64/libc-2.14.90.so -a 'malloc  size=%di'

  (gdb) bt
  #0  parse_eh_frame_hdr (hdr=0x0, hdr_size=2596, hdr_vaddr=71788,
  ehdr=0x7fffd390, eh_frame_vaddr=
  0x7fffd378, table_entries=0x8808d8, table_encoding=0x8808e0 "") at
  dwarf_getcfi_elf.c:79
  #1  0x00385f81615a in getcfi_scn_eh_frame (hdr_vaddr=71788,
  hdr_scn=0x8839b0, shdr=0x7fffd2f0, scn=,
  ehdr=0x7fffd390, elf=0x882b30) at dwarf_getcfi_elf.c:231
  #2  getcfi_shdr (ehdr=0x7fffd390, elf=0x882b30) at dwarf_getcfi_elf.c:283
  #3  dwarf_getcfi_elf (elf=0x882b30) at dwarf_getcfi_elf.c:309
  #4  0x004d5bac in debuginfo__find_probes (pf=0x7fffd4f0,
  dbg=Unhandled dwarf expression opcode 0xfa) at util/probe-finder.c:993
  #5  0x004d634a in debuginfo__find_trace_events (dbg=0x880840,
  pev=, tevs=0x880f88, max_tevs=) at
  util/probe-finder.c:1200
  #6  0x004aed6b in try_to_find_probe_trace_events (target=0x881b20
  "/lib64/libpthread-2.14.90.so",
  max_tevs=128, tevs=0x880f88, pev=0x859b30) at util/probe-event.c:482
  #7  convert_to_probe_trace_events (target=0x881b20
  "/lib64/libpthread-2.14.90.so", max_tevs=128, tevs=0x880f88,
  pev=0x859b30) at util/probe-event.c:2356
  #8  add_perf_probe_events (pevs=, npevs=1, max_tevs=128,
  target=0x881b20 "/lib64/libpthread-2.14.90.so", force_add=false) at
  util/probe-event.c:2391
  #9  0x0044014f in __cmd_probe (argc=,
  argv=0x7fffe2f0, prefix=Unhandled dwarf expression opcode 0xfa) at
  at builtin-probe.c:488
  #10 0x00440313 in cmd_probe (argc=5, argv=0x7fffe2f0,
  prefix=) at builtin-probe.c:506
  #11 0x0041d133 in run_builtin (p=0x805680, argc=5,
  argv=0x7fffe2f0) at perf.c:341
  #12 0x0041c8b2 in handle_internal_command (argv=,
  argc=) at perf.c:400
  #13 run_argv (argv=, argcp=) at perf.c:444
  #14 main (argc=5, argv=0x7fffe2f0) at perf.c:559

And I found a related commit (5704c8c4fa71 "getcfi_scn_eh_frame: Don't
crash and burn when .eh_frame bits aren't there.") in elfutils that can
lead to a unexpected crash like this.  To safely use the function, it
needs to check the .eh_frame section is a PROGBITS type.

Reported-by: David Ahern 
Tested-by: David Ahern 
Signed-off-by: Namhyung Kim 
Acked-by: Masami Hiramatsu 
Cc: David Ahern 
Cc: Mark Wielaard 
Cc: Masami Hiramatsu 
Link: http://lkml.kernel.org/r/20141230090533.GH6081@sejong
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/probe-finder.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index c7918f83b300..b5247d777f0e 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -989,8 +989,24 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
int ret = 0;
 
 #if _ELFUTILS_PREREQ(0, 142)
+   Elf *elf;
+   GElf_Ehdr ehdr;
+   GElf_Shdr shdr;
+
/* Get the call frame information from this dwarf */
-   pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
+   elf = dwarf_getelf(dbg->dbg);
+   if (elf == NULL)
+   return -EINVAL;
+
+   if (gelf_getehdr(elf, &ehdr) == NULL)
+   return -EINVAL;
+
+   if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) &&
+   shdr.sh_type == SHT_PROGBITS) {
+   pf->cfi = dwarf_getcfi_elf(elf);
+   } else {
+   pf->cfi = dwarf_getcfi(dbg->dbg);
+   }
 #endif
 
off = 0;
-- 
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 3/4] perf list: Fix --raw-dump option

2015-01-02 Thread Arnaldo Carvalho de Melo
From: Taesoo Kim 

Currently, 'perf list --raw-dump' requires extra arguments
(e.g., hw) to invoke, which breaks bash/zsh completion
(perf-completion.sh).

  $ perf list --raw-dump
Error: unknown option `raw-dump'

 usage: perf list [hw|sw|cache|tracepoint|pmu|event_glob]

After,

  $ perf list --raw-dump
  cpu-cycles instructions cache-references cache-misses ...

Signed-off-by: Taesoo Kim 
Acked-by: Namhyung Kim 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Taesoo kim 
Link: 
http://lkml.kernel.org/r/1419997015-11071-1-git-send-email-tsgat...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-list.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 011195e38f21..198f3c3aff95 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -19,7 +19,9 @@
 int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 {
int i;
-   const struct option list_options[] = {
+   bool raw_dump = false;
+   struct option list_options[] = {
+   OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"),
OPT_END()
};
const char * const list_usage[] = {
@@ -27,11 +29,18 @@ int cmd_list(int argc, const char **argv, const char 
*prefix __maybe_unused)
NULL
};
 
+   set_option_flag(list_options, 0, "raw-dump", PARSE_OPT_HIDDEN);
+
argc = parse_options(argc, argv, list_options, list_usage,
 PARSE_OPT_STOP_AT_NON_OPTION);
 
setup_pager();
 
+   if (raw_dump) {
+   print_events(NULL, true);
+   return 0;
+   }
+
if (argc == 0) {
print_events(NULL, false);
return 0;
@@ -53,8 +62,6 @@ int cmd_list(int argc, const char **argv, const char *prefix 
__maybe_unused)
print_hwcache_events(NULL, false);
else if (strcmp(argv[i], "pmu") == 0)
print_pmu_events(NULL, false);
-   else if (strcmp(argv[i], "--raw-dump") == 0)
-   print_events(NULL, true);
else {
char *sep = strchr(argv[i], ':'), *s;
int sep_idx;
-- 
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/


[GIT PULL 0/4] perf/urgent fixes

2015-01-02 Thread Arnaldo Carvalho de Melo
Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 5b5e76218fbdbb71a01d5480f289ead624232876:

  Merge tag 'perf-urgent-for-mingo' of 
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent 
(2015-01-01 22:24:36 +0100)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git 
tags/perf-urgent-for-mingo

for you to fetch changes up to e7024fc3783317608b8e07048116a72a7d1cd26d:

  perf diff: Fix to sort by baseline field by default (2015-01-02 23:27:18 
-0300)


perf/urgent fixes:

- 'perf probe' should fall back to find probe point in symbols when failing
  to do so in a debuginfo file (Masami Hiramatsu)

- Fix 'perf probe' crash in dwarf_getcfi_elf (Namhyung Kim)

- Fix shell completion with 'perf list' --raw-dump option (Taesoo Kim)

- Fix 'perf diff' to sort by baseline field by default (Namhyung Kim)

Signed-off-by: Arnaldo Carvalho de Melo 


Masami Hiramatsu (1):
  perf probe: Fix to fall back to find probe point in symbols

Namhyung Kim (2):
  perf probe: Fix crash in dwarf_getcfi_elf
  perf diff: Fix to sort by baseline field by default

Taesoo Kim (1):
  perf list: Fix --raw-dump option

 tools/perf/builtin-diff.c  | 44 ++
 tools/perf/builtin-list.c  | 13 ++---
 tools/perf/util/probe-event.c  |  6 --
 tools/perf/util/probe-finder.c | 18 -
 4 files changed, 75 insertions(+), 6 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7] edac: synps: Added EDAC support for zynq ddr ecc controller

2015-01-02 Thread punnaiah choudary kalluri
On Fri, Jan 2, 2015 at 4:20 PM, Borislav Petkov  wrote:
> On Fri, Jan 02, 2015 at 09:52:20AM +0530, Punnaiah Choudary Kalluri wrote:
>> +/**
>> + * synps_edac_handle_error - Handle controller error types CE and UE
>> + * @mci: Pointer to the edac memory controller instance
>> + * @p:   Pointer to the synopsys ecc status structure
>> + *
>> + * Handles the controller ECC correctable and un correctable error.
>> + */
>> +static void synps_edac_handle_error(struct mem_ctl_info *mci,
>> + struct synps_ecc_status *p)
>> +{
>> + char message[SYNPS_EDAC_MSG_SIZE];
>
> This is still on the stack. My previous comment:
>
> "You could preallocate this on driver init so you don't do relatively
> big stack allocations on the error reporting path and remain lean."

Oh. sorry its my mistake. I will update

>
>> + struct ecc_error_info *pinf;
>> +
>> + if (p->ce_cnt) {
>> + pinf = &p->ceinfo;
>> + snprintf(message, SYNPS_EDAC_MSG_SIZE,
>> +  "DDR ECC error type :%s Row %d Bank %d Col %d ",
>> +  "CE", pinf->row, pinf->bank, pinf->col);
>> + edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
>> +  p->ce_cnt, 0, 0, 0, 0, 0, -1,
>> +  message, "");
>> + }
>> +
>> + if (p->ue_cnt) {
>> + pinf = &p->ueinfo;
>> + snprintf(message, SYNPS_EDAC_MSG_SIZE,
>> +  "DDR ECC error type :%s Row %d Bank %d Col %d ",
>> +  "UE", pinf->row, pinf->bank, pinf->col);
>> + edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,
>> +  p->ue_cnt, 0, 0, 0, 0, 0, -1,
>> +  message, "");
>> + }
>
> From the previous review:
>
> "If you memset(p, 0,...) here, after consumption, you don't need to do
> it anywhere else and be sure that *p would be always clean and ready for
> the next error."

p is pointing to the stack memory. so, if we do memset after consumption, then
it will not guarantee that next time we will get the clean memory.
Here i am clearing
this memory only when the controller reports error and before
consumption by the edac
core to ensure that there is no garbage data.

here is the call stack

int synps_edac_geterror_info(void __iomem *base,
struct synps_ecc_status *p)

{
...
regval = readl(base + STAT_OFST);
 if (!regval)
 return 1;

 memset(p, 0, sizeof(*p));
   ...
}


static void synps_edac_check(struct mem_ctl_info *mci) {
struct synps_ecc_status stat;
   ...
   status = synps_edac_geterror_info(priv->baseaddr, &stat);
   ...
   synps_edac_handle_error(mci, &stat);
  ...
}


>
> Looks like you've missed those two points.
>
>> +static int synps_edac_mc_probe(struct platform_device *pdev)
>> +{
>> + struct mem_ctl_info *mci;
>> + struct edac_mc_layer layers[2];
>> + struct synps_edac_priv *priv;
>> + int rc;
>> + struct resource *res;
>> + void __iomem *baseaddr;
>> +
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + baseaddr = devm_ioremap_resource(&pdev->dev, res);
>> + if (IS_ERR(baseaddr))
>> + return PTR_ERR(baseaddr);
>> +
>> + if (!synps_edac_get_eccstate(baseaddr)) {
>> + edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n");
>> + return -ENXIO;
>> + }
>> +
>> + layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
>> + layers[0].size = SYNPS_EDAC_NR_CSROWS;
>> + layers[0].is_virt_csrow = true;
>> + layers[1].type = EDAC_MC_LAYER_CHANNEL;
>> + layers[1].size = SYNPS_EDAC_NR_CHANS;
>> + layers[1].is_virt_csrow = false;
>> +
>> + mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers,
>> + sizeof(struct synps_edac_priv));
>> + if (!mci) {
>> + edac_printk(KERN_ERR, EDAC_MC,
>> + "Failed memory allocation for mc instance\n");
>> + return -ENOMEM;
>> + }
>> +
>> + priv = mci->pvt_info;
>> + priv->baseaddr = baseaddr;
>> + rc = synps_edac_mc_init(mci, pdev);
>> + if (rc) {
>> + edac_printk(KERN_ERR, EDAC_MC,
>> + "Failed to initialize instance\n");
>> + goto free_edac_mc;
>> + }
>> +
>> + rc = edac_mc_add_mc(mci);
>> + if (rc) {
>> + edac_printk(KERN_ERR, EDAC_MC,
>> + "Failed to register with EDAC core\n");
>> + goto free_edac_mc;
>> + }
>
> With all the more or less redundant commenting in this driver, the *one*
> line which definitely needs a comment is without one:
>
> /*
>  * Start capturing the correctable and uncorrectable errors. A write 
> of
>  * 0 starts the counters.
>  */

Ok.

Thanks,
Punnaia

Re: [PATCH 6/7] perf tools: Append callchains only when requested

2015-01-02 Thread Arnaldo Carvalho de Melo
Em Mon, Dec 22, 2014 at 01:44:14PM +0900, Namhyung Kim escreveu:
> The perf report --children can be called with callchain disabled so no
> need to append callchains.  Actually the root of callchain tree is not
> initialized properly in this case.

Hi Namhyung,

I should have caught this using 'perf test', but it slipped
thru, please try running 'perf test cumulation', I noticed that it fails
and that if I revert this changeset it works again, can you please
check?

- Arnaldo
 
> Signed-off-by: Namhyung Kim 
> ---
>  tools/perf/util/hist.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index bd4a2cd73236..30ff2cb92884 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -300,7 +300,7 @@ static struct hist_entry *hist_entry__new(struct 
> hist_entry *template,
>   size_t callchain_size = 0;
>   struct hist_entry *he;
>  
> - if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain)
> + if (symbol_conf.use_callchain)
>   callchain_size = sizeof(struct callchain_root);
>  
>   he = zalloc(sizeof(*he) + callchain_size);
> @@ -735,7 +735,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter 
> *iter,
>   iter->he = he;
>   he_cache[iter->curr++] = he;
>  
> - callchain_append(he->callchain, &callchain_cursor, sample->period);
> + hist_entry__append_callchain(he, sample);
>  
>   /*
>* We need to re-initialize the cursor since callchain_append()
> @@ -808,7 +808,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter 
> *iter,
>   iter->he = he;
>   he_cache[iter->curr++] = he;
>  
> - callchain_append(he->callchain, &cursor, sample->period);
> + if (symbol_conf.use_callchain)
> + callchain_append(he->callchain, &cursor, sample->period);
>   return 0;
>  }
>  
> -- 
> 2.1.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/


RE: [HPDD-discuss] [PATCH] staging: lustre: lustre: include: lustre_update.h: Fix for possible null pointer dereference

2015-01-02 Thread Patrick Farrell
Ashley,

I sort of understand your larger point, but in this case, I think the purpose 
of the assert is much better served by the move Rickard is suggesting.  
Otherwise only one of its conditions will ever trigger.  It's not that 
different to die on the assertion or from a null dereference, but I think it's 
marginally better to fail the assertion.  And it definitely doesn't make sense 
to have it there and never triggered, which it was before.

- Patrick

From: HPDD-discuss [hpdd-discuss-boun...@lists.01.org] on behalf of Ashley 
Pittman [apitt...@ddn.com]
Sent: Friday, January 02, 2015 11:55 AM
To: Rickard Strandqvist
Cc: de...@driverdev.osuosl.org; hpdd-disc...@lists.01.org; Greg Kroah-Hartman; 
linux-kernel@vger.kernel.org
Subject: Re: [HPDD-discuss] [PATCH] staging: lustre: lustre:include:
lustre_update.h: Fix for possible null pointer dereference

Rickard,

> On 21 Dec 2014, at 22:43, Rickard Strandqvist 
>  wrote:
>
> The NULL check was done to late, and there it was a risk
> of a possible null pointer dereference.
>
> This was partially found by using a static code analysis program called 
> cppcheck.
>
> Signed-off-by: Rickard Strandqvist 
> ---
> drivers/staging/lustre/lustre/include/lustre_update.h |4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/include/lustre_update.h 
> b/drivers/staging/lustre/lustre/include/lustre_update.h
> index 84defce..00e1361 100644
> --- a/drivers/staging/lustre/lustre/include/lustre_update.h
> +++ b/drivers/staging/lustre/lustre/include/lustre_update.h
> @@ -165,12 +165,14 @@ static inline int update_get_reply_buf(struct 
> update_reply *reply, void **buf,
>   int  result;
>
>   ptr = update_get_buf_internal(reply, index, &size);
> +
> + LASSERT((ptr != NULL && size >= sizeof(int)));
> +
>   result = *(int *)ptr;
>
>   if (result < 0)
>   return result;
>
> - LASSERT((ptr != NULL && size >= sizeof(int)));

This looks odd to me, LASSERT is essentially BUG_ON() so is used for checking 
logic bugs.  Moving LASSERT calls doesn’t seem the correct way of resolving a 
logic problem and if you’re doing static analysis it might be more productive 
to do it this with LASSERT disabled.

>   *buf = ptr + sizeof(int);
>   return size - sizeof(int);
> }
> --
> 1.7.10.4
>
> ___
> HPDD-discuss mailing list
> hpdd-disc...@lists.01.org
> https://lists.01.org/mailman/listinfo/hpdd-discuss

___
HPDD-discuss mailing list
hpdd-disc...@lists.01.org
https://lists.01.org/mailman/listinfo/hpdd-discuss
--
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] ethtool: Extend ethtool plugin module eeprom API to phylib

2015-01-02 Thread Ed Swierk
This patch extends the ethtool plugin module eeprom API to support cards
whose phy support is delegated to a separate driver.

The handlers for ETHTOOL_GMODULEINFO and ETHTOOL_GMODULEEEPROM call the
module_info and module_eeprom functions if the phy driver provides them;
otherwise the handlers call the equivalent ethtool_ops functions provided
by network drivers with built-in phy support.

Signed-off-by: Ed Swierk 
---
 include/linux/phy.h |  9 +
 net/core/ethtool.c  | 45 ++---
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 565188c..04e5f5c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -472,6 +472,15 @@ struct phy_driver {
/* See set_wol, but for checking whether Wake on LAN is enabled. */
void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
 
+   /* Get the size and type of the eeprom contained within a plug-in
+* module */
+   int (*module_info)(struct phy_device *dev,
+  struct ethtool_modinfo *modinfo);
+
+   /* Get the eeprom information from the plug-in module */
+   int (*module_eeprom)(struct phy_device *dev,
+struct ethtool_eeprom *ee, u8 *data);
+
struct device_driver driver;
 };
 #define to_phy_driver(d) container_of(d, struct phy_driver, driver)
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 30071de..466526b 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1405,20 +1405,31 @@ static int ethtool_get_ts_info(struct net_device *dev, 
void __user *useraddr)
return err;
 }
 
+static int __ethtool_get_module_info(struct net_device *dev,
+struct ethtool_modinfo *modinfo)
+{
+   const struct ethtool_ops *ops = dev->ethtool_ops;
+   struct phy_device *phydev = dev->phydev;
+
+   if (phydev && phydev->drv && phydev->drv->module_info)
+   return phydev->drv->module_info(phydev, modinfo);
+
+   if (ops->get_module_info)
+   return ops->get_module_info(dev, modinfo);
+
+   return -EOPNOTSUPP;
+}
+
 static int ethtool_get_module_info(struct net_device *dev,
   void __user *useraddr)
 {
int ret;
struct ethtool_modinfo modinfo;
-   const struct ethtool_ops *ops = dev->ethtool_ops;
-
-   if (!ops->get_module_info)
-   return -EOPNOTSUPP;
 
if (copy_from_user(&modinfo, useraddr, sizeof(modinfo)))
return -EFAULT;
 
-   ret = ops->get_module_info(dev, &modinfo);
+   ret = __ethtool_get_module_info(dev, &modinfo);
if (ret)
return ret;
 
@@ -1428,21 +1439,33 @@ static int ethtool_get_module_info(struct net_device 
*dev,
return 0;
 }
 
+static int __ethtool_get_module_eeprom(struct net_device *dev,
+  struct ethtool_eeprom *ee, u8 *data)
+{
+   const struct ethtool_ops *ops = dev->ethtool_ops;
+   struct phy_device *phydev = dev->phydev;
+
+   if (phydev && phydev->drv && phydev->drv->module_eeprom)
+   return phydev->drv->module_eeprom(phydev, ee, data);
+
+   if (ops->get_module_eeprom)
+   return ops->get_module_eeprom(dev, ee, data);
+
+   return -EOPNOTSUPP;
+}
+
 static int ethtool_get_module_eeprom(struct net_device *dev,
 void __user *useraddr)
 {
int ret;
struct ethtool_modinfo modinfo;
-   const struct ethtool_ops *ops = dev->ethtool_ops;
-
-   if (!ops->get_module_info || !ops->get_module_eeprom)
-   return -EOPNOTSUPP;
 
-   ret = ops->get_module_info(dev, &modinfo);
+   ret = __ethtool_get_module_info(dev, &modinfo);
if (ret)
return ret;
 
-   return ethtool_get_any_eeprom(dev, useraddr, ops->get_module_eeprom,
+   return ethtool_get_any_eeprom(dev, useraddr,
+ __ethtool_get_module_eeprom,
  modinfo.eeprom_len);
 }
 
-- 
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 2/3] usb: dwc3: add Fujitsu Specific Glue layer

2015-01-02 Thread Felipe Balbi
Hi,

On Tue, Dec 30, 2014 at 11:12:51AM +0100, Arnd Bergmann wrote:
> On Monday 29 December 2014 01:52:04 Sneeker Yeh wrote:
> > > > +static int dwc3_mb86s70_remove_child(struct device *dev, void *unused)
> > > > +{
> > > > + struct platform_device *pdev = to_platform_device(dev);
> > > > +
> > > > + of_device_unregister(pdev);
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > +static u64 dwc3_mb86s70_dma_mask = DMA_BIT_MASK(32);
> > >
> > > why ? Use dma_coerce_mask_and_coherent().
> > >
> > 
> > okay.
> 
> Actually that is still wrong: we use dma_coerce_mask_and_coherent() to
> annotate drivers that have traditionally been forcing their own dma mask
> by some other means and that need to be changed to something proper (after
> finding out why they did it in the first place).
> 
> Since this is about a child device, the correct interface is to use
> platform_device_register_full().

no, that's wrong. He's essentially fixing the default set by OF core,
which is always 32-bits anyway, so this can actually be removed. Your
suggestion would just make it worse.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH akpm/next] lib: crc32: conditionally constify crc32 lookup table

2015-01-02 Thread Andrew Morton
On Sat, 03 Jan 2015 01:12:43 +0100 Daniel Borkmann  wrote:

> > Seems a lot of fuss.  Why are these tables cacheline aligned anyway?
> > To avoid one cache miss (most of the time, presumably) in a 16k table.
> > Pretty marginal benefit, I suspect.
> 
> I guess, it actually came in with the slice-by-8 algorithm (e.g. used
> in SCTP checksumming if no offloading is available) that was added back
> then, that is, commit 324eb0f17d9dc ("crc32: add slice-by-8 algorithm
> to existing code").

non-responsive ;)  By far the simplest solution is to remove the
cacheline alignment.

Are there other places where CC_HAVE_CONST_ALIGN can be used?  I'm seeing

z:/usr/src/linux-3.19-rc2> grep -r cacheline_aligned . | grep const
./arch/x86/um/sys_call_table_32.c:const sys_call_ptr_t sys_call_table[] 
__cacheline_aligned = {
./arch/x86/um/sys_call_table_64.c:const sys_call_ptr_t sys_call_table[] 
__cacheline_aligned = {
./include/net/netfilter/nf_tables.h:const struct nft_set_ops*ops 
cacheline_aligned;
./net/ethernet/eth.c:const struct header_ops eth_header_ops 
cacheline_aligned = {

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


Re: [PATCH 2/3] video / backlight: remove the backlight_device_registered API

2015-01-02 Thread Jingoo Han
On Wednesday, December 31, 2014 12:50 PM, Aaron Lu wrote:
> 
> Since we will need the backlight_device_get_by_type API, we can use it
> instead of the backlight_device_registered API whenever necessary so
> remove the backlight_device_registered API.
> 
> Signed-off-by: Aaron Lu 

Acked-by: Jingoo Han 

Best regards,
Jingoo Han

> ---
>  drivers/acpi/video.c| 2 +-
>  drivers/video/backlight/backlight.c | 6 --
>  include/linux/backlight.h   | 1 -
>  3 files changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 1eaadff2e198..98d3f0de811e 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -246,7 +246,7 @@ static bool acpi_video_use_native_backlight(void)
>  bool acpi_video_verify_backlight_support(void)
>  {
>   if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
> - backlight_device_registered(BACKLIGHT_RAW))
> + backlight_device_get_by_type(BACKLIGHT_RAW))
>   return false;
>   return acpi_video_backlight_support();
>  }
> diff --git a/drivers/video/backlight/backlight.c 
> b/drivers/video/backlight/backlight.c
> index bea749329236..aec173d9e1ee 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -406,12 +406,6 @@ struct backlight_device 
> *backlight_device_get_by_type(enum backlight_type type)
>  }
>  EXPORT_SYMBOL(backlight_device_get_by_type);
> 
> -bool backlight_device_registered(enum backlight_type type)
> -{
> - return backlight_device_get_by_type(type) ? true : false;
> -}
> -EXPORT_SYMBOL(backlight_device_registered);
> -
>  /**
>   * backlight_device_unregister - unregisters a backlight device object.
>   * @bd: the backlight device object to be unregistered and freed.
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index c59a020df3f8..287a4460054c 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -137,7 +137,6 @@ extern void devm_backlight_device_unregister(struct 
> device *dev,
>   struct backlight_device *bd);
>  extern void backlight_force_update(struct backlight_device *bd,
>  enum backlight_update_reason reason);
> -extern bool backlight_device_registered(enum backlight_type type);
>  extern int backlight_register_notifier(struct notifier_block *nb);
>  extern int backlight_unregister_notifier(struct notifier_block *nb);
>  extern struct backlight_device *backlight_device_get_by_type(enum 
> backlight_type type);
> --
> 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 1/3] video / backlight: add two APIs for drivers to use

2015-01-02 Thread Jingoo Han
On Wednesday, December 31, 2014 12:50 PM, Aaron Lu wrote:
> 
> It is useful to get the backlight device's pointer and use it to set
> backlight in some cases(the following patch will make use of it) so add
> the two APIs and export them.
> 
> Signed-off-by: Aaron Lu 

Acked-by: Jingoo Han 

Best regards,
Jingoo Han

> ---
>  drivers/video/backlight/backlight.c | 44 
> -
>  include/linux/backlight.h   |  2 ++
>  2 files changed, 31 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/video/backlight/backlight.c 
> b/drivers/video/backlight/backlight.c
> index bddc8b17a4d8..bea749329236 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,
>   return sprintf(buf, "%d\n", bd->props.brightness);
>  }
> 
> -static ssize_t brightness_store(struct device *dev,
> - struct device_attribute *attr, const char *buf, size_t count)
> +int backlight_device_set_brightness(struct backlight_device *bd, int 
> brightness)
>  {
> - int rc;
> - struct backlight_device *bd = to_backlight_device(dev);
> - unsigned long brightness;
> -
> - rc = kstrtoul(buf, 0, &brightness);
> - if (rc)
> - return rc;
> -
> - rc = -ENXIO;
> + int rc = -ENXIO;
> 
>   mutex_lock(&bd->ops_lock);
>   if (bd->ops) {
>   if (brightness > bd->props.max_brightness)
>   rc = -EINVAL;
>   else {
> - pr_debug("set brightness to %lu\n", brightness);
> + pr_debug("set brightness to %u\n", brightness);
>   bd->props.brightness = brightness;
>   backlight_update_status(bd);
> - rc = count;
> + rc = 0;
>   }
>   }
>   mutex_unlock(&bd->ops_lock);
> @@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,
> 
>   return rc;
>  }
> +EXPORT_SYMBOL(backlight_device_set_brightness);
> +
> +static ssize_t brightness_store(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t count)
> +{
> + int rc;
> + struct backlight_device *bd = to_backlight_device(dev);
> + unsigned long brightness;
> +
> + rc = kstrtoul(buf, 0, &brightness);
> + if (rc)
> + return rc;
> +
> + rc = backlight_device_set_brightness(bd, brightness);
> +
> + return rc ? rc : count;
> +}
>  static DEVICE_ATTR_RW(brightness);
> 
>  static ssize_t type_show(struct device *dev, struct device_attribute *attr,
> @@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const 
> char *name,
>  }
>  EXPORT_SYMBOL(backlight_device_register);
> 
> -bool backlight_device_registered(enum backlight_type type)
> +struct backlight_device *backlight_device_get_by_type(enum backlight_type 
> type)
>  {
>   bool found = false;
>   struct backlight_device *bd;
> @@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type 
> type)
>   }
>   mutex_unlock(&backlight_dev_list_mutex);
> 
> - return found;
> + return found ? bd : NULL;
> +}
> +EXPORT_SYMBOL(backlight_device_get_by_type);
> +
> +bool backlight_device_registered(enum backlight_type type)
> +{
> + return backlight_device_get_by_type(type) ? true : false;
>  }
>  EXPORT_SYMBOL(backlight_device_registered);
> 
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index adb14a8616df..c59a020df3f8 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -140,6 +140,8 @@ extern void backlight_force_update(struct 
> backlight_device *bd,
>  extern bool backlight_device_registered(enum backlight_type type);
>  extern int backlight_register_notifier(struct notifier_block *nb);
>  extern int backlight_unregister_notifier(struct notifier_block *nb);
> +extern struct backlight_device *backlight_device_get_by_type(enum 
> backlight_type type);
> +extern int backlight_device_set_brightness(struct backlight_device *bd, int 
> brightness);
> 
>  #define to_backlight_device(obj) container_of(obj, struct backlight_device, 
> dev)
> 
> --
> 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] GMAC: fix simple_return.cocci warnings

2015-01-02 Thread Joe Perches
On Sat, 2015-01-03 at 08:25 +0800, kbuild test robot wrote:
> drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:425:1-4: WARNING: end returns 
> can be simpified
> 
>  Simplify a trivial if-return sequence.  Possibly combine with a
>  preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
> 
> CC: Roger Chen 
> Signed-off-by: Fengguang Wu 
> ---
> 
>  dwmac-rk.c |6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -422,11 +422,7 @@ static int rk_gmac_init(struct platform_
>   if (ret)
>   return ret;
>  
> - ret = gmac_clk_enable(bsp_priv, true);
> - if (ret)
> - return ret;
> -
> - return 0;
> + return gmac_clk_enable(bsp_priv, true);

I think this change is not particularly better.

When the pattern is multiply repeated like:

{
...
foo = bar();
if (foo)
return foo;

foo = baz();
if (foo)
return foo;

foo = qux();
if (foo)
return foo;

return 0;
}

I think it's better to not change the last
test in the sequence just to minimize overall
line count.


--
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] arch: arm: mach-omap2: voltage: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
omap_change_voltscale_method() voltdm_add_pwrdm()
voltdm_for_each() voltdm_for_each_pwrdm()

And remove define VOLTSCALE_VPFORCEUPDATE and VOLTSCALE_VCBYPASS

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 arch/arm/mach-omap2/powerdomain.c |1 -
 arch/arm/mach-omap2/voltage.c |  110 -
 arch/arm/mach-omap2/voltage.h |   13 -
 3 files changed, 124 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 7fb033e..20fae59 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -115,7 +115,6 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
}
pwrdm->voltdm.ptr = voltdm;
INIT_LIST_HEAD(&pwrdm->voltdm_node);
-   voltdm_add_pwrdm(voltdm, pwrdm);
 skip_voltdm:
spin_lock_init(&pwrdm->_lock);
 
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 3783b86..cba8cad 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -224,37 +224,6 @@ int omap_voltage_register_pmic(struct voltagedomain 
*voltdm,
 }
 
 /**
- * omap_change_voltscale_method() - API to change the voltage scaling method.
- * @voltdm:pointer to the VDD whose voltage scaling method
- * has to be changed.
- * @voltscale_method:  the method to be used for voltage scaling.
- *
- * This API can be used by the board files to change the method of voltage
- * scaling between vpforceupdate and vcbypass. The parameter values are
- * defined in voltage.h
- */
-void omap_change_voltscale_method(struct voltagedomain *voltdm,
- int voltscale_method)
-{
-   if (!voltdm || IS_ERR(voltdm)) {
-   pr_warn("%s: VDD specified does not exist!\n", __func__);
-   return;
-   }
-
-   switch (voltscale_method) {
-   case VOLTSCALE_VPFORCEUPDATE:
-   voltdm->scale = omap_vp_forceupdate_scale;
-   return;
-   case VOLTSCALE_VCBYPASS:
-   voltdm->scale = omap_vc_bypass_scale;
-   return;
-   default:
-   pr_warn("%s: Trying to change the method of voltage scaling to 
an unsupported one!\n",
-   __func__);
-   }
-}
-
-/**
  * omap_voltage_late_init() - Init the various voltage parameters
  *
  * This API is to be called in the later stages of the
@@ -316,90 +285,11 @@ static struct voltagedomain *_voltdm_lookup(const char 
*name)
return voltdm;
 }
 
-/**
- * voltdm_add_pwrdm - add a powerdomain to a voltagedomain
- * @voltdm: struct voltagedomain * to add the powerdomain to
- * @pwrdm: struct powerdomain * to associate with a voltagedomain
- *
- * Associate the powerdomain @pwrdm with a voltagedomain @voltdm.  This
- * enables the use of voltdm_for_each_pwrdm().  Returns -EINVAL if
- * presented with invalid pointers; -ENOMEM if memory could not be allocated;
- * or 0 upon success.
- */
-int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
-{
-   if (!voltdm || !pwrdm)
-   return -EINVAL;
-
-   pr_debug("voltagedomain: %s: associating powerdomain %s\n",
-voltdm->name, pwrdm->name);
-
-   list_add(&pwrdm->voltdm_node, &voltdm->pwrdm_list);
-
-   return 0;
-}
-
-/**
- * voltdm_for_each_pwrdm - call function for each pwrdm in a voltdm
- * @voltdm: struct voltagedomain * to iterate over
- * @fn: callback function *
- *
- * Call the supplied function @fn for each powerdomain in the
- * voltagedomain @voltdm.  Returns -EINVAL if presented with invalid
- * pointers; or passes along the last return value of the callback
- * function, which should be 0 for success or anything else to
- * indicate failure.
- */
-int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
- int (*fn)(struct voltagedomain *voltdm,
-   struct powerdomain *pwrdm))
-{
-   struct powerdomain *pwrdm;
-   int ret = 0;
-
-   if (!fn)
-   return -EINVAL;
-
-   list_for_each_entry(pwrdm, &voltdm->pwrdm_list, voltdm_node)
-   ret = (*fn)(voltdm, pwrdm);
-
-   return ret;
-}
-
-/**
- * voltdm_for_each - call function on each registered voltagedomain
- * @fn: callback function *
- *
- * Call the supplied function @fn for each registered voltagedomain.
- * The callback function @fn can return anything but 0 to bail out
- * early from the iterator.  Returns the last return value of the
- * callback function, which should be 0 for success or anything else
- * to indicate failure; or -EINVAL if the function pointer is null.
- */
-int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
-   void *user)
-{
-   struct voltagedomain *temp_voltdm;
-   int ret = 0;
-
-   if (!fn)
- 

Re: frequent lockups in 3.18rc4

2015-01-02 Thread John Stultz
On Fri, Dec 26, 2014 at 12:57 PM, Linus Torvalds
 wrote:
> On Fri, Dec 26, 2014 at 10:12 AM, Dave Jones  wrote:
>> On Fri, Dec 26, 2014 at 11:34:10AM -0500, Dave Jones wrote:
>>
>>  > One thing I think I'll try is to try and narrow down which
>>  > syscalls are triggering those "Clocksource hpet had cycles off"
>>  > messages.  I'm still unclear on exactly what is doing
>>  > the stomping on the hpet.
>>
>> First I ran trinity with "-g vm" which limits it to use just
>> a subset of syscalls, specifically VM related ones.
>> That triggered the messages. Further experiments revealed:
>
> So I can trigger the false positives with my original patch quite
> easily by just putting my box under some load. My numbers are nowhere
> near as bad as yours, but then, I didn't put it under as much load
> anyway. Just a regular "make -j64" of the kernel.
>
> I suspect your false positives are bigger partly because of the load,
> but mostly because you presumably have preemption enabled too. I don't
> do preemption in my normal kernels, and that limits the damage of the
> race a bit.
>
> I have a newer version of the patch that gets rid of the false
> positives with some ordering rules instead, and just for you I hacked
> it up to say where the problem happens too, but it's likely too late.
>
> The fact that the original racy patch seems to make a difference for
> you does say that yes, we seem to be zeroing in on the right area
> here, but I'm not seeing what's wrong. I was hoping for big jumps from
> your HPET, since your "TSC unstable" messages do kind of imply that
> such really big jumps can happen.
>
> I'm attaching my updated hacky patch, although I assume it's much too
> late for that machine. Don't look too closely at the backtrace
> generation part, that's just a quick hack, and only works with frame
> pointers enabled anyway.
>
> So I'm still a bit unhappy about not figuring out *what* is wrong. And
> I'd still like the dmidecode from that machine, just for posterity. In
> case we can figure out some pattern.
>
> So right now I can imagine several reasons:
>
>  - actual hardware bug.
>
>This is *really* unlikely, though. It should hit everybody. The
> HPET is in the core intel chipset, we're not talking random unusual
> hardware by fly-by-night vendors here.
>
>  - some SMM/BIOS "power management" feature.
>
>We've seen this before, where the SMM saves/restores the TSC on
> entry/exit in order to hide itself from the system. I could imagine
> similar code for the HPET counter. SMM writers use some bad drugs to
> dull their pain.
>
>And with the HPET counter, since it's not even per-CPU, the "save
> and restore HPET" will actually show up as "HPET went backwards" to
> the other non-SMM CPU's if it happens
>
>  - a bug in our own clocksource handling.
>
>I'm not seeing it. But maybe my patch hides it for some magical reason.

So I sent out a first step validation check to warn us if we end up
with idle periods that are larger then we expect.

It doesn't yet cap the timekeeping_get_ns() output (like you're patch
effectively does), but it would be easy to do that in a following
patch.

I did notice while testing this that the max_idle_ns (max idle time we
report to the scheduler) for the hpet is only ~16sec, and we'll
overflow after just ~21seconds. This second number maps closely to the
22 second stalls seen in the  nmi watchdog reports which seems
interesting, but I also realize that qemu uses a 100MHz hpet, where as
real hardware is likely to be a bit slower, so maybe that's just
chance..

I'd be interested if folks seeing anything similar to Dave would give
my patch a shot.

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


Re: [PATCH V2 0/2] ARM: l2c: OMAP4/AM437x: Additional register programming support.

2015-01-02 Thread Tony Lindgren
* Nishanth Menon  [150102 11:50]:
> On 01/02/2015 12:46 PM, santosh.shilim...@oracle.com wrote:
> > On 1/2/15 9:43 AM, Nishanth Menon wrote:
> >> Hi,
> >> OMAP4 and AM437x ROM code provides services to program PL310's latency
> >> registers and AM437x provides service for programming Address filter
> >> registers.
> >>
> >> Provide support in the kernel for the same.
> >>
> >> V2 of the series contains documentation update and a bug fix due to a
> >> typo introduced during patch split :(
> >>
> >> Nishanth Menon (2):
> >>ARM: l2c: OMAP4/AM437x: Introduce support for cache latency
> >>  programming
> >>ARM: l2c: AM437x: Introduce support for cache filter programming
> >>
> > Looks fine to me ...
> > Feel free to add my ack if you need one ...
> > 
> > Minor: The subject looks like I2C though it is L2C ;-)
> > 
> Yeah, the thought did occur to me, but decided instead to go with the
> existing $subject conventions of arch/arm/mach-omap2/omap4-common.c
> ARM: l2c: omap2+: get rid of init call
> ARM: l2c: omap2+: get rid of redundant cache replacement policy setting
> ARM: l2c: omap2: remove explicit non-secure access bits
> ARM: l2c: omap2: remove cache size override
> ARM: l2c: omap2: remove explicit SMI calls to enable L2 cache
> ARM: l2c: omap2: implement new write_sec method
> ARM: l2c: remove platforms/SoCs setting early BRESP
> ARM: l2c: fix register naming
> ARM: l2c: omap2: remove ES1.0 support
> 
> ..
> 
> If folks feel strongly about this, I can capitalize the same and post
> a v3 to help confusing fonts on certain mail clients and terminals.
> let me know if folks want me to.

I guess no need to :)

Looks like these still won't fix the issue we found in the
series posted by Tomasz though. At least I'm still getting errors
on am437x with these and the patches from Tomasz applied.

Regards,

Tony
--
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] GMAC: fix simple_return.cocci warnings

2015-01-02 Thread kbuild test robot
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:425:1-4: WARNING: end returns 
can be simpified

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Roger Chen 
Signed-off-by: Fengguang Wu 
---

 dwmac-rk.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -422,11 +422,7 @@ static int rk_gmac_init(struct platform_
if (ret)
return ret;
 
-   ret = gmac_clk_enable(bsp_priv, true);
-   if (ret)
-   return ret;
-
-   return 0;
+   return gmac_clk_enable(bsp_priv, true);
 }
 
 static void rk_gmac_exit(struct platform_device *pdev, void *priv)
--
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 akpm/next] lib: crc32: conditionally constify crc32 lookup table

2015-01-02 Thread Daniel Borkmann

On 01/03/2015 12:35 AM, Andrew Morton wrote:

On Wed, 31 Dec 2014 20:03:28 +0100 Daniel Borkmann  wrote:


Commit 8f243af42ade ("sections: fix const sections for crc32 table")


The 8f243af42ade changelog is rather poor :(.  With the help of this
changelog I can now see what 8f243af42ade was doing.  I must have been
asleep at the time.


removed the compile-time generated crc32 tables from the RO sections,
because it conflicts with the definition of __cacheline_aligned
which puts all such aligned data into .data..cacheline_aligned section
optimized for wasting less space, and causes const align issues with
some GCC versions (see #52181, for example).


(searches several bugzilla databases)

"https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52181"; would be more
reader-friendly.


Okay, will add it like that.


We can fix that in two steps: 1) by using the cacheline_aligned
version, which only aligns the data but doesn't move it into specific
sections, 2) test GCC and in problematic cases fall back to the current
code, otherwise use const and proper alignment for the lookup tables.

After patch tables are in RO:

$ nm -v lib/crc32.o | grep -1 -E "crc32c?table"
 t arch_local_irq_enable
 r crc32ctable_le
 t crc32_exit
--
0960 t test_buf
2000 r crc32table_be
4000 r crc32table_le
1d1056e5 A __crc_crc32_be

Signed-off-by: Daniel Borkmann 
Cc: Joe Mario 
---
  Makefile   |  5 +
  lib/Makefile   |  3 +++
  lib/gen_crc32table.c   | 21 +++--
  scripts/gcc-const-align.sh | 21 +
  4 files changed, 44 insertions(+), 6 deletions(-)


Seems a lot of fuss.  Why are these tables cacheline aligned anyway?
To avoid one cache miss (most of the time, presumably) in a 16k table.
Pretty marginal benefit, I suspect.


I guess, it actually came in with the slice-by-8 algorithm (e.g. used
in SCTP checksumming if no offloading is available) that was added back
then, that is, commit 324eb0f17d9dc ("crc32: add slice-by-8 algorithm
to existing code").


--- a/lib/Makefile
+++ b/lib/Makefile
@@ -171,6 +171,9 @@ obj-$(CONFIG_FONT_SUPPORT) += fonts/
  hostprogs-y   := gen_crc32table
  clean-files   := crc32table.h

+# We need to transfer this flag to the host compiler if present
+HOSTCFLAGS_gen_crc32table.o := $(findstring 
-DCC_HAVE_CONST_ALIGN,$(KBUILD_CFLAGS))
+
  $(obj)/crc32.o: $(obj)/crc32table.h

  quiet_cmd_crc32 = GEN $@
diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c
index 71fcfcd..2f06893 100644
--- a/lib/gen_crc32table.c
+++ b/lib/gen_crc32table.c
@@ -21,6 +21,14 @@
  # define BE_TABLE_SIZE (1 << CRC_BE_BITS)
  #endif

+#ifdef CC_HAVE_CONST_ALIGN
+# define TABLE_CONST_ATTR "const"
+# define TABLE_ALIGNMENT  "cacheline_aligned"
+#else
+# define TABLE_CONST_ATTR ""
+# define TABLE_ALIGNMENT  "__cacheline_aligned"
+#endif


Pity out poor readers, trying to work out what all this does and why it
is here.  It is totally unobvious that this is working around some gcc
bug.  Can we please have a nice comment which explains everything?


Will add a comment, sure.

Thanks, Andrew!

I'll send out v2 with your feedback tomorrow.
--
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 akpm/next] lib: crc32: conditionally constify crc32 lookup table

2015-01-02 Thread Andrew Morton
On Wed, 31 Dec 2014 20:03:28 +0100 Daniel Borkmann  wrote:

> Commit 8f243af42ade ("sections: fix const sections for crc32 table")

The 8f243af42ade changelog is rather poor :(.  With the help of this
changelog I can now see what 8f243af42ade was doing.  I must have been
asleep at the time.

> removed the compile-time generated crc32 tables from the RO sections,
> because it conflicts with the definition of __cacheline_aligned
> which puts all such aligned data into .data..cacheline_aligned section
> optimized for wasting less space, and causes const align issues with
> some GCC versions (see #52181, for example).

(searches several bugzilla databases)

"https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52181"; would be more
reader-friendly.

> We can fix that in two steps: 1) by using the cacheline_aligned
> version, which only aligns the data but doesn't move it into specific
> sections, 2) test GCC and in problematic cases fall back to the current
> code, otherwise use const and proper alignment for the lookup tables.
> 
> After patch tables are in RO:
> 
> $ nm -v lib/crc32.o | grep -1 -E "crc32c?table"
>  t arch_local_irq_enable
>  r crc32ctable_le
>  t crc32_exit
> --
> 0960 t test_buf
> 2000 r crc32table_be
> 4000 r crc32table_le
> 1d1056e5 A __crc_crc32_be
> 
> Signed-off-by: Daniel Borkmann 
> Cc: Joe Mario 
> ---
>  Makefile   |  5 +
>  lib/Makefile   |  3 +++
>  lib/gen_crc32table.c   | 21 +++--
>  scripts/gcc-const-align.sh | 21 +
>  4 files changed, 44 insertions(+), 6 deletions(-)

Seems a lot of fuss.  Why are these tables cacheline aligned anyway? 
To avoid one cache miss (most of the time, presumably) in a 16k table. 
Pretty marginal benefit, I suspect.

> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -171,6 +171,9 @@ obj-$(CONFIG_FONT_SUPPORT) += fonts/
>  hostprogs-y  := gen_crc32table
>  clean-files  := crc32table.h
>  
> +# We need to transfer this flag to the host compiler if present
> +HOSTCFLAGS_gen_crc32table.o := $(findstring 
> -DCC_HAVE_CONST_ALIGN,$(KBUILD_CFLAGS))
> +
>  $(obj)/crc32.o: $(obj)/crc32table.h
>  
>  quiet_cmd_crc32 = GEN $@
> diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c
> index 71fcfcd..2f06893 100644
> --- a/lib/gen_crc32table.c
> +++ b/lib/gen_crc32table.c
> @@ -21,6 +21,14 @@
>  # define BE_TABLE_SIZE (1 << CRC_BE_BITS)
>  #endif
>  
> +#ifdef CC_HAVE_CONST_ALIGN
> +# define TABLE_CONST_ATTR "const"
> +# define TABLE_ALIGNMENT  "cacheline_aligned"
> +#else
> +# define TABLE_CONST_ATTR ""
> +# define TABLE_ALIGNMENT  "__cacheline_aligned"
> +#endif

Pity out poor readers, trying to work out what all this does and why it
is here.  It is totally unobvious that this is working around some gcc
bug.  Can we please have a nice comment which explains everything?


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


Re: linux-next: build failure after merge of the net-next tree

2015-01-02 Thread Stephen Rothwell
Hi Sedat,

On Fri, 2 Jan 2015 23:21:05 +0100 Sedat Dilek  wrote:
>
> On Fri, Jan 2, 2015 at 11:11 PM, Stephen Rothwell  
> wrote:
> >
> > After merging the net-next tree, today's linux-next build (powerpc
> > ppc64_defconfig) failed like this:
> >
> > drivers/net/ethernet/mellanox/mlx4/en_clock.c: In function 
> > 'mlx4_en_init_timestamp':
> > drivers/net/ethernet/mellanox/mlx4/en_clock.c:249:2: error: implicit 
> > declaration of function 'CLOCKSOURCE_MASK' 
> > [-Werror=implicit-function-declaration]
> >   mdev->cycles.mask = CLOCKSOURCE_MASK(48);
> >   ^
> > drivers/net/ethernet/mellanox/mlx4/en_clock.c:257:3: error: implicit 
> > declaration of function 'clocksource_khz2mult' 
> > [-Werror=implicit-function-declaration]
> >clocksource_khz2mult(1000 * dev->caps.hca_core_clock, 
> > mdev->cycles.shift);
> >^
> > drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c: In function 
> > 'ixgbe_ptp_start_cyclecounter':
> > drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c:796:2: error: implicit 
> > declaration of function 'CLOCKSOURCE_MASK' 
> > [-Werror=implicit-function-declaration]
> >   adapter->cc.mask = CLOCKSOURCE_MASK(64);
> >   ^
> >
> > Presumably caused by commit 74d23cc704d1 ("time: move the
> > timecounter/cyclecounter code into its own file").
> 
> Just FYI...
> 
> Richard posted a new patch-series "[PATCH net-next 0/7] Fixing the
> "Time Counter fixes and improvements" on linux-nextdev fixing this.
> 
> - Sedat -
> 
> [1] https://lkml.org/lkml/2015/1/1/27

Thanks, so hopefully I won't need my patch for very long.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpshv1JxeJl9.pgp
Description: OpenPGP digital signature


[PATCH] media: i2c: adv7604: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
test_read() edid_read_block() dpp_write() dpp_read()
esdp_write() esdp_read() cec_write_clr_set()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/media/i2c/adv7604.c |   66 ---
 1 file changed, 66 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 47795ff..5e07b91 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -466,11 +466,6 @@ static inline int cec_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val);
 }
 
-static inline int cec_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
-{
-   return cec_write(sd, reg, (cec_read(sd, reg) & ~mask) | val);
-}
-
 static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv7604_state *state = to_state(sd);
@@ -486,34 +481,6 @@ static inline int infoframe_write(struct v4l2_subdev *sd, 
u8 reg, u8 val)
 reg, val);
 }
 
-static inline int esdp_read(struct v4l2_subdev *sd, u8 reg)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   return adv_smbus_read_byte_data(state, ADV7604_PAGE_ESDP, reg);
-}
-
-static inline int esdp_write(struct v4l2_subdev *sd, u8 reg, u8 val)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   return adv_smbus_write_byte_data(state, ADV7604_PAGE_ESDP, reg, val);
-}
-
-static inline int dpp_read(struct v4l2_subdev *sd, u8 reg)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   return adv_smbus_read_byte_data(state, ADV7604_PAGE_DPP, reg);
-}
-
-static inline int dpp_write(struct v4l2_subdev *sd, u8 reg, u8 val)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   return adv_smbus_write_byte_data(state, ADV7604_PAGE_DPP, reg, val);
-}
-
 static inline int afe_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv7604_state *state = to_state(sd);
@@ -561,32 +528,6 @@ static inline int edid_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_EDID, reg, val);
 }
 
-static inline int edid_read_block(struct v4l2_subdev *sd, unsigned len, u8 
*val)
-{
-   struct adv7604_state *state = to_state(sd);
-   struct i2c_client *client = state->i2c_clients[ADV7604_PAGE_EDID];
-   u8 msgbuf0[1] = { 0 };
-   u8 msgbuf1[256];
-   struct i2c_msg msg[2] = {
-   {
-   .addr = client->addr,
-   .len = 1,
-   .buf = msgbuf0
-   },
-   {
-   .addr = client->addr,
-   .flags = I2C_M_RD,
-   .len = len,
-   .buf = msgbuf1
-   },
-   };
-
-   if (i2c_transfer(client->adapter, msg, 2) < 0)
-   return -EIO;
-   memcpy(val, msgbuf1, len);
-   return 0;
-}
-
 static inline int edid_write_block(struct v4l2_subdev *sd,
unsigned len, const u8 *val)
 {
@@ -652,13 +593,6 @@ static inline int hdmi_write_clr_set(struct v4l2_subdev 
*sd, u8 reg, u8 mask, u8
return hdmi_write(sd, reg, (hdmi_read(sd, reg) & ~mask) | val);
 }
 
-static inline int test_read(struct v4l2_subdev *sd, u8 reg)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   return adv_smbus_read_byte_data(state, ADV7604_PAGE_TEST, reg);
-}
-
 static inline int test_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
struct adv7604_state *state = to_state(sd);
-- 
1.7.10.4

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


[PATCH] time: Add debugging checks to warn if we see delays

2015-01-02 Thread John Stultz
Recently there's been some request for better sanity
checking in the time code, so that its more clear
when something is going wrong since timekeeping issues
could manifest in a large number of strange ways with
various subsystems.

Thus, this patch adds some extra infrastructure to
save the maximum cycle value that can be used before
we see multiplicaiton overflows, and adds a check
in update_wall_time to print warnings if we see the
call delayed beyond the overflow point, or beyond the
clocksource max_idle_ns value which is currently 87.5%
of the overflow point.

Tested this a bit by halting qemu for specified
lengths of time to trigger the warnings.

This still needs some work, but wanted to send it out
for some initial feedback and testing.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Chris Mason 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Sasha Levin 
Cc: "Paul E. McKenney" 
Signed-off-by: John Stultz 
---
 include/linux/clocksource.h |  3 +++
 kernel/time/clocksource.c   | 27 +++
 kernel/time/jiffies.c   |  1 +
 kernel/time/timekeeping.c   | 18 ++
 4 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index abcafaa..5c892e1 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -174,6 +174,7 @@ struct clocksource {
u32 mult;
u32 shift;
u64 max_idle_ns;
+   cycle_t max_cycles;
u32 maxadj;
 #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
struct arch_clocksource_data archdata;
@@ -291,6 +292,8 @@ extern struct clocksource * __init 
clocksource_default_clock(void);
 extern void clocksource_mark_unstable(struct clocksource *cs);
 
 extern u64
+clocks_calc_max_cycles(u32 mult, u32 maxadj, u64 mask);
+extern u64
 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask);
 extern void
 clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index b79f39b..6384783 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -540,15 +540,14 @@ static u32 clocksource_max_adjustment(struct clocksource 
*cs)
 }
 
 /**
- * clocks_calc_max_nsecs - Returns maximum nanoseconds that can be converted
+ * clocks_calc_max_cycles - Returns maximum cycles that can be converted to 
nsecs
  * @mult:  cycle to nanosecond multiplier
- * @shift: cycle to nanosecond divisor (power of two)
  * @maxadj:maximum adjustment value to mult (~11%)
  * @mask:  bitmask for two's complement subtraction of non 64 bit counters
  */
-u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask)
+u64 clocks_calc_max_cycles(u32 mult, u32 maxadj, u64 mask)
 {
-   u64 max_nsecs, max_cycles;
+   u64 max_cycles;
 
/*
 * Calculate the maximum number of cycles that we can pass to the
@@ -569,6 +568,24 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, 
u64 mask)
/*
 * The actual maximum number of cycles we can defer the clocksource is
 * determined by the minimum of max_cycles and mask.
+*/
+   return min(max_cycles, mask);
+}
+
+
+/**
+ * clocks_calc_max_nsecs - Returns maximum nanoseconds that can be converted
+ * @mult:  cycle to nanosecond multiplier
+ * @shift: cycle to nanosecond divisor (power of two)
+ * @maxadj:maximum adjustment value to mult (~11%)
+ * @mask:  bitmask for two's complement subtraction of non 64 bit counters
+ */
+u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask)
+{
+   u64 max_nsecs, max_cycles;
+
+   max_cycles = clocks_calc_max_cycles(mult, maxadj, mask);
+   /*
 * Note: Here we subtract the maxadj to make sure we don't sleep for
 * too long if there's a large negative adjustment.
 */
@@ -771,6 +788,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs->maxadj = clocksource_max_adjustment(cs);
}
 
+   cs->max_cycles = clocks_calc_max_cycles(cs->mult, cs->maxadj, cs->mask);
cs->max_idle_ns = clocksource_max_deferment(cs);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
@@ -818,6 +836,7 @@ int clocksource_register(struct clocksource *cs)
cs->name);
 
/* calculate max idle time permitted for this clocksource */
+   cs->max_cycles = clocks_calc_max_cycles(cs->mult, cs->maxadj, cs->mask);
cs->max_idle_ns = clocksource_max_deferment(cs);
 
mutex_lock(&clocksource_mutex);
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index a6a5bf5..7e41390 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -71,6 +71,7 @@ static struct clocksource clocksource_jiffies = {
.mask   = 0x, /*32bits*/
.mult   = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
.shift  = JIFFIES_SHIFT,
+   .max_cy

Re: [PATCH] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Pavel Machek
On Sat 2015-01-03 00:00:22, Richard Weinberger wrote:
> Am 02.01.2015 um 23:54 schrieb Pavel Machek:
> > On Fri 2015-01-02 23:49:52, Jiri Kosina wrote:
> >> On Fri, 2 Jan 2015, Pavel Machek wrote:
> >>
>  You also want to protect against binaries that are evil on purpose,
>  right?
> >>>
> >>> Umm. No. Not by default. We don't want to break crashme or trinity by
> >>> default.
> >>
> >> I thought trinity is issuing syscalls directly (would make more sense than 
> >> going through glibc, wouldn't it?) ... haven't checked the source though.
> > 
> > Patch in this thread wanted to insert delays into kernel on SIGSEGV
> > processing. That's bad idea by default.
> 
> No. This is not what this patch does.
> 
> > But changing glibc to do sleep(30); abort(); instead of abort(); to
> > slow down bruteforcing of canaries makes some kind of sense... and
> > should be ok by default.
> 
> As I saidn only focusing one the specific stack canary case is not enough.

Ok, so I am now saying "adding random delays to the kernel, hoping
they slow attacker down" is bad idea. Feel free to add my NAK to the
patch.

If really neccessary, "kill_me_slowly()" syscall would be acceptable,
but it seems just sleep(); abort(); combination is enough.

glibc should cover 99% cases where this matters, please just fix glibc,
others will follow.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Staging: comedi: tab space coding style issue in pcl818.c

2015-01-02 Thread Joe Perches
On Sat, 2015-01-03 at 00:04 +0530, jitendra kumar khasdev wrote:
> This is patch to the pcl818.c that fix up a use tab error
> found by the checkpatch.pl tool
[]
> diff --git a/drivers/staging/comedi/drivers/pcl818.c 
> b/drivers/staging/comedi/drivers/pcl818.c
[]
> @@ -45,7 +45,7 @@ A word or two about DMA. Driver support DMA operations at 
> two ways:
>  [1] - IRQ(0=disable, 2, 3, 4, 5, 6, 7)
>  [2] - DMA(0=disable, 1, 3)
>  [3] - 0, 10=10MHz clock for 8254
> -  1= 1MHz clock for 8254
> + 1= 1MHz clock for 8254

Please look at the end result and determine
if what you've done is better or worse than
the original.


--
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] adjtimex.2: Change 'PPM' (parts per million) to 'ppm'

2015-01-02 Thread Laurent Georget
Hi again,

this is the second patch of the new series of patchs for adjtimex.2. 

This is a trivia patch correcting "PPM" (parts per million) to the more usual 
"ppm".
Credits to Jeff Epler .

---
 man2/adjtimex.2 | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/man2/adjtimex.2 b/man2/adjtimex.2
index ff4b23e..dbb2333 100644
--- a/man2/adjtimex.2
+++ b/man2/adjtimex.2
@@ -54,7 +54,7 @@ struct timex {
 long offset;  /* Time offset; nanoseconds, if STA_NANO
  status flag is set, otherwise
  microseconds */
-long freq;/* Frequency offset, in units of 2^-16 PPM
+long freq;/* Frequency offset, in units of 2^-16 ppm
  (parts per million) (see NOTES below) */
 long maxerror;/* Maximum error (microseconds) */
 long esterror;/* Estimated error (microseconds) */
@@ -62,8 +62,7 @@ struct timex {
 long constant;/* PLL (phase-locked loop) time constant */
 long precision;   /* Clock precision (microseconds,
  read-only) */
-long tolerance;   /* Clock frequency tolerance (PPM,
- read-only) */
+long tolerance;   /* Clock frequency tolerance (ppm, read-only) */
 struct timeval time;
   /* Current time (read-only, except for
  ADJ_SETOFFSET); upon return, time.tv_usec
@@ -71,13 +70,13 @@ struct timex {
  flag is set, otherwise microseconds */
 long tick;/* Microseconds between clock ticks */
 long ppsfreq; /* PPS (pulse per second) frequency
- (2^-16 PPM (see NOTES), read-only) */
+ (2^-16 ppm (see NOTES), read-only) */
 long jitter;  /* PPS jitter (read-only); nanoseconds, if
  STA_NANO status flag is set, otherwise
  microseconds */
 int  shift;   /* PPS interval duration
  (seconds, read-only) */
-long stabil;  /* PPS stability (2^-16 PPM (see NOTES), read-only) */
+long stabil;  /* PPS stability (2^-16 ppm (see NOTES), read-only) */
 long jitcnt;  /* PPS jitter limit exceeded (read-only) */
 long calcnt;  /* PPS calibration intervals (read-only) */
 long errcnt;  /* PPS calibration errors (read-only) */
@@ -349,9 +348,9 @@ In struct
 .IR ppsfreq ,
 and 
 .I stabil
-are PPM (parts per million) with a 16-bits fractional part, which means that a
-value of 1 in one of those fields actually means 2^-16 PPM, and 2^16=65535 is 
-1 PPM. This is the case for both input values (in the case of
+are ppm (parts per million) with a 16-bits fractional part, which means that a
+value of 1 in one of those fields actually means 2^-16 ppm, and 2^16=65535 is 
+1 ppm. This is the case for both input values (in the case of
 .IR freq )
 and output values.
 .SH CONFORMING TO
-- 
2.0.4




signature.asc
Description: OpenPGP digital signature


[PATCH 1/2] adjtimex.2: Clarify the 'ppm scaling' used in struct timex

2015-01-02 Thread Laurent Georget
Hi,

this is the last version of a new series of patchs for adjtimex.2.
Please ignore all previous versions of this series.

This patch makes explicit and clarifies the unit used for fields "freq", 
"ppsfreq" and "stabil" in struct timex.
It closes a FIXME in the man page.

Reviewed-By: Jeff Epler 

---
 man2/adjtimex.2 | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/man2/adjtimex.2 b/man2/adjtimex.2
index 18823c8..ff4b23e 100644
--- a/man2/adjtimex.2
+++ b/man2/adjtimex.2
@@ -54,9 +54,8 @@ struct timex {
 long offset;  /* Time offset; nanoseconds, if STA_NANO
  status flag is set, otherwise
  microseconds */
-long freq;/* Frequency offset, as scaled PPM
- (parts per million) */
-.\" FIXME What is the scaling unit of timex.freq?  2^16 ?
+long freq;/* Frequency offset, in units of 2^-16 PPM
+ (parts per million) (see NOTES below) */
 long maxerror;/* Maximum error (microseconds) */
 long esterror;/* Estimated error (microseconds) */
 int  status;  /* Clock command/status */
@@ -72,13 +71,13 @@ struct timex {
  flag is set, otherwise microseconds */
 long tick;/* Microseconds between clock ticks */
 long ppsfreq; /* PPS (pulse per second) frequency
- (scaled PPM, read-only) */
+ (2^-16 PPM (see NOTES), read-only) */
 long jitter;  /* PPS jitter (read-only); nanoseconds, if
  STA_NANO status flag is set, otherwise
  microseconds */
 int  shift;   /* PPS interval duration
  (seconds, read-only) */
-long stabil;  /* PPS stability (scaled PPM, read-only) */
+long stabil;  /* PPS stability (2^-16 PPM (see NOTES), read-only) */
 long jitcnt;  /* PPS jitter limit exceeded (read-only) */
 long calcnt;  /* PPS calibration intervals (read-only) */
 long errcnt;  /* PPS calibration errors (read-only) */
@@ -343,6 +342,18 @@ and the caller does not have sufficient privilege.
 Under Linux, the
 .B CAP_SYS_TIME
 capability is required.
+.SH NOTES
+In struct
+.IR timex ,
+.IR freq ,
+.IR ppsfreq ,
+and 
+.I stabil
+are PPM (parts per million) with a 16-bits fractional part, which means that a
+value of 1 in one of those fields actually means 2^-16 PPM, and 2^16=65535 is 
+1 PPM. This is the case for both input values (in the case of
+.IR freq )
+and output values.
 .SH CONFORMING TO
 .BR adjtimex ()
 is Linux-specific and should not be used in programs
-- 
2.0.4




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Richard Weinberger
Am 02.01.2015 um 23:54 schrieb Pavel Machek:
> On Fri 2015-01-02 23:49:52, Jiri Kosina wrote:
>> On Fri, 2 Jan 2015, Pavel Machek wrote:
>>
 You also want to protect against binaries that are evil on purpose,
 right?
>>>
>>> Umm. No. Not by default. We don't want to break crashme or trinity by
>>> default.
>>
>> I thought trinity is issuing syscalls directly (would make more sense than 
>> going through glibc, wouldn't it?) ... haven't checked the source though.
> 
> Patch in this thread wanted to insert delays into kernel on SIGSEGV
> processing. That's bad idea by default.

No. This is not what this patch does.

> But changing glibc to do sleep(30); abort(); instead of abort(); to
> slow down bruteforcing of canaries makes some kind of sense... and
> should be ok by default.

As I saidn only focusing one the specific stack canary case is not enough.

Thanks,
//richard
--
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] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Pavel Machek
On Fri 2015-01-02 23:49:52, Jiri Kosina wrote:
> On Fri, 2 Jan 2015, Pavel Machek wrote:
> 
> > > You also want to protect against binaries that are evil on purpose,
> > > right?
> > 
> > Umm. No. Not by default. We don't want to break crashme or trinity by
> > default.
> 
> I thought trinity is issuing syscalls directly (would make more sense than 
> going through glibc, wouldn't it?) ... haven't checked the source though.

Patch in this thread wanted to insert delays into kernel on SIGSEGV
processing. That's bad idea by default.

But changing glibc to do sleep(30); abort(); instead of abort(); to
slow down bruteforcing of canaries makes some kind of sense... and
should be ok by default.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Jiri Kosina
On Fri, 2 Jan 2015, Jiri Kosina wrote:

> > > You also want to protect against binaries that are evil on purpose,
> > > right?
> > 
> > Umm. No. Not by default. We don't want to break crashme or trinity by
> > default.
> 
> I thought trinity is issuing syscalls directly (would make more sense than 
> going through glibc, wouldn't it?) ... haven't checked the source though.

Okay, I checked, it is. Now I get your point. Seems like "too much pain 
for little gain" though. So it really should be optional, so that 
potentially exposed systems (such as hosting servers, where things like 
trinity are not expected to be run) could turn it on voluntarily.

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


Re: [PATCH] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Jiri Kosina
On Fri, 2 Jan 2015, Pavel Machek wrote:

> > You also want to protect against binaries that are evil on purpose,
> > right?
> 
> Umm. No. Not by default. We don't want to break crashme or trinity by
> default.

I thought trinity is issuing syscalls directly (would make more sense than 
going through glibc, wouldn't it?) ... haven't checked the source though.

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


Re: [PATCH] adjtimex: PPM scaling is by 2^-16

2015-01-02 Thread Laurent Georget
Le 02/01/2015 22:15, Jeff Epler a écrit :
> However, the patch got line-wrapped again (I fixed it manually above).
> With line-wrapped fix, consider it
> 
> Reviewed-by: Jeff Epler 

Sorry, I'm giving up on 'normal' email clients to send patchs. 'git
format-patch' and 'mutt' will do.

> 
> hm, as a separate issue, "ppm" seems to typically be written in
> lowercase.  see e.g., http://en.wikipedia.org/wiki/Parts-per_notation
> 

That's right. I'll send the coresponding fix in another patch.

Thanks

Laurent




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Pavel Machek
On Fri 2015-01-02 23:32:35, Jiri Kosina wrote:
> On Fri, 2 Jan 2015, Pavel Machek wrote:
> 
> > > > Can the slowdown be impelmented in glibc, then?
> > > 
> > > glibc has a lot of asserts where it can detect stack smashing and kills 
> > > the
> > > current process using abort(). Here it could of course also call
> > > sleep().
> > 
> > Please do it in glibc, then.
> 
> You also want to protect against binaries that are evil on purpose,
> right?

Umm. No. Not by default. We don't want to break crashme or trinity by
default.

We want to delay people trying to bruteforce glibc canaries. We want
to do it by default.

Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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] of/pci: add of_pci_dma_configure() update dma configuration

2015-01-02 Thread Murali Karicheri

On 01/02/2015 03:45 PM, Rob Herring wrote:

On Fri, Jan 2, 2015 at 11:20 AM, Murali Karicheri  wrote:

Rob,

See my response below. Arnd and Will, please review this as well.

On 12/26/2014 02:33 PM, Rob Herring wrote:


On Wed, Dec 24, 2014 at 4:11 PM, Murali Karicheri
wrote:


Add of_pci_dma_configure() to allow updating the dma configuration
of the pci device using the configuration from DT of the parent of
the root bridge device.

Signed-off-by: Murali Karicheri
---
   drivers/of/of_pci.c|   73

   include/linux/of_pci.h |   12 
   2 files changed, 85 insertions(+)



[...]


+   coherent = of_dma_is_coherent(parent_np);
+   dev_dbg(dev, "device is%sdma coherent\n",
+   coherent ? " " : " not ");
+
+   arch_setup_dma_ops(dev, dma_addr, size, NULL, coherent);



This is the same code as of_dma_configure. The only difference I see
is which node ptr is passed to of_dma_get_range. You need to make that
a function param of of_dma_configure.

of_dma_configure also has iommu handling now. You will probably need
something similar for PCI in that you setup an iommu based on the root
bus DT properties.


Initially I had the same idea to re-use the existing function
of_dma_configure() for this. I wanted to defer this until we have an
agreement on the changes required for the subject functionality. My quick
review of the code suggestio this would require additional API changes as
below. I did a quick test of the changes and it works for Keystone, but need
to be reviewed by everyone as I touch the IOMMU functionality here and I
don't have a platform with IOMMU. Need test by someone to make sure I don't
break anything.


The IOMMU changes look trivial. We may want to address the comment in
of_iommu_configure about parent nodes. We should be sure these changes
work with how we would do searching parent nodes.


I have no experience with IOMMU and may not offer much help here as I 
originally wrote above. Will Deacon has added this API and probably able 
to offer some help in this discussion.


Will Deacon,

Any comment?

Looking at the iommu documentation and of_iommu.c, I get a feeling that 
this API is not really used at present as there are no callers of 
of_iommu_set_ops() and I assume this is a WIP. I believe the way it is 
expected to work is to have the iommu driver of the master IOMMU devices 
call of_iommu_set_ops(). The device node of this master IOMMU device is 
specified as a phandle in the OF node of the device (various bus devices 
such as platform, PCI etc). This allow to retrieve the iommu ops though 
the of_iommu_configure() API and use it in arch_setup_dma_ops(). So my 
gut feeling is that for PCI devices, as there are no DT node, the root 
bus node may specify iommus phandle to IOMMU master OF nodes.


W.r.t your comment "We may want to address the comment in
of_iommu_configure about parent nodes. We should be sure these changes 
work with how we would do searching parent nodes",


I believe, the parent node search itself should work the same way in the 
case of PCI as with platform bus case. PCI's case, we are providing the 
OF node of the root bus host bridge. Why should this be any different in 
terms of search?


I see a potential issue with dma-ranges as described in the notes below.
As noted below the usage of dma-range for iommu is to be determined. For 
keystone, the of_iommu_configure() always return false as we don't use 
the iommu. But don't know if this has any consequences for other 
platforms. Or I got your questions wrong. Any help here from others on 
the list?



One possible extension to the above is to use an "iommus" property along 
with a "dma-ranges" property in a bus device node (such as PCI host 
bridges). This can be useful to describe how children on the bus relate 
to the IOMMU if they are not explicitly listed in the device tree (e.g. 
PCI devices). However, the requirements of that use-case haven't been 
fully determined yet. Implementing this is therefore not recommended 
without further discussion and extension of this binding.

=

The code is

struct iommu_ops *of_iommu_configure(struct device *dev)
{
struct of_phandle_args iommu_spec;
struct device_node *np;
struct iommu_ops *ops = NULL;
int idx = 0;

/*
 * We don't currently walk up the tree looking for
 * a parent IOMMU. See the `Notes:' section of
 * Documentation/devicetree/bindings/iommu/iommu.txt
 */
while (!of_parse_phandle_with_args(dev->of_node, "iommus",
   "#iommu-cells", idx,
   &iommu_spec)) {
np = iommu_spec.np;
ops = of_iommu_get_ops(np);

i

Re: [PATCH] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Jiri Kosina
On Fri, 2 Jan 2015, Pavel Machek wrote:

> > > Can the slowdown be impelmented in glibc, then?
> > 
> > glibc has a lot of asserts where it can detect stack smashing and kills the
> > current process using abort(). Here it could of course also call
> > sleep().
> 
> Please do it in glibc, then.

You also want to protect against binaries that are evil on purpose, right?

There is no guarantee that those will calling the kernel through glibc at 
all.

-- 
Jiri Kosina
SUSE Labs

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


Re: [PATCH] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Pavel Machek
On Fri 2015-01-02 22:40:14, Richard Weinberger wrote:
> Am 02.01.2015 um 20:46 schrieb Pavel Machek:
> >>> Does this break trinity, crashme, and similar programs?
> >>
> >> If they fork() without execve() and a child dies very fast the next fork()
> >> will be throttled.
> >> This is why I'd like to make this feature disabled by default.
> >>
> >>> Can you detect it died due to the stack canary? Then, the patch might
> >>> be actually acceptable.
> >>
> >> I don't think so as this is glibc specific.
> > 
> > Can the slowdown be impelmented in glibc, then?
> 
> glibc has a lot of asserts where it can detect stack smashing and kills the
> current process using abort(). Here it could of course also call
> sleep().

Please do it in glibc, then.

> > If not, can glibc provide enough information to the kernel to allow us
> > to do the right thing?
> 
> IMHO we should not strictly focus on the stack canary.

IMO we should. We want it enabled by default.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the net-next tree

2015-01-02 Thread Sedat Dilek
On Fri, Jan 2, 2015 at 11:11 PM, Stephen Rothwell  wrote:
> Hi all,
>
> After merging the net-next tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
>
> drivers/net/ethernet/mellanox/mlx4/en_clock.c: In function 
> 'mlx4_en_init_timestamp':
> drivers/net/ethernet/mellanox/mlx4/en_clock.c:249:2: error: implicit 
> declaration of function 'CLOCKSOURCE_MASK' 
> [-Werror=implicit-function-declaration]
>   mdev->cycles.mask = CLOCKSOURCE_MASK(48);
>   ^
> drivers/net/ethernet/mellanox/mlx4/en_clock.c:257:3: error: implicit 
> declaration of function 'clocksource_khz2mult' 
> [-Werror=implicit-function-declaration]
>clocksource_khz2mult(1000 * dev->caps.hca_core_clock, mdev->cycles.shift);
>^
> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c: In function 
> 'ixgbe_ptp_start_cyclecounter':
> drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c:796:2: error: implicit 
> declaration of function 'CLOCKSOURCE_MASK' 
> [-Werror=implicit-function-declaration]
>   adapter->cc.mask = CLOCKSOURCE_MASK(64);
>   ^
>
> Presumably caused by commit 74d23cc704d1 ("time: move the
> timecounter/cyclecounter code into its own file").
>

Happy new 2015 Stephen...

[ The last days I revived my linux-next build-script inspired by
willing to test block-loop-mq v3 patchset against next-20141231 ]

Just FYI...

Richard posted a new patch-series "[PATCH net-next 0/7] Fixing the
"Time Counter fixes and improvements" on linux-nextdev fixing this.

- Sedat -

[1] https://lkml.org/lkml/2015/1/1/27

> I added the following commit for today:
>
> From: Stephen Rothwell 
> Date: Sat, 3 Jan 2015 09:07:21 +1100
> Subject: [PATCH] ixgbe_ptp, mlx4: Include clocksource.h to get 
> CLOCKSOURCE_MASK
>
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c  | 1 +
>  drivers/net/ethernet/mellanox/mlx4/en_clock.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c 
> b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
> index 47c29eaaa140..73548280cbae 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
> @@ -25,6 +25,7 @@
>Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
>
>  
> ***/
> +#include 
>  #include "ixgbe.h"
>  #include 
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c 
> b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
> index e9cce4f72b24..7c6ef4b48f8e 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
> @@ -31,6 +31,7 @@
>   *
>   */
>
> +#include 
>  #include 
>
>  #include "mlx4_en.h"
> --
> 2.1.4
>
> --
> Cheers,
> Stephen Rothwells...@canb.auug.org.au
--
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: How to fix CHECK warning: testing a 'safe expression'

2015-01-02 Thread Josh Triplett
+linux-sparse

On Fri, Jan 02, 2015 at 09:51:25AM -0500, Murali Karicheri wrote:
> On 12/16/2014 01:23 PM, Murali Karicheri wrote:
> >netdev maintainers,
> >
> >I got a comment to address CHECK warning and wondering how to address
> >'warning: testing a 'safe expression' which appears when using
> >IS_ERR_OR_NULL(foo)
> >
> >where foo is defined as
> >
> >struct foo_type *foo;
> >
> >The foo get assigned only NULL or ERR_PTR(error code). So I believe the
> >usage is correct. But then how do I make the CHECK happy of its usage?
> >
> >I have tried doing a grep on the current usage of IS_ERR_OR_NULL() and
> >found 276 of them causes this warning in the v3.18 version of the kernel
> >that I am using
> >
> >$ grep -r "warning: testing a 'safe expression" * | wc -l
> >276
> >
> >1) Can someone explain what this warning means?
> >
> >2) Is it acceptable to post patches to netdev list with this warning?
> >
> >3) if not, how this is expected to be fixed? Any example usage to fix
> >this warning will be helpful.
> >
> >Thanks in advance for
> 
> 
> -- 
> Murali Karicheri
> Linux Kernel, Texas Instruments
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: build failure after merge of the net-next tree

2015-01-02 Thread Stephen Rothwell
Hi all,

After merging the net-next tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

drivers/net/ethernet/mellanox/mlx4/en_clock.c: In function 
'mlx4_en_init_timestamp':
drivers/net/ethernet/mellanox/mlx4/en_clock.c:249:2: error: implicit 
declaration of function 'CLOCKSOURCE_MASK' 
[-Werror=implicit-function-declaration]
  mdev->cycles.mask = CLOCKSOURCE_MASK(48);
  ^
drivers/net/ethernet/mellanox/mlx4/en_clock.c:257:3: error: implicit 
declaration of function 'clocksource_khz2mult' 
[-Werror=implicit-function-declaration]
   clocksource_khz2mult(1000 * dev->caps.hca_core_clock, mdev->cycles.shift);
   ^
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c: In function 
'ixgbe_ptp_start_cyclecounter':
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c:796:2: error: implicit declaration 
of function 'CLOCKSOURCE_MASK' [-Werror=implicit-function-declaration]
  adapter->cc.mask = CLOCKSOURCE_MASK(64);
  ^

Presumably caused by commit 74d23cc704d1 ("time: move the
timecounter/cyclecounter code into its own file").

I added the following commit for today:

From: Stephen Rothwell 
Date: Sat, 3 Jan 2015 09:07:21 +1100
Subject: [PATCH] ixgbe_ptp, mlx4: Include clocksource.h to get CLOCKSOURCE_MASK

Signed-off-by: Stephen Rothwell 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c  | 1 +
 drivers/net/ethernet/mellanox/mlx4/en_clock.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 47c29eaaa140..73548280cbae 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -25,6 +25,7 @@
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 
 
***/
+#include 
 #include "ixgbe.h"
 #include 
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c 
b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
index e9cce4f72b24..7c6ef4b48f8e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
@@ -31,6 +31,7 @@
  *
  */
 
+#include 
 #include 
 
 #include "mlx4_en.h"
-- 
2.1.4

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


pgp82U3WITz4S.pgp
Description: OpenPGP digital signature


Re: [PATCH] fs: isofs: Fix bug in the way to check if the year is a leap year

2015-01-02 Thread Al Viro
On Fri, Jan 02, 2015 at 09:26:35PM +, Oscar Forner Martinez wrote:

> I did not know that function.

Neither did I ;-)  What I'd done was

; git grep -n -w date.*seconds
drivers/rtc/rtc-lib.c:117: * Convert Gregorian date to seconds since 01-01-1970 
00:00:00.
fs/fat/misc.c:192:/* Convert a FAT time/date pair to a UNIX date (seconds since 
1 1 70). */
fs/ncpfs/dir.c:1193:/* Convert a MS-DOS time/date pair to a UNIX date (seconds 
since 1 1 70). */
fs/nfs/nfs4proc.c:6868: clp->cl_implid->date.seconds,
fs/nfs/nfs4proc.c:6869: clp->cl_implid->date.nseconds);
fs/nfs/nfs4xdr.c:5532:  p = xdr_decode_hyper(p, 
&res->impl_id->date.seconds);
fs/nfs/nfs4xdr.c:5533:  res->impl_id->date.nseconds = be32_to_cpup(p);
fs/nfs/super.c:762:impl_id->date.seconds, 
impl_id->date.nseconds);
kernel/time/time.c:308: * mktime64 - Converts date to seconds.
kernel/time/time.c:309: * Converts Gregorian date to seconds since 1970-01-01 
00:00:00.
scripts/analyze_suspend.py:165: utcoffset = int((datetime.now() 
- datetime.utcnow()).total_seconds())
;

and that was it.  While we are at it, drivers/rtc hit is a wrapper around
mktime64(), fs/nfs ones are obviously noise from quick and dirty search
pattern and so's scripts/analyze_suspend.py one.  fs/fat/misc.c and
fs/ncpfs/dir.c ones, though, are really asking for being converted to
mktime64().

While we are grepping, git grep -n '\<31\>.*\<28\>.*\<31\>' also finds
something interesting -
arch/m68k/bvme6000/rtc.c:34:{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
arch/m68k/mvme16x/rtc.c:33:{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
drivers/char/ds1302.c:153:{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 
31};
drivers/char/genrtc.c:83:{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
drivers/char/rtc.c:212:{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
are all about the same thing - open-coded
rtc_month_days(), if not open-coded rtc_valid_tm().  Might be worth looking
into...  And another hit (arch/powerpc/kernel/time.c:to_tm()) is downright
obscene:
/* Number of months in days left */
if (leapyear(tm->tm_year))
days_in_month(FEBRUARY) = 29;
for (i = 1; day >= days_in_month(i); i++)
day -= days_in_month(i);
days_in_month(FEBRUARY) = 28;
(whadday mean, "locking"?)  Almost certainly wants to switch to time_to_tm()...
--
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/9] rhashtable: Do hashing inside of rhashtable_lookup_compare()

2015-01-02 Thread Thomas Graf
Hash the key inside of rhashtable_lookup_compare() like
rhashtable_lookup() does. This allows to simplify the hashing
functions and keep them private.

Signed-off-by: Thomas Graf 
Cc: netfilter-de...@vger.kernel.org
---
 include/linux/rhashtable.h |  5 +--
 lib/rhashtable.c   | 91 +++---
 net/netfilter/nft_hash.c   | 46 ++-
 net/netlink/af_netlink.c   |  5 +--
 4 files changed, 61 insertions(+), 86 deletions(-)

diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index b93fd89..1b51221 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -96,9 +96,6 @@ static inline int lockdep_rht_mutex_is_held(const struct 
rhashtable *ht)
 
 int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
 
-u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len);
-u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
-
 void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
 bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
 void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
@@ -111,7 +108,7 @@ int rhashtable_expand(struct rhashtable *ht);
 int rhashtable_shrink(struct rhashtable *ht);
 
 void *rhashtable_lookup(const struct rhashtable *ht, const void *key);
-void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
+void *rhashtable_lookup_compare(const struct rhashtable *ht, const void *key,
bool (*compare)(void *, void *), void *arg);
 
 void rhashtable_destroy(const struct rhashtable *ht);
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 6c3c723..1ee0eb6 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -42,69 +42,39 @@ static void *rht_obj(const struct rhashtable *ht, const 
struct rhash_head *he)
return (void *) he - ht->p.head_offset;
 }
 
-static u32 __hashfn(const struct rhashtable *ht, const void *key,
- u32 len, u32 hsize)
+static u32 rht_bucket_index(const struct bucket_table *tbl, u32 hash)
 {
-   u32 h;
-
-   h = ht->p.hashfn(key, len, ht->p.hash_rnd);
-
-   return h & (hsize - 1);
-}
-
-/**
- * rhashtable_hashfn - compute hash for key of given length
- * @ht:hash table to compute for
- * @key:   pointer to key
- * @len:   length of key
- *
- * Computes the hash value using the hash function provided in the 'hashfn'
- * of struct rhashtable_params. The returned value is guaranteed to be
- * smaller than the number of buckets in the hash table.
- */
-u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len)
-{
-   struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht);
-
-   return __hashfn(ht, key, len, tbl->size);
+   return hash & (tbl->size - 1);
 }
-EXPORT_SYMBOL_GPL(rhashtable_hashfn);
 
-static u32 obj_hashfn(const struct rhashtable *ht, const void *ptr, u32 hsize)
+static u32 obj_raw_hashfn(const struct rhashtable *ht, const void *ptr)
 {
-   if (unlikely(!ht->p.key_len)) {
-   u32 h;
-
-   h = ht->p.obj_hashfn(ptr, ht->p.hash_rnd);
+   u32 hash;
 
-   return h & (hsize - 1);
-   }
+   if (unlikely(!ht->p.key_len))
+   hash = ht->p.obj_hashfn(ptr, ht->p.hash_rnd);
+   else
+   hash = ht->p.hashfn(ptr + ht->p.key_offset, ht->p.key_len,
+   ht->p.hash_rnd);
 
-   return __hashfn(ht, ptr + ht->p.key_offset, ht->p.key_len, hsize);
+   return hash;
 }
 
-/**
- * rhashtable_obj_hashfn - compute hash for hashed object
- * @ht:hash table to compute for
- * @ptr:   pointer to hashed object
- *
- * Computes the hash value using the hash function `hashfn` respectively
- * 'obj_hashfn' depending on whether the hash table is set up to work with
- * a fixed length key. The returned value is guaranteed to be smaller than
- * the number of buckets in the hash table.
- */
-u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr)
+static u32 key_hashfn(const struct rhashtable *ht, const void *key, u32 len)
 {
struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht);
+   u32 hash;
+
+   hash = ht->p.hashfn(key, len, ht->p.hash_rnd);
 
-   return obj_hashfn(ht, ptr, tbl->size);
+   return rht_bucket_index(tbl, hash);
 }
-EXPORT_SYMBOL_GPL(rhashtable_obj_hashfn);
 
 static u32 head_hashfn(const struct rhashtable *ht,
-  const struct rhash_head *he, u32 hsize)
+  const struct bucket_table *tbl,
+  const struct rhash_head *he)
 {
-   return obj_hashfn(ht, rht_obj(ht, he), hsize);
+   return rht_bucket_index(tbl, obj_raw_hashfn(ht, rht_obj(ht, he)));
 }
 
 static struct bucket_table *bucket_table_alloc(size_t nbuckets)
@@ -170,9 +140,9 @@ static void hashtable_chain_unzip(const struct rhashtable 
*ht,
 * r

[PATCH 5/9] nft_hash: Remove rhashtable_remove_pprev()

2015-01-02 Thread Thomas Graf
The removal function of nft_hash currently stores a reference to the
previous element during lookup which is used to optimize removal later
on. This was possible because a lock is held throughout calling
rhashtable_lookup() and rhashtable_remove().

With the introdution of deferred table resizing in parallel to lookups
and insertions, the nftables lock will no longer synchronize all
table mutations and the stored pprev may become invalid.

Removing this optimization makes removal slightly more expensive on
average but allows taking the resize cost out of the insert and
remove path.

Signed-off-by: Thomas Graf 
Cc: netfilter-de...@vger.kernel.org
---
 include/linux/rhashtable.h |  2 --
 lib/rhashtable.c   | 34 +++---
 net/netfilter/nft_hash.c   | 11 +++
 3 files changed, 10 insertions(+), 37 deletions(-)

diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index b54e24a..f624d4b 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -105,8 +105,6 @@ int rhashtable_init(struct rhashtable *ht, struct 
rhashtable_params *params);
 
 void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
 bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
-void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
-struct rhash_head __rcu **pprev);
 
 bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
 bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 0bd29c1..e6b85c4 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -345,32 +345,6 @@ void rhashtable_insert(struct rhashtable *ht, struct 
rhash_head *obj)
 EXPORT_SYMBOL_GPL(rhashtable_insert);
 
 /**
- * rhashtable_remove_pprev - remove object from hash table given previous 
element
- * @ht:hash table
- * @obj:   pointer to hash head inside object
- * @pprev: pointer to previous element
- *
- * Identical to rhashtable_remove() but caller is alreayd aware of the element
- * in front of the element to be deleted. This is in particular useful for
- * deletion when combined with walking or lookup.
- */
-void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
-struct rhash_head __rcu **pprev)
-{
-   struct bucket_table *tbl = rht_dereference(ht->tbl, ht);
-
-   ASSERT_RHT_MUTEX(ht);
-
-   RCU_INIT_POINTER(*pprev, obj->next);
-   ht->nelems--;
-
-   if (ht->p.shrink_decision &&
-   ht->p.shrink_decision(ht, tbl->size))
-   rhashtable_shrink(ht);
-}
-EXPORT_SYMBOL_GPL(rhashtable_remove_pprev);
-
-/**
  * rhashtable_remove - remove object from hash table
  * @ht:hash table
  * @obj:   pointer to hash head inside object
@@ -403,7 +377,13 @@ bool rhashtable_remove(struct rhashtable *ht, struct 
rhash_head *obj)
continue;
}
 
-   rhashtable_remove_pprev(ht, he, pprev);
+   RCU_INIT_POINTER(*pprev, he->next);
+   ht->nelems--;
+
+   if (ht->p.shrink_decision &&
+   ht->p.shrink_decision(ht, tbl->size))
+   rhashtable_shrink(ht);
+
return true;
}
 
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index d93f1f4..7f903cf 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -83,15 +83,10 @@ static void nft_hash_remove(const struct nft_set *set,
const struct nft_set_elem *elem)
 {
struct rhashtable *priv = nft_set_priv(set);
-   struct rhash_head *he, __rcu **pprev;
-
-   pprev = elem->cookie;
-   he = rht_dereference((*pprev), priv);
-
-   rhashtable_remove_pprev(priv, he, pprev);
 
+   rhashtable_remove(priv, elem->cookie);
synchronize_rcu();
-   kfree(he);
+   kfree(elem->cookie);
 }
 
 struct nft_compare_arg {
@@ -105,7 +100,7 @@ static bool nft_hash_compare(void *ptr, void *arg)
struct nft_compare_arg *x = arg;
 
if (!nft_data_cmp(&he->key, &x->elem->key, x->set->klen)) {
-   x->elem->cookie = &he->node;
+   x->elem->cookie = he;
x->elem->flags = 0;
if (x->set->flags & NFT_SET_MAP)
nft_data_copy(&x->elem->data, he->data);
-- 
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 3/9] rhashtable: Convert bucket iterators to take table and index

2015-01-02 Thread Thomas Graf
This patch is in preparation to introduce per bucket spinlocks. It
extends all iterator macros to take the bucket table and bucket
index. It also introduces a new rht_dereference_bucket() to
handle protected accesses to buckets.

It introduces a barrier() to the RCU iterators to the prevent
the compiler from caching the first element.

The lockdep verifier is introduced as stub which always succeeds
and properly implement in the next patch when the locks are
introduced.

Signed-off-by: Thomas Graf 
---
 include/linux/rhashtable.h | 173 ++---
 lib/rhashtable.c   |  30 +---
 net/netfilter/nft_hash.c   |  12 ++--
 net/netlink/af_netlink.c   |  12 ++--
 net/netlink/diag.c |   4 +-
 5 files changed, 152 insertions(+), 79 deletions(-)

diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 1b51221..b54e24a 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -87,11 +87,18 @@ struct rhashtable {
 
 #ifdef CONFIG_PROVE_LOCKING
 int lockdep_rht_mutex_is_held(const struct rhashtable *ht);
+int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash);
 #else
 static inline int lockdep_rht_mutex_is_held(const struct rhashtable *ht)
 {
return 1;
 }
+
+static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl,
+u32 hash)
+{
+   return 1;
+}
 #endif /* CONFIG_PROVE_LOCKING */
 
 int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
@@ -119,92 +126,144 @@ void rhashtable_destroy(const struct rhashtable *ht);
 #define rht_dereference_rcu(p, ht) \
rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht))
 
-#define rht_entry(ptr, type, member) container_of(ptr, type, member)
-#define rht_entry_safe(ptr, type, member) \
-({ \
-   typeof(ptr) __ptr = (ptr); \
-  __ptr ? rht_entry(__ptr, type, member) : NULL; \
-})
+#define rht_dereference_bucket(p, tbl, hash) \
+   rcu_dereference_protected(p, lockdep_rht_bucket_is_held(tbl, hash))
 
-#define rht_next_entry_safe(pos, ht, member) \
-({ \
-   pos ? rht_entry_safe(rht_dereference((pos)->member.next, ht), \
-typeof(*(pos)), member) : NULL; \
-})
+#define rht_dereference_bucket_rcu(p, tbl, hash) \
+   rcu_dereference_check(p, lockdep_rht_bucket_is_held(tbl, hash))
+
+#define rht_entry(tpos, pos, member) \
+   ({ tpos = container_of(pos, typeof(*tpos), member); 1; })
 
 /**
- * rht_for_each - iterate over hash chain
- * @pos:   &struct rhash_head to use as a loop cursor.
- * @head:  head of the hash chain (struct rhash_head *)
- * @ht:pointer to your struct rhashtable
+ * rht_for_each_continue - continue iterating over hash chain
+ * @pos:   the &struct rhash_head to use as a loop cursor.
+ * @head:  the previous &struct rhash_head to continue from
+ * @tbl:   the &struct bucket_table
+ * @hash:  the hash value / bucket index
  */
-#define rht_for_each(pos, head, ht) \
-   for (pos = rht_dereference(head, ht); \
+#define rht_for_each_continue(pos, head, tbl, hash) \
+   for (pos = rht_dereference_bucket(head, tbl, hash); \
 pos; \
-pos = rht_dereference((pos)->next, ht))
+pos = rht_dereference_bucket((pos)->next, tbl, hash))
+
+/**
+ * rht_for_each - iterate over hash chain
+ * @pos:   the &struct rhash_head to use as a loop cursor.
+ * @tbl:   the &struct bucket_table
+ * @hash:  the hash value / bucket index
+ */
+#define rht_for_each(pos, tbl, hash) \
+   rht_for_each_continue(pos, (tbl)->buckets[hash], tbl, hash)
+
+/**
+ * rht_for_each_entry_continue - continue iterating over hash chain
+ * @tpos:  the type * to use as a loop cursor.
+ * @pos:   the &struct rhash_head to use as a loop cursor.
+ * @head:  the previous &struct rhash_head to continue from
+ * @tbl:   the &struct bucket_table
+ * @hash:  the hash value / bucket index
+ * @member:name of the &struct rhash_head within the hashable struct.
+ */
+#define rht_for_each_entry_continue(tpos, pos, head, tbl, hash, member)
\
+   for (pos = rht_dereference_bucket(head, tbl, hash); \
+pos && rht_entry(tpos, pos, member);   \
+pos = rht_dereference_bucket((pos)->next, tbl, hash))
 
 /**
  * rht_for_each_entry - iterate over hash chain of given type
- * @pos:   type * to use as a loop cursor.
- * @head:  head of the hash chain (struct rhash_head *)
- * @ht:pointer to your struct rhashtable
- * @member:name of the rhash_head within the hashable struct.
+ * @tpos:  the type * to use as a loop cursor.
+ * @pos:   the &struct rhash_head to use as a loop cursor.
+ * @tbl:   the &struct bucket_table
+ * @hash:  the hash value / bucket index
+ * @member:name of the &struct rhash_head within the hashable struct.
  */
-#define rht_

[PATCH 9/9] netlink: Lockless lookup with RCU grace period in socket release

2015-01-02 Thread Thomas Graf
Defers the release of the socket reference using call_rcu() to
allow using an RCU read-side protected call to rhashtable_lookup()

This restores behaviour and performance gains as previously
introduced by e341694 ("netlink: Convert netlink_lookup() to use
RCU protected hash table") without the side effect of severely
delayed socket destruction.

Signed-off-by: Thomas Graf 
---
 net/netlink/af_netlink.c | 32 
 net/netlink/af_netlink.h |  1 +
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 738c3bf..298e1df 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -97,12 +97,12 @@ static int netlink_dump(struct sock *sk);
 static void netlink_skb_destructor(struct sk_buff *skb);
 
 /* nl_table locking explained:
- * Lookup and traversal are protected with nl_sk_hash_lock or nl_table_lock
- * combined with an RCU read-side lock. Insertion and removal are protected
- * with nl_sk_hash_lock while using RCU list modification primitives and may
- * run in parallel to nl_table_lock protected lookups. Destruction of the
- * Netlink socket may only occur *after* nl_table_lock has been acquired
- * either during or after the socket has been removed from the list.
+ * Lookup and traversal are protected with an RCU read-side lock. Insertion
+ * and removal are protected with nl_sk_hash_lock while using RCU list
+ * modification primitives and may run in parallel to RCU protected lookups.
+ * Destruction of the Netlink socket may only occur *after* nl_table_lock has
+ * been acquired * either during or after the socket has been removed from
+ * the list and after an RCU grace period.
  */
 DEFINE_RWLOCK(nl_table_lock);
 EXPORT_SYMBOL_GPL(nl_table_lock);
@@ -1003,13 +1003,11 @@ static struct sock *netlink_lookup(struct net *net, int 
protocol, u32 portid)
struct netlink_table *table = &nl_table[protocol];
struct sock *sk;
 
-   read_lock(&nl_table_lock);
rcu_read_lock();
sk = __netlink_lookup(table, portid, net);
if (sk)
sock_hold(sk);
rcu_read_unlock();
-   read_unlock(&nl_table_lock);
 
return sk;
 }
@@ -1183,6 +1181,13 @@ out_module:
goto out;
 }
 
+static void deferred_put_nlk_sk(struct rcu_head *head)
+{
+   struct netlink_sock *nlk = container_of(head, struct netlink_sock, rcu);
+
+   sock_put(&nlk->sk);
+}
+
 static int netlink_release(struct socket *sock)
 {
struct sock *sk = sock->sk;
@@ -1248,7 +1253,7 @@ static int netlink_release(struct socket *sock)
local_bh_disable();
sock_prot_inuse_add(sock_net(sk), &netlink_proto, -1);
local_bh_enable();
-   sock_put(sk);
+   call_rcu(&nlk->rcu, deferred_put_nlk_sk);
return 0;
 }
 
@@ -1263,7 +1268,6 @@ static int netlink_autobind(struct socket *sock)
 
 retry:
cond_resched();
-   netlink_table_grab();
rcu_read_lock();
if (__netlink_lookup(table, portid, net)) {
/* Bind collision, search negative portid values. */
@@ -1271,11 +1275,9 @@ retry:
if (rover > -4097)
rover = -4097;
rcu_read_unlock();
-   netlink_table_ungrab();
goto retry;
}
rcu_read_unlock();
-   netlink_table_ungrab();
 
err = netlink_insert(sk, net, portid);
if (err == -EADDRINUSE)
@@ -2910,9 +2912,8 @@ static struct sock *netlink_seq_socket_idx(struct 
seq_file *seq, loff_t pos)
 }
 
 static void *netlink_seq_start(struct seq_file *seq, loff_t *pos)
-   __acquires(nl_table_lock) __acquires(RCU)
+   __acquires(RCU)
 {
-   read_lock(&nl_table_lock);
rcu_read_lock();
return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN;
 }
@@ -2964,10 +2965,9 @@ static void *netlink_seq_next(struct seq_file *seq, void 
*v, loff_t *pos)
 }
 
 static void netlink_seq_stop(struct seq_file *seq, void *v)
-   __releases(RCU) __releases(nl_table_lock)
+   __releases(RCU)
 {
rcu_read_unlock();
-   read_unlock(&nl_table_lock);
 }
 
 
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
index f123a88..fd96fa7 100644
--- a/net/netlink/af_netlink.h
+++ b/net/netlink/af_netlink.h
@@ -50,6 +50,7 @@ struct netlink_sock {
 #endif /* CONFIG_NETLINK_MMAP */
 
struct rhash_head   node;
+   struct rcu_head rcu;
 };
 
 static inline struct netlink_sock *nlk_sk(struct sock *sk)
-- 
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 8/9] rhashtable: Supports for nulls marker

2015-01-02 Thread Thomas Graf
In order to allow for wider usage of rhashtable, use a special nulls
marker to terminate each chain. The reason for not using the existing
nulls_list is that the prev pointer usage would not be valid as entries
can be linked in two different buckets at the same time.

The 4 nulls base bits can be set through the rhashtable_params structure
like this:

struct rhashtable_params params = {
[...]
.nulls_base = (1U << RHT_BASE_SHIFT),
};

This reduces the hash length from 32 bits to 27 bits.

Signed-off-by: Thomas Graf 
---
 include/linux/list_nulls.h |  3 ++-
 include/linux/rhashtable.h | 57 ++
 lib/rhashtable.c   | 37 --
 3 files changed, 79 insertions(+), 18 deletions(-)

diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
index 5d10ae36..e8c300e 100644
--- a/include/linux/list_nulls.h
+++ b/include/linux/list_nulls.h
@@ -21,8 +21,9 @@ struct hlist_nulls_head {
 struct hlist_nulls_node {
struct hlist_nulls_node *next, **pprev;
 };
+#define NULLS_MARKER(value) (1UL | (((long)value) << 1))
 #define INIT_HLIST_NULLS_HEAD(ptr, nulls) \
-   ((ptr)->first = (struct hlist_nulls_node *) (1UL | (((long)nulls) << 
1)))
+   ((ptr)->first = (struct hlist_nulls_node *) NULLS_MARKER(nulls))
 
 #define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member)
 /**
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index a1688f0..de7cac7 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -18,15 +18,32 @@
 #ifndef _LINUX_RHASHTABLE_H
 #define _LINUX_RHASHTABLE_H
 
-#include 
+#include 
 #include 
 
+/*
+ * The end of the chain is marked with a special nulls marks which has
+ * the following format:
+ *
+ * +---+-+-+
+ * | Base  |  Hash   |1|
+ * +---+-+-+
+ *
+ * Base (4 bits) : Reserved to distinguish between multiple tables.
+ * Specified via &struct rhashtable_params.nulls_base.
+ * Hash (27 bits): Full hash (unmasked) of first element added to bucket
+ * 1 (1 bit) : Nulls marker (always set)
+ *
+ * The remaining bits of the next pointer remain unused for now.
+ */
+#define RHT_BASE_BITS  4
+#define RHT_HASH_BITS  27
+#define RHT_BASE_SHIFT RHT_HASH_BITS
+
 struct rhash_head {
struct rhash_head __rcu *next;
 };
 
-#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL)
-
 /**
  * struct bucket_table - Table of hash buckets
  * @size: Number of hash buckets
@@ -55,6 +72,7 @@ struct rhashtable;
  * @hash_rnd: Seed to use while hashing
  * @max_shift: Maximum number of shifts while expanding
  * @min_shift: Minimum number of shifts while shrinking
+ * @nulls_base: Base value to generate nulls marker
  * @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
  * @hashfn: Function to hash key
  * @obj_hashfn: Function to hash object
@@ -69,6 +87,7 @@ struct rhashtable_params {
u32 hash_rnd;
size_t  max_shift;
size_t  min_shift;
+   u32 nulls_base;
size_t  locks_mul;
rht_hashfn_thashfn;
rht_obj_hashfn_tobj_hashfn;
@@ -100,6 +119,24 @@ struct rhashtable {
boolbeing_destroyed;
 };
 
+static inline unsigned long rht_marker(const struct rhashtable *ht, u32 hash)
+{
+   return NULLS_MARKER(ht->p.nulls_base + hash);
+}
+
+#define INIT_RHT_NULLS_HEAD(ptr, ht, hash) \
+   ((ptr) = (typeof(ptr)) rht_marker(ht, hash))
+
+static inline bool rht_is_a_nulls(const struct rhash_head *ptr)
+{
+   return ((unsigned long) ptr & 1);
+}
+
+static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr)
+{
+   return ((unsigned long) ptr) >> 1;
+}
+
 #ifdef CONFIG_PROVE_LOCKING
 int lockdep_rht_mutex_is_held(struct rhashtable *ht);
 int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash);
@@ -157,7 +194,7 @@ void rhashtable_destroy(struct rhashtable *ht);
  */
 #define rht_for_each_continue(pos, head, tbl, hash) \
for (pos = rht_dereference_bucket(head, tbl, hash); \
-pos; \
+!rht_is_a_nulls(pos); \
 pos = rht_dereference_bucket((pos)->next, tbl, hash))
 
 /**
@@ -180,7 +217,7 @@ void rhashtable_destroy(struct rhashtable *ht);
  */
 #define rht_for_each_entry_continue(tpos, pos, head, tbl, hash, member)
\
for (pos = rht_dereference_bucket(head, tbl, hash); \
-pos && rht_entry(tpos, pos, member);   \
+(!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member);\
 pos = rht_dereference_bucket((pos)->next, tbl, hash))
 
 /**
@@ -209,9 +246,9 @@ void rhashtable_destroy(struct rhashtable *ht)

[PATCH 7/9] rhashtable: Per bucket locks & deferred expansion/shrinking

2015-01-02 Thread Thomas Graf
Introduces an array of spinlocks to protect bucket mutations. The number
of spinlocks per CPU is configurable and selected based on the hash of
the bucket. This allows for parallel insertions and removals of entries
which do not share a lock.

The patch also defers expansion and shrinking to a worker queue which
allows insertion and removal from atomic context. Insertions and
deletions may occur in parallel to it and are only held up briefly
while the particular bucket is linked or unzipped.

Mutations of the bucket table pointer is protected by a new mutex, read
access is RCU protected.

In the event of an expansion or shrinking, the new bucket table allocated
is exposed as a so called future table as soon as the resize process
starts.  Lookups, deletions, and insertions will briefly use both tables.
The future table becomes the main table after an RCU grace period and
initial linking of the old to the new table was performed. Optimization
of the chains to make use of the new number of buckets follows only the
new table is in use.

The side effect of this is that during that RCU grace period, a bucket
traversal using any rht_for_each() variant on the main table will not see
any insertions performed during the RCU grace period which would at that
point land in the future table. The lookup will see them as it searches
both tables if needed.

Having multiple insertions and removals occur in parallel requires nelems
to become an atomic counter.

Signed-off-by: Thomas Graf 
---
 include/linux/rhashtable.h |  37 ++--
 lib/rhashtable.c   | 458 ++---
 net/netfilter/nft_hash.c   |  27 ++-
 net/netlink/af_netlink.c   |  15 +-
 4 files changed, 384 insertions(+), 153 deletions(-)

diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index f624d4b..a1688f0 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -19,6 +19,7 @@
 #define _LINUX_RHASHTABLE_H
 
 #include 
+#include 
 
 struct rhash_head {
struct rhash_head __rcu *next;
@@ -26,8 +27,17 @@ struct rhash_head {
 
 #define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL)
 
+/**
+ * struct bucket_table - Table of hash buckets
+ * @size: Number of hash buckets
+ * @locks_mask: Mask to apply before accessing locks[]
+ * @locks: Array of spinlocks protecting individual buckets
+ * @buckets: size * hash buckets
+ */
 struct bucket_table {
size_t  size;
+   unsigned intlocks_mask;
+   spinlock_t  *locks;
struct rhash_head __rcu *buckets[];
 };
 
@@ -45,11 +55,11 @@ struct rhashtable;
  * @hash_rnd: Seed to use while hashing
  * @max_shift: Maximum number of shifts while expanding
  * @min_shift: Minimum number of shifts while shrinking
+ * @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
  * @hashfn: Function to hash key
  * @obj_hashfn: Function to hash object
  * @grow_decision: If defined, may return true if table should expand
  * @shrink_decision: If defined, may return true if table should shrink
- * @mutex_is_held: Must return true if protecting mutex is held
  */
 struct rhashtable_params {
size_t  nelem_hint;
@@ -59,37 +69,42 @@ struct rhashtable_params {
u32 hash_rnd;
size_t  max_shift;
size_t  min_shift;
+   size_t  locks_mul;
rht_hashfn_thashfn;
rht_obj_hashfn_tobj_hashfn;
bool(*grow_decision)(const struct rhashtable *ht,
 size_t new_size);
bool(*shrink_decision)(const struct rhashtable *ht,
   size_t new_size);
-#ifdef CONFIG_PROVE_LOCKING
-   int (*mutex_is_held)(void *parent);
-   void*parent;
-#endif
 };
 
 /**
  * struct rhashtable - Hash table handle
  * @tbl: Bucket table
+ * @future_tbl: Table under construction during expansion/shrinking
  * @nelems: Number of elements in table
  * @shift: Current size (1 << shift)
  * @p: Configuration parameters
+ * @run_work: Deferred worker to expand/shrink asynchronously
+ * @mutex: Mutex to protect current/future table swapping
+ * @being_destroyed: True if table is set up for destruction
  */
 struct rhashtable {
struct bucket_table __rcu   *tbl;
-   size_t  nelems;
+   struct bucket_table __rcu   *future_tbl;
+   atomic_tnelems;
size_t  shift;
struct rhashtable_paramsp;
+   struct delayed_work run_work;
+   struct mutexmutex;
+   boolbeing_destroyed;
 };
 
 #ifdef CONFIG_PROVE_LOCKING
-int lockdep_rht_mutex_is_held(const struct rhashtable *ht);
+int lockdep_

[PATCH 6/9] spinlock: Add spin_lock_bh_nested()

2015-01-02 Thread Thomas Graf
Signed-off-by: Thomas Graf 
---
 include/linux/spinlock.h | 8 
 include/linux/spinlock_api_smp.h | 2 ++
 include/linux/spinlock_api_up.h  | 1 +
 kernel/locking/spinlock.c| 8 
 4 files changed, 19 insertions(+)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 262ba4e..3e18379 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -190,6 +190,8 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) 
__releases(lock)
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # define raw_spin_lock_nested(lock, subclass) \
_raw_spin_lock_nested(lock, subclass)
+# define raw_spin_lock_bh_nested(lock, subclass) \
+   _raw_spin_lock_bh_nested(lock, subclass)
 
 # define raw_spin_lock_nest_lock(lock, nest_lock)  \
 do {   \
@@ -205,6 +207,7 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) 
__releases(lock)
 # define raw_spin_lock_nested(lock, subclass)  \
_raw_spin_lock(((void)(subclass), (lock)))
 # define raw_spin_lock_nest_lock(lock, nest_lock)  _raw_spin_lock(lock)
+# define raw_spin_lock_bh_nested(lock, subclass)   _raw_spin_lock_bh(lock)
 #endif
 
 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
@@ -324,6 +327,11 @@ do {   
\
raw_spin_lock_nested(spinlock_check(lock), subclass);   \
 } while (0)
 
+#define spin_lock_bh_nested(lock, subclass)\
+do {   \
+   raw_spin_lock_bh_nested(spinlock_check(lock), subclass);\
+} while (0)
+
 #define spin_lock_nest_lock(lock, nest_lock)   \
 do {   \
raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock);   \
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 42dfab8..5344268 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -22,6 +22,8 @@ int in_lock_functions(unsigned long addr);
 void __lockfunc _raw_spin_lock(raw_spinlock_t *lock)   
__acquires(lock);
 void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass)

__acquires(lock);
+void __lockfunc _raw_spin_lock_bh_nested(raw_spinlock_t *lock, int subclass)
+   
__acquires(lock);
 void __lockfunc
 _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map)

__acquires(lock);
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index d0d1888..d3afef9 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -57,6 +57,7 @@
 
 #define _raw_spin_lock(lock)   __LOCK(lock)
 #define _raw_spin_lock_nested(lock, subclass)  __LOCK(lock)
+#define _raw_spin_lock_bh_nested(lock, subclass) __LOCK(lock)
 #define _raw_read_lock(lock)   __LOCK(lock)
 #define _raw_write_lock(lock)  __LOCK(lock)
 #define _raw_spin_lock_bh(lock)__LOCK_BH(lock)
diff --git a/kernel/locking/spinlock.c b/kernel/locking/spinlock.c
index 4b082b5..db3ccb1 100644
--- a/kernel/locking/spinlock.c
+++ b/kernel/locking/spinlock.c
@@ -363,6 +363,14 @@ void __lockfunc _raw_spin_lock_nested(raw_spinlock_t 
*lock, int subclass)
 }
 EXPORT_SYMBOL(_raw_spin_lock_nested);
 
+void __lockfunc _raw_spin_lock_bh_nested(raw_spinlock_t *lock, int subclass)
+{
+   __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
+   spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_);
+   LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
+}
+EXPORT_SYMBOL(_raw_spin_lock_bh_nested);
+
 unsigned long __lockfunc _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock,
   int subclass)
 {
-- 
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 4/9] rhashtable: Factor out bucket_tail() function

2015-01-02 Thread Thomas Graf
Subsequent patches will require access to the bucket tail. Access
to the tail is relatively cheap as the automatic resizing of the
table should keep the number of entries per bucket to no more
than 0.75 on average.

Signed-off-by: Thomas Graf 
---
 lib/rhashtable.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index ce450d0..0bd29c1 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -83,6 +83,18 @@ static u32 head_hashfn(const struct rhashtable *ht,
return rht_bucket_index(tbl, obj_raw_hashfn(ht, rht_obj(ht, he)));
 }
 
+static struct rhash_head __rcu **bucket_tail(struct bucket_table *tbl, u32 n)
+{
+   struct rhash_head __rcu **pprev;
+
+   for (pprev = &tbl->buckets[n];
+rht_dereference_bucket(*pprev, tbl, n);
+pprev = &rht_dereference_bucket(*pprev, tbl, n)->next)
+   ;
+
+   return pprev;
+}
+
 static struct bucket_table *bucket_table_alloc(size_t nbuckets)
 {
struct bucket_table *tbl;
@@ -266,7 +278,6 @@ EXPORT_SYMBOL_GPL(rhashtable_expand);
 int rhashtable_shrink(struct rhashtable *ht)
 {
struct bucket_table *ntbl, *tbl = rht_dereference(ht->tbl, ht);
-   struct rhash_head __rcu **pprev;
unsigned int i;
 
ASSERT_RHT_MUTEX(ht);
@@ -286,15 +297,9 @@ int rhashtable_shrink(struct rhashtable *ht)
 */
for (i = 0; i < ntbl->size; i++) {
ntbl->buckets[i] = tbl->buckets[i];
+   RCU_INIT_POINTER(*bucket_tail(ntbl, i),
+tbl->buckets[i + ntbl->size]);
 
-   /* Link each bucket in the new table to the first bucket
-* in the old table that contains entries which will hash
-* to the new bucket.
-*/
-   for (pprev = &ntbl->buckets[i]; *pprev != NULL;
-pprev = &rht_dereference_bucket(*pprev, ntbl, i)->next)
-   ;
-   RCU_INIT_POINTER(*pprev, tbl->buckets[i + ntbl->size]);
}
 
/* Publish the new, valid hash table */
-- 
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 2/9] rhashtable: Use rht_obj() instead of manual offset calculation

2015-01-02 Thread Thomas Graf
Signed-off-by: Thomas Graf 
---
 lib/rhashtable.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 1ee0eb6..b658245 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -427,7 +427,7 @@ void *rhashtable_lookup(const struct rhashtable *ht, const 
void *key)
if (memcmp(rht_obj(ht, he) + ht->p.key_offset, key,
   ht->p.key_len))
continue;
-   return (void *) he - ht->p.head_offset;
+   return rht_obj(ht, he);
}
 
return NULL;
@@ -460,7 +460,7 @@ void *rhashtable_lookup_compare(const struct rhashtable 
*ht, const void *key,
rht_for_each_rcu(he, tbl->buckets[hash], ht) {
if (!compare(rht_obj(ht, he), arg))
continue;
-   return (void *) he - ht->p.head_offset;
+   return rht_obj(ht, he);
}
 
return NULL;
-- 
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 0/9 net-next v2] rhashtable: Per bucket locks & deferred table resizing

2015-01-02 Thread Thomas Graf
Prepares for and introduces per bucket spinlocks and deferred table
resizing. This allows for parallel table mutations in different hash
buckets from atomic context. The resizing occurs in the background
in a separate worker thread while lookups, inserts, and removals can
continue.

Also modified the chain linked list to be terminated with a special
nulls marker to allow entries to move between multiple lists.

Last but not least, reintroduces lockless netlink_lookup() with
deferred Netlink socket destruction to avoid the side effect of
increased netlink_release() runtime.

Thomas Graf (9):
  rhashtable: Do hashing inside of rhashtable_lookup_compare()
  rhashtable: Use rht_obj() instead of manual offset calculation
  rhashtable: Convert bucket iterators to take table and index
  rhashtable: Factor out bucket_tail() function
  nft_hash: Remove rhashtable_remove_pprev()
  spinlock: Add spin_lock_bh_nested()
  rhashtable: Per bucket locks & deferred expansion/shrinking
  rhashtable: Supports for nulls marker
  netlink: Lockless lookup with RCU grace period in socket release

 include/linux/list_nulls.h   |   3 +-
 include/linux/rhashtable.h   | 258 -
 include/linux/spinlock.h |   8 +
 include/linux/spinlock_api_smp.h |   2 +
 include/linux/spinlock_api_up.h  |   1 +
 kernel/locking/spinlock.c|   8 +
 lib/rhashtable.c | 607 ++-
 net/netfilter/nft_hash.c |  92 +++---
 net/netlink/af_netlink.c |  64 ++---
 net/netlink/af_netlink.h |   1 +
 net/netlink/diag.c   |   4 +-
 11 files changed, 693 insertions(+), 355 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/


Re: [PATCH] net: ethernet: cisco: enic: enic_dev: Remove some unused functions

2015-01-02 Thread David Miller
From: Rickard Strandqvist 
Date: Fri,  2 Jan 2015 21:29:24 +0100

> Removes some functions that are not used anywhere:
> enic_dev_enable2_done() enic_dev_enable2() enic_dev_deinit_done()
> enic_dev_init_prov2() enic_vnic_dev_deinit()
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 

Applied.
--
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] isdn: hisax: hfc4s8s_l1: Remove some unused functions

2015-01-02 Thread David Miller
From: Rickard Strandqvist 
Date: Thu,  1 Jan 2015 20:17:22 +0100

> Removes some functions that are not used anywhere:
> Read_hfc32() Write_hfc32() Write_hfc16()
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 

Applied.
--
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] [RFC] Deter exploit bruteforcing

2015-01-02 Thread Richard Weinberger
Am 02.01.2015 um 20:46 schrieb Pavel Machek:
>>> Does this break trinity, crashme, and similar programs?
>>
>> If they fork() without execve() and a child dies very fast the next fork()
>> will be throttled.
>> This is why I'd like to make this feature disabled by default.
>>
>>> Can you detect it died due to the stack canary? Then, the patch might
>>> be actually acceptable.
>>
>> I don't think so as this is glibc specific.
> 
> Can the slowdown be impelmented in glibc, then?

glibc has a lot of asserts where it can detect stack smashing and kills the
current process using abort(). Here it could of course also call sleep().

> If not, can glibc provide enough information to the kernel to allow us
> to do the right thing?

IMHO we should not strictly focus on the stack canary.
If an attacker can kind of control the attacked child and it segfaults the 
generic
in-kernel bruteforce detection will still work.
Many exploits use the fact that after fork() the child has the same memory as 
before
and brute force is possible. A user space solution won't help here.

Thanks,
//richard
--
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] net: ethernet: chelsio: cxgb3: mc5.c: Remove some unused functions

2015-01-02 Thread David Miller
From: Rickard Strandqvist 
Date: Thu,  1 Jan 2015 17:49:55 +0100

> Removes some functions that are not used anywhere:
> dbgi_rd_rsp3() dbgi_wr_addr3()
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 

Applied.
--
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] net: fddi: skfp: smt.c: Remove unused function

2015-01-02 Thread David Miller
From: Rickard Strandqvist 
Date: Thu,  1 Jan 2015 18:01:26 +0100

> Remove the function smt_ifconfig() that is not used anywhere.
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 

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


Re: [PATCH 1/3] TTY: add support for "tty slave" devices.

2015-01-02 Thread NeilBrown
On Sun, 28 Dec 2014 15:20:10 +0100 Pavel Machek  wrote:

> Hi!
> 
> > index 8c4fd0332028..b59501ee2f21 100644
> > --- a/Documentation/devicetree/bindings/serial/of-serial.txt
> > +++ b/Documentation/devicetree/bindings/serial/of-serial.txt
> > @@ -39,6 +39,10 @@ Optional properties:
> >driver is allowed to detect support for the capability even without this
> >property.
> >  
> > +Optional child node:
> > +- a platform device listed as a child node will be probed and
> > +  powered-on whenever the tty is in use (open).
> > +
> >  Example:
> >  
> > uart@8023 {
> 
> Hmm. Other devices may want it the other way around: probe the device
> behind the uart, make it control power and open/close of the uart, and
> hide the /dev/ttyXX from userspace...
>   Pavel
>   

I've been thinking a bit about this.

The current "tty" seems to be a combination of two things:
 - a line discipline
 - a char_dev

But some line disciplines don't really want the char_dev.
N_MOUSE wants a serio device.
N_HCI wants an HCI device
N_GSM07010 wants 63 different tty char_devs.
N_IRDA and N_PPP ultimately want a net_dev.
etc.

It would be really nice if the uart would register the line disciple as a
child device, then the line discipline would register whatever it wants.

Then if a uart had no children, it would register the 'N_TTY' line discipline
and get a tty char_dev.  If it had a child, it would probe the child device
and leave it to register and appropriate line discipline.

The child device could interpose itself in the control flow somehow so my
driver could add power control at open/close.

But that isn't how it works.  The line discipline doesn't talk to the uart.
Rather the tty layer talks to the uart (through tty_operations) and to the
line discipline (through tty_ldisc_ops) and also registers the char_dev.

One of the several difficulties with allowing a child device to select a line
discipline is the different line disciplines activate differently.

N_HCI activates (registers the hci dev) on HCIUARTSETPROTO ioctl.  A child
  device would need a way to specify the protocol I resume.
N_MOUSE activates on a 'read' on the tty - and deactivates when the read
  completes.
N_GSM0710 activates immediately that the ldisc is activated, as does N_IRDA
N_PPP seems to want a PPPIOCNEWUNIT ioctl to fully register.

Doing any of these in a driver for a uart slave device would certainly be
possible.  I wonder if it is something we really want to do in the kernel
though.  What is the gain over providing sufficient information in the
KOBJ_ADD uevent so that udev can do the required work in user-space?

I'm not against the idea, I am just finding it hard to justify.

However I do like the idea of having the UART probe the child instead of
registering a tty.  It could pass the tty_operations structure to the child,
and the child could then register a tty with a slightly different
tty_operations structure, allowing it to capture any operations that it wants
to capture (such as open/close).
I might try coding that and see what it looks like...

Thanks,
NeilBrown


pgpIrRT2I8qW2.pgp
Description: OpenPGP digital signature


Re: [PATCH] net: ethernet: micrel: ksz884x.c: Remove some unused functions

2015-01-02 Thread David Miller
From: Rickard Strandqvist 
Date: Thu,  1 Jan 2015 18:00:23 +0100

> Removes some functions that are not used anywhere:
> hw_w_phy_link_md() hw_r_phy_link_md() hw_w_phy_polarity()
> hw_r_phy_polarity() hw_w_phy_crossover() hw_r_phy_crossover()
> hw_r_phy_rem_cap() hw_w_phy_auto_neg() hw_r_phy_auto_neg()
> hw_r_phy_link_stat() sw_get_addr() port_chk_prio() port_chk_replace_vid()
> port_chk_802_1p() port_chk_diffserv() sw_chk_unk_def_port()
> sw_cfg_unk_def_port() sw_cfg_chk_unk_def_deliver() sw_cfg_unk_def_deliver()
> port_chk_in_filter() port_chk_dis_non_vid() port_cfg_in_filter()
> port_cfg_dis_non_vid() port_chk_rmv_tag() port_chk_ins_tag()
> port_cfg_rmv_tag() port_cfg_ins_tag() sw_flush_dyn_mac_table() port_cfg_tx()
> port_cfg_rx() port_chk_force_flow_ctrl() port_chk_back_pressure()
> port_cfg_force_flow_ctrl() port_chk_broad_storm() hw_ena_intr_bit()
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 

This causes a cascade of new warnings because now functions like
phy_chk() are unused in some configurations.

I'm really not thrilled to even review change from you of this nature
if you aren't going to be careful about attending to details like
that.

Just blindly removing functions and not looking at the context or
other potential side effects is not really acceptable.
--
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] net: wireless: b43legacy: radio.c: Remove unused function

2015-01-02 Thread Rafał Miłecki
On 2 January 2015 at 18:46, Rickard Strandqvist
 wrote:
> 2015-01-02 13:14 GMT+01:00 Sedat Dilek :
>>
>> On Fri, Jan 2, 2015 at 1:06 PM, Rafał Miłecki  wrote:
>> > On 2 January 2015 at 13:05, Rafał Miłecki  wrote:
>> >> On 1 January 2015 at 16:46, Rickard Strandqvist
>> >>  wrote:
>> >>> Remove the function b43legacy_radio_set_tx_iq() that is not used
>> >>> anywhere.
>> >>>
>> >>> This was partially found by using a static code analysis program
>> >>> called cppcheck.
>> >>
>> >> It seems to be for A-PHY based hardware (with 0x2060 radio id) which
>> >> is not handled by b43legacy. Should be safe to drop this code (we
>> >> won't likely need it).
>> >>
>> >> Ack
>> >
>> > For future, we prefix patches with just a driver name. So this could
>> > be simply called
>> > b43legacy: radio.c: Remove unused function
>> >
>>
>> Alternatively...
>>
>> "b43legacy: Remove unused function in radio.c"
>>
>> BTW, as Arnd Bergmann pointed out [1] how did you test with cppcheck
>> to get such stuff?
>>
>> - Sedat -
>>
>> [1] https://lkml.org/lkml/2015/1/2/51
>
>
>
> Hi Rafal and Sedat
>
> Rafal do you mean I should remove the entire b43legacy part?

1) I gave you Ack for the changes
2) You could drop "net: wireless: " or better use something Sedat proposed

-- 
Rafał
--
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] arch: arm: mach-omap2: voltage.c: Remove some unused functions

2015-01-02 Thread Arnd Bergmann
On Friday 02 January 2015 17:02:21 Rickard Strandqvist wrote:
> 2015-01-02 10:46 GMT+01:00 Arnd Bergmann :
> > On Thursday 01 January 2015 18:06:34 Rickard Strandqvist wrote:
> >
> > You have correctly spotted the only place that references
> > voltdm_for_each_pwrdm
> > and changed the comment, but you failed to notice that it no longer makes
> > sense to call voltdm_add_pwrdm or keep the voltdm->pwrdm_list pointer
> > at all, so this function, and the associated list heads can all be removed
> > as well.
> >
> > Arnd
> >
> 
> 
> Hi Arnd
> 
> Thanks for your reply.
> 
> I see what you mean, but you are aware that voltdm_add_pwrdm() also be
> called from:
> arch/arm/mach-omap2/powerdomain.c in _pwrdm_register()

Yes, that call needs to be removed as well of course.

> I have also removde the voltdm_for_each()

Ok, sounds good. That list of course has to stay though, so removing
_voltdm_register would be bad ;-)

Arnd
--
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] clk: rockchip: rk3288: Make s2r reliable by switching PLLs to slow mode

2015-01-02 Thread Heiko Stübner
Am Montag, 22. Dezember 2014, 11:31:48 schrieb Doug Anderson:
> We've been seeing some crashes at resume time on rk3288-based systems.
> On some machines they simply never wake up from suspend.  Symptoms
> include:
> 
> - System clearly got to sleep OK.  Power consumption is low, the PWM
>   for the PWM regulator has stopped, and the "global_pwroff" output
>   shows that the system is down.
> 
> - When system tries to wake up power consumption goes up.
> 
> - No kernel resume code (which was left in PMU SRAM) ran.  We added
>   some basic logging to this code (write to a location in SRAM right
>   at resume time) and didn't see the logging run.
> 
> It appears that we can fix the problem by slowing down APLL before we
> suspend.  On the system I tested things seemed reliable if I disabled
> 1.8GHz and 1.7GHz.  The Mask ROM itself tries to slow things down
> (which is why PLLs are in slow mode by the time we get to the kernel),
> but apparently it is crashing before it even gets there.
> 
> We'll be super paranoid and not just go down to 1.6GHz but we'll match
> what the Mask ROM seems to be doing and go into slow mode.  We'll also
> be safe and put all PLLs (not just APLL) into slow mode (well, except
> DPLL which is needed for SDRAM).  We'll even put NPLL into slow mode
> which the Mask ROM didn't do (not that it's used for much important
> stuff at early resume time).
> 
> Note that the old Rockchip reference code did something just like
> this, though they jammed it into pm.c instead of putting it in the
> syscore ops of the clock driver.
> 
> Signed-off-by: Doug Anderson 

applied to my clk branch for 3.20

As I already talked about with Doug on IRC (last year), I see this as a sort-
of stop-gap solution till we know the suspend requirements of the older/other 
Rockchip SoCs that do suspend slightly different and can generalize the whole 
clk suspend handling at this point.


Heiko
--
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] adjtimex: PPM scaling is by 2^-16

2015-01-02 Thread Jeff Epler
On Fri, Jan 02, 2015 at 05:39:17PM +0100, Laurent Georget wrote:
> +long freq;/* Frequency offset, in units of 2^-16 PPM
> + (parts per million) (see NOTES below) */
...
> +.SH NOTES
> +In struct
> +.IR timex ,
> +.IR freq ,
> +.IR ppsfreq ,
> +and
> +.I stabil
> +are PPM (parts per million) with a 16-bits fractional part, which means that 
> a
> +value of 1 in one of those fields actually means 2^-16 PPM, and 2^16=65535 is
> +1 PPM. This is the case for both input values (in the case of
> +.IR freq )
> +and output values.

I appreciate the addition of the NOTES section, this is likely to be
unclear to first-time readers and that section should clear it up
nicely.  Giving the definition of PPM as "parts per million" is good
too.

However, the patch got line-wrapped again (I fixed it manually above).
With line-wrapped fix, consider it

Reviewed-by: Jeff Epler 

hm, as a separate issue, "ppm" seems to typically be written in
lowercase.  see e.g., http://en.wikipedia.org/wiki/Parts-per_notation

Jeff
--
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] of/pci: add of_pci_dma_configure() update dma configuration

2015-01-02 Thread Murali Karicheri

On 01/02/2015 03:57 PM, Arnd Bergmann wrote:

On Friday 02 January 2015 12:20:53 Murali Karicheri wrote:

Initially I had the same idea to re-use the existing function
of_dma_configure() for this. I wanted to defer this until we have an
agreement on the changes required for the subject functionality. My
quick review of the code suggestio this would require additional API
changes as below. I did a quick test of the changes and it works for
Keystone, but need to be reviewed by everyone as I touch the IOMMU
functionality here and I don't have a platform with IOMMU. Need test by
someone to make sure I don't break anything.

Here are the changes required to implement this suggestion.

1. Move the of_dma_configure() to drivers/of/device.c (include the API
in of_device.h) and make it global (using proper EXPORT macro).
Otherwise, we will have to include of_platform.h in drivers/of/of_pci.c
assuming the prototype is defined in of_platform.h which doesn't look
appropriate to me. Would require following additional include files in
drivers/of/device.c as well.

+#include
+#include
+#include


Yes, sounds good.


2. drivers/iommu/of_iommu.c. This is needed so that of_iommu_configure()
can take confuguration from the root bus DT as you have suggested.

-struct iommu_ops *of_iommu_configure(struct device *dev)
+struct iommu_ops *of_iommu_configure(struct device *dev, struct
device_node *node)
   {
  struct of_phandle_args iommu_spec;
  struct device_node *np;
@@ -145,7 +145,7 @@ struct iommu_ops *of_iommu_configure(struct device *dev)
   * See the `Notes:' section of
   * Documentation/devicetree/bindings/iommu/iommu.txt
   */
-   while (!of_parse_phandle_with_args(dev->of_node, "iommus",
+   while (!of_parse_phandle_with_args(node, "iommus",
 "#iommu-cells", idx,
 &iommu_spec)) {


Right.


3. drivers/of/of_pci.c. The existing function (added in this patch) will
make call to of_dma_configure() as

parent_np = of_get_pci_root_bridge_parent(pci_dev);
of_dma_configure(dev, parent_np);


With dev =&pci_dev->dev, I assume?


Yes




4. drivers/of/platform.c. Add a wrapper function
of_platform_dma_configure() that calls of_dma_configure() as
of_dma_configure(dev, dev->of_node). All existing calls converted to
this wrapper.


There are only two callers, I don't think we need a wrapper for it,
just change the calling conventions along with step 2.


Ok. That is what Rob's comment as well.




If the above looks good, I can post v3 of the patch with these changes.


With that one minor change, sounds perfect to me. The same can also
be used by other bus types if we ever need it.

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



--
Murali Karicheri
Linux Kernel, Texas Instruments
--
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] ARM: OMAP2+: hwmod: Fix _wait_target_ready() for hwmods without sysc

2015-01-02 Thread Paul Walmsley
+ Suman, lakml

Hi Roger

On Thu, 18 Dec 2014, Roger Quadros wrote:

> Fixing up Paul's email id.
> 
> cheers,
> -roger
> 
> On 18/12/14 17:49, Roger Quadros wrote:
> > There are quite a few hwmods that don't have sysconfig register and so
> > _find_mpu_rt_port(oh) will return NULL thus preventing ready state check
> > on those modules after the module is enabled.

Hmm.  Any IP block that exposes registers that are accessible by the MPU 
should have an MPU register target port, even if there's no SYSCONFIG 
register.  And if an IP block doesn't have registers that are accessible 
from the MPU, then there shouldn't be much point to waiting for the module 
to become ready.

Looks like the real problem is the test for oh->class->sysc before the 
call to _init_mpu_rt_base().  That was introduced by commit 6423d6df1440 
("ARM: OMAP2+: hwmod: check for module address space during init"). It's 
not clear to me why that test was added, since _init_mpu_rt_base() doesn't 
do anything with oh->class->sysc or SYSCONFIG registers.

Could you please test the following patch?
I don't have an AM437x-gp-evm.  


- Paul

---
 arch/arm/mach-omap2/omap_hwmod.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cbb908dc5cf0..ce6d11f3eda7 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2451,14 +2451,10 @@ static int __init _init(struct omap_hwmod *oh, void 
*data)
oh->name, np->name);
}
 
-   if (oh->class->sysc) {
-   r = _init_mpu_rt_base(oh, NULL, index, np);
-   if (r < 0) {
-   WARN(1, "omap_hwmod: %s: doesn't have mpu register 
target base\n",
-oh->name);
-   return 0;
-   }
-   }
+   r = _init_mpu_rt_base(oh, NULL, index, np);
+   if (r < 0)
+   pr_debug("omap_hwmod: %s: doesn't have mpu register target 
base\n",
+oh->name);
 
r = _init_clocks(oh, NULL);
if (r < 0) {
-- 
2.1.4

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


Re: [RFC 2/4] PCI: generic: Add support for ARM64 and MSI(x)

2015-01-02 Thread Arnd Bergmann
On Friday 02 January 2015 12:18:06 Suravee Suthikulanit wrote:
> On 1/2/2015 5:55 AM, Lorenzo Pieralisi wrote:
> > Hi Suravee,
> >
> > On Mon, Dec 29, 2014 at 07:32:44PM +, Suravee Suthikulpanit wrote:
> >> >Hi,
> >> >
> >> >I am not sure if this thread is still alive. I'm trying to see what I
> >> >can do to help clean up/convert to make the PCI GHC also works for arm64
> >> >w/ zero or minimal ifdefs.
> >> >
> >> >Please let me know if someone is already working on this. I noticed that
> >> >Lorenzo's patches has already been in 3.19-rc1, and in Bjorn's
> >> >pci/domain branch. Otherwise, I'll try to continue the work based on the
> >> >sample patch from Arnd here.
> > If I am not mistaken, the only bit missing to remove pci_sys_data (and so
> > having a generic host controller driver that works on ARM32/64) is generic
> > MSI management.
> 
> Lorenzo,
> 
> Do you mean to remove pci_sys_data from pci-host-generic.c or removing 
> it completely? I assume the former case.

Something inbetween: We should be able to remove pci_sys_data and
pci_common_init_dev from all drivers in drivers/pci/host/, but keep them
for all drivers in arch/arm/*/pci.c

> So, looking at the current code in the pci-host-generic.c, my 
> understanding is that the:
>  *gen_pci = pci_bus->sysdata->private_data
> will be changed to:
>  *gen_pci = pci_bus->sysdata
> 
> Then, we can simply just call pci_scan_root_bus() directly since we no 
> longer need to declare hw_pci for calling pci_common_init_dev().

Right.

> > I know for certain Marc is working on it, and the solution is WIP,
> > I think we should prevent adding more churn to pci_sys_data, since
> > I managed to remove most of the dependencies (domain, mem_offset).
> 
> Thanks for cleaning up the domain and mem_offset.
> 
> I saw Marc's irq/msi_domain patch series 
> (http://git.kernel.org/cgit/linux/kernel/git/maz/arm-platforms.git/log/?h=irq/msi_domain).
>  
> 
> 
> My understanding is that deals with associating the newly introduced 
> msi_domain to each device, which replaces the need for pci_bus->msi and 
> hw_pci->msi_ctrl when configure with CONFIG_PCI_MSI_IRQ_DOMAIN (not sure 
> if this would be the plan for all arm32).  For ARM32, if not define 
> CONFIG_PCI_MSI_IRQ_DOMAIN, it would still fall back to using the 
> [pci_sys_data|hw_pci]->msi_ctrl.

For all I can tell, we have two cases on ARM regarding MSI:

- arch/arm/mach-iop13xx/pci.c uses its own
  arch_setup_msi_irq/arch_teardown_msi_irq implementation and does not
  use pci_bus->msi.

- everything else that supports MSI has a modern driver with multiplatform
  support and uses msi_controller. If any platform wants to support GICv2m,
  we have to use CONFIG_PCI_MSI_IRQ_DOMAIN for all of them, and that
  seems like the best way forward.

Arnd
--
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] arch: m68k: 68360: config: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function BSP_set_clock_mmss() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 arch/m68k/68360/config.c |   13 -
 1 file changed, 13 deletions(-)

diff --git a/arch/m68k/68360/config.c b/arch/m68k/68360/config.c
index 17ec416..fd1f948 100644
--- a/arch/m68k/68360/config.c
+++ b/arch/m68k/68360/config.c
@@ -106,19 +106,6 @@ void hw_timer_init(irq_handler_t handler)
   pquicc->timer_tgcr  = tgcr_save;
 }
 
-int BSP_set_clock_mmss(unsigned long nowtime)
-{
-#if 0
-  short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
-
-  tod->second1 = real_seconds / 10;
-  tod->second2 = real_seconds % 10;
-  tod->minute1 = real_minutes / 10;
-  tod->minute2 = real_minutes % 10;
-#endif
-  return 0;
-}
-
 void BSP_reset (void)
 {
   local_irq_disable();
-- 
1.7.10.4

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


[PATCH] gpu: drm: armada: armada_drv: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function armada_drm_vbl_event_remove_unlocked() that is not used 
anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/armada/armada_drm.h |2 --
 drivers/gpu/drm/armada/armada_drv.c |   10 --
 2 files changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_drm.h 
b/drivers/gpu/drm/armada/armada_drm.h
index ea63c6c..5f6aef0 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -46,8 +46,6 @@ void armada_drm_vbl_event_add(struct armada_crtc *,
struct armada_vbl_event *);
 void armada_drm_vbl_event_remove(struct armada_crtc *,
struct armada_vbl_event *);
-void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *,
-   struct armada_vbl_event *);
 #define armada_drm_vbl_event_init(_e, _f, _d) do { \
struct armada_vbl_event *__e = _e;  \
INIT_LIST_HEAD(&__e->node); \
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 908e531..f862bae 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -253,16 +253,6 @@ void armada_drm_vbl_event_remove(struct armada_crtc *dcrtc,
}
 }
 
-void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *dcrtc,
-   struct armada_vbl_event *evt)
-{
-   unsigned long flags;
-
-   spin_lock_irqsave(&dcrtc->irq_lock, flags);
-   armada_drm_vbl_event_remove(dcrtc, evt);
-   spin_unlock_irqrestore(&dcrtc->irq_lock, flags);
-}
-
 /* These are called under the vbl_lock. */
 static int armada_drm_enable_vblank(struct drm_device *dev, int crtc)
 {
-- 
1.7.10.4

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


[PATCH] tools: perf: util: dso: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
dso__data_size() dso__data_status_seen()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 tools/perf/util/dso.c |   34 --
 tools/perf/util/dso.h |3 ---
 2 files changed, 37 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 0247acf..8f0b6a3 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -359,18 +359,6 @@ out:
return dso->data.fd;
 }
 
-bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by)
-{
-   u32 flag = 1 << by;
-
-   if (dso->data.status_seen & flag)
-   return true;
-
-   dso->data.status_seen |= flag;
-
-   return false;
-}
-
 static void
 dso_cache__free(struct rb_root *root)
 {
@@ -546,28 +534,6 @@ static int data_file_size(struct dso *dso)
return 0;
 }
 
-/**
- * dso__data_size - Return dso data size
- * @dso: dso object
- * @machine: machine object
- *
- * Return: dso data size
- */
-off_t dso__data_size(struct dso *dso, struct machine *machine)
-{
-   int fd;
-
-   fd = dso__data_fd(dso, machine);
-   if (fd < 0)
-   return fd;
-
-   if (data_file_size(dso))
-   return -1;
-
-   /* For now just estimate dso data size is close to file size */
-   return dso->data.file_size;
-}
-
 static ssize_t data_read_offset(struct dso *dso, u64 offset,
u8 *data, ssize_t size)
 {
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index acb651a..bd99f25 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -184,7 +184,6 @@ int dso__read_binary_type_filename(const struct dso *dso, 
enum dso_binary_type t
  * The dso__data_* external interface provides following functions:
  *   dso__data_fd
  *   dso__data_close
- *   dso__data_size
  *   dso__data_read_offset
  *   dso__data_read_addr
  *
@@ -222,13 +221,11 @@ int dso__read_binary_type_filename(const struct dso *dso, 
enum dso_binary_type t
 int dso__data_fd(struct dso *dso, struct machine *machine);
 void dso__data_close(struct dso *dso);
 
-off_t dso__data_size(struct dso *dso, struct machine *machine);
 ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
  u64 offset, u8 *data, ssize_t size);
 ssize_t dso__data_read_addr(struct dso *dso, struct map *map,
struct machine *machine, u64 addr,
u8 *data, ssize_t size);
-bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by);
 
 struct map *dso__new_map(const char *name);
 struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
-- 
1.7.10.4

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


[PATCH] firewire: ohci: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function ar_prev_buffer_index() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/firewire/ohci.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index a66a321..9662daa 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -719,11 +719,6 @@ static inline unsigned int ar_next_buffer_index(unsigned 
int index)
return (index + 1) % AR_BUFFERS;
 }
 
-static inline unsigned int ar_prev_buffer_index(unsigned int index)
-{
-   return (index - 1 + AR_BUFFERS) % AR_BUFFERS;
-}
-
 static inline unsigned int ar_first_buffer_index(struct ar_context *ctx)
 {
return ar_next_buffer_index(ctx->last_buffer_index);
-- 
1.7.10.4

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


[patch] mm: memcontrol: track move_lock state internally

2015-01-02 Thread Johannes Weiner
The complexity of memcg page stat synchronization is currently leaking
into the callsites, forcing them to keep track of the move_lock state
and the IRQ flags.  Simplify the API by tracking it in the memcg.

Signed-off-by: Johannes Weiner 
---
 include/linux/memcontrol.h |  6 ++--
 mm/memcontrol.c| 68 ++
 mm/page-writeback.c| 12 +++-
 mm/rmap.c  | 12 +++-
 4 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index fb212e1d700d..04d3c2028782 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -138,12 +138,10 @@ static inline bool mem_cgroup_disabled(void)
return false;
 }
 
-struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked,
- unsigned long *flags);
-void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool *locked,
- unsigned long *flags);
+struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page);
 void mem_cgroup_update_page_stat(struct mem_cgroup *memcg,
 enum mem_cgroup_stat_index idx, int val);
+void mem_cgroup_end_page_stat(struct mem_cgroup *memcg);
 
 static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
enum mem_cgroup_stat_index idx)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a855848627a5..eccc0ed3b6f3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -325,9 +325,11 @@ struct mem_cgroup {
/*
 * set > 0 if pages under this cgroup are moving to other cgroup.
 */
-   atomic_tmoving_account;
+   atomic_tmoving_account;
/* taken only while moving_account > 0 */
-   spinlock_t  move_lock;
+   spinlock_t  move_lock;
+   struct task_struct  *move_lock_task;
+   unsigned long   move_lock_flags;
/*
 * percpu counter.
 */
@@ -1977,34 +1979,33 @@ cleanup:
 /**
  * mem_cgroup_begin_page_stat - begin a page state statistics transaction
  * @page: page that is going to change accounted state
- * @locked: &memcg->move_lock slowpath was taken
- * @flags: IRQ-state flags for &memcg->move_lock
  *
  * This function must mark the beginning of an accounted page state
  * change to prevent double accounting when the page is concurrently
  * being moved to another memcg:
  *
- *   memcg = mem_cgroup_begin_page_stat(page, &locked, &flags);
+ *   memcg = mem_cgroup_begin_page_stat(page);
  *   if (TestClearPageState(page))
  * mem_cgroup_update_page_stat(memcg, state, -1);
- *   mem_cgroup_end_page_stat(memcg, locked, flags);
- *
- * The RCU lock is held throughout the transaction.  The fast path can
- * get away without acquiring the memcg->move_lock (@locked is false)
- * because page moving starts with an RCU grace period.
- *
- * The RCU lock also protects the memcg from being freed when the page
- * state that is going to change is the only thing preventing the page
- * from being uncharged.  E.g. end-writeback clearing PageWriteback(),
- * which allows migration to go ahead and uncharge the page before the
- * account transaction might be complete.
+ *   mem_cgroup_end_page_stat(memcg);
  */
-struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page,
- bool *locked,
- unsigned long *flags)
+struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page)
 {
struct mem_cgroup *memcg;
+   unsigned long flags;
 
+   /*
+* The RCU lock is held throughout the transaction.  The fast
+* path can get away without acquiring the memcg->move_lock
+* because page moving starts with an RCU grace period.
+*
+* The RCU lock also protects the memcg from being freed when
+* the page state that is going to change is the only thing
+* preventing the page from being uncharged.
+* E.g. end-writeback clearing PageWriteback(), which allows
+* migration to go ahead and uncharge the page before the
+* account transaction might be complete.
+*/
rcu_read_lock();
 
if (mem_cgroup_disabled())
@@ -2014,16 +2015,22 @@ again:
if (unlikely(!memcg))
return NULL;
 
-   *locked = false;
if (atomic_read(&memcg->moving_account) <= 0)
return memcg;
 
-   spin_lock_irqsave(&memcg->move_lock, *flags);
+   spin_lock_irqsave(&memcg->move_lock, flags);
if (memcg != page->mem_cgroup) {
-   spin_unlock_irqrestore(&memcg->move_lock, *flags);
+   spin_unlock_irqrestore(&memcg->move_lock, flags);
goto again;
}
-   *locked = true;
+
+   /*
+* When charge migration first begins, we can have locke

[PATCH] acpi: acpica: utstate: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function acpi_ut_create_pkg_state_and_push() that is not used 
anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/acpi/acpica/acutils.h |8 
 drivers/acpi/acpica/utstate.c |   33 -
 2 files changed, 41 deletions(-)

diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 486d342..ef2ad3c 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -539,14 +539,6 @@ acpi_ut_create_update_state_and_push(union 
acpi_operand_object *object,
 u16 action,
 union acpi_generic_state **state_list);
 
-#ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_ut_create_pkg_state_and_push(void *internal_object,
- void *external_object,
- u16 index,
- union acpi_generic_state **state_list);
-#endif /* ACPI_FUTURE_USAGE */
-
 union acpi_generic_state *acpi_ut_create_control_state(void);
 
 void acpi_ut_delete_generic_state(union acpi_generic_state *state);
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index 1cc97a7..fa932e9 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -49,39 +49,6 @@ ACPI_MODULE_NAME("utstate")
 
 
/***
  *
- * FUNCTION:acpi_ut_create_pkg_state_and_push
- *
- * PARAMETERS:  object  - Object to be added to the new state
- *  action  - Increment/Decrement
- *  state_list  - List the state will be added to
- *
- * RETURN:  Status
- *
- * DESCRIPTION: Create a new state and push it
- *
- 
**/
-acpi_status
-acpi_ut_create_pkg_state_and_push(void *internal_object,
- void *external_object,
- u16 index,
- union acpi_generic_state **state_list)
-{
-   union acpi_generic_state *state;
-
-   ACPI_FUNCTION_ENTRY();
-
-   state =
-   acpi_ut_create_pkg_state(internal_object, external_object, index);
-   if (!state) {
-   return (AE_NO_MEMORY);
-   }
-
-   acpi_ut_push_generic_state(state_list, state);
-   return (AE_OK);
-}
-
-/***
- *
  * FUNCTION:acpi_ut_push_generic_state
  *
  * PARAMETERS:  list_head   - Head of the state stack
-- 
1.7.10.4

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


Re: [PATCH v10 0/4] This suspend patch is only support cut off the power of cpu and some external

2015-01-02 Thread Heiko Stübner
Am Montag, 1. Dezember 2014, 16:52:16 schrieb Chris Zhong:
> devices, since we still lack power_domain driver, so the other power rail
> of rk3288 need keep power on.
> I have tested it on rk3288-evb board, atop next-20141112. goto suspend by
> type "echo mem > /sys/power/state", vdd_cpu is about 0mv by measuring, so
> it can be determined in sleep mode, then press power button to wakeup it.

I've tested this series again on 3.19-rc1. It still sucessfully suspends and 
wakes a rk3288-evb-rk808 system on power-key presses.
[except the sdmmc detect interrupt going off when a card is inserted on 
suspend]

So I've applied this series to appropriate soc and dts branches for 3.20


Heiko
--
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] of/pci: add of_pci_dma_configure() update dma configuration

2015-01-02 Thread Arnd Bergmann
On Friday 02 January 2015 12:20:53 Murali Karicheri wrote:
> Initially I had the same idea to re-use the existing function 
> of_dma_configure() for this. I wanted to defer this until we have an 
> agreement on the changes required for the subject functionality. My 
> quick review of the code suggestio this would require additional API 
> changes as below. I did a quick test of the changes and it works for 
> Keystone, but need to be reviewed by everyone as I touch the IOMMU 
> functionality here and I don't have a platform with IOMMU. Need test by 
> someone to make sure I don't break anything.
> 
> Here are the changes required to implement this suggestion.
> 
> 1. Move the of_dma_configure() to drivers/of/device.c (include the API 
> in of_device.h) and make it global (using proper EXPORT macro). 
> Otherwise, we will have to include of_platform.h in drivers/of/of_pci.c 
> assuming the prototype is defined in of_platform.h which doesn't look 
> appropriate to me. Would require following additional include files in 
> drivers/of/device.c as well.
> 
> +#include 
> +#include 
> +#include 

Yes, sounds good.

> 2. drivers/iommu/of_iommu.c. This is needed so that of_iommu_configure() 
> can take confuguration from the root bus DT as you have suggested.
> 
> -struct iommu_ops *of_iommu_configure(struct device *dev)
> +struct iommu_ops *of_iommu_configure(struct device *dev, struct 
> device_node *node)
>   {
>  struct of_phandle_args iommu_spec;
>  struct device_node *np;
> @@ -145,7 +145,7 @@ struct iommu_ops *of_iommu_configure(struct device *dev)
>   * See the `Notes:' section of
>   * Documentation/devicetree/bindings/iommu/iommu.txt
>   */
> -   while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> +   while (!of_parse_phandle_with_args(node, "iommus",
> "#iommu-cells", idx,
> &iommu_spec)) {

Right.

> 3. drivers/of/of_pci.c. The existing function (added in this patch) will 
> make call to of_dma_configure() as
> 
> parent_np = of_get_pci_root_bridge_parent(pci_dev);
> of_dma_configure(dev, parent_np);

With dev = &pci_dev->dev, I assume?

> 4. drivers/of/platform.c. Add a wrapper function 
> of_platform_dma_configure() that calls of_dma_configure() as
> of_dma_configure(dev, dev->of_node). All existing calls converted to 
> this wrapper.

There are only two callers, I don't think we need a wrapper for it,
just change the calling conventions along with step 2.

> If the above looks good, I can post v3 of the patch with these changes.

With that one minor change, sounds perfect to me. The same can also
be used by other bus types if we ever need it.

Arnd
--
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] gpu: drm: armada: armada_output: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
armada_drm_encoder_mode_fixup() armada_drm_encoder_commit() 
armada_drm_encoder_prepare()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/armada/armada_output.c |   16 
 drivers/gpu/drm/armada/armada_output.h |6 --
 2 files changed, 22 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_output.c 
b/drivers/gpu/drm/armada/armada_output.c
index abbc309..5a98231 100644
--- a/drivers/gpu/drm/armada/armada_output.c
+++ b/drivers/gpu/drm/armada/armada_output.c
@@ -72,22 +72,6 @@ static const struct drm_connector_funcs 
armada_drm_conn_funcs = {
.set_property   = armada_drm_connector_set_property,
 };
 
-void armada_drm_encoder_prepare(struct drm_encoder *encoder)
-{
-   encoder_helper_funcs(encoder)->dpms(encoder, DRM_MODE_DPMS_OFF);
-}
-
-void armada_drm_encoder_commit(struct drm_encoder *encoder)
-{
-   encoder_helper_funcs(encoder)->dpms(encoder, DRM_MODE_DPMS_ON);
-}
-
-bool armada_drm_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode, struct drm_display_mode *adjusted)
-{
-   return true;
-}
-
 /* Shouldn't this be a generic helper function? */
 int armada_drm_slave_encoder_mode_valid(struct drm_connector *conn,
struct drm_display_mode *mode)
diff --git a/drivers/gpu/drm/armada/armada_output.h 
b/drivers/gpu/drm/armada/armada_output.h
index 4126d43..d3a6ce7 100644
--- a/drivers/gpu/drm/armada/armada_output.h
+++ b/drivers/gpu/drm/armada/armada_output.h
@@ -21,12 +21,6 @@ struct armada_output_type {
 
 struct drm_encoder *armada_drm_connector_encoder(struct drm_connector *conn);
 
-void armada_drm_encoder_prepare(struct drm_encoder *encoder);
-void armada_drm_encoder_commit(struct drm_encoder *encoder);
-
-bool armada_drm_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode, struct drm_display_mode *adj);
-
 int armada_drm_slave_encoder_mode_valid(struct drm_connector *conn,
struct drm_display_mode *mode);
 
-- 
1.7.10.4

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


Re: [PATCH] staging: gs_fpgaboot: io.c: Remove unused function

2015-01-02 Thread Insop Song
Reviewed-by: Insop Song 

Thank you,

ISS

On Thu, Jan 01, 2015 at 05:23:13PM +0100, Rickard Strandqvist wrote:
> Remove the function bitswap() that is not used anywhere.
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 
> ---
>  drivers/staging/gs_fpgaboot/io.c |9 -
>  1 file changed, 9 deletions(-)
> 
> diff --git a/drivers/staging/gs_fpgaboot/io.c 
> b/drivers/staging/gs_fpgaboot/io.c
> index b260e45..819db53 100644
> --- a/drivers/staging/gs_fpgaboot/io.c
> +++ b/drivers/staging/gs_fpgaboot/io.c
> @@ -79,15 +79,6 @@ void xl_shift_bytes_out(enum wbus bus_byte, unsigned char 
> *pdata)
>  /*
>   * generic bit swap for xilinx SYSTEMMAP FPGA programming
>   */
> -static inline unsigned char bitswap(unsigned char s)
> -{
> - unsigned char d;
> -
> - d = (((s&0x80)>>7) | ((s&0x40)>>5) | ((s&0x20)>>3) | ((s&0x10)>>1) |
> - ((s&0x08)<<1) | ((s&0x04)<<3) | ((s&0x02)<<5) | ((s&0x01)<<7));
> - return d;
> -}
> -
>  void xl_program_b(int32_t i)
>  {
>  }
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/2] of/pci: add of_pci_dma_configure() update dma configuration

2015-01-02 Thread Rob Herring
On Fri, Jan 2, 2015 at 11:20 AM, Murali Karicheri  wrote:
> Rob,
>
> See my response below. Arnd and Will, please review this as well.
>
> On 12/26/2014 02:33 PM, Rob Herring wrote:
>>
>> On Wed, Dec 24, 2014 at 4:11 PM, Murali Karicheri
>> wrote:
>>>
>>> Add of_pci_dma_configure() to allow updating the dma configuration
>>> of the pci device using the configuration from DT of the parent of
>>> the root bridge device.
>>>
>>> Signed-off-by: Murali Karicheri
>>> ---
>>>   drivers/of/of_pci.c|   73
>>> 
>>>   include/linux/of_pci.h |   12 
>>>   2 files changed, 85 insertions(+)
>>>

[...]

>>> +   coherent = of_dma_is_coherent(parent_np);
>>> +   dev_dbg(dev, "device is%sdma coherent\n",
>>> +   coherent ? " " : " not ");
>>> +
>>> +   arch_setup_dma_ops(dev, dma_addr, size, NULL, coherent);
>>
>>
>> This is the same code as of_dma_configure. The only difference I see
>> is which node ptr is passed to of_dma_get_range. You need to make that
>> a function param of of_dma_configure.
>>
>> of_dma_configure also has iommu handling now. You will probably need
>> something similar for PCI in that you setup an iommu based on the root
>> bus DT properties.
>>
> Initially I had the same idea to re-use the existing function
> of_dma_configure() for this. I wanted to defer this until we have an
> agreement on the changes required for the subject functionality. My quick
> review of the code suggestio this would require additional API changes as
> below. I did a quick test of the changes and it works for Keystone, but need
> to be reviewed by everyone as I touch the IOMMU functionality here and I
> don't have a platform with IOMMU. Need test by someone to make sure I don't
> break anything.

The IOMMU changes look trivial. We may want to address the comment in
of_iommu_configure about parent nodes. We should be sure these changes
work with how we would do searching parent nodes.

> Here are the changes required to implement this suggestion.
>
> 1. Move the of_dma_configure() to drivers/of/device.c (include the API in
> of_device.h) and make it global (using proper EXPORT macro). Otherwise, we
> will have to include of_platform.h in drivers/of/of_pci.c assuming the
> prototype is defined in of_platform.h which doesn't look appropriate to me.
> Would require following additional include files in drivers/of/device.c as
> well.
>
> +#include 
> +#include 
> +#include 

Okay.

> 2. drivers/iommu/of_iommu.c. This is needed so that of_iommu_configure() can
> take confuguration from the root bus DT as you have suggested.
>
> -struct iommu_ops *of_iommu_configure(struct device *dev)
> +struct iommu_ops *of_iommu_configure(struct device *dev, struct device_node
> *node)
>  {
> struct of_phandle_args iommu_spec;
> struct device_node *np;
> @@ -145,7 +145,7 @@ struct iommu_ops *of_iommu_configure(struct device *dev)
>  * See the `Notes:' section of
>  * Documentation/devicetree/bindings/iommu/iommu.txt
>  */
> -   while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> +   while (!of_parse_phandle_with_args(node, "iommus",
>"#iommu-cells", idx,
>&iommu_spec)) {
>

Seems safe enough.

> 3. drivers/of/of_pci.c. The existing function (added in this patch) will
> make call to of_dma_configure() as
>
> parent_np = of_get_pci_root_bridge_parent(pci_dev);
> of_dma_configure(dev, parent_np);

Okay.

> 4. drivers/of/platform.c. Add a wrapper function of_platform_dma_configure()
> that calls of_dma_configure() as
> of_dma_configure(dev, dev->of_node). All existing calls converted to this
> wrapper.

There's only a few callers of of_dma_configure, so I don't think this
is necessary. The only thing platform bus specific is who is calling
the function.

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


Re: [PATCH 2/3] soc: ti: Add wkup_m3_ipc driver

2015-01-02 Thread Felipe Balbi
On Fri, Jan 02, 2015 at 02:16:43PM -0600, Felipe Balbi wrote:
> On Fri, Jan 02, 2015 at 02:00:16PM -0600, Dave Gerlach wrote:
> > Introduce a wkup_m3_ipc driver to handle communication between the MPU
> > and Cortex M3 wkup_m3 present on am335x.
> > 
> > This driver is responsible for actually booting the wkup_m3_rproc and
> > also handling all IPC which is done using the IPC registers in the control
> > module, a mailbox, and a separate interrupt back from the wkup_m3. A small
> > API is exposed for executing specific power commands, which include
> > configuring for low power mode, request a transition to a low power mode,
> > and status info on a previous transition.

another comment is that no user of such API is provided, so it's very
difficult to verify that there's no other way of implementing this.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] media: platform: s5p-jpeg: jpeg-hw-exynos4: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
exynos4_jpeg_set_timer_count() exynos4_jpeg_get_frame_size() 
exynos4_jpeg_set_sys_int_enable() exynos4_jpeg_get_fifo_status()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c |   35 -
 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h |5 ---
 2 files changed, 40 deletions(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c 
b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
index ab6d6f4..5685577 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c
@@ -163,15 +163,6 @@ unsigned int exynos4_jpeg_get_int_status(void __iomem 
*base)
return int_status;
 }
 
-unsigned int exynos4_jpeg_get_fifo_status(void __iomem *base)
-{
-   unsigned int fifo_status;
-
-   fifo_status = readl(base + EXYNOS4_FIFO_STATUS_REG);
-
-   return fifo_status;
-}
-
 void exynos4_jpeg_set_huf_table_enable(void __iomem *base, int value)
 {
unsigned intreg;
@@ -186,18 +177,6 @@ void exynos4_jpeg_set_huf_table_enable(void __iomem *base, 
int value)
base + EXYNOS4_JPEG_CNTL_REG);
 }
 
-void exynos4_jpeg_set_sys_int_enable(void __iomem *base, int value)
-{
-   unsigned intreg;
-
-   reg = readl(base + EXYNOS4_JPEG_CNTL_REG) & ~(EXYNOS4_SYS_INT_EN);
-
-   if (value == 1)
-   writel(reg | EXYNOS4_SYS_INT_EN, base + EXYNOS4_JPEG_CNTL_REG);
-   else
-   writel(reg & ~EXYNOS4_SYS_INT_EN, base + EXYNOS4_JPEG_CNTL_REG);
-}
-
 void exynos4_jpeg_set_stream_buf_address(void __iomem *base,
 unsigned int address)
 {
@@ -255,22 +234,8 @@ void exynos4_jpeg_set_dec_bitstream_size(void __iomem 
*base, unsigned int size)
writel(size, base + EXYNOS4_BITSTREAM_SIZE_REG);
 }
 
-void exynos4_jpeg_get_frame_size(void __iomem *base,
-   unsigned int *width, unsigned int *height)
-{
-   *width = (readl(base + EXYNOS4_DECODE_XY_SIZE_REG) &
-   EXYNOS4_DECODED_SIZE_MASK);
-   *height = (readl(base + EXYNOS4_DECODE_XY_SIZE_REG) >> 16) &
-   EXYNOS4_DECODED_SIZE_MASK;
-}
-
 unsigned int exynos4_jpeg_get_frame_fmt(void __iomem *base)
 {
return readl(base + EXYNOS4_DECODE_IMG_FMT_REG) &
EXYNOS4_JPEG_DECODED_IMG_FMT_MASK;
 }
-
-void exynos4_jpeg_set_timer_count(void __iomem *base, unsigned int size)
-{
-   writel(size, base + EXYNOS4_INT_TIMER_COUNT_REG);
-}
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h 
b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h
index c228d28..19690e4 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h
+++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.h
@@ -21,7 +21,6 @@ void exynos4_jpeg_set_enc_tbl(void __iomem *base);
 void exynos4_jpeg_set_interrupt(void __iomem *base);
 unsigned int exynos4_jpeg_get_int_status(void __iomem *base);
 void exynos4_jpeg_set_huf_table_enable(void __iomem *base, int value);
-void exynos4_jpeg_set_sys_int_enable(void __iomem *base, int value);
 void exynos4_jpeg_set_stream_buf_address(void __iomem *base,
 unsigned int address);
 void exynos4_jpeg_set_stream_size(void __iomem *base,
@@ -33,10 +32,6 @@ void exynos4_jpeg_set_encode_tbl_select(void __iomem *base,
 void exynos4_jpeg_set_encode_hoff_cnt(void __iomem *base, unsigned int fmt);
 void exynos4_jpeg_set_dec_bitstream_size(void __iomem *base, unsigned int 
size);
 unsigned int exynos4_jpeg_get_stream_size(void __iomem *base);
-void exynos4_jpeg_get_frame_size(void __iomem *base,
-   unsigned int *width, unsigned int *height);
 unsigned int exynos4_jpeg_get_frame_fmt(void __iomem *base);
-unsigned int exynos4_jpeg_get_fifo_status(void __iomem *base);
-void exynos4_jpeg_set_timer_count(void __iomem *base, unsigned int size);
 
 #endif /* JPEG_HW_EXYNOS4_H_ */
-- 
1.7.10.4

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


[PATCH] arch: parisc: kernel: smp: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function smp_send_start() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 arch/parisc/kernel/smp.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index ceda229..52e8597 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -230,9 +230,6 @@ send_IPI_allbutself(enum ipi_message_type op)
 inline void 
 smp_send_stop(void){ send_IPI_allbutself(IPI_CPU_STOP); }
 
-static inline void
-smp_send_start(void)   { send_IPI_allbutself(IPI_CPU_START); }
-
 void 
 smp_send_reschedule(int cpu) { send_IPI_single(cpu, IPI_RESCHEDULE); }
 
-- 
1.7.10.4

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


[PATCH] arch: x86: kernel: traps: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function conditional_cli() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 arch/x86/kernel/traps.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 0d0e922..60614b1 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -94,12 +94,6 @@ static inline void preempt_conditional_sti(struct pt_regs 
*regs)
local_irq_enable();
 }
 
-static inline void conditional_cli(struct pt_regs *regs)
-{
-   if (regs->flags & X86_EFLAGS_IF)
-   local_irq_disable();
-}
-
 static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
if (regs->flags & X86_EFLAGS_IF)
-- 
1.7.10.4

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


[PATCH] scsi: aic7xxx: aic7770: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function aic7770_find_device() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/scsi/aic7xxx/aic7770.c |   14 --
 drivers/scsi/aic7xxx/aic7xxx.h |1 -
 2 files changed, 15 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7770.c b/drivers/scsi/aic7xxx/aic7770.c
index 5000bd6..cbe10755 100644
--- a/drivers/scsi/aic7xxx/aic7770.c
+++ b/drivers/scsi/aic7xxx/aic7770.c
@@ -107,20 +107,6 @@ struct aic7770_identity aic7770_ident_table[] =
 };
 const int ahc_num_aic7770_devs = ARRAY_SIZE(aic7770_ident_table);
 
-struct aic7770_identity *
-aic7770_find_device(uint32_t id)
-{
-   struct  aic7770_identity *entry;
-   int i;
-
-   for (i = 0; i < ahc_num_aic7770_devs; i++) {
-   entry = &aic7770_ident_table[i];
-   if (entry->full_id == (id & entry->id_mask))
-   return (entry);
-   }
-   return (NULL);
-}
-
 int
 aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
 {
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index f695774..ead8924 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -1144,7 +1144,6 @@ void   ahc_pci_resume(struct 
ahc_softc *ahc);
 #endif
 
 /*** EISA/VL Front End 
/
-struct aic7770_identity *aic7770_find_device(uint32_t);
 int aic7770_config(struct ahc_softc *ahc,
struct aic7770_identity *,
u_int port);
-- 
1.7.10.4

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


[PATCH] net: ethernet: cisco: enic: enic_dev: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
enic_dev_enable2_done() enic_dev_enable2() enic_dev_deinit_done()
enic_dev_init_prov2() enic_vnic_dev_deinit()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/net/ethernet/cisco/enic/enic_dev.c |   56 
 drivers/net/ethernet/cisco/enic/enic_dev.h |5 ---
 2 files changed, 61 deletions(-)

diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.c 
b/drivers/net/ethernet/cisco/enic/enic_dev.c
index 87ddc44..f8d2a6a 100644
--- a/drivers/net/ethernet/cisco/enic/enic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/enic_dev.c
@@ -177,40 +177,6 @@ int enic_dev_intr_coal_timer_info(struct enic *enic)
return err;
 }
 
-int enic_vnic_dev_deinit(struct enic *enic)
-{
-   int err;
-
-   spin_lock_bh(&enic->devcmd_lock);
-   err = vnic_dev_deinit(enic->vdev);
-   spin_unlock_bh(&enic->devcmd_lock);
-
-   return err;
-}
-
-int enic_dev_init_prov2(struct enic *enic, struct vic_provinfo *vp)
-{
-   int err;
-
-   spin_lock_bh(&enic->devcmd_lock);
-   err = vnic_dev_init_prov2(enic->vdev,
-   (u8 *)vp, vic_provinfo_size(vp));
-   spin_unlock_bh(&enic->devcmd_lock);
-
-   return err;
-}
-
-int enic_dev_deinit_done(struct enic *enic, int *status)
-{
-   int err;
-
-   spin_lock_bh(&enic->devcmd_lock);
-   err = vnic_dev_deinit_done(enic->vdev, status);
-   spin_unlock_bh(&enic->devcmd_lock);
-
-   return err;
-}
-
 /* rtnl lock is held */
 int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
 {
@@ -237,28 +203,6 @@ int enic_vlan_rx_kill_vid(struct net_device *netdev, 
__be16 proto, u16 vid)
return err;
 }
 
-int enic_dev_enable2(struct enic *enic, int active)
-{
-   int err;
-
-   spin_lock_bh(&enic->devcmd_lock);
-   err = vnic_dev_enable2(enic->vdev, active);
-   spin_unlock_bh(&enic->devcmd_lock);
-
-   return err;
-}
-
-int enic_dev_enable2_done(struct enic *enic, int *status)
-{
-   int err;
-
-   spin_lock_bh(&enic->devcmd_lock);
-   err = vnic_dev_enable2_done(enic->vdev, status);
-   spin_unlock_bh(&enic->devcmd_lock);
-
-   return err;
-}
-
 int enic_dev_status_to_errno(int devcmd_status)
 {
switch (devcmd_status) {
diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.h 
b/drivers/net/ethernet/cisco/enic/enic_dev.h
index 10bb970..f5bb058 100644
--- a/drivers/net/ethernet/cisco/enic/enic_dev.h
+++ b/drivers/net/ethernet/cisco/enic/enic_dev.h
@@ -55,11 +55,6 @@ int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
 int enic_dev_enable(struct enic *enic);
 int enic_dev_disable(struct enic *enic);
 int enic_dev_intr_coal_timer_info(struct enic *enic);
-int enic_vnic_dev_deinit(struct enic *enic);
-int enic_dev_init_prov2(struct enic *enic, struct vic_provinfo *vp);
-int enic_dev_deinit_done(struct enic *enic, int *status);
-int enic_dev_enable2(struct enic *enic, int arg);
-int enic_dev_enable2_done(struct enic *enic, int *status);
 int enic_dev_status_to_errno(int devcmd_status);
 
 #endif /* _ENIC_DEV_H_ */
-- 
1.7.10.4

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


[PATCH] net: wireless: rtlwifi: btcoexist: halbtc8821a2ant: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
ex_halbtc8821a2ant_periodical() ex_halbtc8821a2ant_halt_notify()
ex_halbtc8821a2ant_bt_info_notify()
ex_halbtc8821a2ant_special_packet_notify()
ex_halbtc8821a2ant_connect_notify() ex_halbtc8821a2ant_scan_notify()
ex_halbtc8821a2ant_lps_notify() ex_halbtc8821a2ant_ips_notify()
ex_halbtc8821a2ant_display_coex_info() ex_halbtc8821a2ant_init_coex_dm()
ex_halbtc8821a2ant_init_hwconfig()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 .../wireless/rtlwifi/btcoexist/halbtc8821a2ant.c   |  548 
 .../wireless/rtlwifi/btcoexist/halbtc8821a2ant.h   |   51 --
 2 files changed, 599 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c 
b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c
index cf819f0..7d7b81d 100644
--- a/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3290,346 +3290,6 @@ static void 
halbtc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
  * extern function start with EXhalbtc8821a2ant_
  *
  */
-void ex_halbtc8821a2ant_init_hwconfig(struct btc_coexist *btcoexist)
-{
-   u8 u1tmp = 0;
-
-   BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
- "[BTCoex], 2Ant Init HW Config!!\n");
-
-   /* backup rf 0x1e value */
-   coex_dm->bt_rf0x1e_backup =
-   btcoexist->btc_get_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xf);
-
-   /* 0x790[5:0] = 0x5 */
-   u1tmp = btcoexist->btc_read_1byte(btcoexist, 0x790);
-   u1tmp &= 0xc0;
-   u1tmp |= 0x5;
-   btcoexist->btc_write_1byte(btcoexist, 0x790, u1tmp);
-
-   /*Antenna config */
-   halbtc8821a2ant_set_ant_path(btcoexist,
-BTC_ANT_WIFI_AT_MAIN, true, false);
-
-   /* PTA parameter */
-   halbtc8821a2ant_coex_table(btcoexist,
-  FORCE_EXEC, 0x, 0x,
-  0x, 0x3);
-
-   /* Enable counter statistics */
-   /*0x76e[3] = 1, WLAN_Act control by PTA*/
-   btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
-   btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
-   btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
-}
-
-void
-ex_halbtc8821a2ant_init_coex_dm(
-   struct btc_coexist *btcoexist
-   )
-{
-   BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT,
- "[BTCoex], Coex Mechanism Init!!\n");
-
-   halbtc8821a2ant_init_coex_dm(btcoexist);
-}
-
-void
-ex_halbtc8821a2ant_display_coex_info(
-   struct btc_coexist *btcoexist
-   )
-{
-   struct btc_board_info *board_info = &btcoexist->board_info;
-   struct btc_stack_info *stack_info = &btcoexist->stack_info;
-   struct rtl_priv *rtlpriv = btcoexist->adapter;
-   u8 u1tmp[4], i, bt_info_ext, ps_tdma_case = 0;
-   u32 u4tmp[4];
-   bool roam = false, scan = false, link = false, wifi_under_5g = false;
-   bool bt_hs_on = false, wifi_busy = false;
-   long wifi_rssi = 0, bt_hs_rssi = 0;
-   u32 wifi_bw, wifi_traffic_dir;
-   u8 wifi_dot_11_chnl, wifi_hs_chnl;
-   u32 fw_ver = 0, bt_patch_ver = 0;
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-  "\r\n [BT Coexist info]");
-
-   if (!board_info->bt_exist) {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n BT not exists 
!!!");
-   return;
-   }
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-  "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:",
-  board_info->pg_ant_num, board_info->btdm_ant_num);
-
-   if (btcoexist->manual_control) {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-  "\r\n %-35s", "[Action Manual control]!!");
-   }
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-  "\r\n %-35s = %s / %d", "BT stack/ hci ext ver",
-  ((stack_info->profile_notified) ? "Yes" : "No"),
-  stack_info->hci_version);
-
-   btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER, &bt_patch_ver);
-   btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-  "\r\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)",
-  "CoexVer/ FwVer/ PatchVer",
-  glcoex_ver_date_8821a_2ant, glcoex_ver_8821a_2ant,
-  fw_ver, bt_patch_ver, bt_patch_ver);
-
-   btcoexist->btc_get(btcoexist,
-   BTC_GET_BL_HS_OPERATION, &bt_hs_on);
-   btcoexist->btc_get(btcoexist,
-   BTC_GET_U1_WIFI_DOT11_CHNL, &wifi_dot_11_chnl);
-   btcoexist->btc_get(btcoexist,
-   BTC_GET_U1_WIFI_HS_CHNL, &wifi_hs_chnl);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG

Re: [PATCH 2/3] soc: ti: Add wkup_m3_ipc driver

2015-01-02 Thread Felipe Balbi
On Fri, Jan 02, 2015 at 02:00:16PM -0600, Dave Gerlach wrote:
> Introduce a wkup_m3_ipc driver to handle communication between the MPU
> and Cortex M3 wkup_m3 present on am335x.
> 
> This driver is responsible for actually booting the wkup_m3_rproc and
> also handling all IPC which is done using the IPC registers in the control
> module, a mailbox, and a separate interrupt back from the wkup_m3. A small
> API is exposed for executing specific power commands, which include
> configuring for low power mode, request a transition to a low power mode,
> and status info on a previous transition.
> 
> Signed-off-by: Dave Gerlach 
> ---
>  drivers/soc/ti/Kconfig   |  11 ++
>  drivers/soc/ti/Makefile  |   1 +
>  drivers/soc/ti/wkup_m3_ipc.c | 451 
> +++
>  include/linux/wkup_m3_ipc.h  |  33 
>  4 files changed, 496 insertions(+)
>  create mode 100644 drivers/soc/ti/wkup_m3_ipc.c
>  create mode 100644 include/linux/wkup_m3_ipc.h
> 
> diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
> index 7266b21..61cda85 100644
> --- a/drivers/soc/ti/Kconfig
> +++ b/drivers/soc/ti/Kconfig
> @@ -28,4 +28,15 @@ config KEYSTONE_NAVIGATOR_DMA
>  
> If unsure, say N.
>  
> +config WKUP_M3_IPC
> + bool "TI AM33XX Wkup-M3 IPC Driver"

tristate ?

> + depends on WKUP_M3_RPROC
> + select MAILBOX
> + select OMAP2PLUS_MBOX

selects are usually frowned upon.

> + help
> +   TI AM33XX has a Cortex M3 to handle low power transitions. This IPC
> +   driver provides the necessary API to communicate and use the wkup m3
> +   for PM features like Suspend/Resume and boots the wkup_m3 using
> +   wkup_m3_rproc driver.
> +
>  endif # SOC_TI
> diff --git a/drivers/soc/ti/Makefile b/drivers/soc/ti/Makefile
> index 6bed611..b6b8c8b 100644
> --- a/drivers/soc/ti/Makefile
> +++ b/drivers/soc/ti/Makefile
> @@ -3,3 +3,4 @@
>  #
>  obj-$(CONFIG_KEYSTONE_NAVIGATOR_QMSS)+= knav_qmss_queue.o 
> knav_qmss_acc.o
>  obj-$(CONFIG_KEYSTONE_NAVIGATOR_DMA) += knav_dma.o
> +obj-$(CONFIG_WKUP_M3_IPC)+= wkup_m3_ipc.o
> diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c
> new file mode 100644
> index 000..4dcf748
> --- /dev/null
> +++ b/drivers/soc/ti/wkup_m3_ipc.c
> @@ -0,0 +1,451 @@
> +/*
> + * AMx3 Wkup M3 IPC driver
> + *
> + * Copyright (C) 2014 Texas Instruments, Inc.
> + *
> + * Dave Gerlach 
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define AM33XX_CTRL_IPC_REG_COUNT0x8
> +#define AM33XX_CTRL_IPC_REG_OFFSET(m)(0x4 + 4 * (m))
> +
> +/* AM33XX M3_TXEV_EOI register */
> +#define AM33XX_CONTROL_M3_TXEV_EOI   0x00
> +
> +#define AM33XX_M3_TXEV_ACK   (0x1 << 0)
> +#define AM33XX_M3_TXEV_ENABLE(0x0 << 0)
> +
> +#define IPC_CMD_DS0  0x4
> +#define IPC_CMD_STANDBY  0xc
> +#define IPC_CMD_RESET0xe
> +#define DS_IPC_DEFAULT   0x
> +#define M3_VERSION_UNKNOWN   0x
> +#define M3_BASELINE_VERSION  0x187
> +#define M3_STATUS_RESP_MASK  (0x << 16)
> +#define M3_FW_VERSION_MASK   0x
> +
> +#define M3_STATE_UNKNOWN 0
> +#define M3_STATE_RESET   1
> +#define M3_STATE_INITED  2
> +#define M3_STATE_MSG_FOR_LP  3
> +#define M3_STATE_MSG_FOR_RESET   4
> +
> +struct wkup_m3_ipc {
> + struct rproc *rproc;
> +
> + void __iomem *ipc_mem_base;
> + struct device *dev;
> +
> + int mem_type;
> + unsigned long resume_addr;
> + int state;
> +
> + struct mbox_client mbox_client;
> + struct mbox_chan *mbox;
> +};
> +
> +static struct wkup_m3_ipc m3_ipc_state;
> +
> +static DECLARE_COMPLETION(m3_ipc_sync);

either move this inside struct wkup_m3_ipc or make this
DECLARE_COMPLETION_ONSTACK();

> +
> +static inline void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc)
> +{
> + writel(AM33XX_M3_TXEV_ACK,
> +m3_ipc->ipc_mem_base + AM33XX_CONTROL_M3_TXEV_EOI);
> +}
> +
> +static inline void am33xx_txev_enable(struct wkup_m3_ipc *m3_ipc)
> +{
> + writel(AM33XX_M3_TXEV_ENABLE,
> +m3_ipc->ipc_mem_base + AM33XX_CONTROL_M3_TXEV_EOI);
> +}
> +
> +static inline void wkup_m3_ctrl_ipc_write(struct wkup_m3_ipc *m3_ipc,
> +   u32 val,

Re: [PATCHv5 0/2] INPUT: Route keyboard LEDs through the generic LEDs layer

2015-01-02 Thread Samuel Thibault
Pavel Machek, le Fri 02 Jan 2015 20:53:51 +0100, a écrit :
> input4::capsl/trigger was none by default, that can't be right, right?

Indeed. And I don't see how it can be that way, since the input4::capsl
LED and the input4-capsl trigger get initialized at the same time in
input_led_connect... (and the order does not matter since both will
try to connect to the other on registration).

> I tried putting kbd-capslock and input4-capsl there, but that did not
> seem to help.

That should have.

> It works with heartbeat trigger, but not with input4-numl
> trigger.

It should have worked with input4-numl too.

> vt::capsl/brightness controls capslock led, even when
> input4-capsl/trigger is set to input4-numl.

It shouldn't.

> Confused,

I guess I'm even more.  I had tested everything that you have described,
without any issue, on both an internal laptop keyboard and an external
USB keyboard, and have tested again just now, with the same success.

Which hardware setup do you have, more precisely?

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


Re: [PATCH 3/3] remoteproc: wkup_m3: Add wkup_m3 remote proc driver

2015-01-02 Thread Felipe Balbi
On Fri, Jan 02, 2015 at 01:51:59PM -0600, Dave Gerlach wrote:
> Add a remoteproc driver to load the firmware for and boot the wkup_m3
> present on am33xx. The wkup_m3 is an integrated Cortex M3 that allows
> the SoC to enter the lowest possible power state by taking control from
> the MPU after it has gone into its own low power state and shutting off
> any additional peripherals.
> 
> The driver expects a resource table to be present in the wkup_m3
> firmware to define the required memory resources needed by the wkup_m3,
> at least the data memory so that the firmware can be copied to the proper
> place for execution.
> 
> Signed-off-by: Dave Gerlach 
> ---
>  drivers/remoteproc/Kconfig |  12 +++
>  drivers/remoteproc/Makefile|   1 +
>  drivers/remoteproc/wkup_m3_rproc.c | 175 
> +
>  3 files changed, 188 insertions(+)
>  create mode 100644 drivers/remoteproc/wkup_m3_rproc.c
> 
> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> index 5e343ba..7fbdb53 100644
> --- a/drivers/remoteproc/Kconfig
> +++ b/drivers/remoteproc/Kconfig
> @@ -41,6 +41,18 @@ config STE_MODEM_RPROC
> This can be either built-in or a loadable module.
> If unsure say N.
>  
> +config WKUP_M3_RPROC
> + bool "AM33xx wkup-m3 remoteproc support"

it would be nicer if this could be a loadable module.

> + depends on SOC_AM33XX
> + select REMOTEPROC
> + help
> +   Say y here to support AM33xx wkup-m3.
> +
> +   Required for Suspend-to-ram and CPUIdle on AM33xx. Allows for
> +   loading of firmware of CM3 PM coprocessor that is present
> +   on AM33xx family of SoCs
> +   If unsure say N.
> +
>  config DA8XX_REMOTEPROC
>   tristate "DA8xx/OMAP-L13x remoteproc support"
>   depends on ARCH_DAVINCI_DA8XX
> diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> index ac2ff75..81b04d1 100644
> --- a/drivers/remoteproc/Makefile
> +++ b/drivers/remoteproc/Makefile
> @@ -9,4 +9,5 @@ remoteproc-y  += remoteproc_virtio.o
>  remoteproc-y += remoteproc_elf_loader.o
>  obj-$(CONFIG_OMAP_REMOTEPROC)+= omap_remoteproc.o
>  obj-$(CONFIG_STE_MODEM_RPROC)+= ste_modem_rproc.o
> +obj-$(CONFIG_WKUP_M3_RPROC)  += wkup_m3_rproc.o
>  obj-$(CONFIG_DA8XX_REMOTEPROC)   += da8xx_remoteproc.o
> diff --git a/drivers/remoteproc/wkup_m3_rproc.c 
> b/drivers/remoteproc/wkup_m3_rproc.c
> new file mode 100644
> index 000..8686ca2
> --- /dev/null
> +++ b/drivers/remoteproc/wkup_m3_rproc.c
> @@ -0,0 +1,175 @@
> +/*
> + * AMx3 Wkup M3 Remote Processor driver
> + *
> + * Copyright (C) 2014 Texas Instruments, Inc.
> + *
> + * Dave Gerlach 
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include "remoteproc_internal.h"
> +
> +struct wkup_m3_rproc {
> + struct rproc *rproc;
> + struct platform_device *pdev;
> +};
> +
> +static int wkup_m3_rproc_start(struct rproc *rproc)
> +{
> + struct wkup_m3_rproc *m3_rproc = rproc->priv;
> + struct platform_device *pdev = m3_rproc->pdev;
> + struct device *dev = &pdev->dev;
> + struct wkup_m3_platform_data *pdata = dev->platform_data;
> + int ret;
> +
> + ret = pdata->deassert_reset(pdev, pdata->reset_name);

looks like here you should assert, wait, deassert. What if soemthing
else used wkup_m3 before this loads ?

> + if (ret) {
> + dev_err(dev, "Unable to reset wkup_m3!\n");
> + return -ENODEV;
> + }
> +
> + return 0;
> +}
> +
> +static int wkup_m3_rproc_stop(struct rproc *rproc)
> +{
> + struct wkup_m3_rproc *m3_rproc = rproc->priv;
> + struct platform_device *pdev = m3_rproc->pdev;
> + struct device *dev = &pdev->dev;
> + struct wkup_m3_platform_data *pdata = dev->platform_data;
> + int ret;
> +
> + ret = pdata->assert_reset(pdev, pdata->reset_name);
> + if (ret) {
> + dev_err(dev, "Unable to assert reset of wkup_m3!\n");
> + return -ENODEV;
> + }
> + return 0;
> +}
> +
> +static struct rproc_ops wkup_m3_rproc_ops = {
> + .start  = wkup_m3_rproc_start,
> + .stop   = wkup_m3_rproc_stop,
> +};
> +
> +static const struct of_device_id wkup_m3_rproc_of_match[] = {
> + {
> + .compatible = "ti,am3353-wkup-m3",
> + .data = (void *)"am335x-pm-firmware.elf",

do you know of anyb

[PATCH 3/3] ARM: dts: am33xx: Add wkup_m3_ipc node

2015-01-02 Thread Dave Gerlach
Add wkup_m3_ipc node for wkup_m3_ipc driver.

Signed-off-by: Dave Gerlach 
---
 arch/arm/boot/dts/am33xx.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index acd3705..1ebb230 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -863,6 +863,15 @@
reg = <0x4831 0x2000>;
interrupts = <111>;
};
+
+   wkup_m3_ipc: wkup_m3_ipc@44e11324 {
+   compatible = "ti,am3353-wkup-m3-ipc";
+   reg = <0x44e11324 0x0024>;
+   reg-names = "ipc_regs";
+   interrupts = <78>;
+   ti,rproc = <&wkup_m3>;
+   mboxes = <&mailbox &mbox_wkupm3>;
+   };
};
 };
 
-- 
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 2/3] soc: ti: Add wkup_m3_ipc driver

2015-01-02 Thread Dave Gerlach
Introduce a wkup_m3_ipc driver to handle communication between the MPU
and Cortex M3 wkup_m3 present on am335x.

This driver is responsible for actually booting the wkup_m3_rproc and
also handling all IPC which is done using the IPC registers in the control
module, a mailbox, and a separate interrupt back from the wkup_m3. A small
API is exposed for executing specific power commands, which include
configuring for low power mode, request a transition to a low power mode,
and status info on a previous transition.

Signed-off-by: Dave Gerlach 
---
 drivers/soc/ti/Kconfig   |  11 ++
 drivers/soc/ti/Makefile  |   1 +
 drivers/soc/ti/wkup_m3_ipc.c | 451 +++
 include/linux/wkup_m3_ipc.h  |  33 
 4 files changed, 496 insertions(+)
 create mode 100644 drivers/soc/ti/wkup_m3_ipc.c
 create mode 100644 include/linux/wkup_m3_ipc.h

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index 7266b21..61cda85 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -28,4 +28,15 @@ config KEYSTONE_NAVIGATOR_DMA
 
  If unsure, say N.
 
+config WKUP_M3_IPC
+   bool "TI AM33XX Wkup-M3 IPC Driver"
+   depends on WKUP_M3_RPROC
+   select MAILBOX
+   select OMAP2PLUS_MBOX
+   help
+ TI AM33XX has a Cortex M3 to handle low power transitions. This IPC
+ driver provides the necessary API to communicate and use the wkup m3
+ for PM features like Suspend/Resume and boots the wkup_m3 using
+ wkup_m3_rproc driver.
+
 endif # SOC_TI
diff --git a/drivers/soc/ti/Makefile b/drivers/soc/ti/Makefile
index 6bed611..b6b8c8b 100644
--- a/drivers/soc/ti/Makefile
+++ b/drivers/soc/ti/Makefile
@@ -3,3 +3,4 @@
 #
 obj-$(CONFIG_KEYSTONE_NAVIGATOR_QMSS)  += knav_qmss_queue.o knav_qmss_acc.o
 obj-$(CONFIG_KEYSTONE_NAVIGATOR_DMA)   += knav_dma.o
+obj-$(CONFIG_WKUP_M3_IPC)  += wkup_m3_ipc.o
diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c
new file mode 100644
index 000..4dcf748
--- /dev/null
+++ b/drivers/soc/ti/wkup_m3_ipc.c
@@ -0,0 +1,451 @@
+/*
+ * AMx3 Wkup M3 IPC driver
+ *
+ * Copyright (C) 2014 Texas Instruments, Inc.
+ *
+ * Dave Gerlach 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AM33XX_CTRL_IPC_REG_COUNT  0x8
+#define AM33XX_CTRL_IPC_REG_OFFSET(m)  (0x4 + 4 * (m))
+
+/* AM33XX M3_TXEV_EOI register */
+#define AM33XX_CONTROL_M3_TXEV_EOI 0x00
+
+#define AM33XX_M3_TXEV_ACK (0x1 << 0)
+#define AM33XX_M3_TXEV_ENABLE  (0x0 << 0)
+
+#define IPC_CMD_DS00x4
+#define IPC_CMD_STANDBY0xc
+#define IPC_CMD_RESET  0xe
+#define DS_IPC_DEFAULT 0x
+#define M3_VERSION_UNKNOWN 0x
+#define M3_BASELINE_VERSION0x187
+#define M3_STATUS_RESP_MASK(0x << 16)
+#define M3_FW_VERSION_MASK 0x
+
+#define M3_STATE_UNKNOWN   0
+#define M3_STATE_RESET 1
+#define M3_STATE_INITED2
+#define M3_STATE_MSG_FOR_LP3
+#define M3_STATE_MSG_FOR_RESET 4
+
+struct wkup_m3_ipc {
+   struct rproc *rproc;
+
+   void __iomem *ipc_mem_base;
+   struct device *dev;
+
+   int mem_type;
+   unsigned long resume_addr;
+   int state;
+
+   struct mbox_client mbox_client;
+   struct mbox_chan *mbox;
+};
+
+static struct wkup_m3_ipc m3_ipc_state;
+
+static DECLARE_COMPLETION(m3_ipc_sync);
+
+static inline void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc)
+{
+   writel(AM33XX_M3_TXEV_ACK,
+  m3_ipc->ipc_mem_base + AM33XX_CONTROL_M3_TXEV_EOI);
+}
+
+static inline void am33xx_txev_enable(struct wkup_m3_ipc *m3_ipc)
+{
+   writel(AM33XX_M3_TXEV_ENABLE,
+  m3_ipc->ipc_mem_base + AM33XX_CONTROL_M3_TXEV_EOI);
+}
+
+static inline void wkup_m3_ctrl_ipc_write(struct wkup_m3_ipc *m3_ipc,
+ u32 val, int ipc_reg_num)
+{
+   if (ipc_reg_num < 0 || ipc_reg_num > AM33XX_CTRL_IPC_REG_COUNT)
+   return;
+
+   writel(val, m3_ipc->ipc_mem_base +
+  AM33XX_CTRL_IPC_REG_OFFSET(ipc_reg_num));
+}
+
+static inline unsigned int wkup_m3_ctrl_ipc_read(struct wkup_m3_ipc *m3_ipc,
+int ipc_reg_num)
+{
+   if (ipc_reg_num < 0 || ipc_reg_num > AM33XX_CTRL_IPC_REG_COUNT)
+ 

[PATCH 1/3] Documentation: dt: add ti,am3353-wkup-m3-ipc bindings

2015-01-02 Thread Dave Gerlach
Add the device tree bindings document for ti,am3353-wkup-m3-ipc which
is used by the wkup_m3_ipc driver.

Signed-off-by: Dave Gerlach 
---
 .../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 41 ++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt

diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt 
b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
new file mode 100644
index 000..ceb6acf
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
@@ -0,0 +1,41 @@
+Wakeup M3 IPC Driver
+=
+
+TI AMx3 family of devices use a Cortex M3 co-processor to help with various
+low power tasks that cannot be controlled from the MPU like suspend/resume
+and certain deep C-states for CPU Idle. Once the wkup_m3_ipc driver uses the
+wkup_m3_rproc driver to boot the wkup_m3, it handles communication with the
+CM3 using IPC registers present in the SoC's control module and a mailbox.
+The wkup_m3_ipc exposes an API to allow the SoC PM code to execute specific
+PM tasks.
+
+Wkup M3 Device Node:
+
+A wkup_m3_ipc device node is used to represent a wakeup M3 IP instance within
+an SoC. The sub-mailboxes are represented as child node of this parent node.
+
+Required properties:
+
+- compatible:  Should be "ti,am3353-wkup-m3-ipc" for AM33xx SoCs
+- reg: Contains the wkup_m3 register address ranges for
+   ipc-regs.
+- reg-names:   Name for ipc-regs given above
+- interrupts:  Contains the interrupt information for the wkup_m3
+   interrupt that signals the MPU.
+- ti,rproc:Phandle to the wkup_m3 rproc node so the IPC driver
+   can boot it.
+- mboxes:  Phandles used by IPC framework to get correct mbox
+   channel for communication. Must point to appropriate
+   mbox_wkupm3 child node.
+
+Example:
+
+/* AM33xx */
+wkup_m3_ipc: wkup_m3_ipc@44e11324 {
+   compatible = "ti,am3353-wkup-m3-ipc";
+   reg = <0x44e11324 0x0024>;
+   reg-names = "ipc_regs";
+   interrupts = <78>;
+   ti,rproc = <&wkup_m3>;
+   mboxes = <&mailbox &mbox_wkupm3>;
+};
-- 
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 0/3] drivers: soc: ti: Introduce wkup_m3_ipc driver

2015-01-02 Thread Dave Gerlach
This series introduces a wkup_m3_ipc driver to handle communication
between the MPU and Cortex M3 present on TI AM335x SoCs. This is
required for much of the PM functionality for AM335x including suspend
support. This was split off from v4 of the am335x suspend series,
discussion that led to the implementation of this driver can be found
with the series here [1].  A previous RFC version of this series can be
found here [2]. The changes from that version are as follows:
 - Remove wake source reporting as it is unnecessary.
 - Use newly introduced rproc_get_by_phandle API to get rproc for
   booting [3].

This series depends on the patch "remoteproc: Introduce
rproc_get_by_phandle API" [3] and the wkup_m3_rproc series found
here [4]. A branch based on 3.19-rc1 containing this series and
all dependencies for the AM33xx suspend series can be found
here [5] for a high level view of what I am using this for.

A small API is exposed to allow the SoC PM code to execute the
specific tasks it needs to in order to enter and exit low power
modes. Communication works the same as it did in the past using the
IPC registers found within the control module, a mailbox module, and
an interrupt coming back from the CM3. All of that, including the
configurations needed for different low power tasks is encapsulated
within this driver.

Regards,
Dave

[1] http://www.spinics.net/lists/linux-omap/msg109331.html
[2] http://www.spinics.net/lists/linux-omap/msg113372.html
[3] http://marc.info/?l=linux-kernel&m=142022798923784&w=2
[4] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg795457.html
[5] https://github.com/dgerlach/linux-pm/tree/pm-am335x-v3.19-rc1

Dave Gerlach (3):
  Documentation: dt: add ti,am3353-wkup-m3-ipc bindings
  soc: ti: Add wkup_m3_ipc driver
  ARM: dts: am33xx: Add wkup_m3_ipc node

 .../devicetree/bindings/soc/ti/wkup_m3_ipc.txt |  41 ++
 arch/arm/boot/dts/am33xx.dtsi  |   9 +
 drivers/soc/ti/Kconfig |  11 +
 drivers/soc/ti/Makefile|   1 +
 drivers/soc/ti/wkup_m3_ipc.c   | 451 +
 include/linux/wkup_m3_ipc.h|  33 ++
 6 files changed, 546 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
 create mode 100644 drivers/soc/ti/wkup_m3_ipc.c
 create mode 100644 include/linux/wkup_m3_ipc.h

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


  1   2   3   4   >