Re: Re: [PATCH] perf probe: Improve error message when function not found

2013-12-26 Thread Masami Hiramatsu
(2013/12/26 22:43), David Ahern wrote:
> Masami:
> 
> If you do not have any problems with this version please Ack so Arnaldo 
> will pick it up.

David, as we talked about that before;

(2013/12/04 10:23), Masami Hiramatsu wrote:> (2013/12/04 0:15), David Ahern 
wrote:
>> On 12/2/13, 10:12 PM, Masami Hiramatsu wrote:
 That needs to be explicitly stated in the error message -- only global
 symbols may be given.
>>>
>>> Ah, I see. In that case, I think the "variable" is not a correct word,
>>> the "symbol" is better, because perf probe can take tracing variable
>>> arguments after the trace point definition. :)
>>
>> Right, variable is not the correct word. So how about this:
>>
>> "Failed to find requested symbol in %s. Is it a global symbol?"
>
> Yeah, that's good for me now :)

But your patch, still using the "variable"

>> +pr_err("Failed to find requested symbol in %s. Is it a global 
>> variable?\n",
>> +   name);

Thus, I can't give Ack for this.

Anyway, I'd like to rewrite this part since it is too limited,
after my 2 weeks off.

Thank you,

> On 12/20/13, 1:04 PM, David Ahern wrote:
>> When requesting a function from a userspace library the error message to
>> the user is less than helpful. e.g.,
>>
>>  perf probe -x /lib64/libpthread-2.14.90.so -a 
>> 'lock_full=__pthread_mutex_lock_full'
>>  no symbols found in /lib64/libpthread-2.14.90.so, maybe install a debug 
>> package?
>>  Failed to load map.
>> Error: Failed to add events. (-22)
>>
>> yet the symbol really does exist but is a local symbol which is filtered:
>>
>> nm /lib64/libpthread-2.14.90.so | grep __pthread_mutex_lock_full
>> 5700 t __pthread_mutex_lock_full
>>
>> With this patch:
>>  perf probe -x /lib64/libpthread-2.14.90.so -a 
>> 'lock_full=__pthread_mutex_lock_full'
>>
>>  no symbols found in /lib64/libpthread-2.14.90.so, maybe install a debug 
>> package?
>>  Failed to find function in /lib64/libpthread-2.14.90.so. Perhaps it is 
>> a local variable?
>>Error: Failed to add events. (-22)
>>
>> Signed-off-by: David Ahern 
>> Cc: Masami Hiramatsu 
>> Cc: Srikar Dronamraju 
>>
>> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>> index 9c6989ca2bea..2eac49096840 100644
>> --- a/tools/perf/util/probe-event.c
>> +++ b/tools/perf/util/probe-event.c
>> @@ -2309,7 +2309,8 @@ static int convert_name_to_addr(struct 
>> perf_probe_event *pev, const char *exec)
>>  }
>>  available_func_filter = strfilter__new(function, NULL);
>>  if (map__load(map, filter_available_functions)) {
>> -pr_err("Failed to load map.\n");
>> +pr_err("Failed to find requested symbol in %s. Is it a global 
>> variable?\n",
>> +   name);
>>  goto out;
>>  }

-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@hitachi.com


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


[PATCH net-next 04/20] net: enic: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Christian Benvenuti 
Cc: Sujith Sankar 
Cc: Govindarajulu Varadarajan 
Cc: Neel Patel 
Cc: Nishank Trivedi 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/cisco/enic/enic_pp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cisco/enic/enic_pp.c 
b/drivers/net/ethernet/cisco/enic/enic_pp.c
index 43464f0..e6a8319 100644
--- a/drivers/net/ethernet/cisco/enic/enic_pp.c
+++ b/drivers/net/ethernet/cisco/enic/enic_pp.c
@@ -162,7 +162,7 @@ static int enic_are_pp_different(struct enic_port_profile 
*pp1,
return strcmp(pp1->name, pp2->name) | !!memcmp(pp1->instance_uuid,
pp2->instance_uuid, PORT_UUID_MAX) |
!!memcmp(pp1->host_uuid, pp2->host_uuid, PORT_UUID_MAX) |
-   !!memcmp(pp1->mac_addr, pp2->mac_addr, ETH_ALEN);
+   !ether_addr_equal(pp1->mac_addr, pp2->mac_addr);
 }
 
 static int enic_pp_preassociate(struct enic *enic, int vf,
-- 
1.8.0


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


[PATCH net-next 02/20] net: bnx2x: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use the possibly more efficient ether_addr_equal or
ether_addr_equal_unaligned to instead of memcmp.

Cc: Ariel Elior 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c| 10 --
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c  |  2 +-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 32c92ab..a83c67c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -663,7 +663,7 @@ static int bnx2x_check_mac_add(struct bnx2x *bp,
 
/* Check if a requested MAC already exists */
list_for_each_entry(pos, >head, link)
-   if (!memcmp(data->mac.mac, pos->u.mac.mac, ETH_ALEN) &&
+   if (ether_addr_equal(data->mac.mac, pos->u.mac.mac) &&
(data->mac.is_inner_mac == pos->u.mac.is_inner_mac))
return -EEXIST;
 
@@ -696,8 +696,7 @@ static int bnx2x_check_vlan_mac_add(struct bnx2x *bp,
 
list_for_each_entry(pos, >head, link)
if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
-   (!memcmp(data->vlan_mac.mac, pos->u.vlan_mac.mac,
- ETH_ALEN)) &&
+   (ether_addr_equal_unaligned(data->vlan_mac.mac, 
pos->u.vlan_mac.mac)) &&
(data->vlan_mac.is_inner_mac ==
 pos->u.vlan_mac.is_inner_mac))
return -EEXIST;
@@ -716,7 +715,7 @@ static struct bnx2x_vlan_mac_registry_elem *
DP(BNX2X_MSG_SP, "Checking MAC %pM for DEL command\n", data->mac.mac);
 
list_for_each_entry(pos, >head, link)
-   if ((!memcmp(data->mac.mac, pos->u.mac.mac, ETH_ALEN)) &&
+   if ((ether_addr_equal(data->mac.mac, pos->u.mac.mac)) &&
(data->mac.is_inner_mac == pos->u.mac.is_inner_mac))
return pos;
 
@@ -751,8 +750,7 @@ static struct bnx2x_vlan_mac_registry_elem *
 
list_for_each_entry(pos, >head, link)
if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
-   (!memcmp(data->vlan_mac.mac, pos->u.vlan_mac.mac,
-ETH_ALEN)) &&
+   (ether_addr_equal_unaligned(data->vlan_mac.mac, 
pos->u.vlan_mac.mac)) &&
(data->vlan_mac.is_inner_mac ==
 pos->u.vlan_mac.is_inner_mac))
return pos;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 2e46c28..040276b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -3605,7 +3605,7 @@ enum sample_bulletin_result bnx2x_sample_bulletin(struct 
bnx2x *bp)
 
/* the mac address in bulletin board is valid and is new */
if (bulletin.valid_bitmap & 1 << MAC_ADDR_VALID &&
-   memcmp(bulletin.mac, bp->old_bulletin.mac, ETH_ALEN)) {
+   !ether_addr_equal(bulletin.mac, bp->old_bulletin.mac)) {
/* update new mac to net device */
memcpy(bp->dev->dev_addr, bulletin.mac, ETH_ALEN);
}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index efa8a15..4d2ae15 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -1702,7 +1702,7 @@ static void bnx2x_vf_mbx_set_q_filters(struct bnx2x *bp,
 
/* ...and only the mac set by the ndo */
if (filters->n_mac_vlan_filters == 1 &&
-   memcmp(filters->filters->mac, bulletin->mac, ETH_ALEN)) {
+   !ether_addr_equal(filters->filters->mac, bulletin->mac)) {
BNX2X_ERR("VF[%d] requested the addition of a mac 
address not matching the one configured by set_vf_mac ndo\n",
  vf->abs_vfid);
 
-- 
1.8.0


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


[PATCH net-next 07/20] net: ixgbe: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Jeff Kirsher 
Cc: Jesse Brandeburg 
Cc: Bruce Allan 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index d6f0c0d..9ce07f3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -715,8 +715,7 @@ static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter 
*adapter,
}
 
if (adapter->vfinfo[vf].pf_set_mac &&
-   memcmp(adapter->vfinfo[vf].vf_mac_addresses, new_mac,
-  ETH_ALEN)) {
+   !ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) {
e_warn(drv,
   "VF %d attempted to override administratively set MAC 
address\n"
   "Reload the VF driver to resume operations\n",
-- 
1.8.0


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


Re: [PATCH] serial: samsung: Remove hard-coded major/minor numbers

2013-12-26 Thread Greg KH
On Fri, Dec 27, 2013 at 10:43:23AM +0400, Alexander Shiyan wrote:
> Hello.
> > On Fri, Dec 27, 2013 at 12:00:20PM +0530, Tushar Behera wrote:
> > > On 27 December 2013 10:48, Greg KH  wrote:
> > > > On Fri, Dec 27, 2013 at 10:37:28AM +0530, Tushar Behera wrote:
> > > >> The hard-coded values clash with the values set for amba-pl011 serial
> > > >> driver. Because of this there is no serial output on Samsung boards
> > > >> if amba-pl011 is enabled alongwith samsung-serial driver.
> > > >>
> > > >> Remove the hardcoded values and let the framework decide on
> > > >> appropriate major/minor number. This is required for multi-platform
> > > >> development work on Exynos platform.
> > > >>
> > > >> Signed-off-by: Tushar Behera 
> ...
> > > >>  #define S3C24XX_SERIAL_NAME  "ttySAC"
> > > >> -#define S3C24XX_SERIAL_MAJOR 204
> > > >> -#define S3C24XX_SERIAL_MINOR 64
> > > >>
> > > >>  /* macros to change one thing to another */
> > > >>
> > > >> @@ -951,8 +949,6 @@ static struct uart_driver s3c24xx_uart_drv = {
> > > >>   .nr = CONFIG_SERIAL_SAMSUNG_UARTS,
> > > >>   .cons   = S3C24XX_SERIAL_CONSOLE,
> > > >>   .dev_name   = S3C24XX_SERIAL_NAME,
> > > >> - .major  = S3C24XX_SERIAL_MAJOR,
> > > >> - .minor  = S3C24XX_SERIAL_MINOR,
> > > >
> > > > Doesn't this break existing systems and configurations that are
> > > > expecting 204:64 as the location of this serial port?
> > > >
> > > 
> > > I tested this on Exynos4210-Origen, Exynos5250-Arndale board, it works
> > > fine there. I haven't tested on any older boards.
> > 
> > How did it work?  You are relying on some userspace tools to do this
> > properly, right?  What about systems without those specific tools?
> 
> Can this issue be resolved by using MODULE_ALIAS_CHARDEV()
> in the driver code?

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


[PATCH net-next 11/20] net: packetengines: slight optimization of addr

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/packetengines/yellowfin.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/packetengines/yellowfin.c 
b/drivers/net/ethernet/packetengines/yellowfin.c
index d28593b..b83ac0e 100644
--- a/drivers/net/ethernet/packetengines/yellowfin.c
+++ b/drivers/net/ethernet/packetengines/yellowfin.c
@@ -1097,12 +1097,12 @@ static int yellowfin_rx(struct net_device *dev)
if (status2 & 0x80) dev->stats.rx_dropped++;
 #ifdef YF_PROTOTYPE/* Support for prototype hardware errata. */
} else if ((yp->flags & HasMACAddrBug)  &&
-   memcmp(le32_to_cpu(yp->rx_ring_dma +
-   entry*sizeof(struct yellowfin_desc)),
-   dev->dev_addr, 6) != 0 &&
-   memcmp(le32_to_cpu(yp->rx_ring_dma +
-   entry*sizeof(struct yellowfin_desc)),
-   "\377\377\377\377\377\377", 6) != 0) {
+   !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
+ entry * sizeof(struct 
yellowfin_desc)),
+ dev->dev_addr) &&
+   !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma +
+ entry * sizeof(struct 
yellowfin_desc)),
+ 
"\377\377\377\377\377\377")) {
if (bogus_rx++ == 0)
netdev_warn(dev, "Bad frame to %pM\n",
buf_addr);
-- 
1.7.1



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


[PATCH net-next 08/20] net: mlx4: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Amir Vadai 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c| 4 ++--
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c 
b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 6f92090..7e43858 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -782,7 +782,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
list_for_each_entry(dst_tmp, dst, list) {
found = false;
list_for_each_entry(src_tmp, src, list) {
-   if (!memcmp(dst_tmp->addr, src_tmp->addr, ETH_ALEN)) {
+   if (ether_addr_equal(dst_tmp->addr, src_tmp->addr)) {
found = true;
break;
}
@@ -797,7 +797,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
list_for_each_entry(src_tmp, src, list) {
found = false;
list_for_each_entry(dst_tmp, dst, list) {
-   if (!memcmp(dst_tmp->addr, src_tmp->addr, ETH_ALEN)) {
+   if (ether_addr_equal(dst_tmp->addr, src_tmp->addr)) {
dst_tmp->action = MCLIST_NONE;
found = true;
break;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c 
b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 2f3f2bc..2e3232c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -3634,7 +3634,7 @@ static int validate_eth_header_mac(int slave, struct 
_rule_hw *eth_header,
!is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
list_for_each_entry_safe(res, tmp, rlist, list) {
be_mac = cpu_to_be64(res->mac << 16);
-   if (!memcmp(_mac, eth_header->eth.dst_mac, ETH_ALEN))
+   if (ether_addr_equal((u8 *)_mac, 
eth_header->eth.dst_mac))
return 0;
}
pr_err("MAC %pM doesn't belong to VF %d, Steering rule 
rejected\n",
-- 
1.8.0


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


Re: Re: [PATCH -tip v2 2/2] perf-probe: Support basic dwarf-based operations on uprobe events

2013-12-26 Thread Masami Hiramatsu
(2013/12/26 23:38), David Ahern wrote:
> On 12/26/13, 12:41 AM, Masami Hiramatsu wrote:
>> And this shows the available variables at the given line of
>> the function.
>> 
>> # ./perf probe -x perf --vars map__load:8
>> Available variables at map__load:8
>>  @
>>  char*   name
>>  struct map* map
>>  symbol_filter_t filter
>>  @
>>  char*   name
>>  symbol_filter_t filter
>>  @
>>  char*   name
>>  symbol_filter_t filter
>>  @
>>  char*   name
>>  struct map* map
>>  symbol_filter_t filter
> 
> Still limitations. This is Fedora 18:
> 
> # rpm -qa | grep debug
> glibc-debuginfo-common-2.16-34.fc18.x86_64
> glibc-debuginfo-2.16-34.fc18.x86_64
> 
> # /tmp/perf/perf probe -V malloc -x /lib64/libc-2.16.so
> Failed to find variables at malloc (0)
> 
> So probing on system libraries does not benefit from this patch.

Yes, please see the todo list in 0/2

>  - Support distro style debuginfo path (/usr/lib/debug/...)

Not only the libraries but also all distro packaged binaries have
debuginfo as other binaries. We should locate it by using dso.
But since this is just the first step series, I'd like to start with
the "homebrew" debuginfo.


>> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
>> index 5681266..20b3e15 100644
>> --- a/tools/perf/builtin-probe.c
>> +++ b/tools/perf/builtin-probe.c
>> @@ -425,7 +425,7 @@ int cmd_probe(int argc, const char **argv, const char 
>> *prefix __maybe_unused)
>>  }
>>
>>   #ifdef HAVE_DWARF_SUPPORT
>> -if (params.show_lines && !params.uprobes) {
>> +if (params.show_lines) {
>>  if (params.mod_events) {
>>  pr_err("  Error: Don't use --line with"
>> " --add/--del.\n");
> 
> Unrelated change.

No, this is required for the --line dwarf support.


>> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>> index 05be5de..2f82267 100644
>> --- a/tools/perf/util/probe-event.c
>> +++ b/tools/perf/util/probe-event.c
>> @@ -172,6 +172,52 @@ const char *kernel_get_module_path(const char *module)
>>  return (dso) ? dso->long_name : NULL;
>>   }
>>
>> +/* Copied from unwind.c */
>> +static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
>> +GElf_Shdr *shp, const char *name)
>> +{
>> +Elf_Scn *sec = NULL;
>> +
>> +while ((sec = elf_nextscn(elf, sec)) != NULL) {
>> +char *str;
>> +
>> +gelf_getshdr(sec, shp);
>> +str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
>> +if (!strcmp(name, str))
>> +break;
>> +}
>> +
>> +return sec;
>> +}
> 
> Why copy it? With unwind.c and util/symbol-elf.c we now have 2 copies. 
> How about exporting one of those?

Hm, OK, I missed the copy in symbol-elf.c. I'd like to use that, since
the unwind.c can be disabled by NO_LIBUNWIND.

>> @@ -261,6 +338,40 @@ static int kprobe_convert_to_perf_probe(struct 
>> probe_trace_point *tp,
>>  return 0;
>>   }
>>
>> +static int add_exec_to_probe_trace_events(struct probe_trace_event *tevs,
>> +  int ntevs, const char *exec)
>> +{
>> +int i, ret = 0;
>> +unsigned long offset, stext = 0;
>> +char buf[32];
>> +
>> +if (!exec)
>> +return 0;
>> +
>> +ret = get_text_start_address(exec, );
>> +if (ret < 0)
>> +return ret;
>> +
>> +for (i = 0; i < ntevs && ret >= 0; i++) {
>> +offset = tevs[i].point.address - stext;
>> +offset += tevs[i].point.offset;
>> +tevs[i].point.offset = 0;
>> +free(tevs[i].point.symbol);
>> +ret = e_snprintf(buf, 32, "0x%lx", offset);
>> +if (ret < 0)
>> +break;
>> +tevs[i].point.module = strdup(exec);
>> +tevs[i].point.symbol = strdup(buf);
>> +if (!tevs[i].point.symbol || !tevs[i].point.module) {
>> +ret = -ENOMEM;
>> +break;
>> +}
>> +tevs[i].uprobes = true;
>> +}
>> +
>> +return ret;
>> +}
>> +
> 
> More strdup's. This is library code and we need methods to free that 
> memory as well.

Ah, yes. Still some error handling routine doesn't clean it at all.
And it should be a separated bugfix patch, since not only
add_exec_to_probe_trace_events but also add_module_to_probe_trace_events
does the similar strdups.

Thank you!

-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@hitachi.com


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

[PATCH net-next 14/20] net: renesas: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/renesas/sh_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c 
b/drivers/net/ethernet/renesas/sh_eth.c
index ca742e1..2d00bce 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2207,7 +2207,7 @@ static int sh_eth_tsu_find_entry(struct net_device *ndev, 
const u8 *addr)
 
for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) {
sh_eth_tsu_read_entry(reg_offset, c_addr);
-   if (memcmp(addr, c_addr, ETH_ALEN) == 0)
+   if (ether_addr_equal(addr, c_addr))
return i;
}
 
-- 
1.8.0

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


[PATCH net-next 03/20] net: cxgb3: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Santosh Raspatur 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 +-
 drivers/net/ethernet/chelsio/cxgb3/l2t.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c 
b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
index 76ae0999..c0a9dd5 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
@@ -182,7 +182,7 @@ static struct net_device *get_iff_from_mac(struct adapter 
*adapter,
for_each_port(adapter, i) {
struct net_device *dev = adapter->port[i];
 
-   if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) {
+   if (ether_addr_equal(dev->dev_addr, mac)) {
rcu_read_lock();
if (vlan && vlan != VLAN_VID_MASK) {
dev = __vlan_find_dev_deep(dev, 
htons(ETH_P_8021Q), vlan);
diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c 
b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
index 8d53438..5f226ed 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
@@ -429,7 +429,7 @@ found:
} else {
e->state = neigh->nud_state & NUD_CONNECTED ?
L2T_STATE_VALID : L2T_STATE_STALE;
-   if (memcmp(e->dmac, neigh->ha, 6))
+   if (!ether_addr_equal(e->dmac, neigh->ha))
setup_l2e_send_pending(dev, NULL, e);
}
}
-- 
1.8.0


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


[PATCH net-next 15/20] net: seeq: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/seeq/sgiseeq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/seeq/sgiseeq.c 
b/drivers/net/ethernet/seeq/sgiseeq.c
index c765718..ced5b13 100644
--- a/drivers/net/ethernet/seeq/sgiseeq.c
+++ b/drivers/net/ethernet/seeq/sgiseeq.c
@@ -356,7 +356,7 @@ static inline void sgiseeq_rx(struct net_device *dev, 
struct sgiseeq_private *sp
if (pkt_status & SEEQ_RSTAT_FIG) {
/* Packet is OK. */
/* We don't want to receive our own packets */
-   if (memcmp(rd->skb->data + 6, dev->dev_addr, ETH_ALEN)) 
{
+   if (!ether_addr_equal(rd->skb->data + 6, 
dev->dev_addr)) {
if (len > rx_copybreak) {
skb = rd->skb;
newskb = netdev_alloc_skb(dev, 
PKT_BUF_SZ);
-- 
1.8.0


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


[PATCH net-next 13/20] net: qlcnic: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use the possibly more efficient ether_addr_equal or
ether_addr_equal_unaligned to instead of memcmp.

Cc: Himanshu Madhani 
Cc: Rajesh Borundia 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c   | 4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c   | 4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 3fe971c..a9a149b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -462,7 +462,7 @@ int qlcnic_nic_del_mac(struct qlcnic_adapter *adapter, 
const u8 *addr)
/* Delete MAC from the existing list */
list_for_each(head, >mac_list) {
cur = list_entry(head, struct qlcnic_mac_vlan_list, list);
-   if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0) {
+   if (ether_addr_equal(addr, cur->mac_addr)) {
err = qlcnic_sre_macaddr_change(adapter, cur->mac_addr,
0, QLCNIC_MAC_DEL);
if (err)
@@ -483,7 +483,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, 
const u8 *addr, u16 vlan)
/* look up if already exists */
list_for_each(head, >mac_list) {
cur = list_entry(head, struct qlcnic_mac_vlan_list, list);
-   if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0 &&
+   if (ether_addr_equal(addr, cur->mac_addr) &&
cur->vlan_id == vlan)
return 0;
}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 0538022..a215e0f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -202,7 +202,7 @@ static struct qlcnic_filter *qlcnic_find_mac_filter(struct 
hlist_head *head,
struct hlist_node *n;
 
hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
-   if (!memcmp(tmp_fil->faddr, addr, ETH_ALEN) &&
+   if (ether_addr_equal(tmp_fil->faddr, addr) &&
tmp_fil->vlan_id == vlan_id)
return tmp_fil;
}
@@ -346,7 +346,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter 
*adapter,
head = &(adapter->fhash.fhead[hindex]);
 
hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
-   if (!memcmp(tmp_fil->faddr, _addr, ETH_ALEN) &&
+   if (ether_addr_equal(tmp_fil->faddr, _addr) &&
tmp_fil->vlan_id == vlan_id) {
if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime))
qlcnic_change_filter(adapter, _addr,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index bf132c9..d131ec1 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -313,7 +313,7 @@ static void qlcnic_delete_adapter_mac(struct qlcnic_adapter 
*adapter)
 
list_for_each(head, >mac_list) {
cur = list_entry(head, struct qlcnic_mac_vlan_list, list);
-   if (!memcmp(adapter->mac_addr, cur->mac_addr, ETH_ALEN)) {
+   if (ether_addr_equal_unaligned(adapter->mac_addr, 
cur->mac_addr)) {
qlcnic_sre_macaddr_change(adapter, cur->mac_addr,
  0, QLCNIC_MAC_DEL);
list_del(>list);
@@ -337,7 +337,7 @@ static int qlcnic_set_mac(struct net_device *netdev, void 
*p)
if (!is_valid_ether_addr(addr->sa_data))
return -EINVAL;
 
-   if (!memcmp(adapter->mac_addr, addr->sa_data, ETH_ALEN))
+   if (ether_addr_equal_unaligned(adapter->mac_addr, addr->sa_data))
return 0;
 
if (test_bit(__QLCNIC_DEV_UP, >state)) {
-- 
1.8.0


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


[PATCH net-next 17/20] net: ti: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/ti/cpsw_ale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw_ale.c 
b/drivers/net/ethernet/ti/cpsw_ale.c
index 7fa60d6..63e9819 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -163,7 +163,7 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 
vid)
if (cpsw_ale_get_vlan_id(ale_entry) != vid)
continue;
cpsw_ale_get_addr(ale_entry, entry_addr);
-   if (memcmp(entry_addr, addr, 6) == 0)
+   if (ether_addr_equal(entry_addr, addr))
return idx;
}
return -ENOENT;
-- 
1.8.0


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


[PATCH net-next 16/20] net: sun: optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/sun/sunvnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sun/sunvnet.c 
b/drivers/net/ethernet/sun/sunvnet.c
index 3df5684..1c24a8f 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -751,7 +751,7 @@ static struct vnet_mcast_entry *__vnet_mc_find(struct vnet 
*vp, u8 *addr)
struct vnet_mcast_entry *m;
 
for (m = vp->mcast_list; m; m = m->next) {
-   if (!memcmp(m->addr, addr, ETH_ALEN))
+   if (ether_addr_equal(m->addr, addr))
return m;
}
return NULL;
-- 
1.8.0


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


[PATCH net-next 10/20] net: vxge: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Jon Mason 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/neterion/vxge/vxge-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c 
b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 11b1c70..6eae216 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -1430,7 +1430,7 @@ vxge_search_mac_addr_in_da_table(struct vxge_vpath 
*vpath, struct macInfo *mac)
return status;
}
 
-   while (memcmp(mac->macaddr, macaddr, ETH_ALEN)) {
+   while (!ether_addr_equal(mac->macaddr, macaddr)) {
status = vxge_hw_vpath_mac_addr_get_next(vpath->handle,
macaddr, macmask);
if (status != VXGE_HW_OK)
-- 
1.8.0


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


[PATCH net-next 18/20] net: fddi: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/fddi/skfp/fplustm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fddi/skfp/fplustm.c b/drivers/net/fddi/skfp/fplustm.c
index d918d8a..7d3779a 100644
--- a/drivers/net/fddi/skfp/fplustm.c
+++ b/drivers/net/fddi/skfp/fplustm.c
@@ -23,6 +23,7 @@
 #include "h/smc.h"
 #include "h/supern_2.h"
 #include 
+#include 
 
 #ifndeflint
 static const char ID_sccs[] = "@(#)fplustm.c   1.32 99/02/23 (C) SK " ;
@@ -1082,7 +1083,7 @@ static struct s_fpmc* mac_get_mc_table(struct s_smc *smc,
slot = tb ;
continue ;
}
-   if (memcmp((char *)>a,(char *)own,6))
+   if (!ether_addr_equal((char *)>a, (char *)own))
continue ;
return tb;
}
-- 
1.8.0


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


[PATCH net-next 06/20] net: igbvf: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Jeff Kirsher 
Cc: Jesse Brandeburg 
Cc: Carolyn Wyborny 
Cc: Don Skidmore 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/intel/igbvf/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c 
b/drivers/net/ethernet/intel/igbvf/netdev.c
index 04bf22e..675435f 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -1745,7 +1745,7 @@ static int igbvf_set_mac(struct net_device *netdev, void 
*p)
 
hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
 
-   if (memcmp(addr->sa_data, hw->mac.addr, 6))
+   if (!ether_addr_equal(addr->sa_data, hw->mac.addr))
return -EADDRNOTAVAIL;
 
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
-- 
1.8.0


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


[PATCH net-next 20/20] net: caif: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Dmitry Tarnyagin 
Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 net/caif/cfrfml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c
index 61d7617..c680414 100644
--- a/net/caif/cfrfml.c
+++ b/net/caif/cfrfml.c
@@ -79,7 +79,7 @@ static struct cfpkt *rfm_append(struct cfrfml *rfml, char 
*seghead,
return NULL;
 
/* Verify correct header */
-   if (memcmp(seghead, rfml->seghead, 6) != 0)
+   if (!ether_addr_equal(seghead, rfml->seghead))
return NULL;
 
tmppkt = cfpkt_append(rfml->incomplete_frm, pkt,
-- 
1.8.0


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


[PATCH net-next 12/20] net: netxen: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Manish Chopra 
Cc: Sony Chacko 
Cc: Rajesh Borundia 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c 
b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index b72b6be..db4280c 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -661,7 +661,7 @@ static int nx_p3_nic_add_mac(struct netxen_adapter *adapter,
list_for_each(head, del_list) {
cur = list_entry(head, nx_mac_list_t, list);
 
-   if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0) {
+   if (ether_addr_equal(addr, cur->mac_addr)) {
list_move_tail(head, >mac_list);
return 0;
}
-- 
1.8.0


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


[PATCH net-next 19/20] net: plip: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/plip/plip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c
index 7b4ff35..26614df 100644
--- a/drivers/net/plip/plip.c
+++ b/drivers/net/plip/plip.c
@@ -549,7 +549,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct 
net_device *dev)
 
if(*eth->h_dest&1)
{
-   if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
+   if(ether_addr_equal(eth->h_dest, dev->broadcast))
skb->pkt_type=PACKET_BROADCAST;
else
skb->pkt_type=PACKET_MULTICAST;
-- 
1.8.0


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


[PATCH net-next 09/20] net: ksz884x: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/micrel/ksz884x.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c 
b/drivers/net/ethernet/micrel/ksz884x.c
index ddd252a..8e9dad7 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -4128,10 +4128,10 @@ static int hw_add_addr(struct ksz_hw *hw, u8 *mac_addr)
int i;
int j = ADDITIONAL_ENTRIES;
 
-   if (!memcmp(hw->override_addr, mac_addr, ETH_ALEN))
+   if (ether_addr_equal(hw->override_addr, mac_addr))
return 0;
for (i = 0; i < hw->addr_list_size; i++) {
-   if (!memcmp(hw->address[i], mac_addr, ETH_ALEN))
+   if (ether_addr_equal(hw->address[i], mac_addr))
return 0;
if (ADDITIONAL_ENTRIES == j && empty_addr(hw->address[i]))
j = i;
@@ -4149,7 +4149,7 @@ static int hw_del_addr(struct ksz_hw *hw, u8 *mac_addr)
int i;
 
for (i = 0; i < hw->addr_list_size; i++) {
-   if (!memcmp(hw->address[i], mac_addr, ETH_ALEN)) {
+   if (ether_addr_equal(hw->address[i], mac_addr)) {
memset(hw->address[i], 0, ETH_ALEN);
writel(0, hw->io + ADD_ADDR_INCR * i +
KS_ADD_ADDR_0_HI);
@@ -7104,8 +7104,7 @@ static int pcidev_init(struct pci_dev *pdev, const struct 
pci_device_id *id)
   ETH_ALEN);
else {
memcpy(dev->dev_addr, sw->other_addr, ETH_ALEN);
-   if (!memcmp(sw->other_addr, hw->override_addr,
-   ETH_ALEN))
+   if (ether_addr_equal(sw->other_addr, hw->override_addr))
dev->dev_addr[5] += port->first_port;
}
 
-- 
1.8.0


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


[PATCH net-next 05/20] net: benet: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: Sathya Perla 
Cc: Subbu Seetharaman 
Cc: Ajit Khaparde 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c 
b/drivers/net/ethernet/emulex/benet/be_main.c
index f67586a..b5c238a 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -287,7 +287,7 @@ static int be_mac_addr_set(struct net_device *netdev, void 
*p)
/* The MAC change did not happen, either due to lack of privilege
 * or PF didn't pre-provision.
 */
-   if (memcmp(addr->sa_data, mac, ETH_ALEN)) {
+   if (!ether_addr_equal(addr->sa_data, mac)) {
status = -EPERM;
goto err;
}
-- 
1.8.0


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


[PATCH net-next 00/20] slight optimization of addr compare for net modules

2013-12-26 Thread Ding Tianhong
This is the second patchset for slight optimization of address compare,
mainly for net tree, just following the Joe's opinion, it will help review
the code for maintainers and supports.

Best Regards
Ding

Ding Tianhong (20):
  net: 3com: slight optimization of addr compare
  net: bnx2x: slight optimization of addr compare
  net: cxgb3: slight optimization of addr compare
  net: enic: slight optimization of addr compare
  net: benet: slight optimization of addr compare
  net: igbvf: slight optimization of addr compare
  net: ixgbe: slight optimization of addr compare
  net: mlx4: slight optimization of addr compare
  net: ksz884x: slight optimization of addr compare
  net: vxge: slight optimization of addr compare
  net: packetengines: slight optimization of addr compare
  net: netxen: slight optimization of addr compare
  net: qlcnic: slight optimization of addr compare
  net: renesas: slight optimization of addr compare
  net: seeq: slight optimization of addr compare
  net: sun: optimization of addr compare
  net: ti: slight optimization of addr compare
  net: fddi: slight optimization of addr compare
  net: plip: slight optimization of addr compare
  net: caif: slight optimization of addr compare

 drivers/net/ethernet/3com/3c509.c |  3 +--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c| 10 --
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c  |  2 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c|  2 +-
 drivers/net/ethernet/chelsio/cxgb3/l2t.c  |  2 +-
 drivers/net/ethernet/cisco/enic/enic_pp.c |  2 +-
 drivers/net/ethernet/emulex/benet/be_main.c   |  2 +-
 drivers/net/ethernet/intel/igbvf/netdev.c |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c|  3 +--
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c|  4 ++--
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |  2 +-
 drivers/net/ethernet/micrel/ksz884x.c |  9 -
 drivers/net/ethernet/neterion/vxge/vxge-main.c|  2 +-
 drivers/net/ethernet/packetengines/yellowfin.c|  8 ++--
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c|  2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c|  4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c|  4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c  |  4 ++--
 drivers/net/ethernet/renesas/sh_eth.c |  2 +-
 drivers/net/ethernet/seeq/sgiseeq.c   |  2 +-
 drivers/net/ethernet/sun/sunvnet.c|  2 +-
 drivers/net/ethernet/ti/cpsw_ale.c|  2 +-
 drivers/net/fddi/skfp/fplustm.c   |  3 ++-
 drivers/net/plip/plip.c   |  2 +-
 net/caif/cfrfml.c |  2 +-
 26 files changed, 38 insertions(+), 46 deletions(-)

-- 
1.8.0


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


[PATCH net-next 01/20] net: 3com: slight optimization of addr compare

2013-12-26 Thread Ding Tianhong
Use possibly more efficient ether_addr_equal
to instead of memcmp.

Cc: "David S. Miller" 
Signed-off-by: Ding Tianhong 
---
 drivers/net/ethernet/3com/3c509.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/3com/3c509.c 
b/drivers/net/ethernet/3com/3c509.c
index ede8daa..9142b47 100644
--- a/drivers/net/ethernet/3com/3c509.c
+++ b/drivers/net/ethernet/3com/3c509.c
@@ -252,8 +252,7 @@ static int el3_isa_id_sequence(__be16 *phys_addr)
for (i = 0; i < el3_cards; i++) {
struct el3_private *lp = netdev_priv(el3_devs[i]);
if (lp->type == EL3_PNP &&
-   !memcmp(phys_addr, el3_devs[i]->dev_addr,
-   ETH_ALEN)) {
+   ether_addr_equal(phys_addr, el3_devs[i]->dev_addr)) 
{
if (el3_debug > 3)
pr_debug("3c509 with address %02x %02x 
%02x %02x %02x %02x was found by ISAPnP\n",
phys_addr[0] & 0xff, 
phys_addr[0] >> 8,
-- 
1.8.0


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


Re: mdadm raid1 regression

2013-12-26 Thread Vasiliy Tolstov
2013/4/22 NeilBrown :
> I'll try to make sure that works correctly for the next release.
> Thanks for the report.


Sorry, Neil. for bumping up old thread. I'm again have problems with
data-offset param for mdadm.
I'm using version from git master (guthub). If i try to create raid1 like
/sbin/mdadm --create --data-offset=2048 --metadata=1.2 --verbose
--force --run --bitmap=internal --assume-clean --name=md21_901
md21_901 --level=raid1 --raid-devices=2 /dev/mapper/sas00-21_901
/dev/mapper/sas01-21_901
I have
  Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
 Array UUID : 64e0028e:301aa3ce:cdf1a54f:a9e28f27
   Name : xen25:md21_901  (local to host xen25)
  Creation Time : Fri Dec 27 10:43:06 2013
 Raid Level : raid1
   Raid Devices : 2

 Avail Dev Size : 10489856 (5.00 GiB 5.37 GB)
 Array Size : 5244928 (5.00 GiB 5.37 GB)
Data Offset : 4096 sectors
   Super Offset : 8 sectors
   Unused Space : before=4008 sectors, after=0 sectors
  State : clean
Device UUID : 38771de6:cb5f0dbc:9f32f85f:164e1e89

Internal Bitmap : 8 sectors from superblock
Update Time : Fri Dec 27 10:43:22 2013
  Bad Block Log : 512 entries available at offset 72 sectors
   Checksum : 7f07eb77 - correct
 Events : 2


But when i try to create raid1 like
/sbin/mdadm --create --data-offset=1024 --metadata=1.2 --verbose
--force --run --bitmap=internal --assume-clean --name=md21_901
md21_901 --level=raid1 --raid-devices=2 /dev/mapper/sas00-21_901
/dev/mapper/sas01-21_901
I getting
  Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
 Array UUID : ef22dca1:1424ea9e:1b4dce89:27c61a91
   Name : xen25:md21_901  (local to host xen25)
  Creation Time : Fri Dec 27 10:44:21 2013
 Raid Level : raid1
   Raid Devices : 2

 Avail Dev Size : 10491904 (5.00 GiB 5.37 GB)
 Array Size : 5245952 (5.00 GiB 5.37 GB)
Data Offset : 2048 sectors
   Super Offset : 8 sectors
   Unused Space : before=1960 sectors, after=0 sectors
  State : clean
Device UUID : afae5e27:6c706246:4c3e3cb0:e5c726ac

Internal Bitmap : 8 sectors from superblock
Update Time : Fri Dec 27 10:44:26 2013
  Bad Block Log : 512 entries available at offset 72 sectors
   Checksum : 45be4cd1 - correct
 Events : 2


Why data offset specified in command line grows twice in resulting md
array component?

-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru
jabber: v...@selfip.ru
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] f2fs: fix build warning for f2fs_has_inline_data()

2013-12-26 Thread Haicheng Li
This patch is to fix the issue reported by Fengguang Wu:
> Note: the f2fs/linux-3.4 HEAD 22a48d188024830d61365ce97a0a8a0bedd494a9 builds 
> fine.
>   It only hurts bisectibility.
>
> All error/warnings:
>
>In file included from fs/f2fs/data.c:22:0:
>fs/f2fs/data.c: In function 'f2fs_direct_IO':
> >> fs/f2fs/f2fs.h:1302:12: error: inlining failed in call to
> >> always_inline 'f2fs_has_inline_data': function body not available
> inline int f2fs_has_inline_data(struct inode *);
..snip..

Signed-off-by: Haicheng Li 
Reported-by: Fengguang Wu 
Cc: Huajun Li 
---
 fs/f2fs/f2fs.h   |5 -
 fs/f2fs/inline.c |5 -
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 6991a28..e143ca1 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1314,7 +1314,10 @@ extern const struct inode_operations 
f2fs_special_inode_operations;
 /*
  * inline.c
  */
-inline int f2fs_has_inline_data(struct inode *);
+static inline int f2fs_has_inline_data(struct inode *inode)
+{
+   return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
+}
 bool f2fs_may_inline(struct inode *);
 int f2fs_read_inline_data(struct inode *, struct page *);
 int f2fs_convert_inline_data(struct inode *, pgoff_t);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 0e940ce..bcc6f65 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -13,11 +13,6 @@
 
 #include "f2fs.h"
 
-inline int f2fs_has_inline_data(struct inode *inode)
-{
-   return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
-}
-
 bool f2fs_may_inline(struct inode *inode)
 {
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
-- 
1.7.9.5

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


Re: [PATCH] serial: samsung: Remove hard-coded major/minor numbers

2013-12-26 Thread Alexander Shiyan
Hello.
> On Fri, Dec 27, 2013 at 12:00:20PM +0530, Tushar Behera wrote:
> > On 27 December 2013 10:48, Greg KH  wrote:
> > > On Fri, Dec 27, 2013 at 10:37:28AM +0530, Tushar Behera wrote:
> > >> The hard-coded values clash with the values set for amba-pl011 serial
> > >> driver. Because of this there is no serial output on Samsung boards
> > >> if amba-pl011 is enabled alongwith samsung-serial driver.
> > >>
> > >> Remove the hardcoded values and let the framework decide on
> > >> appropriate major/minor number. This is required for multi-platform
> > >> development work on Exynos platform.
> > >>
> > >> Signed-off-by: Tushar Behera 
...
> > >>  #define S3C24XX_SERIAL_NAME  "ttySAC"
> > >> -#define S3C24XX_SERIAL_MAJOR 204
> > >> -#define S3C24XX_SERIAL_MINOR 64
> > >>
> > >>  /* macros to change one thing to another */
> > >>
> > >> @@ -951,8 +949,6 @@ static struct uart_driver s3c24xx_uart_drv = {
> > >>   .nr = CONFIG_SERIAL_SAMSUNG_UARTS,
> > >>   .cons   = S3C24XX_SERIAL_CONSOLE,
> > >>   .dev_name   = S3C24XX_SERIAL_NAME,
> > >> - .major  = S3C24XX_SERIAL_MAJOR,
> > >> - .minor  = S3C24XX_SERIAL_MINOR,
> > >
> > > Doesn't this break existing systems and configurations that are
> > > expecting 204:64 as the location of this serial port?
> > >
> > 
> > I tested this on Exynos4210-Origen, Exynos5250-Arndale board, it works
> > fine there. I haven't tested on any older boards.
> 
> How did it work?  You are relying on some userspace tools to do this
> properly, right?  What about systems without those specific tools?

Can this issue be resolved by using MODULE_ALIAS_CHARDEV()
in the driver code?

---


Re: [PATCH] serial: samsung: Remove hard-coded major/minor numbers

2013-12-26 Thread Greg KH
On Fri, Dec 27, 2013 at 12:00:20PM +0530, Tushar Behera wrote:
> On 27 December 2013 10:48, Greg KH  wrote:
> > On Fri, Dec 27, 2013 at 10:37:28AM +0530, Tushar Behera wrote:
> >> The hard-coded values clash with the values set for amba-pl011 serial
> >> driver. Because of this there is no serial output on Samsung boards
> >> if amba-pl011 is enabled alongwith samsung-serial driver.
> >>
> >> Remove the hardcoded values and let the framework decide on
> >> appropriate major/minor number. This is required for multi-platform
> >> development work on Exynos platform.
> >>
> >> Signed-off-by: Tushar Behera 
> >> ---
> >>  drivers/tty/serial/samsung.c |4 
> >>  1 file changed, 4 deletions(-)
> >>
> >> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> >> index c1af04d..9c20543 100644
> >> --- a/drivers/tty/serial/samsung.c
> >> +++ b/drivers/tty/serial/samsung.c
> >> @@ -56,8 +56,6 @@
> >>  /* UART name and device definitions */
> >>
> >>  #define S3C24XX_SERIAL_NAME  "ttySAC"
> >> -#define S3C24XX_SERIAL_MAJOR 204
> >> -#define S3C24XX_SERIAL_MINOR 64
> >>
> >>  /* macros to change one thing to another */
> >>
> >> @@ -951,8 +949,6 @@ static struct uart_driver s3c24xx_uart_drv = {
> >>   .nr = CONFIG_SERIAL_SAMSUNG_UARTS,
> >>   .cons   = S3C24XX_SERIAL_CONSOLE,
> >>   .dev_name   = S3C24XX_SERIAL_NAME,
> >> - .major  = S3C24XX_SERIAL_MAJOR,
> >> - .minor  = S3C24XX_SERIAL_MINOR,
> >
> > Doesn't this break existing systems and configurations that are
> > expecting 204:64 as the location of this serial port?
> >
> 
> I tested this on Exynos4210-Origen, Exynos5250-Arndale board, it works
> fine there. I haven't tested on any older boards.

How did it work?  You are relying on some userspace tools to do this
properly, right?  What about systems without those specific tools?

> > Why change this one and not the amba-pl011 driver?
> >
> 
> I could only test this driver, so thought of changing this rather than
> modifying amba-pl011 driver. I don't have any other reason.

Please get the samsung driver maintainer to agree with this and sign off
on it before trying to get it merged again.

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


Re: [PATCH] serial: samsung: Remove hard-coded major/minor numbers

2013-12-26 Thread Tushar Behera
On 27 December 2013 10:48, Greg KH  wrote:
> On Fri, Dec 27, 2013 at 10:37:28AM +0530, Tushar Behera wrote:
>> The hard-coded values clash with the values set for amba-pl011 serial
>> driver. Because of this there is no serial output on Samsung boards
>> if amba-pl011 is enabled alongwith samsung-serial driver.
>>
>> Remove the hardcoded values and let the framework decide on
>> appropriate major/minor number. This is required for multi-platform
>> development work on Exynos platform.
>>
>> Signed-off-by: Tushar Behera 
>> ---
>>  drivers/tty/serial/samsung.c |4 
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
>> index c1af04d..9c20543 100644
>> --- a/drivers/tty/serial/samsung.c
>> +++ b/drivers/tty/serial/samsung.c
>> @@ -56,8 +56,6 @@
>>  /* UART name and device definitions */
>>
>>  #define S3C24XX_SERIAL_NAME  "ttySAC"
>> -#define S3C24XX_SERIAL_MAJOR 204
>> -#define S3C24XX_SERIAL_MINOR 64
>>
>>  /* macros to change one thing to another */
>>
>> @@ -951,8 +949,6 @@ static struct uart_driver s3c24xx_uart_drv = {
>>   .nr = CONFIG_SERIAL_SAMSUNG_UARTS,
>>   .cons   = S3C24XX_SERIAL_CONSOLE,
>>   .dev_name   = S3C24XX_SERIAL_NAME,
>> - .major  = S3C24XX_SERIAL_MAJOR,
>> - .minor  = S3C24XX_SERIAL_MINOR,
>
> Doesn't this break existing systems and configurations that are
> expecting 204:64 as the location of this serial port?
>

I tested this on Exynos4210-Origen, Exynos5250-Arndale board, it works
fine there. I haven't tested on any older boards.

> Why change this one and not the amba-pl011 driver?
>

I could only test this driver, so thought of changing this rather than
modifying amba-pl011 driver. I don't have any other reason.

> greg k-h


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


[PATCG]DM: dm-compression: a compressed DM target for SSD

2013-12-26 Thread Shaohua Li
This is a simple DM target supporting compression for SSD only. Under layer SSD
must support 512B sector size, the target only supports 4k sector size.

Disk layout:
|super|...meta...|..data...|

Store unit is 4k (a block). Super is 1 block, which stores meta and data size
and compression algorithm. Meta is a bitmap. For each data block, there are 5
bits meta.

Data:
Data of a block is compressed. Compressed data is round up to 512B, which is
the payload. In disk, payload is stored at the begining of logical sector of
the block. Let's look at an example. Say we store data to block A, which is in
sector B(A*8), its orginal size is 4k, compressed size is 1500. Compressed data
(CD) will use 3 sectors (512B). The 3 sectors are the payload. Payload will be
stored at sector B.

---
... | CD1 | CD2 | CD3 |   |   |   |   || ...
---
^B^B+1  ^B+2  ^B+7 ^B+8

For this block, we will not use sector B+3 to B+7 (a hole). We use 4 meta bits
to present payload size. The compressed size (1500) isn't stored in meta
directly. Instead, we store it at the last 32bits of payload. In this example,
we store it at the end of sector B+2. If compressed size + sizeof(32bits)
crosses a sector, payload size will increase one sector. If payload uses 8
sectors, we store uncompressed data directly.

If IO size is bigger than one block, we can store the data as an extent. Data
of the whole extent will compressed and stored in the similar way like above.
The first block of the extent is the head, all others are the tail. If extent
is 1 block, the block is head. We have 1 bit of meta to present if a block is
head or tail. If 4 meta bits of head block can't store extent payload size, we
will borrow tail block meta bits to store payload size. Max allowd extent size
is 128k, so we don't compress/decompress too big size data.

Meta:
Modifying data will modify meta too. Meta will be written(flush) to disk
depending on meta write policy. We support writeback and writethrough mode. In
writeback mode, meta will be written to disk in an interval or a FLUSH request.
In writethrough mode, data and meta data will be written to disk together.

Advantages:
1. simple. Since we store compressed data in-place, we don't need complicated
disk data management.
2. efficient. For each 4k, we only need 5 bits meta. 1T data will use less than
200M meta, so we can load all meta into memory. And actual compression size is
in payload. So if IO doesn't need RMW and we use writeback meta flush, we don't
need extra IO for meta.

Disadvantages:
1. hole. Since we store compressed data in-place, there are a lot of holes (in
above example, B+3 - B+7) Hole can impact IO, because we can't do IO merge.
2. 1:1 size. Compression doesn't change disk size. If disk is 1T, we can only 
store
1T data even we do compression.

But this is for SSD only. Generally SSD firmware has a FTL layer to map disk
sectors to flash nand. High end SSD firmware has filesystem-like FTL.
1. hole. Disk has a lot of holes, but SSD FTL can still store data continuous
in nand. Even we can't do IO merge in OS layer, SSD firmware can do it.
2. 1:1 size. On one side, we write compressed data to SSD, which means less
data is written to SSD. This will be very helpful to improve SSD garbage
collection, and so write speed and life cycle. So even this is a problem, the
target is still helpful. On the other side, advanced SSD FTL can easily do thin
provision. For example, if nand is 1T and we let SSD report it as 2T, and use
the SSD as compressed target. In such SSD, we don't have the 1:1 size issue.

So if SSD FTL can map non-continuous disk sectors to continuous nand and
support thin provision, the compressed target will work very well.

Signed-off-by: Shaohua Li 
---
 drivers/md/Kconfig  |6 
 drivers/md/Makefile |1 
 drivers/md/dm-compression.c | 1464 
 drivers/md/dm-compression.h |  140 
 4 files changed, 1611 insertions(+)

Index: linux/drivers/md/Kconfig
===
--- linux.orig/drivers/md/Kconfig   2013-12-27 11:05:06.699835262 +0800
+++ linux/drivers/md/Kconfig2013-12-27 11:05:06.687835408 +0800
@@ -290,6 +290,12 @@ config DM_CACHE_CLEANER
  A simple cache policy that writes back all data to the
  origin.  Used when decommissioning a dm-cache.
 
+config DM_COMPRESSION
+   tristate "Compression target"
+   depends on BLK_DEV_DM
+   ---help---
+ Allow volume managers to compress data for SSD.
+
 config DM_MIRROR
tristate "Mirror target"
depends on BLK_DEV_DM
Index: linux/drivers/md/Makefile
===
--- linux.orig/drivers/md/Makefile  2013-12-27 11:05:06.699835262 +0800
+++ linux/drivers/md/Makefile   2013-12-27 11:05:06.691835358 +0800
@@ 

Re: [PATCH 5/6] f2fs: add the number of inline_data files to status info

2013-12-26 Thread Jaegeuk Kim
Change log from v1:
 o fix kbuild failure

>From a9ebdcffd30b9642b2973ea8e9688e7b0d4bf7e3 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim 
Date: Tue, 26 Nov 2013 11:08:57 +0900
Subject: [PATCH] f2fs: add the number of inline_data files to status
info

This patch adds the number of inline_data files into the status
information.
Note that the number is reset whenever the filesystem is newly mounted.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/debug.c  |  3 +++
 fs/f2fs/f2fs.h   | 22 --
 fs/f2fs/inline.c |  7 ++-
 fs/f2fs/inode.c  |  1 +
 4 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 61adbcb..711a0d4 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -45,6 +45,7 @@ static void update_general_status(struct f2fs_sb_info
*sbi)
si->valid_count = valid_user_blocks(sbi);
si->valid_node_count = valid_node_count(sbi);
si->valid_inode_count = valid_inode_count(sbi);
+   si->inline_inode = sbi->inline_inode;
si->utilization = utilization(sbi);
 
si->free_segs = free_segments(sbi);
@@ -200,6 +201,8 @@ static int stat_show(struct seq_file *s, void *v)
seq_printf(s, "Other: %u)\n  - Data: %u\n",
   si->valid_node_count - si->valid_inode_count,
   si->valid_count - si->valid_node_count);
+   seq_printf(s, "  - Inline_data Inode: %u\n",
+  si->inline_inode);
seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n",
   si->main_area_segs, si->main_area_sections,
   si->main_area_zones);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index af35039..0b6bada 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -460,6 +460,7 @@ struct f2fs_sb_info {
unsigned int segment_count[2];  /* # of allocated segments */
unsigned int block_count[2];/* # of allocated blocks */
int total_hit_ext, read_hit_ext;/* extent cache hit ratio */
+   int inline_inode;   /* # of inline_data inodes */
int bg_gc;  /* background gc calls */
unsigned int n_dirty_dirs;  /* # of dir inodes */
 #endif
@@ -992,6 +993,11 @@ static inline int inline_xattr_size(struct inode
*inode)
return 0;
 }
 
+static inline int f2fs_has_inline_data(struct inode *inode)
+{
+   return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA);
+}
+
 static inline void *inline_data_addr(struct page *page)
 {
struct f2fs_inode *ri;
@@ -1201,7 +1207,7 @@ struct f2fs_stat_info {
int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
int nats, sits, fnids;
int total_count, utilization;
-   int bg_gc;
+   int bg_gc, inline_inode;
unsigned int valid_count, valid_node_count, valid_inode_count;
unsigned int bimodal, avg_vblocks;
int util_free, util_valid, util_invalid;
@@ -1230,6 +1236,17 @@ static inline struct f2fs_stat_info
*F2FS_STAT(struct f2fs_sb_info *sbi)
 #define stat_dec_dirty_dir(sbi)((sbi)->n_dirty_dirs--)
 #define stat_inc_total_hit(sb) ((F2FS_SB(sb))->total_hit_ext++)
 #define stat_inc_read_hit(sb)  ((F2FS_SB(sb))->read_hit_ext++)
+#define stat_inc_inline_inode(inode)   \
+   do {\
+   if (f2fs_has_inline_data(inode))\
+   ((F2FS_SB(inode->i_sb))->inline_inode++);   \
+   } while (0)
+#define stat_dec_inline_inode(inode)   \
+   do {\
+   if (f2fs_has_inline_data(inode))\
+   ((F2FS_SB(inode->i_sb))->inline_inode--);   \
+   } while (0)
+
 #define stat_inc_seg_type(sbi, curseg) \
((sbi)->segment_count[(curseg)->alloc_type]++)
 #define stat_inc_block_count(sbi, curseg)  \
@@ -1273,6 +1290,8 @@ void f2fs_destroy_root_stats(void);
 #define stat_dec_dirty_dir(sbi)
 #define stat_inc_total_hit(sb)
 #define stat_inc_read_hit(sb)
+#define stat_inc_inline_inode(inode)
+#define stat_dec_inline_inode(inode)
 #define stat_inc_seg_type(sbi, curseg)
 #define stat_inc_block_count(sbi, curseg)
 #define stat_inc_seg_count(si, type)
@@ -1299,7 +1318,6 @@ extern const struct inode_operations
f2fs_special_inode_operations;
 /*
  * inline.c
  */
-inline int f2fs_has_inline_data(struct inode *);
 bool f2fs_may_inline(struct inode *);
 int f2fs_read_inline_data(struct inode *, struct page *);
 int f2fs_convert_inline_data(struct inode *, pgoff_t);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 1843bc7..5b259df 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -13,11 +13,6 @@
 
 

Re: [PATCH -tip v2 1/2] [CLEANUP] perf-probe: Expand given path to absolute path

2013-12-26 Thread Masami Hiramatsu
(2013/12/26 23:22), Arnaldo Carvalho de Melo wrote:
> Em Thu, Dec 26, 2013 at 09:14:46AM -0500, David Ahern escreveu:
>> On 12/26/13, 12:41 AM, Masami Hiramatsu wrote:
>>> @@ -180,7 +181,20 @@ static int opt_set_target(const struct option *opt, 
>>> const char *str,
>>> else
>>> return ret;
>>>
>>> -   params.target = str;
>>> +   /* Expand given path to absolute path, except for modulename */
>>> +   if (params.uprobes || strchr(str, '/')) {
>>> +   tmp = realpath(str, NULL);
>>> +   if (!tmp) {
>>> +   pr_warning("Failed to find the path of %s.\n",
>>> +  str);
>>
>> That error message will be misleading if it is generated. How about:
>> Failed to get the absolute path of %s: %d\n", str, errno.
> 
> Changed it to:
> 
>  pr_warning("Failed to get the absolute path of %s: %m\n", str);

Thanks, that looks good to me.

>>> +   return ret;
>>> +   }
>>> +   } else {
>>> +   tmp = strdup(str);
>>> +   if (!tmp)
>>> +   return -ENOMEM;
>>> +   }
>>> +   params.target = tmp;
>>
>> When is params.target freed?

Nowhere, since there is no terminal code for user
command interface.

Those memories are released when the program terminated.
I think it is just a waste of the time to free the memory
pieces which are not used(and allocated) repeatedly.
Or, is there any chance to call this part directly from
other command?


Thank you,

-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@hitachi.com


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


Re: [RFC] speeding up the stat() family of system calls...

2013-12-26 Thread H. Peter Anvin
On 12/26/2013 11:00 AM, Linus Torvalds wrote:
> 
> Interestingly, looking at the cp_new_stat() profiles, the games we
> play to get efficient range checking seem to actually hurt us. Maybe
> it's the "sbb" that is just expensive, or maybe it's turning a (very
> predictable) conditional branch into a data dependency chain instead.
> Or maybe it's just random noise in my profiles that happened to make
> those sbb's look bad.
> 

Much to my surprise, this patch adds almost 10K of text to an
"allyesconfig" build.  I wouldn't have expected it.  I'll look at it
some more tomorrow.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] mtd: nand: remove pasemi_nand driver

2013-12-26 Thread Olof Johansson
The PA Semi platform is sparsely used these days (with just a handful
of known users out there). I'm 100% sure none of them use the MTD NAND
driver -- most standard use cases include PCI-e SATA controllers for
storage instead, and boot is done from LPC NOR flash.

So, there's little reason to keep carrying a driver that's not used by
anybody and that just gets hit by some tree-wide or tools-based changes
every now and then.

Signed-off-by: Olof Johansson 
---
 drivers/mtd/nand/pasemi_nand.c |  238 
 1 file changed, 238 deletions(-)
 delete mode 100644 drivers/mtd/nand/pasemi_nand.c

diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
deleted file mode 100644
index 90f871a..000
--- a/drivers/mtd/nand/pasemi_nand.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (C) 2006-2007 PA Semi, Inc
- *
- * Author: Egor Martovetsky 
- * Maintained by: Olof Johansson 
- *
- * Driver for the PWRficient onchip NAND flash interface
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-#undef DEBUG
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define LBICTRL_LPCCTL_NR  0x4000
-#define CLE_PIN_CTL15
-#define ALE_PIN_CTL14
-
-static unsigned int lpcctl;
-static struct mtd_info *pasemi_nand_mtd;
-static const char driver_name[] = "pasemi-nand";
-
-static void pasemi_read_buf(struct mtd_info *mtd, u_char *buf, int len)
-{
-   struct nand_chip *chip = mtd->priv;
-
-   while (len > 0x800) {
-   memcpy_fromio(buf, chip->IO_ADDR_R, 0x800);
-   buf += 0x800;
-   len -= 0x800;
-   }
-   memcpy_fromio(buf, chip->IO_ADDR_R, len);
-}
-
-static void pasemi_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-   struct nand_chip *chip = mtd->priv;
-
-   while (len > 0x800) {
-   memcpy_toio(chip->IO_ADDR_R, buf, 0x800);
-   buf += 0x800;
-   len -= 0x800;
-   }
-   memcpy_toio(chip->IO_ADDR_R, buf, len);
-}
-
-static void pasemi_hwcontrol(struct mtd_info *mtd, int cmd,
-unsigned int ctrl)
-{
-   struct nand_chip *chip = mtd->priv;
-
-   if (cmd == NAND_CMD_NONE)
-   return;
-
-   if (ctrl & NAND_CLE)
-   out_8(chip->IO_ADDR_W + (1 << CLE_PIN_CTL), cmd);
-   else
-   out_8(chip->IO_ADDR_W + (1 << ALE_PIN_CTL), cmd);
-
-   /* Push out posted writes */
-   eieio();
-   inl(lpcctl);
-}
-
-int pasemi_device_ready(struct mtd_info *mtd)
-{
-   return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR);
-}
-
-static int pasemi_nand_probe(struct platform_device *ofdev)
-{
-   struct pci_dev *pdev;
-   struct device_node *np = ofdev->dev.of_node;
-   struct resource res;
-   struct nand_chip *chip;
-   int err = 0;
-
-   err = of_address_to_resource(np, 0, );
-
-   if (err)
-   return -EINVAL;
-
-   /* We only support one device at the moment */
-   if (pasemi_nand_mtd)
-   return -ENODEV;
-
-   pr_debug("pasemi_nand at %pR\n", );
-
-   /* Allocate memory for MTD device structure and private data */
-   pasemi_nand_mtd = kzalloc(sizeof(struct mtd_info) +
- sizeof(struct nand_chip), GFP_KERNEL);
-   if (!pasemi_nand_mtd) {
-   printk(KERN_WARNING
-  "Unable to allocate PASEMI NAND MTD device structure\n");
-   err = -ENOMEM;
-   goto out;
-   }
-
-   /* Get pointer to private data */
-   chip = (struct nand_chip *)_nand_mtd[1];
-
-   /* Link the private data with the MTD structure */
-   pasemi_nand_mtd->priv = chip;
-   pasemi_nand_mtd->owner = THIS_MODULE;
-
-   chip->IO_ADDR_R = of_iomap(np, 0);
-   chip->IO_ADDR_W = chip->IO_ADDR_R;
-
-   if (!chip->IO_ADDR_R) {
-   err = -EIO;
-   goto out_mtd;
-   }
-
-   pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa008, NULL);
-   if (!pdev) {
-   err = -ENODEV;
-   goto out_ior;
-   }
-
-   lpcctl = pci_resource_start(pdev, 0);
-   pci_dev_put(pdev);
-
-   if (!request_region(lpcctl, 4, driver_name)) {
-   err 

[PATCH v2] extcon: gpio: Add power resume support

2013-12-26 Thread rjying
From: Rongjun Ying 

When system on the suspend state, Some SoC can't get gpio interrupt.
After system resume, need send extcon uevent to userspace.

Signed-off-by: Rongjun Ying 
---
 -v2: Add lost_sleep_irq flags.

 drivers/extcon/extcon-gpio.c   |   20 
 include/linux/extcon/extcon-gpio.h |1 +
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 7e0dff5..fde52c1 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -40,6 +40,7 @@ struct gpio_extcon_data {
int irq;
struct delayed_work work;
unsigned long debounce_jiffies;
+   bool lost_sleep_irq;
 };
 
 static void gpio_extcon_work(struct work_struct *work)
@@ -103,6 +104,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
extcon_data->gpio_active_low = pdata->gpio_active_low;
extcon_data->state_on = pdata->state_on;
extcon_data->state_off = pdata->state_off;
+   extcon_data->lost_sleep_irq = pdata->lost_sleep_irq;
if (pdata->state_on && pdata->state_off)
extcon_data->edev.print_state = extcon_gpio_print_state;
if (pdata->debounce) {
@@ -159,12 +161,30 @@ static int gpio_extcon_remove(struct platform_device 
*pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int gpio_extcon_resume(struct device *dev)
+{
+   struct gpio_extcon_data *extcon_data;
+
+   extcon_data = dev_get_drvdata(dev);
+   if (extcon_data->lost_sleep_irq)
+   queue_delayed_work(system_power_efficient_wq,
+   _data->work, extcon_data->debounce_jiffies);
+   return 0;
+}
+#endif
+
+static const struct dev_pm_ops gpio_extcon_pm_ops = {
+   SET_SYSTEM_SLEEP_PM_OPS(NULL, gpio_extcon_resume)
+};
+
 static struct platform_driver gpio_extcon_driver = {
.probe  = gpio_extcon_probe,
.remove = gpio_extcon_remove,
.driver = {
.name   = "extcon-gpio",
.owner  = THIS_MODULE,
+   .pm = _extcon_pm_ops,
},
 };
 
diff --git a/include/linux/extcon/extcon-gpio.h 
b/include/linux/extcon/extcon-gpio.h
index 4195810..c7f0c3e 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -51,6 +51,7 @@ struct gpio_extcon_platform_data {
/* if NULL, "0" or "1" will be printed */
const char *state_on;
const char *state_off;
+   bool lost_sleep_irq;
 };
 
 #endif /* __EXTCON_GPIO_H__ */
-- 
1.7.5.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 1/2][Untested] ACPI / hotplug: Add demand_offline hotplug profile flag

2013-12-26 Thread Yasuaki Ishimatsu

(2013/12/27 14:18), Yasuaki Ishimatsu wrote:

(2013/12/27 9:58), Rafael J. Wysocki wrote:

On Thursday, December 26, 2013 01:10:30 PM Yasuaki Ishimatsu wrote:

(2013/12/26 12:10), Yasuaki Ishimatsu wrote:

(2013/12/23 23:00), Rafael J. Wysocki wrote:

From: Rafael J. Wysocki 

Add a new ACPI hotplug profile flag, demand_offline, such that if
set for the given ACPI device object's scan handler, it will cause
acpi_scan_hot_remove() to check if that device object's physical
companions are offline upfront and fail the hot removal if that
is not the case.

That flag will be useful to overcome a problem with containers on
some system where they can only be hot-removed after some cleanup
operations carried out by user space, which needs to be notified
of the container hot-removal before the kernel attempts to offline
devices in the container.  In those cases the current implementation
of acpi_scan_hot_remove() is not sufficient, because it first tries
to offline the devices in the container and only if that is
suffcessful it tries to offline the container itself.  As a result,
the container hot-removal notification is not delivered to user space
at the right time.

Signed-off-by: Rafael J. Wysocki 
---
   drivers/acpi/scan.c |   41 +
   include/acpi/acpi_bus.h |3 ++-
   2 files changed, 39 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/acpi/scan.c
===
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -126,6 +126,24 @@ acpi_device_modalias_show(struct device
   }
   static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);

+static bool acpi_scan_is_offline(struct acpi_device *adev)
+{
+struct acpi_device_physical_node *pn;
+bool offline = true;
+
+mutex_lock(>physical_node_lock);
+
+list_for_each_entry(pn, >physical_node_list, node)



+if (!pn->dev->offline) {





Please check pn->dev->bus and pn->dev->bus->offline too as follow:

  if (pn->dev->bus && pn->dev->bus->offline &&
  !pn->dev->offline) {



Adding above check, I could remove container device by using eject sysfs.
But following messages were shown:


Well, it looks like I have overlooked that error during my testing.


[ 1017.543000] [ cut here ]
[ 1017.543000] WARNING: CPU: 0 PID: 6 at drivers/base/core.c:251 
device_release+0x92/0xa0()
[ 1017.543000] Device 'ACPI0004:01' does not have a release() function, it is 
broken and must be fixed.
[ 1017.653000] Modules linked in: xt_CHECKSUM nf_conntrack_netbios_ns 
nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT ipmi_devintf ipt_REJECT 
cfg80211 xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc 
ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 
nf_nat_ipv6
ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables 
iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack 
iptable_mangle iptable_security iptable_raw iptable_filter sg ip_tables vfat 
fat x86_pkg_temp_thermal coretemp iTCO_wdt iTCO_vendor_support kvm_intel
kvm crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel 
lrw gf128mul glue_helper ablk_helper cryptd dm_mirror dm_region_hash dm_log 
dm_mod microcode lpc_ich igb sb_edac e1000e pcspkr i2c_i801
[ 1017.653000]  edac_core mfd_core dca ptp pps_core shpchp ipmi_si 
ipmi_msghandler tpm_infineon nfsd auth_rpcgss nfs_acl lockd sunrpc xfs 
libcrc32c sd_mod mgag200 syscopyarea sysfillrect sysimgblt lpfc i2c_algo_bit 
drm_kms_helper ttm drm crc_t10dif crct10dif_common scsi_transport_fc 
megaraid_sas
i2c_core scsi_tgt
[ 1017.653000] CPU: 0 PID: 6 Comm: kworker/u512:0 Tainted: GW
3.13.0-rc5+ #5
[ 1017.653000] Hardware name:
[ 1017.653000] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
[ 1017.653000]  0009 880873a6dc68 815d85ca 
880873a6dcb0
[ 1017.653000]  880873a6dca0 8106594d 8a07d221c010 
8a07d221c000
[ 1017.653000]  8808715472c0 880871e91018 0103 
880873a6dd00
[ 1017.653000] Call Trace:
[ 1017.653000]  [] dump_stack+0x45/0x56
[ 1017.653000]  [] warn_slowpath_common+0x7d/0xa0
[ 1017.653000]  [] warn_slowpath_fmt+0x4c/0x50
[ 1017.653000]  [] device_release+0x92/0xa0
[ 1017.653000]  [] kobject_cleanup+0x77/0x1b0
[ 1017.653000]  [] kobject_put+0x35/0x70
[ 1017.653000]  [] device_unregister+0x2c/0x60
[ 1017.653000]  [] container_device_detach+0x28/0x2a
[ 1017.653000]  [] acpi_bus_trim+0x56/0x89
[ 1017.653000]  [] acpi_device_hotplug+0x168/0x383
[ 1017.653000]  [] acpi_hotplug_work_fn+0x1c/0x27
[ 1017.653000]  [] process_one_work+0x17b/0x460
[ 1017.653000]  [] worker_thread+0x11b/0x400
[ 1017.653000]  [] ? rescuer_thread+0x3e0/0x3e0
[ 1017.653000]  [] kthread+0xd2/0xf0
[ 1017.653000]  [] ? kthread_create_on_node+0x180/0x180
[ 1017.653000]  [] ret_from_fork+0x7c/0xb0
[ 1017.653000]  [] ? 

Re: [PATCH 1/2][Untested] ACPI / hotplug: Add demand_offline hotplug profile flag

2013-12-26 Thread Yasuaki Ishimatsu

(2013/12/27 9:58), Rafael J. Wysocki wrote:

On Thursday, December 26, 2013 01:10:30 PM Yasuaki Ishimatsu wrote:

(2013/12/26 12:10), Yasuaki Ishimatsu wrote:

(2013/12/23 23:00), Rafael J. Wysocki wrote:

From: Rafael J. Wysocki 

Add a new ACPI hotplug profile flag, demand_offline, such that if
set for the given ACPI device object's scan handler, it will cause
acpi_scan_hot_remove() to check if that device object's physical
companions are offline upfront and fail the hot removal if that
is not the case.

That flag will be useful to overcome a problem with containers on
some system where they can only be hot-removed after some cleanup
operations carried out by user space, which needs to be notified
of the container hot-removal before the kernel attempts to offline
devices in the container.  In those cases the current implementation
of acpi_scan_hot_remove() is not sufficient, because it first tries
to offline the devices in the container and only if that is
suffcessful it tries to offline the container itself.  As a result,
the container hot-removal notification is not delivered to user space
at the right time.

Signed-off-by: Rafael J. Wysocki 
---
   drivers/acpi/scan.c |   41 +
   include/acpi/acpi_bus.h |3 ++-
   2 files changed, 39 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/acpi/scan.c
===
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -126,6 +126,24 @@ acpi_device_modalias_show(struct device
   }
   static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);

+static bool acpi_scan_is_offline(struct acpi_device *adev)
+{
+struct acpi_device_physical_node *pn;
+bool offline = true;
+
+mutex_lock(>physical_node_lock);
+
+list_for_each_entry(pn, >physical_node_list, node)



+if (!pn->dev->offline) {





Please check pn->dev->bus and pn->dev->bus->offline too as follow:

  if (pn->dev->bus && pn->dev->bus->offline &&
  !pn->dev->offline) {



Adding above check, I could remove container device by using eject sysfs.
But following messages were shown:


Well, it looks like I have overlooked that error during my testing.


[ 1017.543000] [ cut here ]
[ 1017.543000] WARNING: CPU: 0 PID: 6 at drivers/base/core.c:251 
device_release+0x92/0xa0()
[ 1017.543000] Device 'ACPI0004:01' does not have a release() function, it is 
broken and must be fixed.
[ 1017.653000] Modules linked in: xt_CHECKSUM nf_conntrack_netbios_ns 
nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT ipmi_devintf ipt_REJECT 
cfg80211 xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc 
ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 
nf_nat_ipv6
ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables 
iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack 
iptable_mangle iptable_security iptable_raw iptable_filter sg ip_tables vfat 
fat x86_pkg_temp_thermal coretemp iTCO_wdt iTCO_vendor_support kvm_intel
kvm crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel 
lrw gf128mul glue_helper ablk_helper cryptd dm_mirror dm_region_hash dm_log 
dm_mod microcode lpc_ich igb sb_edac e1000e pcspkr i2c_i801
[ 1017.653000]  edac_core mfd_core dca ptp pps_core shpchp ipmi_si 
ipmi_msghandler tpm_infineon nfsd auth_rpcgss nfs_acl lockd sunrpc xfs 
libcrc32c sd_mod mgag200 syscopyarea sysfillrect sysimgblt lpfc i2c_algo_bit 
drm_kms_helper ttm drm crc_t10dif crct10dif_common scsi_transport_fc 
megaraid_sas
i2c_core scsi_tgt
[ 1017.653000] CPU: 0 PID: 6 Comm: kworker/u512:0 Tainted: GW
3.13.0-rc5+ #5
[ 1017.653000] Hardware name:
[ 1017.653000] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
[ 1017.653000]  0009 880873a6dc68 815d85ca 
880873a6dcb0
[ 1017.653000]  880873a6dca0 8106594d 8a07d221c010 
8a07d221c000
[ 1017.653000]  8808715472c0 880871e91018 0103 
880873a6dd00
[ 1017.653000] Call Trace:
[ 1017.653000]  [] dump_stack+0x45/0x56
[ 1017.653000]  [] warn_slowpath_common+0x7d/0xa0
[ 1017.653000]  [] warn_slowpath_fmt+0x4c/0x50
[ 1017.653000]  [] device_release+0x92/0xa0
[ 1017.653000]  [] kobject_cleanup+0x77/0x1b0
[ 1017.653000]  [] kobject_put+0x35/0x70
[ 1017.653000]  [] device_unregister+0x2c/0x60
[ 1017.653000]  [] container_device_detach+0x28/0x2a
[ 1017.653000]  [] acpi_bus_trim+0x56/0x89
[ 1017.653000]  [] acpi_device_hotplug+0x168/0x383
[ 1017.653000]  [] acpi_hotplug_work_fn+0x1c/0x27
[ 1017.653000]  [] process_one_work+0x17b/0x460
[ 1017.653000]  [] worker_thread+0x11b/0x400
[ 1017.653000]  [] ? rescuer_thread+0x3e0/0x3e0
[ 1017.653000]  [] kthread+0xd2/0xf0
[ 1017.653000]  [] ? kthread_create_on_node+0x180/0x180
[ 1017.653000]  [] ret_from_fork+0x7c/0xb0
[ 1017.653000]  [] ? kthread_create_on_node+0x180/0x180
[ 1017.653000] ---[ end trace 

Re: [PATCH] serial: samsung: Remove hard-coded major/minor numbers

2013-12-26 Thread Greg KH
On Fri, Dec 27, 2013 at 10:37:28AM +0530, Tushar Behera wrote:
> The hard-coded values clash with the values set for amba-pl011 serial
> driver. Because of this there is no serial output on Samsung boards
> if amba-pl011 is enabled alongwith samsung-serial driver.
> 
> Remove the hardcoded values and let the framework decide on
> appropriate major/minor number. This is required for multi-platform
> development work on Exynos platform.
> 
> Signed-off-by: Tushar Behera 
> ---
>  drivers/tty/serial/samsung.c |4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> index c1af04d..9c20543 100644
> --- a/drivers/tty/serial/samsung.c
> +++ b/drivers/tty/serial/samsung.c
> @@ -56,8 +56,6 @@
>  /* UART name and device definitions */
>  
>  #define S3C24XX_SERIAL_NAME  "ttySAC"
> -#define S3C24XX_SERIAL_MAJOR 204
> -#define S3C24XX_SERIAL_MINOR 64
>  
>  /* macros to change one thing to another */
>  
> @@ -951,8 +949,6 @@ static struct uart_driver s3c24xx_uart_drv = {
>   .nr = CONFIG_SERIAL_SAMSUNG_UARTS,
>   .cons   = S3C24XX_SERIAL_CONSOLE,
>   .dev_name   = S3C24XX_SERIAL_NAME,
> - .major  = S3C24XX_SERIAL_MAJOR,
> - .minor  = S3C24XX_SERIAL_MINOR,

Doesn't this break existing systems and configurations that are
expecting 204:64 as the location of this serial port?

Why change this one and not the amba-pl011 driver?

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


[PATCH] serial: samsung: Remove hard-coded major/minor numbers

2013-12-26 Thread Tushar Behera
The hard-coded values clash with the values set for amba-pl011 serial
driver. Because of this there is no serial output on Samsung boards
if amba-pl011 is enabled alongwith samsung-serial driver.

Remove the hardcoded values and let the framework decide on
appropriate major/minor number. This is required for multi-platform
development work on Exynos platform.

Signed-off-by: Tushar Behera 
---
 drivers/tty/serial/samsung.c |4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index c1af04d..9c20543 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -56,8 +56,6 @@
 /* UART name and device definitions */
 
 #define S3C24XX_SERIAL_NAME"ttySAC"
-#define S3C24XX_SERIAL_MAJOR   204
-#define S3C24XX_SERIAL_MINOR   64
 
 /* macros to change one thing to another */
 
@@ -951,8 +949,6 @@ static struct uart_driver s3c24xx_uart_drv = {
.nr = CONFIG_SERIAL_SAMSUNG_UARTS,
.cons   = S3C24XX_SERIAL_CONSOLE,
.dev_name   = S3C24XX_SERIAL_NAME,
-   .major  = S3C24XX_SERIAL_MAJOR,
-   .minor  = S3C24XX_SERIAL_MINOR,
 };
 
 static struct s3c24xx_uart_port 
s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = {
-- 
1.7.9.5

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


[PATCH] irqchip: s3c24xx: add missing comma for completeness

2013-12-26 Thread Tushar Behera
No functional change, adding for uniformity.

Signed-off-by: Tushar Behera 
---
 drivers/irqchip/irq-s3c24xx.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index bbcc944..ee41ae2 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -270,7 +270,7 @@ static struct irq_chip s3c_irq_chip = {
.irq_mask   = s3c_irq_mask,
.irq_unmask = s3c_irq_unmask,
.irq_set_type   = s3c_irq_type,
-   .irq_set_wake   = s3c_irq_wake
+   .irq_set_wake   = s3c_irq_wake,
 };
 
 static struct irq_chip s3c_irq_level_chip = {
@@ -287,7 +287,7 @@ static struct irq_chip s3c_irqext_chip = {
.irq_unmask = s3c_irq_unmask,
.irq_ack= s3c_irq_ack,
.irq_set_type   = s3c_irqext_type,
-   .irq_set_wake   = s3c_irqext_wake
+   .irq_set_wake   = s3c_irqext_wake,
 };
 
 static struct irq_chip s3c_irq_eint0t4 = {
-- 
1.7.9.5

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


[PATCH] arm: mm: add memory type for inner-writeback

2013-12-26 Thread Mark Zhang
From: Colin Cross 

For streaming-style operations (e.g., software rendering of graphics
surfaces shared with non-coherent DMA devices), the cost of performing
L2 cache maintenance can exceed the benefit of having the larger cache
(this is particularly true for OUTER_CACHE configurations like the ARM
PL2x0).

This change uses the currently-unused mapping 5 (TEX[0]=1, C=0, B=1)
in the tex remapping tables as an inner-writeback-write-allocate, outer
non-cacheable memory type, so that this mapping will be available to
clients which will benefit from the reduced L2 maintenance.

Signed-off-by: Gary King 
---
 arch/arm/include/asm/pgtable-2level.h | 1 +
 arch/arm/include/asm/pgtable.h| 3 +++
 arch/arm/mm/proc-macros.S | 2 +-
 arch/arm/mm/proc-v7-2level.S  | 4 ++--
 arch/arm/mm/proc-xsc3.S   | 2 +-
 arch/arm/mm/proc-xscale.S | 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/pgtable-2level.h 
b/arch/arm/include/asm/pgtable-2level.h
index dfff709fda3c..528b397b6c91 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -141,6 +141,7 @@
 #define L_PTE_MT_DEV_WC(_AT(pteval_t, 0x09) << 2)  /* 1001 
*/
 #define L_PTE_MT_DEV_CACHED(_AT(pteval_t, 0x0b) << 2)  /* 1011 */
 #define L_PTE_MT_MASK  (_AT(pteval_t, 0x0f) << 2)
+#define L_PTE_MT_INNER_WB  (_AT(pteval_t, 0x05) << 2)  /* 0101 (armv6, 
armv7) */
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 7d59b524f2af..2b0601a9a18e 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -134,6 +134,9 @@ extern pgprot_t phys_mem_access_prot(struct file *file, 
unsigned long pfn,
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED | L_PTE_XN)
 #endif
 
+#define pgprot_inner_writeback(prot) \
+   __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_INNER_WB)
+
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e3c48a3fe063..fa829840ee16 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -127,7 +127,7 @@
.long   PTE_CACHEABLE   @ 
L_PTE_MT_WRITETHROUGH
.long   PTE_CACHEABLE | PTE_BUFFERABLE  @ 
L_PTE_MT_WRITEBACK
.long   PTE_BUFFERABLE  @ 
L_PTE_MT_DEV_SHARED
-   .long   0x00@ unused
+   .long   PTE_EXT_TEX(4) | PTE_BUFFERABLE @ 
L_PTE_MT_INNER_WB
.long   0x00@ 
L_PTE_MT_MINICACHE (not present)
.long   PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ 
L_PTE_MT_WRITEALLOC
.long   0x00@ unused
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index bdd3be4be77a..059a9d7242c2 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -144,8 +144,8 @@ ENDPROC(cpu_v7_set_pte_ext)
 *   NS1 = PRRR[19] = 1 - normal shareable property
 *   NOS = PRRR[24+n] = 1   - not outer shareable
 */
-.equ   PRRR,   0xff0a81a8
-.equ   NMRR,   0x40e040e0
+.equ   PRRR,   0xff0a89a8
+.equ   NMRR,   0x40e044e0
 
/*
 * Macro for setting up the TTBRx and TTBCR registers.
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index dc1645890042..9c374495e778 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -381,7 +381,7 @@ cpu_xsc3_mt_table:
.long   PTE_EXT_TEX(5) | PTE_CACHEABLE  @ 
L_PTE_MT_WRITETHROUGH
.long   PTE_CACHEABLE | PTE_BUFFERABLE  @ 
L_PTE_MT_WRITEBACK
.long   PTE_EXT_TEX(1) | PTE_BUFFERABLE @ 
L_PTE_MT_DEV_SHARED
-   .long   0x00@ unused
+   .long   PTE_EXT_TEX(4) | PTE_BUFFERABLE @ 
L_PTE_MT_INNER_WB (not present?)
.long   0x00@ 
L_PTE_MT_MINICACHE (not present)
.long   PTE_EXT_TEX(5) | PTE_CACHEABLE | PTE_BUFFERABLE @ 
L_PTE_MT_WRITEALLOC (not present?)
.long   0x00@ unused
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index d19b1cfcad91..2ac1b88e02ac 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -491,7 +491,7 @@ cpu_xscale_mt_table:
.long   PTE_CACHEABLE   @ 
L_PTE_MT_WRITETHROUGH
.long   PTE_CACHEABLE | PTE_BUFFERABLE  @ 
L_PTE_MT_WRITEBACK
.long   PTE_EXT_TEX(1) | PTE_BUFFERABLE @ 
L_PTE_MT_DEV_SHARED
-   .long   0x00@ unused
+   .long   PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ 
L_PTE_MT_INNER_WB

[PATCH] Current patch to fix autofs symlink expiry

2013-12-26 Thread Ian Kent
This patch obsoletes both the current patches:
autofs-fix-symlinks-arent-checked-for-expiry.patch
autofs-fix-fix-symlinks-arent-checked-for-expiry.patch

It's a merge of both of these patches with an updated description.

---

Ian Kent (1):
  autofs - fix symlinks aren't checked for expiry


 fs/autofs4/expire.c  |   14 ++
 fs/autofs4/symlink.c |4 
 2 files changed, 18 insertions(+)

-- 
Ian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] autofs - fix symlinks aren't checked for expiry

2013-12-26 Thread Ian Kent
From: Ian Kent 

The autofs4 module doesn't consider symlinks for expire as it did
in the older autofs v3 module (so it's actually a long stnding
regression).

The user space daemon has focused on the use of bind mounts instead
of symlinks for a long time now and that's why this has not been
noticed. But with the future addition of amd map parsing to
automount(8), not to mention amd itself (of am-utils), symlink
expiry will be needed.

The direct and offset mount types can't be symlinks and the tree
mounts of version 4 were always real mounts so only indirect
mounts need expire symlinks.

Since the current users of the autofs4 module haven't reproted
this as a problem to date this patch probably isn't a candidate
for backport to stable.

Signed-off-by: Ian Kent 
---
 fs/autofs4/expire.c  |   14 ++
 fs/autofs4/symlink.c |4 
 2 files changed, 18 insertions(+)

diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 3d9d3f5..394e90b 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -402,6 +402,20 @@ struct dentry *autofs4_expire_indirect(struct super_block 
*sb,
goto next;
}
 
+   if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)) {
+   DPRINTK("checking symlink %p %.*s",
+   dentry, (int)dentry->d_name.len, 
dentry->d_name.name);
+   /*
+* A symlink can't be "busy" in the usual sense so
+* just check last used for expire timeout.
+*/
+   if (autofs4_can_expire(dentry, timeout, do_now)) {
+   expired = dentry;
+   goto found;
+   }
+   goto next;
+   }
+
if (simple_empty(dentry))
goto next;
 
diff --git a/fs/autofs4/symlink.c b/fs/autofs4/symlink.c
index f27c094..1e8ea19 100644
--- a/fs/autofs4/symlink.c
+++ b/fs/autofs4/symlink.c
@@ -14,6 +14,10 @@
 
 static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
+   struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+   struct autofs_info *ino = autofs4_dentry_ino(dentry);
+   if (ino && !autofs4_oz_mode(sbi))
+   ino->last_used = jiffies;
nd_set_link(nd, dentry->d_inode->i_private);
return NULL;
 }

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


[PATCH] ASoC: simple-card: cleanup asoc_simple_card_parse_of() code

2013-12-26 Thread Xiubo Li
Since there is only one common format via "simple-audio-card,format"
for simple card driver(CPU & CODEC DAI), there is no need to do the
INV mask.

Signed-off-by: Xiubo Li 
---
 sound/soc/generic/simple-card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index d340320..8189e68 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -135,7 +135,7 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
 
/* get CPU/CODEC common format via simple-audio-card,format */
info->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
-   (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
+   SND_SOC_DAIFMT_FORMAT_MASK;
 
ret = asoc_simple_card_get_component(node, info);
if (ret)
-- 
1.8.4


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


[PATCH 3/6] f2fs: call f2fs_put_page at the error case

2013-12-26 Thread Jaegeuk Kim
In f2fs_write_begin(), if f2fs_conver_inline_data() returns an error like
-ENOSPC, f2fs should call f2fs_put_page().
Otherwise, it is remained as a locked page, resulting in the following bug.

[] sleep_on_page+0xe/0x20
[] __lock_page+0x67/0x70
[] truncate_inode_pages_range+0x368/0x5d0
[] truncate_inode_pages+0x15/0x20
[] truncate_pagecache+0x4b/0x70
[] truncate_setsize+0x12/0x20
[] f2fs_setattr+0x72/0x270 [f2fs]
[] notify_change+0x213/0x400
[] do_truncate+0x66/0xa0
[] vfs_truncate+0x191/0x1b0
[] do_sys_truncate+0x5c/0xa0
[] SyS_truncate+0xe/0x10
[] system_call_fastpath+0x16/0x1b
[] 0x

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

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index bf39eed..253e663 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -916,8 +916,10 @@ repeat:
goto inline_data;
} else if (f2fs_has_inline_data(inode)) {
err = f2fs_convert_inline_data(inode, page, flags);
-   if (err)
+   if (err) {
+   f2fs_put_page(page, 1);
return err;
+   }
}
 
f2fs_lock_op(sbi);
-- 
1.8.4.474.g128a96c

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


[PATCH 2/6] f2fs: convert inline_data for punch_hole

2013-12-26 Thread Jaegeuk Kim
In the punch_hole(), let's convert inline_data all the time for simplicity and
to avoid potential deadlock conditions.
It is pretty much not a big deal to do this.

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

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7ef2d6a..f64a1c8 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -462,25 +462,9 @@ static int punch_hole(struct inode *inode, loff_t offset, 
loff_t len)
loff_t off_start, off_end;
int ret = 0;
 
-   if (f2fs_has_inline_data(inode)) {
-   struct page *page;
-   unsigned flags = AOP_FLAG_NOFS;
-   page = grab_cache_page_write_begin(inode->i_mapping, 0, flags);
-   if (IS_ERR(page))
-   return PTR_ERR(page);
-   if (offset + len > MAX_INLINE_DATA) {
-   ret = f2fs_convert_inline_data(inode, page, flags);
-   f2fs_put_page(page, 1);
-   if (ret)
-   return ret;
-   } else {
-   zero_user_segment(page, offset, offset + len);
-   SetPageUptodate(page);
-   set_page_dirty(page);
-   f2fs_put_page(page, 1);
-   return ret;
-   }
-   }
+   ret = f2fs_convert_inline_data(inode, NULL, AOP_FLAG_NOFS);
+   if (ret)
+   return ret;
 
pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT;
pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT;
-- 
1.8.4.474.g128a96c

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


[PATCH 5/6] f2fs: add the number of inline_data files to status info

2013-12-26 Thread Jaegeuk Kim
This patch adds the number of inline_data files into the status information.
Note that the number is reset whenever the filesystem is newly mounted.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/debug.c  |  3 +++
 fs/f2fs/f2fs.h   | 16 +++-
 fs/f2fs/inline.c |  2 ++
 fs/f2fs/inode.c  |  1 +
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 61adbcb..711a0d4 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -45,6 +45,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
si->valid_count = valid_user_blocks(sbi);
si->valid_node_count = valid_node_count(sbi);
si->valid_inode_count = valid_inode_count(sbi);
+   si->inline_inode = sbi->inline_inode;
si->utilization = utilization(sbi);
 
si->free_segs = free_segments(sbi);
@@ -200,6 +201,8 @@ static int stat_show(struct seq_file *s, void *v)
seq_printf(s, "Other: %u)\n  - Data: %u\n",
   si->valid_node_count - si->valid_inode_count,
   si->valid_count - si->valid_node_count);
+   seq_printf(s, "  - Inline_data Inode: %u\n",
+  si->inline_inode);
seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n",
   si->main_area_segs, si->main_area_sections,
   si->main_area_zones);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index af35039..ef4073f 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -460,6 +460,7 @@ struct f2fs_sb_info {
unsigned int segment_count[2];  /* # of allocated segments */
unsigned int block_count[2];/* # of allocated blocks */
int total_hit_ext, read_hit_ext;/* extent cache hit ratio */
+   int inline_inode;   /* # of inline_data inodes */
int bg_gc;  /* background gc calls */
unsigned int n_dirty_dirs;  /* # of dir inodes */
 #endif
@@ -1201,7 +1202,7 @@ struct f2fs_stat_info {
int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
int nats, sits, fnids;
int total_count, utilization;
-   int bg_gc;
+   int bg_gc, inline_inode;
unsigned int valid_count, valid_node_count, valid_inode_count;
unsigned int bimodal, avg_vblocks;
int util_free, util_valid, util_invalid;
@@ -1230,6 +1231,17 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct 
f2fs_sb_info *sbi)
 #define stat_dec_dirty_dir(sbi)((sbi)->n_dirty_dirs--)
 #define stat_inc_total_hit(sb) ((F2FS_SB(sb))->total_hit_ext++)
 #define stat_inc_read_hit(sb)  ((F2FS_SB(sb))->read_hit_ext++)
+#define stat_inc_inline_inode(inode)   \
+   do {\
+   if (f2fs_has_inline_data(inode))\
+   ((F2FS_SB(inode->i_sb))->inline_inode++);   \
+   } while (0)
+#define stat_dec_inline_inode(inode)   \
+   do {\
+   if (f2fs_has_inline_data(inode))\
+   ((F2FS_SB(inode->i_sb))->inline_inode--);   \
+   } while (0)
+
 #define stat_inc_seg_type(sbi, curseg) \
((sbi)->segment_count[(curseg)->alloc_type]++)
 #define stat_inc_block_count(sbi, curseg)  \
@@ -1273,6 +1285,8 @@ void f2fs_destroy_root_stats(void);
 #define stat_dec_dirty_dir(sbi)
 #define stat_inc_total_hit(sb)
 #define stat_inc_read_hit(sb)
+#define stat_inc_inline_inode(inode)
+#define stat_dec_inline_inode(inode)
 #define stat_inc_seg_type(sbi, curseg)
 #define stat_inc_block_count(sbi, curseg)
 #define stat_inc_seg_count(si, type)
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 1843bc7..048f601 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -113,6 +113,7 @@ static int __f2fs_convert_inline_data(struct inode *inode, 
struct page *page)
zero_user_segment(ipage, INLINE_DATA_OFFSET,
 INLINE_DATA_OFFSET + MAX_INLINE_DATA);
clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
+   stat_dec_inline_inode(inode);
 
sync_inode_page();
f2fs_put_page(ipage, 1);
@@ -165,6 +166,7 @@ int f2fs_write_inline_data(struct inode *inode,
if (!f2fs_has_inline_data(inode)) {
truncate_data_blocks_range(, 1);
set_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
+   stat_inc_inline_inode(inode);
}
 
sync_inode_page();
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index a91f451..915f9a8 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -277,6 +277,7 @@ void f2fs_evict_inode(struct inode *inode)
 
f2fs_lock_op(sbi);

[PATCH 6/6] f2fs: add inline_data recovery routine

2013-12-26 Thread Jaegeuk Kim
This patch adds a inline_data recovery routine with the following policy.

[prev.] [next] of inline_data flag
   o   o  -> recover inline_data
   o   x  -> remove inline_data, and then recover data blocks
   x   o  -> remove inline_data, and then recover inline_data
   x   x  -> recover data blocks

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h  |  2 ++
 fs/f2fs/file.c  |  2 +-
 fs/f2fs/inline.c| 48 
 fs/f2fs/recovery.c  |  8 ++--
 include/linux/f2fs_fs.h |  3 +--
 5 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index ef4073f..6991a28 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1010,6 +1010,7 @@ static inline int f2fs_readonly(struct super_block *sb)
  */
 int f2fs_sync_file(struct file *, loff_t, loff_t, int);
 void truncate_data_blocks(struct dnode_of_data *);
+int truncate_blocks(struct inode *, u64);
 void f2fs_truncate(struct inode *);
 int f2fs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 int f2fs_setattr(struct dentry *, struct iattr *);
@@ -1318,4 +1319,5 @@ bool f2fs_may_inline(struct inode *);
 int f2fs_read_inline_data(struct inode *, struct page *);
 int f2fs_convert_inline_data(struct inode *, pgoff_t);
 int f2fs_write_inline_data(struct inode *, struct page *, unsigned int);
+int recover_inline_data(struct inode *, struct page *);
 #endif
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 68dd7bf..c77ad4d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -251,7 +251,7 @@ static void truncate_partial_data_page(struct inode *inode, 
u64 from)
f2fs_put_page(page, 1);
 }
 
-static int truncate_blocks(struct inode *inode, u64 from)
+int truncate_blocks(struct inode *inode, u64 from)
 {
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
unsigned int blocksize = inode->i_sb->s_blocksize;
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 048f601..0e940ce 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -174,3 +174,51 @@ int f2fs_write_inline_data(struct inode *inode,
 
return 0;
 }
+
+int recover_inline_data(struct inode *inode, struct page *npage)
+{
+   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+   struct f2fs_inode *ri = NULL;
+   void *src_addr, *dst_addr;
+   struct page *ipage;
+
+   /*
+* The inline_data recovery policy is as follows.
+* [prev.] [next] of inline_data flag
+*o   o  -> recover inline_data
+*o   x  -> remove inline_data, and then recover data blocks
+*x   o  -> remove inline_data, and then recover inline_data
+*x   x  -> recover data blocks
+*/
+   if (IS_INODE(npage))
+   ri = F2FS_INODE(npage);
+
+   if (f2fs_has_inline_data(inode) &&
+   ri && ri->i_inline & F2FS_INLINE_DATA) {
+process_inline:
+   ipage = get_node_page(sbi, inode->i_ino);
+   f2fs_bug_on(IS_ERR(ipage));
+
+   src_addr = inline_data_addr(npage);
+   dst_addr = inline_data_addr(ipage);
+   memcpy(dst_addr, src_addr, MAX_INLINE_DATA);
+   update_inode(inode, ipage);
+   f2fs_put_page(ipage, 1);
+   return -1;
+   }
+
+   if (f2fs_has_inline_data(inode)) {
+   ipage = get_node_page(sbi, inode->i_ino);
+   f2fs_bug_on(IS_ERR(ipage));
+   zero_user_segment(ipage, INLINE_DATA_OFFSET,
+INLINE_DATA_OFFSET + MAX_INLINE_DATA);
+   clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
+   update_inode(inode, ipage);
+   f2fs_put_page(ipage, 1);
+   } else if (ri && ri->i_inline & F2FS_INLINE_DATA) {
+   truncate_blocks(inode, 0);
+   set_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
+   goto process_inline;
+   }
+   return 0;
+}
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 96e690b6..655791e 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -298,6 +298,9 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct 
inode *inode,
struct node_info ni;
int err = 0, recovered = 0;
 
+   if (recover_inline_data(inode, page))
+   goto out;
+
start = start_bidx_of_node(ofs_of_node(page), fi);
if (IS_INODE(page))
end = start + ADDRS_PER_INODE(fi);
@@ -305,12 +308,13 @@ static int do_recover_data(struct f2fs_sb_info *sbi, 
struct inode *inode,
end = start + ADDRS_PER_BLOCK;
 
f2fs_lock_op(sbi);
+
set_new_dnode(, inode, NULL, NULL, 0);
 
err = get_dnode_of_data(, start, ALLOC_NODE);
if (err) {
f2fs_unlock_op(sbi);
-   return err;
+   goto out;
}
 
wait_on_page_writeback(dn.node_page);
@@ -361,7 +365,7 @@ static int 

[PATCH 1/6] f2fs: don't need to get f2fs_lock_op for the inline_data test

2013-12-26 Thread Jaegeuk Kim
This patch locates checking the inline_data prior to calling f2fs_lock_op()
in truncate_blocks(), since getting the lock is unnecessary.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/file.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index dd80e72..7ef2d6a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -261,14 +261,14 @@ static int truncate_blocks(struct inode *inode, u64 from)
 
trace_f2fs_truncate_blocks_enter(inode, from);
 
+   if (f2fs_has_inline_data(inode))
+   goto done;
+
free_from = (pgoff_t)
((from + blocksize - 1) >> (sbi->log_blocksize));
 
f2fs_lock_op(sbi);
 
-   if (f2fs_has_inline_data(inode))
-   goto done;
-
set_new_dnode(, inode, NULL, NULL, 0);
err = get_dnode_of_data(, free_from, LOOKUP_NODE);
if (err) {
@@ -295,9 +295,8 @@ static int truncate_blocks(struct inode *inode, u64 from)
f2fs_put_dnode();
 free_next:
err = truncate_inode_blocks(inode, free_from);
-done:
f2fs_unlock_op(sbi);
-
+done:
/* lastly zero out the first data page */
truncate_partial_data_page(inode, from);
 
-- 
1.8.4.474.g128a96c

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


[PATCH 4/6] f2fs: refactor f2fs_convert_inline_data

2013-12-26 Thread Jaegeuk Kim
This patch refactors f2fs_convert_inline_data to check a couple of conditions
internally for deciding whether it needs to convert inline_data or not.

So, the new f2fs_convert_inline_data initially checks:
1) f2fs_has_inline_data(), and
2) the data size to be changed.

If the inode has inline_data but the size to fill is less than MAX_INLINE_DATA,
then we don't need to convert the inline_data with data allocation.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/data.c   | 16 ++--
 fs/f2fs/f2fs.h   |  2 +-
 fs/f2fs/file.c   | 25 +
 fs/f2fs/inline.c | 26 --
 4 files changed, 28 insertions(+), 41 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 253e663..fc7a28c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -906,21 +906,17 @@ static int f2fs_write_begin(struct file *file, struct 
address_space *mapping,
 
f2fs_balance_fs(sbi);
 repeat:
+   err = f2fs_convert_inline_data(inode, pos + len);
+   if (err)
+   return err;
+
page = grab_cache_page_write_begin(mapping, index, flags);
if (!page)
return -ENOMEM;
*pagep = page;
 
-   if ((pos + len) < MAX_INLINE_DATA) {
-   if (f2fs_has_inline_data(inode))
-   goto inline_data;
-   } else if (f2fs_has_inline_data(inode)) {
-   err = f2fs_convert_inline_data(inode, page, flags);
-   if (err) {
-   f2fs_put_page(page, 1);
-   return err;
-   }
-   }
+   if (f2fs_has_inline_data(inode) && (pos + len) <= MAX_INLINE_DATA)
+   goto inline_data;
 
f2fs_lock_op(sbi);
set_new_dnode(, inode, NULL, NULL, 0);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index b01ccaa..af35039 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1302,6 +1302,6 @@ extern const struct inode_operations 
f2fs_special_inode_operations;
 inline int f2fs_has_inline_data(struct inode *);
 bool f2fs_may_inline(struct inode *);
 int f2fs_read_inline_data(struct inode *, struct page *);
-int f2fs_convert_inline_data(struct inode *, struct page *, unsigned);
+int f2fs_convert_inline_data(struct inode *, pgoff_t);
 int f2fs_write_inline_data(struct inode *, struct page *, unsigned int);
 #endif
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index f64a1c8..68dd7bf 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -370,17 +370,12 @@ int f2fs_setattr(struct dentry *dentry, struct iattr 
*attr)
 
if ((attr->ia_valid & ATTR_SIZE) &&
attr->ia_size != i_size_read(inode)) {
-   if (f2fs_has_inline_data(inode) &&
-   (attr->ia_size > MAX_INLINE_DATA)) {
-   unsigned flags = AOP_FLAG_NOFS;
-   err = f2fs_convert_inline_data(inode, NULL, flags);
-   if (err)
-   return err;
-   }
+   err = f2fs_convert_inline_data(inode, attr->ia_size);
+   if (err)
+   return err;
 
truncate_setsize(inode, attr->ia_size);
-   if (!f2fs_has_inline_data(inode))
-   f2fs_truncate(inode);
+   f2fs_truncate(inode);
f2fs_balance_fs(F2FS_SB(inode->i_sb));
}
 
@@ -462,7 +457,7 @@ static int punch_hole(struct inode *inode, loff_t offset, 
loff_t len)
loff_t off_start, off_end;
int ret = 0;
 
-   ret = f2fs_convert_inline_data(inode, NULL, AOP_FLAG_NOFS);
+   ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1);
if (ret)
return ret;
 
@@ -512,16 +507,14 @@ static int expand_inode_data(struct inode *inode, loff_t 
offset,
loff_t off_start, off_end;
int ret = 0;
 
-   if (f2fs_has_inline_data(inode) && (offset + len > MAX_INLINE_DATA)) {
-   ret = f2fs_convert_inline_data(inode, NULL, AOP_FLAG_NOFS);
-   if (ret)
-   return ret;
-   }
-
ret = inode_newsize_ok(inode, (len + offset));
if (ret)
return ret;
 
+   ret = f2fs_convert_inline_data(inode, offset + len);
+   if (ret)
+   return ret;
+
pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT;
pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT;
 
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 62c72aa..1843bc7 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -101,6 +101,7 @@ static int __f2fs_convert_inline_data(struct inode *inode, 
struct page *page)
dst_addr = kmap(page);
memcpy(dst_addr, src_addr, MAX_INLINE_DATA);
kunmap(page);
+   SetPageUptodate(page);
 
/* write data page to try to make data consistent */
set_page_writeback(page);
@@ -120,25 +121,22 @@ static int __f2fs_convert_inline_data(struct inode 
*inode, struct page *page)

[PATCH] mm: dump page when hitting a VM_BUG_ON using VM_BUG_ON_PAGE

2013-12-26 Thread Sasha Levin
Most of the VM_BUG_ON assertions are performed on a page. Usually, when
one of these assertions fails we'll get a BUG_ON with a call stack and
the registers.

I've recently noticed based on the requests to add a small piece of code
that dumps the page to various VM_BUG_ON sites that the page dump is quite
useful to people debugging issues in mm.

This patch adds a VM_BUG_ON_PAGE(cond, page) which beyond doing what
VM_BUG_ON() does, also dumps the page before executing the actual BUG_ON.

Signed-off-by: Sasha Levin 
---
 arch/x86/mm/gup.c  |  8 
 include/linux/hugetlb.h|  2 +-
 include/linux/hugetlb_cgroup.h |  4 ++--
 include/linux/mm.h | 22 +++---
 include/linux/mmdebug.h|  3 +++
 include/linux/page-flags.h | 10 +-
 include/linux/pagemap.h| 10 +-
 mm/cleancache.c|  6 +++---
 mm/compaction.c|  2 +-
 mm/filemap.c   | 16 
 mm/huge_memory.c   | 36 ++--
 mm/hugetlb.c   | 10 +-
 mm/hugetlb_cgroup.c|  2 +-
 mm/internal.h  | 14 +++---
 mm/ksm.c   | 12 ++--
 mm/memcontrol.c| 28 ++--
 mm/memory.c|  8 
 mm/migrate.c   |  6 +++---
 mm/mlock.c |  4 ++--
 mm/page_alloc.c| 21 +++--
 mm/page_io.c   |  4 ++--
 mm/rmap.c  | 12 ++--
 mm/shmem.c |  8 
 mm/slub.c  | 12 ++--
 mm/swap.c  | 36 ++--
 mm/swap_state.c| 16 
 mm/swapfile.c  |  8 
 mm/util.c  |  2 +-
 mm/vmscan.c| 20 ++--
 29 files changed, 173 insertions(+), 169 deletions(-)

diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 0596e8e..207d9aef 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -108,8 +108,8 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long 
addr,
 
 static inline void get_head_page_multiple(struct page *page, int nr)
 {
-   VM_BUG_ON(page != compound_head(page));
-   VM_BUG_ON(page_count(page) == 0);
+   VM_BUG_ON_PAGE(page != compound_head(page), page);
+   VM_BUG_ON_PAGE(page_count(page) == 0, page);
atomic_add(nr, >_count);
SetPageReferenced(page);
 }
@@ -135,7 +135,7 @@ static noinline int gup_huge_pmd(pmd_t pmd, unsigned long 
addr,
head = pte_page(pte);
page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
do {
-   VM_BUG_ON(compound_head(page) != head);
+   VM_BUG_ON_PAGE(compound_head(page) != head, page);
pages[*nr] = page;
if (PageTail(page))
get_huge_page_tail(page);
@@ -212,7 +212,7 @@ static noinline int gup_huge_pud(pud_t pud, unsigned long 
addr,
head = pte_page(pte);
page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
do {
-   VM_BUG_ON(compound_head(page) != head);
+   VM_BUG_ON_PAGE(compound_head(page) != head, page);
pages[*nr] = page;
if (PageTail(page))
get_huge_page_tail(page);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index d01cc97..eff5e24 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -354,7 +354,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct 
vm_area_struct *vma,
 
 static inline struct hstate *page_hstate(struct page *page)
 {
-   VM_BUG_ON(!PageHuge(page));
+   VM_BUG_ON_PAGE(!PageHuge(page), page);
return size_to_hstate(PAGE_SIZE << compound_order(page));
 }
 
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index ce8217f..844bd5a 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -28,7 +28,7 @@ struct hugetlb_cgroup;
 
 static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page 
*page)
 {
-   VM_BUG_ON(!PageHuge(page));
+   VM_BUG_ON_PAGE(!PageHuge(page), page);
 
if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
return NULL;
@@ -38,7 +38,7 @@ static inline struct hugetlb_cgroup 
*hugetlb_cgroup_from_page(struct page *page)
 static inline
 int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
 {
-   VM_BUG_ON(!PageHuge(page));
+   VM_BUG_ON_PAGE(!PageHuge(page), page);
 
if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
return -1;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 75bc489..aef772d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -303,7 +303,7 @@ static inline int get_freepage_migratetype(struct page 
*page)
  */
 static 

Re: [RFC] speeding up the stat() family of system calls...

2013-12-26 Thread H. Peter Anvin
Ok the sign bit doesn't really make any sense on second thought... to work with 
set_fs() we have to load something from memory anyway and then we might as well 
do a compare...

"H. Peter Anvin"  wrote:
>On 12/26/2013 11:00 AM, Linus Torvalds wrote:
>> 
>> Interestingly, looking at the cp_new_stat() profiles, the games we
>> play to get efficient range checking seem to actually hurt us. Maybe
>> it's the "sbb" that is just expensive, or maybe it's turning a (very
>> predictable) conditional branch into a data dependency chain instead.
>> Or maybe it's just random noise in my profiles that happened to make
>> those sbb's look bad.
>> 
>
>I'm not at all surprised... there is a pretty serious data dependency
>chain here and in the end we end up manifesting a value in a register
>that has to be tested even though it is available in the flags.  Inline
>assembly also means the compiler can't optimize it at all.
>
>I have to wonder if we actually have to test the upper limit, though:
>we
>can always guarantee a guard zone between user space and kernel space,
>and thus guarantee either a #PF or #GP if someone tries to overflow
>user
>space.  Testing just the lower limit would be much cheaper, especially
>on 64 bits where we can simply test the sign bit.
>
>What do you think?
>
>   -hpa

-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 stable v2 2/3] virtio-net: make all RX paths handle errors consistently

2013-12-26 Thread Jason Wang
On 12/26/2013 09:32 PM, Michael S. Tsirkin wrote:
> receive mergeable now handles errors internally.
> Do same for big and small packet paths, otherwise
> the logic is too hard to follow.
>
> Cc: Jason Wang 
> Cc: David S. Miller 
> Acked-by: Michael Dalton 
> Signed-off-by: Michael S. Tsirkin 
>
> (cherry picked from commit f121159d72091f25afb22007c833e60a6845e912)
> ---
>  drivers/net/virtio_net.c | 56 
> +++-
>  1 file changed, 36 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 435076f..c0ed6d5 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -297,6 +297,34 @@ static struct sk_buff *page_to_skb(struct receive_queue 
> *rq,
>   return skb;
>  }
>  
> +static struct sk_buff *receive_small(void *buf, unsigned int len)
> +{
> + struct sk_buff * skb = buf;
> +
> + len -= sizeof(struct virtio_net_hdr);
> + skb_trim(skb, len);
> +
> + return skb;
> +}
> +
> +static struct sk_buff *receive_big(struct net_device *dev,
> +struct receive_queue *rq,
> +void *buf)
> +{
> + struct page *page = buf;
> + struct sk_buff *skb = page_to_skb(rq, page, 0);
> +
> + if (unlikely(!skb))
> + goto err;
> +
> + return skb;
> +
> +err:
> + dev->stats.rx_dropped++;
> + give_pages(rq, page);
> + return NULL;
> +}
> +
>  static struct sk_buff *receive_mergeable(struct net_device *dev,
>struct receive_queue *rq,
>void *buf,
> @@ -360,7 +388,6 @@ static void receive_buf(struct receive_queue *rq, void 
> *buf, unsigned int len)
>   struct net_device *dev = vi->dev;
>   struct virtnet_stats *stats = this_cpu_ptr(vi->stats);
>   struct sk_buff *skb;
> - struct page *page;
>   struct skb_vnet_hdr *hdr;
>  
>   if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
> @@ -372,26 +399,15 @@ static void receive_buf(struct receive_queue *rq, void 
> *buf, unsigned int len)
>   dev_kfree_skb(buf);
>   return;
>   }
> + if (vi->mergeable_rx_bufs)
> + skb = receive_mergeable(dev, rq, buf, len);
> + else if (vi->big_packets)
> + skb = receive_big(dev, rq, buf);
> + else
> + skb = receive_small(buf, len);
>  
> - if (!vi->mergeable_rx_bufs && !vi->big_packets) {
> - skb = buf;
> - len -= sizeof(struct virtio_net_hdr);
> - skb_trim(skb, len);
> - } else {
> - page = buf;
> - if (vi->mergeable_rx_bufs) {
> - skb = receive_mergeable(dev, rq, page, len);
> - if (unlikely(!skb))
> - return;
> - } else {
> - skb = page_to_skb(rq, page, len);
> - if (unlikely(!skb)) {
> - dev->stats.rx_dropped++;
> - give_pages(rq, page);
> - return;
> - }
> - }
> - }
> + if (unlikely(!skb))
> + return;
>  
>   hdr = skb_vnet_hdr(skb);
>  

Acked-by: Jason Wang 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 stable v2 1/3] virtio_net: fix error handling for mergeable buffers

2013-12-26 Thread Jason Wang
On 12/26/2013 09:32 PM, Michael S. Tsirkin wrote:
> Eric Dumazet noticed that if we encounter an error
> when processing a mergeable buffer, we don't
> dequeue all of the buffers from this packet,
> the result is almost sure to be loss of networking.
>
> Fix this issue.
>
> Cc: Rusty Russell 
> Cc: Michael Dalton 
> Acked-by: Michael Dalton 
> Cc: Eric Dumazet 
> Cc: Jason Wang 
> Cc: David S. Miller 
>
> Signed-off-by: Michael S. Tsirkin 
>
> (cherry picked from commit 8fc3b9e9a229778e5af3aa453c44f1a3857ba769)
> ---
>  drivers/net/virtio_net.c | 66 
> +---
>  1 file changed, 46 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 9fbdfcd..435076f 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -297,26 +297,33 @@ static struct sk_buff *page_to_skb(struct receive_queue 
> *rq,
>   return skb;
>  }
>  
> -static int receive_mergeable(struct receive_queue *rq, struct sk_buff *skb)
> +static struct sk_buff *receive_mergeable(struct net_device *dev,
> +  struct receive_queue *rq,
> +  void *buf,
> +  unsigned int len)
>  {
> - struct skb_vnet_hdr *hdr = skb_vnet_hdr(skb);
> - struct page *page;
> - int num_buf, i, len;
> + struct skb_vnet_hdr *hdr = page_address(buf);
> + int num_buf = hdr->mhdr.num_buffers;
> + struct page *page = buf;
> + struct sk_buff *skb = page_to_skb(rq, page, len);
> + int i;
> +
> + if (unlikely(!skb))
> + goto err_skb;
>  
> - num_buf = hdr->mhdr.num_buffers;
>   while (--num_buf) {
>   i = skb_shinfo(skb)->nr_frags;
>   if (i >= MAX_SKB_FRAGS) {
>   pr_debug("%s: packet too long\n", skb->dev->name);
>   skb->dev->stats.rx_length_errors++;
> - return -EINVAL;
> + return NULL;
>   }
>   page = virtqueue_get_buf(rq->vq, );
>   if (!page) {
> - pr_debug("%s: rx error: %d buffers missing\n",
> -  skb->dev->name, hdr->mhdr.num_buffers);
> - skb->dev->stats.rx_length_errors++;
> - return -EINVAL;
> + pr_debug("%s: rx error: %d buffers %d missing\n",
> +  dev->name, hdr->mhdr.num_buffers, num_buf);
> + dev->stats.rx_length_errors++;
> + goto err_buf;
>   }
>  
>   if (len > PAGE_SIZE)
> @@ -326,7 +333,25 @@ static int receive_mergeable(struct receive_queue *rq, 
> struct sk_buff *skb)
>  
>   --rq->num;
>   }
> - return 0;
> + return skb;
> +err_skb:
> + give_pages(rq, page);
> + while (--num_buf) {
> + buf = virtqueue_get_buf(rq->vq, );
> + if (unlikely(!buf)) {
> + pr_debug("%s: rx error: %d buffers missing\n",
> +  dev->name, num_buf);
> + dev->stats.rx_length_errors++;
> + break;
> + }
> + page = buf;
> + give_pages(rq, page);
> + --rq->num;
> + }
> +err_buf:
> + dev->stats.rx_dropped++;
> + dev_kfree_skb(skb);
> + return NULL;
>  }
>  
>  static void receive_buf(struct receive_queue *rq, void *buf, unsigned int 
> len)
> @@ -354,17 +379,18 @@ static void receive_buf(struct receive_queue *rq, void 
> *buf, unsigned int len)
>   skb_trim(skb, len);
>   } else {
>   page = buf;
> - skb = page_to_skb(rq, page, len);
> - if (unlikely(!skb)) {
> - dev->stats.rx_dropped++;
> - give_pages(rq, page);
> - return;
> - }
> - if (vi->mergeable_rx_bufs)
> - if (receive_mergeable(rq, skb)) {
> - dev_kfree_skb(skb);
> + if (vi->mergeable_rx_bufs) {
> + skb = receive_mergeable(dev, rq, page, len);
> + if (unlikely(!skb))
> + return;
> + } else {
> + skb = page_to_skb(rq, page, len);
> + if (unlikely(!skb)) {
> + dev->stats.rx_dropped++;
> + give_pages(rq, page);
>   return;
>   }
> + }
>   }
>  
>   hdr = skb_vnet_hdr(skb);

Acked-by: Jason Wang 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ipvs: Remove unused variable ret from sync_thread_master()

2013-12-26 Thread Simon Horman
On Thu, Dec 19, 2013 at 09:23:51AM +0200, Julian Anastasov wrote:
> 
>   Hello,
> 
> On Wed, 13 Nov 2013, Julian Anastasov wrote:
> 
> > On Tue, 12 Nov 2013, Geert Uytterhoeven wrote:
> > 
> > > net/netfilter/ipvs/ip_vs_sync.c: In function 'sync_thread_master':
> > > net/netfilter/ipvs/ip_vs_sync.c:1640:8: warning: unused variable 'ret' 
> > > [-Wunused-variable]
> > > 
> > > Commit 35a2af94c7ce7130ca292c68b1d27fcfdb648f6b ("sched/wait: Make the
> > > __wait_event*() interface more friendly") changed how the interruption
> > > state is returned. However, sync_thread_master() ignores this state,
> > > now causing a compile warning.
> > > 
> > > According to Julian Anastasov , this behavior is OK:
> > > 
> > > "Yes, your patch looks ok to me. In the past we used ssleep() but IPVS
> > >  users were confused why IPVS threads increase the load average. So, 
> > > we
> > >  switched to _interruptible calls and later the socket polling was
> > >  added."
> > > 
> > > Document this, as requested by Peter Zijlstra, to avoid precious 
> > > developers
> > > disappearing in this pitfall in the future.
> > > 
> > > Signed-off-by: Geert Uytterhoeven 
> > > ---
> > > v2: Document that sync_thread_master() ignores the interruption state,
> > > 
> > >  net/netfilter/ipvs/ip_vs_sync.c |5 -
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/net/netfilter/ipvs/ip_vs_sync.c 
> > > b/net/netfilter/ipvs/ip_vs_sync.c
> > > index f63c2388f38d..db801263ee9f 100644
> > > --- a/net/netfilter/ipvs/ip_vs_sync.c
> > > +++ b/net/netfilter/ipvs/ip_vs_sync.c
> > > @@ -1637,7 +1637,10 @@ static int sync_thread_master(void *data)
> > >   continue;
> > >   }
> > >   while (ip_vs_send_sync_msg(tinfo->sock, sb->mesg) < 0) {
> > > - int ret = __wait_event_interruptible(*sk_sleep(sk),
> > > + /* (Ab)use interruptible sleep to avoid increasing
> > > +  * the load avg.
> > > +  */
> > > + __wait_event_interruptible(*sk_sleep(sk),
> > >  sock_writeable(sk) ||
> > >  kthread_should_stop());
> > >   if (unlikely(kthread_should_stop()))
> > 
> > Fabio Estevam posted similar change too early but
> > we are better with such comment.
> > 
> > Acked-by: Julian Anastasov 
> > 
> > Also, the TASK_UNINTERRUPTIBLE | TASK_IDLE idea looks good
> > to me. If such change is planned may be the above patch
> > better not to go via the ipvs-next tree to avoid conflicts?
> > As we don't have any changes in this area let us know if
> > someone takes the above patch for another tree.
> 
>   Simon, lets apply this patch to ipvs-next tree...

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


[PATCH net-next 1/6] r8152: move rtl8152_unload and ocp_reg_write

2013-12-26 Thread Hayes Wang
Change the locations of rtl8152_unload() and ocp_reg_write().

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 5107372..79bb553 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -653,6 +653,20 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 
index, u32 data)
generic_ocp_write(tp, index, byen, sizeof(tmp), , type);
 }
 
+static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data)
+{
+   u16 ocp_base, ocp_index;
+
+   ocp_base = addr & 0xf000;
+   if (ocp_base != tp->ocp_base) {
+   ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base);
+   tp->ocp_base = ocp_base;
+   }
+
+   ocp_index = (addr & 0x0fff) | 0xb000;
+   ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data);
+}
+
 static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value)
 {
u32 ocp_data;
@@ -715,20 +729,6 @@ void write_mii_word(struct net_device *netdev, int phy_id, 
int reg, int val)
r8152_mdio_write(tp, reg, val);
 }
 
-static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data)
-{
-   u16 ocp_base, ocp_index;
-
-   ocp_base = addr & 0xf000;
-   if (ocp_base != tp->ocp_base) {
-   ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base);
-   tp->ocp_base = ocp_base;
-   }
-
-   ocp_index = (addr & 0x0fff) | 0xb000;
-   ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data);
-}
-
 static
 int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags);
 
@@ -2079,6 +2079,21 @@ static void r8152b_get_version(struct r8152 *tp)
}
 }
 
+static void rtl8152_unload(struct r8152 *tp)
+{
+   u32 ocp_data;
+
+   if (tp->version != RTL_VER_01) {
+   ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_UPS_CTRL);
+   ocp_data |= POWER_CUT;
+   ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data);
+   }
+
+   ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
+   ocp_data &= ~RWSUME_INDICATE;
+   ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
+}
+
 static int rtl8152_probe(struct usb_interface *intf,
 const struct usb_device_id *id)
 {
@@ -2150,21 +2165,6 @@ out:
return ret;
 }
 
-static void rtl8152_unload(struct r8152 *tp)
-{
-   u32 ocp_data;
-
-   if (tp->version != RTL_VER_01) {
-   ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_UPS_CTRL);
-   ocp_data |= POWER_CUT;
-   ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data);
-   }
-
-   ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
-   ocp_data &= ~RWSUME_INDICATE;
-   ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
-}
-
 static void rtl8152_disconnect(struct usb_interface *intf)
 {
struct r8152 *tp = usb_get_intfdata(intf);
-- 
1.8.3.1

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


[PATCH] fbcon: trivial optimization for fbcon_exit

2013-12-26 Thread Wang YanQing
Break out as soon as we find a mapped entry con2fb_map.

Signed-off-by: Wang YanQing 
---
 drivers/video/console/fbcon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index cd8a802..f39931f 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3547,8 +3547,10 @@ static void fbcon_exit(void)
"no"));
 
for (j = first_fb_vc; j <= last_fb_vc; j++) {
-   if (con2fb_map[j] == i)
+   if (con2fb_map[j] == i) {
mapped = 1;
+   break;
+   }
}
 
if (mapped) {
-- 
1.8.3.4.8.g69490f3.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 net-next 3/6] r8152: change some definitions

2013-12-26 Thread Hayes Wang
Replace RX_BUF_THR with RX_THR_HIGH.
Replace RWSUME_INDICATE with RESUME_INDICATE.
Add CRC_SIZE, TX_ALIGN, and RX_ALIGN.

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index b8bc3eb..a8ea848 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -209,7 +209,7 @@
 #define TX_AGG_MAX_THRESHOLD   0x03
 
 /* USB_RX_BUF_TH */
-#define RX_BUF_THR 0x7a120180
+#define RX_THR_HIGH0x7a120180
 
 /* USB_TX_DMA */
 #define TEST_MODE_DISABLE  0x0001
@@ -219,7 +219,7 @@
 #define POWER_CUT  0x0100
 
 /* USB_PM_CTRL_STATUS */
-#define RWSUME_INDICATE0x0001
+#define RESUME_INDICATE0x0001
 
 /* USB_USB_CTRL */
 #define RX_AGG_DISABLE 0x0010
@@ -274,6 +274,9 @@ enum rtl_register_content {
 #define RTL8152_MAX_TX 10
 #define RTL8152_MAX_RX 10
 #define INTBUFSIZE 2
+#define CRC_SIZE   4
+#define TX_ALIGN   4
+#define RX_ALIGN   8
 
 #define INTR_LINK  0x0004
 
@@ -916,12 +919,12 @@ resubmit:
 
 static inline void *rx_agg_align(void *data)
 {
-   return (void *)ALIGN((uintptr_t)data, 8);
+   return (void *)ALIGN((uintptr_t)data, RX_ALIGN);
 }
 
 static inline void *tx_agg_align(void *data)
 {
-   return (void *)ALIGN((uintptr_t)data, 4);
+   return (void *)ALIGN((uintptr_t)data, TX_ALIGN);
 }
 
 static void free_all_mem(struct r8152 *tp)
@@ -990,7 +993,8 @@ static int alloc_all_mem(struct r8152 *tp)
 
if (buf != rx_agg_align(buf)) {
kfree(buf);
-   buf = kmalloc_node(rx_buf_sz + 8, GFP_KERNEL, node);
+   buf = kmalloc_node(rx_buf_sz + RX_ALIGN, GFP_KERNEL,
+  node);
if (!buf)
goto err1;
}
@@ -1015,7 +1019,8 @@ static int alloc_all_mem(struct r8152 *tp)
 
if (buf != tx_agg_align(buf)) {
kfree(buf);
-   buf = kmalloc_node(rx_buf_sz + 4, GFP_KERNEL, node);
+   buf = kmalloc_node(rx_buf_sz + TX_ALIGN, GFP_KERNEL,
+  node);
if (!buf)
goto err1;
}
@@ -1215,7 +1220,7 @@ static void rx_bottom(struct r8152 *tp)
 
stats = rtl8152_get_stats(netdev);
 
-   pkt_len -= 4; /* CRC */
+   pkt_len -= CRC_SIZE; /* CRC */
rx_data += sizeof(struct rx_desc);
 
skb = netdev_alloc_skb_ip_align(netdev, pkt_len);
@@ -1230,7 +1235,7 @@ static void rx_bottom(struct r8152 *tp)
stats->rx_packets++;
stats->rx_bytes += pkt_len;
 
-   rx_data = rx_agg_align(rx_data + pkt_len + 4);
+   rx_data = rx_agg_align(rx_data + pkt_len + CRC_SIZE);
rx_desc = (struct rx_desc *)rx_data;
len_used = (int)(rx_data - (u8 *)agg->head);
len_used += sizeof(struct rx_desc);
@@ -1580,7 +1585,7 @@ static void r8152b_exit_oob(struct r8152 *tp)
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TXFIFO_CTRL, TXFIFO_THR_NORMAL);
 
ocp_write_byte(tp, MCU_TYPE_USB, USB_TX_AGG, TX_AGG_MAX_THRESHOLD);
-   ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_BUF_THR);
+   ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_HIGH);
ocp_write_dword(tp, MCU_TYPE_USB, USB_TX_DMA,
TEST_MODE_DISABLE | TX_SIZE_ADJUST1);
 
@@ -1893,7 +1898,7 @@ static void r8152b_init(struct r8152 *tp)
ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data);
 
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
-   ocp_data &= ~RWSUME_INDICATE;
+   ocp_data &= ~RESUME_INDICATE;
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
 
r8152b_exit_oob(tp);
@@ -2074,7 +2079,7 @@ static void rtl8152_unload(struct r8152 *tp)
}
 
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
-   ocp_data &= ~RWSUME_INDICATE;
+   ocp_data &= ~RESUME_INDICATE;
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
 }
 
-- 
1.8.3.1

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


[PATCH net-next 6/6] r8152: support RTL8153

2013-12-26 Thread Hayes Wang
Support new chip RTL8153 which is the USB 3.0 giga ethernet adapter.

Signed-off-by: Hayes Wang 
---
 drivers/net/usb/cdc_ether.c |  10 +
 drivers/net/usb/r8152.c | 615 +++-
 drivers/net/usb/r815x.c |   2 +-
 3 files changed, 621 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 4b1c0f3..3e09887 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -486,6 +486,7 @@ static const struct driver_info wwan_info = {
 #define ZTE_VENDOR_ID  0x19D2
 #define DELL_VENDOR_ID 0x413C
 #define REALTEK_VENDOR_ID  0x0bda
+#define VENDOR_ID_SAMSUNG  0x04e8
 
 static const struct usb_device_id  products[] = {
 /* BLACKLIST !!
@@ -652,6 +653,15 @@ static const struct usb_device_id  products[] = {
.driver_info = 0,
 },
 
+#if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE)
+/* Samsung USB Ethernet Adapters */
+{
+   USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID_SAMSUNG, 0xa101, USB_CLASS_COMM,
+   USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
+   .driver_info = 0,
+},
+#endif
+
 /* WHITELIST!!!
  *
  * CDC Ether uses two interfaces, not necessarily consecutive.
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 537..bc226e9 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -24,7 +24,7 @@
 #include 
 
 /* Version Information */
-#define DRIVER_VERSION "v1.02.0 (2013/10/28)"
+#define DRIVER_VERSION "v1.03.0 (2013/12/26)"
 #define DRIVER_AUTHOR "Realtek linux nic maintainers "
 #define DRIVER_DESC "Realtek RTL8152 Based USB 2.0 Ethernet Adapters"
 #define MODULENAME "r8152"
@@ -39,15 +39,24 @@
 #define PLA_RXFIFO_CTRL2   0xc0a8
 #define PLA_FMC0xc0b4
 #define PLA_CFG_WOL0xc0b6
+#define PLA_TEREDO_CFG 0xc0bc
 #define PLA_MAR0xcd00
+#define PLA_BACKUP 0xd000
 #define PAL_BDC_CR 0xd1a0
+#define PLA_TEREDO_TIMER   0xd2cc
+#define PLA_REALWOW_TIMER  0xd2e8
 #define PLA_LEDSEL 0xdd90
 #define PLA_LED_FEATURE0xdd92
 #define PLA_PHYAR  0xde00
+#define PLA_BOOT_CTRL  0xe004
 #define PLA_GPHY_INTR_IMR  0xe022
 #define PLA_EEE_CR 0xe040
 #define PLA_EEEP_CR0xe080
 #define PLA_MAC_PWR_CTRL   0xe0c0
+#define PLA_MAC_PWR_CTRL2  0xe0ca
+#define PLA_MAC_PWR_CTRL3  0xe0cc
+#define PLA_MAC_PWR_CTRL4  0xe0ce
+#define PLA_WDT6_CTRL  0xe428
 #define PLA_TCR0   0xe610
 #define PLA_TCR1   0xe612
 #define PLA_TXFIFO_CTRL0xe618
@@ -73,16 +82,25 @@
 #define PLA_BP_5   0xfc32
 #define PLA_BP_6   0xfc34
 #define PLA_BP_7   0xfc36
+#define PLA_BP_EN  0xfc38
 
+#define USB_U2P3_CTRL  0xb460
 #define USB_DEV_STAT   0xb808
 #define USB_USB_CTRL   0xd406
 #define USB_PHY_CTRL   0xd408
 #define USB_TX_AGG 0xd40a
 #define USB_RX_BUF_TH  0xd40c
 #define USB_USB_TIMER  0xd428
+#define USB_RX_EARLY_AGG   0xd42c
 #define USB_PM_CTRL_STATUS 0xd432
 #define USB_TX_DMA 0xd434
+#define USB_TOLERANCE  0xd490
+#define USB_LPM_CTRL   0xd41a
 #define USB_UPS_CTRL   0xd800
+#define USB_MISC_0 0xd81a
+#define USB_POWER_CUT  0xd80a
+#define USB_AFE_CTRL2  0xd824
+#define USB_WDT11_CTRL 0xe43c
 #define USB_BP_BA  0xfc26
 #define USB_BP_0   0xfc28
 #define USB_BP_1   0xfc2a
@@ -92,6 +110,7 @@
 #define USB_BP_5   0xfc32
 #define USB_BP_6   0xfc34
 #define USB_BP_7   0xfc36
+#define USB_BP_EN  0xfc38
 
 /* OCP Registers */
 #define OCP_ALDPS_CONFIG   0x2010
@@ -101,6 +120,20 @@
 #define OCP_BASE_MII   0xa400
 #define OCP_EEE_AR 0xa41a
 #define OCP_EEE_DATA   0xa41c
+#define OCP_PHY_STATUS 0xa420
+#define OCP_POWER_CFG  0xa430
+#define OCP_EEE_CFG0xa432
+#define OCP_SRAM_ADDR  0xa436
+#define OCP_SRAM_DATA  0xa438
+#define OCP_DOWN_SPEED 0xa442
+#define OCP_EEE_CFG2   0xa5d0
+#define OCP_ADC_CFG0xbc06
+
+/* SRAM Register */
+#define SRAM_LPF_CFG   0x8012
+#define SRAM_10M_AMP1  0x8080
+#define SRAM_10M_AMP2  0x8082
+#define SRAM_IMPEDANCE 0x8084
 
 /* PLA_RCR */
 #define RCR_AAP0x0001
@@ -117,14 +150,17 @@
 #define RXFIFO_THR2_FULL   0x0060
 #define RXFIFO_THR2_HIGH   0x0038
 #define RXFIFO_THR2_OOB0x004a
+#define RXFIFO_THR2_NORMAL 0x00a0
 
 /* PLA_RXFIFO_CTRL2 */
 #define RXFIFO_THR3_FULL   0x0078
 #define RXFIFO_THR3_HIGH   0x0048
 #define RXFIFO_THR3_OOB0x005a
+#define RXFIFO_THR3_NORMAL 

[PATCH net-next 5/6] r8152: split rtl8152_enable

2013-12-26 Thread Hayes Wang
Split the contents of rtl8152_enable() into rtl_set_eee_plus() and
rtl_enable().

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 040ef73..537 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1447,13 +1447,11 @@ static inline u8 rtl8152_get_speed(struct r8152 *tp)
return ocp_read_byte(tp, MCU_TYPE_PLA, PLA_PHYSTATUS);
 }
 
-static int rtl8152_enable(struct r8152 *tp)
+static void rtl_set_eee_plus(struct r8152 *tp)
 {
u32 ocp_data;
-   int i, ret;
u8 speed;
 
-   set_tx_qlen(tp);
speed = rtl8152_get_speed(tp);
if (speed & _10bps) {
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR);
@@ -1464,6 +1462,12 @@ static int rtl8152_enable(struct r8152 *tp)
ocp_data &= ~EEEP_CR_EEEP_TX;
ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR, ocp_data);
}
+}
+
+static int rtl_enable(struct r8152 *tp)
+{
+   u32 ocp_data;
+   int i, ret;
 
r8152b_reset_packet_filter(tp);
 
@@ -1485,6 +1489,14 @@ static int rtl8152_enable(struct r8152 *tp)
return ret;
 }
 
+static int rtl8152_enable(struct r8152 *tp)
+{
+   set_tx_qlen(tp);
+   rtl_set_eee_plus(tp);
+
+   return rtl_enable(tp);
+}
+
 static void rtl8152_disable(struct r8152 *tp)
 {
struct net_device_stats *stats = rtl8152_get_stats(tp->netdev);
-- 
1.8.3.1

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


[PATCH net-next 2/6] r8152: modify the method of accessing PHY

2013-12-26 Thread Hayes Wang
The old method to access PHY is through mdio channel. Replace it
with the OCP channel.

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 79bb553..b8bc3eb 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -98,6 +98,7 @@
 #define OCP_EEE_CONFIG10x2080
 #define OCP_EEE_CONFIG20x2092
 #define OCP_EEE_CONFIG30x2094
+#define OCP_BASE_MII   0xa400
 #define OCP_EEE_AR 0xa41a
 #define OCP_EEE_DATA   0xa41c
 
@@ -653,7 +654,7 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 
index, u32 data)
generic_ocp_write(tp, index, byen, sizeof(tmp), , type);
 }
 
-static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data)
+static u16 ocp_reg_read(struct r8152 *tp, u16 addr)
 {
u16 ocp_base, ocp_index;
 
@@ -664,48 +665,31 @@ static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 
data)
}
 
ocp_index = (addr & 0x0fff) | 0xb000;
-   ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data);
+   return ocp_read_word(tp, MCU_TYPE_PLA, ocp_index);
 }
 
-static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value)
+static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data)
 {
-   u32 ocp_data;
-   int i;
-
-   ocp_data = PHYAR_FLAG | ((reg_addr & 0x1f) << 16) |
-  (value & 0x);
-
-   ocp_write_dword(tp, MCU_TYPE_PLA, PLA_PHYAR, ocp_data);
+   u16 ocp_base, ocp_index;
 
-   for (i = 20; i > 0; i--) {
-   udelay(25);
-   ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_PHYAR);
-   if (!(ocp_data & PHYAR_FLAG))
-   break;
+   ocp_base = addr & 0xf000;
+   if (ocp_base != tp->ocp_base) {
+   ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base);
+   tp->ocp_base = ocp_base;
}
-   udelay(20);
+
+   ocp_index = (addr & 0x0fff) | 0xb000;
+   ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data);
 }
 
-static int r8152_mdio_read(struct r8152 *tp, u32 reg_addr)
+static inline void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value)
 {
-   u32 ocp_data;
-   int i;
-
-   ocp_data = (reg_addr & 0x1f) << 16;
-   ocp_write_dword(tp, MCU_TYPE_PLA, PLA_PHYAR, ocp_data);
-
-   for (i = 20; i > 0; i--) {
-   udelay(25);
-   ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_PHYAR);
-   if (ocp_data & PHYAR_FLAG)
-   break;
-   }
-   udelay(20);
-
-   if (!(ocp_data & PHYAR_FLAG))
-   return -EAGAIN;
+   ocp_reg_write(tp, OCP_BASE_MII + reg_addr * 2, value);
+}
 
-   return (u16)(ocp_data & 0x);
+static inline int r8152_mdio_read(struct r8152 *tp, u32 reg_addr)
+{
+   return ocp_reg_read(tp, OCP_BASE_MII + reg_addr * 2);
 }
 
 static int read_mii_word(struct net_device *netdev, int phy_id, int reg)
-- 
1.8.3.1

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


[PATCH net-next 4/6] r8152: add rtl_ops

2013-12-26 Thread Hayes Wang
The different chips may have different settings. This makes it easy
to let different chips have the same flow with differnt settings.

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

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index a8ea848..040ef73 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -367,6 +367,15 @@ struct r8152 {
spinlock_t rx_lock, tx_lock;
struct delayed_work schedule;
struct mii_if_info mii;
+
+   struct rtl_ops {
+   void (*init)(struct r8152 *);
+   int (*enable)(struct r8152 *);
+   void (*disable)(struct r8152 *);
+   void (*down)(struct r8152 *);
+   void (*unload)(struct r8152 *);
+   } rtl_ops;
+
int intr_interval;
u32 msg_enable;
u32 tx_qlen;
@@ -1751,7 +1760,7 @@ static void set_carrier(struct r8152 *tp)
 
if (speed & LINK_STATUS) {
if (!(tp->speed & LINK_STATUS)) {
-   rtl8152_enable(tp);
+   tp->rtl_ops.enable(tp);
set_bit(RTL8152_SET_RX_MODE, >flags);
netif_carrier_on(netdev);
}
@@ -1759,7 +1768,7 @@ static void set_carrier(struct r8152 *tp)
if (tp->speed & LINK_STATUS) {
netif_carrier_off(netdev);
tasklet_disable(>tl);
-   rtl8152_disable(tp);
+   tp->rtl_ops.disable(tp);
tasklet_enable(>tl);
}
}
@@ -1819,7 +1828,7 @@ static int rtl8152_close(struct net_device *netdev)
cancel_delayed_work_sync(>schedule);
netif_stop_queue(netdev);
tasklet_disable(>tl);
-   rtl8152_disable(tp);
+   tp->rtl_ops.disable(tp);
tasklet_enable(>tl);
 
return res;
@@ -1945,7 +1954,7 @@ static int rtl8152_suspend(struct usb_interface *intf, 
pm_message_t message)
tasklet_disable(>tl);
}
 
-   rtl8152_down(tp);
+   tp->rtl_ops.down(tp);
 
return 0;
 }
@@ -1954,7 +1963,7 @@ static int rtl8152_resume(struct usb_interface *intf)
 {
struct r8152 *tp = usb_get_intfdata(intf);
 
-   r8152b_init(tp);
+   tp->rtl_ops.init(tp);
netif_device_attach(tp->netdev);
if (netif_running(tp->netdev)) {
rtl8152_set_speed(tp, AUTONEG_ENABLE, SPEED_100, DUPLEX_FULL);
@@ -2083,6 +2092,34 @@ static void rtl8152_unload(struct r8152 *tp)
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
 }
 
+static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
+{
+   struct rtl_ops *ops = >rtl_ops;
+   int ret = 0;
+
+   switch (id->idVendor) {
+   case VENDOR_ID_REALTEK:
+   switch (id->idProduct) {
+   case PRODUCT_ID_RTL8152:
+   ops->init   = r8152b_init;
+   ops->enable = rtl8152_enable;
+   ops->disable= rtl8152_disable;
+   ops->down   = rtl8152_down;
+   ops->unload = rtl8152_unload;
+   break;
+   default:
+   ret = -EFAULT;
+   break;
+   }
+   break;
+
+   default:
+   ret = -EFAULT;
+   break;
+   }
+   return ret;
+}
+
 static int rtl8152_probe(struct usb_interface *intf,
 const struct usb_device_id *id)
 {
@@ -2106,6 +2143,11 @@ static int rtl8152_probe(struct usb_interface *intf,
tp = netdev_priv(netdev);
tp->msg_enable = 0x7FFF;
 
+   if (rtl_ops_init(tp, id)) {
+   netif_err(tp, probe, netdev, "Unknown Device");
+   return -ENODEV;
+   }
+
tasklet_init(>tl, bottom_half, (unsigned long)tp);
INIT_DELAYED_WORK(>schedule, rtl_work_func_t);
 
@@ -2128,7 +2170,7 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->mii.supports_gmii = 0;
 
r8152b_get_version(tp);
-   r8152b_init(tp);
+   tp->rtl_ops.init(tp);
set_ethernet_addr(tp);
 
ret = alloc_all_mem(tp);
@@ -2163,7 +2205,7 @@ static void rtl8152_disconnect(struct usb_interface *intf)
set_bit(RTL8152_UNPLUG, >flags);
tasklet_kill(>tl);
unregister_netdev(tp->netdev);
-   rtl8152_unload(tp);
+   tp->rtl_ops.unload(tp);
free_all_mem(tp);
free_netdev(tp->netdev);
}
-- 
1.8.3.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  

[PATCH net-next 0/6] Support new chip

2013-12-26 Thread Hayes Wang
Adjust the code to make it easy to add the settings for the new chip.
Then, add the relative parameters of the RTL8153.

Hayes Wang (6):
  r8152: move rtl8152_unload and ocp_reg_write
  r8152: modify the method of accessing PHY
  r8152: change some definitions
  r8152: add rtl_ops
  r8152: split rtl8152_enable
  r8152: support RTL8153

 drivers/net/usb/cdc_ether.c |  10 +
 drivers/net/usb/r8152.c | 812 +++-
 drivers/net/usb/r815x.c |   2 +-
 3 files changed, 741 insertions(+), 83 deletions(-)

-- 
1.8.3.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] drivers: video: Remove unused function genericbl_limit_intensity() in generic_bl.c

2013-12-26 Thread Jingoo Han
On Monday, December 16, 2013 11:24 PM, Josh Triplett wrote:
> On Mon, Dec 16, 2013 at 04:51:10PM +0530, Rashika Kheria wrote:
> > Removes unused function genericbl_limit_intensity() in
> > backlight/generic_bl.c.
> >
> > This eliminates the following warning in backlight/generic_bl.c:
> > drivers/video/backlight/generic_bl.c:59:6: warning: no previous prototype 
> > for
> ‘genericbl_limit_intensity’ [-Wmissing-prototypes]
> >
> > Signed-off-by: Rashika Kheria 
> 
> Reviewed-by: Josh Triplett 

(+cc Andrew Morton, Eric Miao)

Acked-by: Jingoo Han 

Best regards,
Jingoo Han

> 
> >  drivers/video/backlight/generic_bl.c |   18 --
> >  1 file changed, 18 deletions(-)
> >
> > diff --git a/drivers/video/backlight/generic_bl.c 
> > b/drivers/video/backlight/generic_bl.c
> > index 5d8d652..67dfb93 100644
> > --- a/drivers/video/backlight/generic_bl.c
> > +++ b/drivers/video/backlight/generic_bl.c
> > @@ -52,24 +52,6 @@ static int genericbl_get_intensity(struct 
> > backlight_device *bd)
> > return genericbl_intensity;
> >  }
> >
> > -/*
> > - * Called when the battery is low to limit the backlight intensity.
> > - * If limit==0 clear any limit, otherwise limit the intensity
> > - */
> > -void genericbl_limit_intensity(int limit)
> > -{
> > -   struct backlight_device *bd = generic_backlight_device;
> > -
> > -   mutex_lock(>ops_lock);
> > -   if (limit)
> > -   bd->props.state |= GENERICBL_BATTLOW;
> > -   else
> > -   bd->props.state &= ~GENERICBL_BATTLOW;
> > -   backlight_update_status(generic_backlight_device);
> > -   mutex_unlock(>ops_lock);
> > -}
> > -EXPORT_SYMBOL(genericbl_limit_intensity);
> > -
> >  static const struct backlight_ops genericbl_ops = {
> > .options = BL_CORE_SUSPENDRESUME,
> > .get_brightness = genericbl_get_intensity,
> > --
> > 1.7.9.5
> >

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


Re: No freezing of kernel threads (was: Re: [GIT PULL] libata fixes for v3.13-rc5)

2013-12-26 Thread Tejun Heo
Hello,

On Thu, Dec 26, 2013 at 09:14:49PM -0500, Alan Stern wrote:
> I can't disagree with this.  But the design may well be perfectly
> adequate for some use cases.  Given a workqueue or kthread which should
> not operate during system sleep, we have to:
> 
>   Tell the wq/thread to stop running because a sleep is about
>   to start, and
> 
>   Provide a function the wq/thread can call to put itself on 
>   hold for the duration of the sleep.
> 
> The freezer does both these things pretty efficiently.  Problems may

I don't even like the interface itself.  It's too implicit and spread
all over the place - we basically had to spread it all over the wait
interfaces, and the implementation is far more involved than called
for.  I don't know how you're defining "efficiently" but that isn't a
word I'd use to describe the freezer.

> So you're suggesting changing the kthread to a workqueue thread, but
> keeping the existing list of scheduled events instead of relying on the
> workqueue's own queue of work items?  What's the advantage?  Making
> such a change wouldn't simplify anything.

Well, that'd be an easy first step which does away with the dedicated
kthread, likely reduces cache footprint and allows use of wq
synchronization / freezing constructs which are easier to deal with.
More involved conversion would of course be doable but even simple
conversion seems like a win.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: No freezing of kernel threads (was: Re: [GIT PULL] libata fixes for v3.13-rc5)

2013-12-26 Thread Alan Stern
Hello,

On Thu, 26 Dec 2013, Tejun Heo wrote:

> > Maybe it's the other way around: The separate paths are necessary, and 
> > the freezer _simplifies_ the system sleep ops.
> 
> Again, the point is it's too big a tool given the problem with history
> of abuse.  It sure is "convenient" to have tools at that level for
> that particular user - not because the task at hand fits such solution
> but because a lot more is being paid elsewhere.  It just is out of
> proportion and isn't a good design in larger sense.

I can't disagree with this.  But the design may well be perfectly
adequate for some use cases.  Given a workqueue or kthread which should
not operate during system sleep, we have to:

Tell the wq/thread to stop running because a sleep is about
to start, and

Provide a function the wq/thread can call to put itself on 
hold for the duration of the sleep.

The freezer does both these things pretty efficiently.  Problems may
arise, though, because of workqueues or kthreads which need to continue 
some but not all of their operations, or which need to be put on hold 
in a specific sequence with respect to other threads.  The freezer is 
not suited for such things.

(There is a similar problem when userspace gets frozen.  Tasks 
implementing FUSE filesystems, in particular, have a deplorable 
tendency to get frozen at inconvenient times.)

> As for autopm vs. system pm, there sure are necessary differences
> between the two but they also can share a lot.  At least, it looks
> that way from libata side.  I really don't think having two separate
> paradigms in implementing PM is a good idea even if the two paths have
> to deviate in significant ways.

Put it the other way around: Implementing two significantly different
kinds of PM is okay because the two paths can share a lot.

Really.  Although system PM and runtime PM may appear similar from some
points of view, underneath they are quite different in several
important ways.  Most of what they have in common is the idea of 
putting devices into or out of low-power states.  But when and how to 
do these things...

> > Taking khubd as an example, I have to agree that converting it to a
> > workqueue would be a big simplification overall.  And yet there are
> > some things khubd does which are (as far as I know) rather difficult to
> > accomplish with workqueues.  One example in drivers/usb/core/hub.c:  
> > kick_khubd() calls usb_autopm_get_interface_no_resume() if and only if
> > it added the hub to the event list (and it does so before releasing the
> > list's lock).  How can you do that with a workqueue?
> 
> Do the same thing and just replace wake_up() with queue_work()?

So you're suggesting changing the kthread to a workqueue thread, but
keeping the existing list of scheduled events instead of relying on the
workqueue's own queue of work items?  What's the advantage?  Making
such a change wouldn't simplify anything.

Alan Stern

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


Re: [PATCH] doc/kmemcheck: add kmemcheck to kernel-parameters.txt

2013-12-26 Thread Greg KH
On Thu, Dec 26, 2013 at 11:25:03AM +0800, Xishi Qiu wrote:
> Add kmemcheck to Documentation/kernel-parameters.txt.
> 
> Signed-off-by: Xishi Qiu 
> ---
>  Documentation/kernel-parameters.txt |7 +++
>  1 files changed, 7 insertions(+), 0 deletions(-)




This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] autofs - fix fix symlinks arent checked for expiry

2013-12-26 Thread Ian Kent
On Thu, 2013-12-26 at 17:19 -0800, Andrew Morton wrote:
> On Fri, 27 Dec 2013 09:09:52 +0800 Ian Kent  wrote:
> 
> > On Thu, 2013-12-26 at 13:42 -0800, Andrew Morton wrote:
> > > On Tue, 24 Dec 2013 17:44:59 +0800 Ian Kent  wrote:
> > > 
> > > > When following a symlink the last_used counter is unconditionally
> > > > updated causing the expire checks from user space to prevent
> > > > expiry. Opps!
> > > 
> > > A bit unclear.  You're saying that userspace's act of checking expiry
> > > status will itself disrupt the expiry process?
> > 
> > If the user space expire code uses stat(2) instead of lstat(2), yes.
> > It's quite possible this will be the case since it made no difference
> > when not using symlinks in the autofs directory tree.
> > 
> > > 
> > > Also, it's rather unclear what the userspace impact is here, and how
> > > severe it is.  Please always carefully describe the user-visible impact
> > > so that others can decide which kernel version(s) need the patch.
> > 
> > The impact of this is that symlinks within an an autofs directory tree
> > don't cause a callback to the daemon so they can be expired (removed in
> > this case).
> > 
> > autofs4_oz_mode() is the mechanism that's used to identify the user
> > space process that's managing the automount tree. It's used in a number
> > of places to prevent the process managing the tree from doing things
> > like triggering mounts itself or updating the last_used counter.
> > 
> > It's a bit of a puzzle why it worked when I originally tested it.  But
> > later when I looked at it to work out why some symlinks weren't expiring
> > it was obvious.
> > 
> > Do you want me to re-submit this with an updated description?
> 
> Yes please.  The questions which a bugfix changelog should answer are
> "should this be backported to -stable and if so, why".  It's also
> helpful if it answers "if not, why not".

Yes, that's not clear.
I'd say it's not necessary to back port.

But I'm really keen for this to be merged in the current kernel because
I'm making upstream changes to autofs (adding a parser for amd style
mount maps) that will be able to make use of it (I can give details if
you want).

It's probably a month or two before I commit them to git, and longer
before they get into a source release.

And I can include the kernel patch in the autofs git tree for those that
need it.

OTOH this affects am-utils (the amd package, http://www.am-utils.org/)
now, so since it's a fairly small change, maybe it should be back
ported.

Unfortunately it's even worse than it sounds because the am-utils
package isn't receiving much attention, both upstream (for about six
years now) and downstream (certainly in Fedora anyway).

am-utils in Fedora hasn't worked properly for quite some time and I was
unable to get any sensible assistance from upstream.

I'll put together a more detailed description based on above and merge
autofs-fix-symlinks-arent-checked-for-expiry.patch and
autofs-fix-fix-symlinks-arent-checked-for-expiry.patch
and re-submit.

> 
> > > 
> > > > --- a/fs/autofs4/symlink.c
> > > > +++ b/fs/autofs4/symlink.c
> > > > @@ -14,8 +14,9 @@
> > > >  
> > > >  static void *autofs4_follow_link(struct dentry *dentry, struct 
> > > > nameidata *nd)
> > > >  {
> > > > +   struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
> > > > struct autofs_info *ino = autofs4_dentry_ino(dentry);
> > > > -   if (ino)
> > > > +   if (ino && !autofs4_oz_mode(sbi))
> > > > ino->last_used = jiffies;
> > > > nd_set_link(nd, dentry->d_inode->i_private);
> > > > return NULL;
> > > 
> > > What kernel is this against?  3.13-rc5 is quite different:
> > 
> > That's a good question.
> > Which tree should I be basing patches on?
> 
> Current Linus git is almost always the one to target.
> 
> > As it turns out it is against 3.13-rc5 which was the version the linus
> > tree was at (when I pulled it) prior to mailing the patch.
> 
> Nope, autofs4_follow_link() looks like
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/autofs4/symlink.c
> all the way back to 3.12.
> 


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


Re: [PATCH 0/3] Ceph fscache: Fix kernel panic due to a race

2013-12-26 Thread Yunchuan Wen
Hi, Milosz
I am not very sure about how to enable caching in write path.

I just compile the latest kernel with "Enable Ceph client caching
support", start cachefilesd, and mount cephfs with -o fsc.
Then, the kernel will panic easily when the script runs to "dd
if=cephfs/foo of=/dev/null bs=8 count=1024"


2013/12/27 Milosz Tanski :
> Li,
>
> I looked at the patchset am I correct that this only happens when we
> enable caching in the write path?
>
> - Milosz
>
> On Thu, Dec 26, 2013 at 9:29 AM, Li Wang  wrote:
>> From: Yunchuan Wen 
>>
>> The following scripts could easily panic the kernel,
>>
>> #!/bin/bash
>> mount -t ceph -o fsc MONADDR:/ cephfs
>> rm -rf cephfs/foo
>> dd if=/dev/zero of=cephfs/foo bs=8 count=512
>> echo 3 > /proc/sys/vm/drop_caches
>> dd if=cephfs/foo of=/dev/null bs=8 count=1024
>>
>> This is due to when writing a page into fscache, the code will
>> assert that the write position does not exceed the
>> object->store_limit_l, which is supposed to be equal to inode->i_size.
>> However, for current implementation, after file writing, the
>> object->store_limit_l is not synchronized with new
>> inode->i_size immediately, which introduces a race that if writing
>> a new page into fscache, will reach the ASSERT that write position
>> has exceeded the object->store_limit_l, and cause kernel panic.
>> This patch fixes it.
>>
>> Yunchuan Wen (3):
>>   Ceph fscache: Add an interface to synchronize object store limit
>>   Ceph fscache: Update object store limit after writing
>>   Ceph fscache: Wait for completion of object initialization
>>
>>  fs/ceph/cache.c |1 +
>>  fs/ceph/cache.h |   10 ++
>>  fs/ceph/file.c  |3 +++
>>  3 files changed, 14 insertions(+)
>>
>> --
>> 1.7.9.5
>>
>
>
>
> --
> Milosz Tanski
> CTO
> 10 East 53rd Street, 37th floor
> New York, NY 10022
>
> p: 646-253-9055
> e: mil...@adfin.com
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.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/5] checkpatch: Add tests for function pointer style misuses

2013-12-26 Thread Joe Perches
On Thu, 2013-12-26 at 16:58 -0800, Josh Triplett wrote:
> On Thu, Dec 26, 2013 at 12:07:23PM -0800, Josh Triplett wrote:
> > On Thu, Dec 26, 2013 at 11:20:28AM -0800, Joe Perches wrote:
> > > Kernel style uses function pointers in this form:
> > > "type (*funcptr)(args...)"
> > > 
> > > Emit warnings when this function pointer form isn't used.
[]
> Here's a patch that fixes the two messages I commented about, which
> applies on top of the version of the patch that went into -mm.

Acked-by: Joe Perches 

thanks Josh, Joe

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


Re: [PATCH] autofs - fix fix symlinks arent checked for expiry

2013-12-26 Thread Andrew Morton
On Fri, 27 Dec 2013 09:09:52 +0800 Ian Kent  wrote:

> On Thu, 2013-12-26 at 13:42 -0800, Andrew Morton wrote:
> > On Tue, 24 Dec 2013 17:44:59 +0800 Ian Kent  wrote:
> > 
> > > When following a symlink the last_used counter is unconditionally
> > > updated causing the expire checks from user space to prevent
> > > expiry. Opps!
> > 
> > A bit unclear.  You're saying that userspace's act of checking expiry
> > status will itself disrupt the expiry process?
> 
> If the user space expire code uses stat(2) instead of lstat(2), yes.
> It's quite possible this will be the case since it made no difference
> when not using symlinks in the autofs directory tree.
> 
> > 
> > Also, it's rather unclear what the userspace impact is here, and how
> > severe it is.  Please always carefully describe the user-visible impact
> > so that others can decide which kernel version(s) need the patch.
> 
> The impact of this is that symlinks within an an autofs directory tree
> don't cause a callback to the daemon so they can be expired (removed in
> this case).
> 
> autofs4_oz_mode() is the mechanism that's used to identify the user
> space process that's managing the automount tree. It's used in a number
> of places to prevent the process managing the tree from doing things
> like triggering mounts itself or updating the last_used counter.
> 
> It's a bit of a puzzle why it worked when I originally tested it.  But
> later when I looked at it to work out why some symlinks weren't expiring
> it was obvious.
> 
> Do you want me to re-submit this with an updated description?

Yes please.  The questions which a bugfix changelog should answer are
"should this be backported to -stable and if so, why".  It's also
helpful if it answers "if not, why not".

> > 
> > > --- a/fs/autofs4/symlink.c
> > > +++ b/fs/autofs4/symlink.c
> > > @@ -14,8 +14,9 @@
> > >  
> > >  static void *autofs4_follow_link(struct dentry *dentry, struct nameidata 
> > > *nd)
> > >  {
> > > + struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
> > >   struct autofs_info *ino = autofs4_dentry_ino(dentry);
> > > - if (ino)
> > > + if (ino && !autofs4_oz_mode(sbi))
> > >   ino->last_used = jiffies;
> > >   nd_set_link(nd, dentry->d_inode->i_private);
> > >   return NULL;
> > 
> > What kernel is this against?  3.13-rc5 is quite different:
> 
> That's a good question.
> Which tree should I be basing patches on?

Current Linus git is almost always the one to target.

> As it turns out it is against 3.13-rc5 which was the version the linus
> tree was at (when I pulled it) prior to mailing the patch.

Nope, autofs4_follow_link() looks like
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/autofs4/symlink.c
all the way back to 3.12.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] bq24735: don't attempt I2C accesses if charger is not present

2013-12-26 Thread Andrew Bresticker
If we have an AC-detect GPIO for the charger and the charger is not
present during probe time, don't attempt I2C accesses to the charger
as they are not guaranteed to succeed.  The charger will be configured
once it is plugged in.  Also initialize the AC-detect GPIO as an input
so that its value can be read reliably before setting it up as an IRQ.

Signed-off-by: Andrew Bresticker 
---
 drivers/power/bq24735-charger.c | 81 +
 1 file changed, 49 insertions(+), 32 deletions(-)

diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c
index d022b82..df3e215 100644
--- a/drivers/power/bq24735-charger.c
+++ b/drivers/power/bq24735-charger.c
@@ -47,6 +47,7 @@ struct bq24735 {
struct power_supply charger;
struct i2c_client   *client;
struct bq24735_platform *pdata;
+   boolconfigured;
 };
 
 static inline struct bq24735 *to_bq24735(struct power_supply *psy)
@@ -178,10 +179,15 @@ static irqreturn_t bq24735_charger_isr(int irq, void 
*devid)
struct power_supply *psy = devid;
struct bq24735 *charger = to_bq24735(psy);
 
-   if (bq24735_charger_is_present(charger))
+   if (bq24735_charger_is_present(charger)) {
+   if (!charger->configured) {
+   bq24735_config_charger(charger);
+   charger->configured = true;
+   }
bq24735_enable_charging(charger);
-   else
+   } else {
bq24735_disable_charging(charger);
+   }
 
power_supply_changed(psy);
 
@@ -290,33 +296,10 @@ static int bq24735_charger_probe(struct i2c_client 
*client,
 
i2c_set_clientdata(client, charger);
 
-   ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID);
-   if (ret < 0) {
-   dev_err(>dev, "Failed to read manufacturer id : %d\n",
-   ret);
-   goto err_free_name;
-   } else if (ret != 0x0040) {
-   dev_err(>dev,
-   "manufacturer id mismatch. 0x0040 != 0x%04x\n", ret);
-   ret = -ENODEV;
-   goto err_free_name;
-   }
-
-   ret = bq24735_read_word(client, BQ24735_DEVICE_ID);
-   if (ret < 0) {
-   dev_err(>dev, "Failed to read device id : %d\n", ret);
-   goto err_free_name;
-   } else if (ret != 0x000B) {
-   dev_err(>dev,
-   "device id mismatch. 0x000b != 0x%04x\n", ret);
-   ret = -ENODEV;
-   goto err_free_name;
-   }
-
if (gpio_is_valid(charger->pdata->status_gpio)) {
-   ret = devm_gpio_request(>dev,
-   charger->pdata->status_gpio,
-   name);
+   ret = devm_gpio_request_one(>dev,
+   charger->pdata->status_gpio,
+   GPIOF_IN, name);
if (ret) {
dev_err(>dev,
"Failed GPIO request for GPIO %d: %d\n",
@@ -326,14 +309,48 @@ static int bq24735_charger_probe(struct i2c_client 
*client,
charger->pdata->status_gpio_valid = !ret;
}
 
-   ret = bq24735_config_charger(charger);
-   if (ret < 0) {
-   dev_err(>dev, "failed in configuring charger");
-   goto err_free_name;
+   /*
+* If we have an AC-detect GPIO and we know the charger is not
+* present, don't bother with trying to access it over I2C as it
+* may not resopnd.
+*/
+   if (!charger->pdata->status_gpio_valid ||
+   bq24735_charger_is_present(charger)) {
+   ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID);
+   if (ret < 0) {
+   dev_err(>dev,
+   "Failed to read manufacturer id : %d\n", ret);
+   goto err_free_name;
+   } else if (ret != 0x0040) {
+   dev_err(>dev,
+   "manufacturer id mismatch. 0x0040 != 0x%04x\n",
+   ret);
+   ret = -ENODEV;
+   goto err_free_name;
+   }
+
+   ret = bq24735_read_word(client, BQ24735_DEVICE_ID);
+   if (ret < 0) {
+   dev_err(>dev, "Failed to read device id : %d\n",
+   ret);
+   goto err_free_name;
+   } else if (ret != 0x000B) {
+   dev_err(>dev,
+   "device id mismatch. 0x000b != 0x%04x\n", ret);
+   ret = -ENODEV;
+   goto err_free_name;
+   }
}
 
/* check for AC adapter presence */
if (bq24735_charger_is_present(charger)) {
+   ret = 

Re: [PATCH] autofs - fix fix symlinks arent checked for expiry

2013-12-26 Thread Ian Kent
On Thu, 2013-12-26 at 13:42 -0800, Andrew Morton wrote:
> On Tue, 24 Dec 2013 17:44:59 +0800 Ian Kent  wrote:
> 
> > When following a symlink the last_used counter is unconditionally
> > updated causing the expire checks from user space to prevent
> > expiry. Opps!
> 
> A bit unclear.  You're saying that userspace's act of checking expiry
> status will itself disrupt the expiry process?

If the user space expire code uses stat(2) instead of lstat(2), yes.
It's quite possible this will be the case since it made no difference
when not using symlinks in the autofs directory tree.

> 
> Also, it's rather unclear what the userspace impact is here, and how
> severe it is.  Please always carefully describe the user-visible impact
> so that others can decide which kernel version(s) need the patch.

The impact of this is that symlinks within an an autofs directory tree
don't cause a callback to the daemon so they can be expired (removed in
this case).

autofs4_oz_mode() is the mechanism that's used to identify the user
space process that's managing the automount tree. It's used in a number
of places to prevent the process managing the tree from doing things
like triggering mounts itself or updating the last_used counter.

It's a bit of a puzzle why it worked when I originally tested it.  But
later when I looked at it to work out why some symlinks weren't expiring
it was obvious.

Do you want me to re-submit this with an updated description?

> 
> > --- a/fs/autofs4/symlink.c
> > +++ b/fs/autofs4/symlink.c
> > @@ -14,8 +14,9 @@
> >  
> >  static void *autofs4_follow_link(struct dentry *dentry, struct nameidata 
> > *nd)
> >  {
> > +   struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
> > struct autofs_info *ino = autofs4_dentry_ino(dentry);
> > -   if (ino)
> > +   if (ino && !autofs4_oz_mode(sbi))
> > ino->last_used = jiffies;
> > nd_set_link(nd, dentry->d_inode->i_private);
> > return NULL;
> 
> What kernel is this against?  3.13-rc5 is quite different:

That's a good question.
Which tree should I be basing patches on?

As it turns out it is against 3.13-rc5 which was the version the linus
tree was at (when I pulled it) prior to mailing the patch.

> 
> static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
> {
>   nd_set_link(nd, dentry->d_inode->i_private);
>   return NULL;
> }
> 

Ian

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] sbs-battery: make writes to ManufacturerAccess optional

2013-12-26 Thread Andrew Bresticker
According to the Smart Battery Data Specification, the use
of ManufacturerAcess (register 0x0) is implementation-defined.
It appears that some batteries use writes to this register
in order to implement certain functionality, but others may
simply NAK all writes to it.  As a result, write failures to
ManufacturerAccess should not be used as an indicator of battery
presence.

Signed-off-by: Andrew Bresticker 
---
 drivers/power/sbs-battery.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
index b5f2a76..1240a9c 100644
--- a/drivers/power/sbs-battery.c
+++ b/drivers/power/sbs-battery.c
@@ -228,13 +228,8 @@ static int sbs_get_battery_presence_and_health(
/* Write to ManufacturerAccess with
 * ManufacturerAccess command and then
 * read the status */
-   ret = sbs_write_word_data(client, sbs_data[REG_MANUFACTURER_DATA].addr,
+   sbs_write_word_data(client, sbs_data[REG_MANUFACTURER_DATA].addr,
MANUFACTURER_ACCESS_STATUS);
-   if (ret < 0) {
-   if (psp == POWER_SUPPLY_PROP_PRESENT)
-   val->intval = 0; /* battery removed */
-   return ret;
-   }
 
ret = sbs_read_word_data(client, sbs_data[REG_MANUFACTURER_DATA].addr);
if (ret < 0)
@@ -827,16 +822,13 @@ static int sbs_suspend(struct device *dev)
 {
struct i2c_client *client = to_i2c_client(dev);
struct sbs_info *chip = i2c_get_clientdata(client);
-   s32 ret;
 
if (chip->poll_time > 0)
cancel_delayed_work_sync(>work);
 
/* write to manufacturer access with sleep command */
-   ret = sbs_write_word_data(client, sbs_data[REG_MANUFACTURER_DATA].addr,
+   sbs_write_word_data(client, sbs_data[REG_MANUFACTURER_DATA].addr,
MANUFACTURER_ACCESS_SLEEP);
-   if (chip->is_present && ret < 0)
-   return ret;
 
return 0;
 }
-- 
1.8.5.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 1/5] checkpatch: Add tests for function pointer style misuses

2013-12-26 Thread Josh Triplett
On Thu, Dec 26, 2013 at 12:07:23PM -0800, Josh Triplett wrote:
> On Thu, Dec 26, 2013 at 11:20:28AM -0800, Joe Perches wrote:
> > Kernel style uses function pointers in this form:
> > "type (*funcptr)(args...)"
> > 
> > Emit warnings when this function pointer form isn't used.
> > 
> > Signed-off-by: Joe Perches 
> 
> Two comments below.

On Thu, Dec 26, 2013 at 02:16:10PM -0800, a...@linux-foundation.org wrote:
> The patch titled
>  Subject: checkpatch: add tests for function pointer style misuses
> has been added to the -mm tree.  Its filename is
>  checkpatch-add-tests-for-function-pointer-style-misuses.patch

Here's a patch that fixes the two messages I commented about, which
applies on top of the version of the patch that went into -mm.

---8<---
From: Josh Triplett 
Subject: [PATCH] Fix up messages from "checkpatch: Add tests for function 
pointer style misuses"

Fix an ambiguity in one warning message and a copy/paste problem in
another.

Signed-off-by: Josh Triplett 
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2460094..b74b086 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2831,7 +2831,7 @@ sub process {
if (defined $pre_pointer_space &&
$pre_pointer_space =~ /^\s/) {
WARN("SPACING",
-"Unnecessary space after function pointer 
open parenthesis\n" . $herecurr);
+"Unnecessary space between open 
parenthesis and '*' in function pointer declaration\n" . $herecurr);
}
 
 # unnecessary space "type (* funcptr)(args...)"
@@ -2852,7 +2852,7 @@ sub process {
if (defined $pre_args_space &&
$pre_args_space =~ /^\s/) {
WARN("SPACING",
-"Unnecessary space before function pointer 
name\n" . $herecurr);
+"Unnecessary space before function pointer 
argument list\n" . $herecurr);
}
 
if (show_type("SPACING") && $fix) {
-- 
1.8.5.2

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


[PATCH 6/7] clk: tegra: cclk_lp has a pllx/2 divider

2013-12-26 Thread Andrew Bresticker
When pll_x is the parent of cclk_lp, PLLX_DIV2_BYPASS_LP determines
whether cclk_lp output is divided by 2.  Set TEGRA_DIVIDER_2 so that
the clk_super driver is aware of this.

Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-tegra-super-gen4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-tegra-super-gen4.c 
b/drivers/clk/tegra/clk-tegra-super-gen4.c
index 05dce4a..feb3201 100644
--- a/drivers/clk/tegra/clk-tegra-super-gen4.c
+++ b/drivers/clk/tegra/clk-tegra-super-gen4.c
@@ -120,7 +120,7 @@ void __init tegra_super_clk_gen4_init(void __iomem 
*clk_base,
ARRAY_SIZE(cclk_lp_parents),
CLK_SET_RATE_PARENT,
clk_base + CCLKLP_BURST_POLICY,
-   0, 4, 8, 9, NULL);
+   TEGRA_DIVIDER_2, 4, 8, 9, NULL);
*dt_clk = clk;
}
 
-- 
1.8.5.1

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


[PATCH 7/7] clk: tegra: use max divider if divider overflows

2013-12-26 Thread Andrew Bresticker
When requesting a rate less than the minimum clock rate for a divider,
use the maximum divider value instead of bailing out with an error.
This matches the behavior of the generic clock divider.

Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-divider.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c
index 4d75b1f..290f9c1 100644
--- a/drivers/clk/tegra/clk-divider.c
+++ b/drivers/clk/tegra/clk-divider.c
@@ -59,7 +59,7 @@ static int get_div(struct tegra_clk_frac_div *divider, 
unsigned long rate,
return 0;
 
if (divider_ux1 > get_max_div(divider))
-   return -EINVAL;
+   return get_max_div(divider);
 
return divider_ux1;
 }
-- 
1.8.5.1

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


[PATCH 1/7] clk: tegra: Fix PLLP rate table

2013-12-26 Thread Andrew Bresticker
From: Gabe Black 

This table had settings for 216MHz, but PLLP is (and is supposed to be)
configured at 408MHz.  If that table is used and PLLP_BASE_OVRRIDE is
not set, the kernel will panic in clk_pll_recalc_rate().

Signed-off-by: Gabe Black 
Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-tegra124.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index aff86b5..28bb238 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -516,11 +516,11 @@ static struct div_nmp pllp_nmp = {
 };
 
 static struct tegra_clk_pll_freq_table pll_p_freq_table[] = {
-   {1200, 21600, 432, 12, 1, 8},
-   {1300, 21600, 432, 13, 1, 8},
-   {1680, 21600, 360, 14, 1, 8},
-   {1920, 21600, 360, 16, 1, 8},
-   {2600, 21600, 432, 26, 1, 8},
+   {1200, 40800, 408, 12, 0, 8},
+   {1300, 40800, 408, 13, 0, 8},
+   {1680, 40800, 340, 14, 0, 8},
+   {1920, 40800, 340, 16, 0, 8},
+   {2600, 40800, 408, 26, 0, 8},
{0, 0, 0, 0, 0, 0},
 };
 
-- 
1.8.5.1

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


[PATCH 2/7] clk: tegra: Fix PLLD mnp table

2013-12-26 Thread Andrew Bresticker
From: Rhyland Klein 

PLLD was using the same mnp table as PLLP.  Fix it to use its own
table which is different from PLLP's.

Signed-off-by: Rhyland Klein 
Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-tegra124.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 28bb238..14c3f2f 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -570,6 +570,15 @@ static struct tegra_clk_pll_params pll_a_params = {
.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
 };
 
+static struct div_nmp plld_nmp = {
+   .divm_shift = 0,
+   .divm_width = 5,
+   .divn_shift = 8,
+   .divn_width = 11,
+   .divp_shift = 20,
+   .divp_width = 3,
+};
+
 static struct tegra_clk_pll_freq_table pll_d_freq_table[] = {
{1200, 21600, 864, 12, 4, 12},
{1300, 21600, 864, 13, 4, 12},
@@ -603,7 +612,7 @@ static struct tegra_clk_pll_params pll_d_params = {
.lock_mask = PLL_BASE_LOCK,
.lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
.lock_delay = 1000,
-   .div_nmp = _nmp,
+   .div_nmp = _nmp,
.freq_table = pll_d_freq_table,
.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
 TEGRA_PLL_USE_LOCK,
-- 
1.8.5.1

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


Re: [RFC] speeding up the stat() family of system calls...

2013-12-26 Thread H. Peter Anvin
On 12/26/2013 11:00 AM, Linus Torvalds wrote:
> 
> Interestingly, looking at the cp_new_stat() profiles, the games we
> play to get efficient range checking seem to actually hurt us. Maybe
> it's the "sbb" that is just expensive, or maybe it's turning a (very
> predictable) conditional branch into a data dependency chain instead.
> Or maybe it's just random noise in my profiles that happened to make
> those sbb's look bad.
> 

I'm not at all surprised... there is a pretty serious data dependency
chain here and in the end we end up manifesting a value in a register
that has to be tested even though it is available in the flags.  Inline
assembly also means the compiler can't optimize it at all.

I have to wonder if we actually have to test the upper limit, though: we
can always guarantee a guard zone between user space and kernel space,
and thus guarantee either a #PF or #GP if someone tries to overflow user
space.  Testing just the lower limit would be much cheaper, especially
on 64 bits where we can simply test the sign bit.

What do you think?

-hpa

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


[PATCH 4/7] clk: tegra: fix host1x clock on Tegra124

2013-12-26 Thread Andrew Bresticker
From: Mark Zhang 

The host1x clock on Tegra124 is a 3-bit wide mux with 6 parents.
Change thte id to tegra_clk_host1x_8 so that the correct clock gets
registered.

Signed-off-by: Mark Zhang 
Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-tegra124.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 0fc9126..743ccb4 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -775,7 +775,7 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] 
__initdata = {
[tegra_clk_gr3d] = { .dt_id = TEGRA124_CLK_GR_3D, .present = true },
[tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true },
[tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true },
-   [tegra_clk_host1x] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true },
+   [tegra_clk_host1x_8] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true 
},
[tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true },
[tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true },
[tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true },
-- 
1.8.5.1

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


[PATCH 3/7] clk: tegra: PLLD2 fixes for hdmi

2013-12-26 Thread Andrew Bresticker
From: David Ung 

Set correct pll_d2_out0 divider and correct the p div values for pll_d2.

Signed-off-by: David Ung 
Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-tegra124.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 14c3f2f..0fc9126 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -619,12 +619,11 @@ static struct tegra_clk_pll_params pll_d_params = {
 };
 
 static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = {
-   { 1200, 14850,  99, 1, 8},
-   { 1200, 59400,  99, 1, 1},
-   { 1300, 59400,  91, 1, 1},  /* actual: 591.5 MHz */
-   { 1680, 59400,  71, 1, 1},  /* actual: 596.4 MHz */
-   { 1920, 59400,  62, 1, 1},  /* actual: 595.2 MHz */
-   { 2600, 59400,  91, 2, 1},  /* actual: 591.5 MHz */
+   { 1200, 59400,  99, 1, 2},
+   { 1300, 59400,  91, 1, 2},  /* actual: 591.5 MHz */
+   { 1680, 59400,  71, 1, 2},  /* actual: 596.4 MHz */
+   { 1920, 59400,  62, 1, 2},  /* actual: 595.2 MHz */
+   { 2600, 59400,  91, 2, 2},  /* actual: 591.5 MHz */
{ 0, 0, 0, 0, 0, 0 },
 };
 
@@ -1295,9 +1294,9 @@ static void __init tegra124_pll_init(void __iomem 
*clk_base,
clk_register_clkdev(clk, "pll_d2", NULL);
clks[TEGRA124_CLK_PLL_D2] = clk;
 
-   /* PLLD2_OUT0 ?? */
+   /* PLLD2_OUT0 */
clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2",
-   CLK_SET_RATE_PARENT, 1, 2);
+   CLK_SET_RATE_PARENT, 1, 1);
clk_register_clkdev(clk, "pll_d2_out0", NULL);
clks[TEGRA124_CLK_PLL_D2_OUT0] = clk;
 
-- 
1.8.5.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 1/2][Untested] ACPI / hotplug: Add demand_offline hotplug profile flag

2013-12-26 Thread Rafael J. Wysocki
On Thursday, December 26, 2013 01:10:30 PM Yasuaki Ishimatsu wrote:
> (2013/12/26 12:10), Yasuaki Ishimatsu wrote:
> > (2013/12/23 23:00), Rafael J. Wysocki wrote:
> >> From: Rafael J. Wysocki 
> >>
> >> Add a new ACPI hotplug profile flag, demand_offline, such that if
> >> set for the given ACPI device object's scan handler, it will cause
> >> acpi_scan_hot_remove() to check if that device object's physical
> >> companions are offline upfront and fail the hot removal if that
> >> is not the case.
> >>
> >> That flag will be useful to overcome a problem with containers on
> >> some system where they can only be hot-removed after some cleanup
> >> operations carried out by user space, which needs to be notified
> >> of the container hot-removal before the kernel attempts to offline
> >> devices in the container.  In those cases the current implementation
> >> of acpi_scan_hot_remove() is not sufficient, because it first tries
> >> to offline the devices in the container and only if that is
> >> suffcessful it tries to offline the container itself.  As a result,
> >> the container hot-removal notification is not delivered to user space
> >> at the right time.
> >>
> >> Signed-off-by: Rafael J. Wysocki 
> >> ---
> >>   drivers/acpi/scan.c |   41 +
> >>   include/acpi/acpi_bus.h |3 ++-
> >>   2 files changed, 39 insertions(+), 5 deletions(-)
> >>
> >> Index: linux-pm/drivers/acpi/scan.c
> >> ===
> >> --- linux-pm.orig/drivers/acpi/scan.c
> >> +++ linux-pm/drivers/acpi/scan.c
> >> @@ -126,6 +126,24 @@ acpi_device_modalias_show(struct device
> >>   }
> >>   static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
> >>
> >> +static bool acpi_scan_is_offline(struct acpi_device *adev)
> >> +{
> >> +struct acpi_device_physical_node *pn;
> >> +bool offline = true;
> >> +
> >> +mutex_lock(>physical_node_lock);
> >> +
> >> +list_for_each_entry(pn, >physical_node_list, node)
> >
> >> +if (!pn->dev->offline) {
> >
> 
> > Please check pn->dev->bus and pn->dev->bus->offline too as follow:
> >
> >  if (pn->dev->bus && pn->dev->bus->offline &&
> >  !pn->dev->offline) {
> >
> 
> Adding above check, I could remove container device by using eject sysfs.
> But following messages were shown:

Well, it looks like I have overlooked that error during my testing.

> [ 1017.543000] [ cut here ]
> [ 1017.543000] WARNING: CPU: 0 PID: 6 at drivers/base/core.c:251 
> device_release+0x92/0xa0()
> [ 1017.543000] Device 'ACPI0004:01' does not have a release() function, it is 
> broken and must be fixed.
> [ 1017.653000] Modules linked in: xt_CHECKSUM nf_conntrack_netbios_ns 
> nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT ipmi_devintf ipt_REJECT 
> cfg80211 xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc 
> ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 
> nf_nat_ipv6 
> ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables 
> iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack 
> iptable_mangle iptable_security iptable_raw iptable_filter sg ip_tables vfat 
> fat x86_pkg_temp_thermal coretemp iTCO_wdt iTCO_vendor_support kvm_intel 
> kvm crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel 
> aesni_intel lrw gf128mul glue_helper ablk_helper cryptd dm_mirror 
> dm_region_hash dm_log dm_mod microcode lpc_ich igb sb_edac e1000e pcspkr 
> i2c_i801
> [ 1017.653000]  edac_core mfd_core dca ptp pps_core shpchp ipmi_si 
> ipmi_msghandler tpm_infineon nfsd auth_rpcgss nfs_acl lockd sunrpc xfs 
> libcrc32c sd_mod mgag200 syscopyarea sysfillrect sysimgblt lpfc i2c_algo_bit 
> drm_kms_helper ttm drm crc_t10dif crct10dif_common scsi_transport_fc 
> megaraid_sas 
> i2c_core scsi_tgt
> [ 1017.653000] CPU: 0 PID: 6 Comm: kworker/u512:0 Tainted: GW
> 3.13.0-rc5+ #5
> [ 1017.653000] Hardware name:
> [ 1017.653000] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
> [ 1017.653000]  0009 880873a6dc68 815d85ca 
> 880873a6dcb0
> [ 1017.653000]  880873a6dca0 8106594d 8a07d221c010 
> 8a07d221c000
> [ 1017.653000]  8808715472c0 880871e91018 0103 
> 880873a6dd00
> [ 1017.653000] Call Trace:
> [ 1017.653000]  [] dump_stack+0x45/0x56
> [ 1017.653000]  [] warn_slowpath_common+0x7d/0xa0
> [ 1017.653000]  [] warn_slowpath_fmt+0x4c/0x50
> [ 1017.653000]  [] device_release+0x92/0xa0
> [ 1017.653000]  [] kobject_cleanup+0x77/0x1b0
> [ 1017.653000]  [] kobject_put+0x35/0x70
> [ 1017.653000]  [] device_unregister+0x2c/0x60
> [ 1017.653000]  [] container_device_detach+0x28/0x2a
> [ 1017.653000]  [] acpi_bus_trim+0x56/0x89
> [ 1017.653000]  [] acpi_device_hotplug+0x168/0x383
> [ 1017.653000]  [] acpi_hotplug_work_fn+0x1c/0x27
> [ 1017.653000]  [] process_one_work+0x17b/0x460
> [ 1017.653000]  [] 

[PATCH 5/7] clk: tegra: fix sdmmc clks on Tegra1x4

2013-12-26 Thread Andrew Bresticker
The sdmmc clocks on Tegra114 and Tegra124 are 3-bit wide muxes with
6 parents.  Add support for tegra_clk_sdmmc*_8 and switch Tegra114
and Tegra124 to use these clocks instead.

Signed-off-by: Andrew Bresticker 
---
 drivers/clk/tegra/clk-id.h   | 4 
 drivers/clk/tegra/clk-tegra-periph.c | 4 
 drivers/clk/tegra/clk-tegra114.c | 8 
 drivers/clk/tegra/clk-tegra124.c | 8 
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h
index cf0c323..c39613c 100644
--- a/drivers/clk/tegra/clk-id.h
+++ b/drivers/clk/tegra/clk-id.h
@@ -180,9 +180,13 @@ enum clk_id {
tegra_clk_sbc6_8,
tegra_clk_sclk,
tegra_clk_sdmmc1,
+   tegra_clk_sdmmc1_8,
tegra_clk_sdmmc2,
+   tegra_clk_sdmmc2_8,
tegra_clk_sdmmc3,
+   tegra_clk_sdmmc3_8,
tegra_clk_sdmmc4,
+   tegra_clk_sdmmc4_8,
tegra_clk_se,
tegra_clk_soc_therm,
tegra_clk_sor0,
diff --git a/drivers/clk/tegra/clk-tegra-periph.c 
b/drivers/clk/tegra/clk-tegra-periph.c
index 5c35885..c212473 100644
--- a/drivers/clk/tegra/clk-tegra-periph.c
+++ b/drivers/clk/tegra/clk-tegra-periph.c
@@ -465,6 +465,10 @@ static struct tegra_periph_init_data periph_clks[] = {
MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, 
TEGRA_PERIPH_ON_APB, tegra_clk_adx1),
MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, 
TEGRA_PERIPH_ON_APB, tegra_clk_amx1),
MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 
20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2),
+   MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, 
tegra_clk_sdmmc1_8),
+   MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, 
tegra_clk_sdmmc2_8),
+   MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, 
tegra_clk_sdmmc3_8),
+   MUX8("sdmmc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, 
tegra_clk_sdmmc4_8),
MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, 
TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8),
MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, 
TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8),
MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, 
TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8),
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c
index 90d9d25..80431f0 100644
--- a/drivers/clk/tegra/clk-tegra114.c
+++ b/drivers/clk/tegra/clk-tegra114.c
@@ -682,12 +682,12 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] 
__initdata = {
[tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true },
[tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true },
[tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true },
-   [tegra_clk_sdmmc2] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true },
+   [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true 
},
[tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true },
[tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true },
[tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true 
},
-   [tegra_clk_sdmmc1] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true },
-   [tegra_clk_sdmmc4] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true },
+   [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true 
},
+   [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true 
},
[tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true },
[tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true },
[tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true },
@@ -723,7 +723,7 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] 
__initdata = {
[tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true },
[tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true },
[tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true },
-   [tegra_clk_sdmmc3] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true },
+   [tegra_clk_sdmmc3_8] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true 
},
[tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true },
[tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true },
[tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true },
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 743ccb4..b4cf650 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -761,12 +761,12 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] 
__initdata = {
[tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true },
[tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true },

[PATCH 0/7] misc Tegra clock fixes

2013-12-26 Thread Andrew Bresticker
Fixes for various clock-related issues found during bringup of
Tegra124-based Venice2 and Norrin boards.

Andrew Bresticker (3):
  clk: tegra: fix sdmmc clks on Tegra1x4
  clk: tegra: cclk_lp has a pllx/2 divider
  clk: tegra: use max divider if divider overflows

David Ung (1):
  clk: tegra: PLLD2 fixes for hdmi

Gabe Black (1):
  clk: tegra: Fix PLLP rate table

Mark Zhang (1):
  clk: tegra: fix host1x clock on Tegra124

Rhyland Klein (1):
  clk: tegra: Fix PLLD mnp table

 drivers/clk/tegra/clk-divider.c  |  2 +-
 drivers/clk/tegra/clk-id.h   |  4 +++
 drivers/clk/tegra/clk-tegra-periph.c |  4 +++
 drivers/clk/tegra/clk-tegra-super-gen4.c |  2 +-
 drivers/clk/tegra/clk-tegra114.c |  8 +++---
 drivers/clk/tegra/clk-tegra124.c | 46 +++-
 6 files changed, 41 insertions(+), 25 deletions(-)

-- 
1.8.5.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] Add the LED burst trigger

2013-12-26 Thread Joe Xue
Hi,

I'm writing the Morse code trigger.
what about this

echo "-.-. *"> patten
-  a long on then a off
.  a short on then a off
space a long off
* mean repeat the patten
s mean indicate the patten just one time then stop

Do we also need a  "step_length_ms" as Pavel's suggestion?
If so, we can define long on as 2*step_length_ms and short on as 
1*step_length_ms.

Any other parameters do you guys think we should add?

Any suggestion is very appreciated.

Thanks

Joe




> Date: Thu, 26 Dec 2013 15:26:08 +0100
> From: pa...@ucw.cz
> To: lg...@hotmail.com
> CC: coolo...@gmail.com; rpur...@rpsys.net; r...@landley.net; milo@ti.com; 
> linux-l...@vger.kernel.org; linux-kernel@vger.kernel.org; 
> linux-...@vger.kernel.org
> Subject: Re: [PATCH] Add the LED burst trigger
>
> Hi!
>
>> Yes, Morse code can indicate any means. But when we look at the LEDs, would 
>> we like to also have a Morse code book in hand?
>>
>> The burst led blink idea is because it is easy to use and easy to describe. 
>> Mostly when users on site are describing the LEDs states to the support 
>> engineer.
>>
>
> Well.. above 7 or so blinks, people will be unable to count. "one
> short, one long" will help to extend that.
>
> Plus, there may be patterns such as "keep it ON, count number of brief
> OFFs"...
>
> That's why I suggested:
>
>>> echo 40> step_length_ms
>>> echo "- - - "> pattern
>>>
>>> do the same trick?
>>>
>>> Plus, you could for example do
>>>
>>> echo "- --- "> pattern
>>>
>>> to do morse code...
>
> Interface
>
> (Note that your client stripped some spaces out of it).
>
> With that, it should be very easy to program all the reasonable
> blinking patterns for single LED without PWM.
> 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 v4 00/15] usb: phy: msm: Fixes, cleanups and DT support

2013-12-26 Thread Stephen Boyd
On 12/20, David Brown wrote:
> On Thu, Dec 19, 2013 at 05:26:13PM -0600, Felipe Balbi wrote:
> 
> >it's getting quite late for me. I still want to leave my stuff soaking
> >in linux-next for a while. I'll try my best, though, if you ack it ASAP
> 
> Thanks.  Patch 1 already has my Ack in it, and I've sent an ack for
> number 6.
> 

Felipe,

If this isn't picked up for 3.14 can we get an ack on patch 1 so
we can send it through arm-soc as part of the multi-platform
patches I have for MSM[1]?

[1] https://lkml.org/lkml/2013/12/4/523
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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][Untested] ACPI / hotplug: Add demand_offline hotplug profile flag

2013-12-26 Thread Rafael J. Wysocki
On Thursday, December 26, 2013 12:10:04 PM Yasuaki Ishimatsu wrote:
> (2013/12/23 23:00), Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki 
> >
> > Add a new ACPI hotplug profile flag, demand_offline, such that if
> > set for the given ACPI device object's scan handler, it will cause
> > acpi_scan_hot_remove() to check if that device object's physical
> > companions are offline upfront and fail the hot removal if that
> > is not the case.
> >
> > That flag will be useful to overcome a problem with containers on
> > some system where they can only be hot-removed after some cleanup
> > operations carried out by user space, which needs to be notified
> > of the container hot-removal before the kernel attempts to offline
> > devices in the container.  In those cases the current implementation
> > of acpi_scan_hot_remove() is not sufficient, because it first tries
> > to offline the devices in the container and only if that is
> > suffcessful it tries to offline the container itself.  As a result,
> > the container hot-removal notification is not delivered to user space
> > at the right time.
> >
> > Signed-off-by: Rafael J. Wysocki 
> > ---
> >   drivers/acpi/scan.c |   41 +
> >   include/acpi/acpi_bus.h |3 ++-
> >   2 files changed, 39 insertions(+), 5 deletions(-)
> >
> > Index: linux-pm/drivers/acpi/scan.c
> > ===
> > --- linux-pm.orig/drivers/acpi/scan.c
> > +++ linux-pm/drivers/acpi/scan.c
> > @@ -126,6 +126,24 @@ acpi_device_modalias_show(struct device
> >   }
> >   static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
> >
> > +static bool acpi_scan_is_offline(struct acpi_device *adev)
> > +{
> > +   struct acpi_device_physical_node *pn;
> > +   bool offline = true;
> > +
> > +   mutex_lock(>physical_node_lock);
> > +
> > +   list_for_each_entry(pn, >physical_node_list, node)
> 
> > +   if (!pn->dev->offline) {
> 
> Please check pn->dev->bus and pn->dev->bus->offline too as follow:
> 
>   if (pn->dev->bus && pn->dev->bus->offline &&
>   !pn->dev->offline) {
> 
> My container has CPU and Memory and PCI root bridge. PCI root bridge
> does not has offline function (pn->dev->bus->offline). So I cannot offline
> the device and pn->dev->offline of the device is always 0. Therefore,
> following operation always returns -EBUSY even if I offline CPUs and
> all memory sections on a container device.
> 
> echo 0 > /sys/bus/container/devices/ACPI0004:01/online

I see.  We simply can do

if (device_supports_offline(pn->dev) && !pn->dev->offline) {

there I think.

Thanks,
Rafael

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


Re: [PATCH 7/10] ACPI / hotplug: Move container-specific code out of the core

2013-12-26 Thread Rafael J. Wysocki
On Thursday, December 26, 2013 11:53:10 AM Yasuaki Ishimatsu wrote:
> HI Rafael,
> 
> (2013/12/26 10:01), Rafael J. Wysocki wrote:
> > On Monday, December 23, 2013 02:58:38 PM Rafael J. Wysocki wrote:
> >> On Saturday, December 14, 2013 06:07:06 AM Rafael J. Wysocki wrote:
> >>> On Friday, December 13, 2013 02:17:32 PM Yasuaki Ishimatsu wrote:
>  (2013/12/13 13:56), Rafael J. Wysocki wrote:
> > On Friday, December 13, 2013 11:56:32 AM Yasuaki Ishimatsu wrote:
> >> Hi Rafael,
> >
> > Hi,
> >
> >> Please share your more detailed idea. I started to implement the 
> >> following
> >> idea. But the idea has one problem.
> >>
> > The eject work flow can be:
> >   (1) an eject event occurs,
> >   (2) the container "physical" device fails offline in 
> > acpi_scan_hot_remove()
> >   emmitting, say, KOBJ_CHANGE for the "physical" device,
> >   (3) user space notices the KOBJ_CHANGE and does the cleanup 
> > as needed,
> >   (4) user space changes the "physical" container device flag 
> > controlling
> >   offline to 0,
> >   (5) user space uses the sysfs "eject" attribute of the ACPI 
> > container object
> >   to finally eject the container,
> >   (6) the offline in acpi_scan_hot_remove() is now successful, 
> > because the
> >   flag controlling it has been set to 0 in step (4),
> >   (7) the "physical" container device goes away before 
> > executing _EJ0,
> >   (8) the container is ejected.
> >>
> >> I want to emit KOBJ_CHANGE before offlining devices on container 
> >> device at (2).
> >> But acpi_scan_hot_remove() offlines devices on container device at 
> >> first.
> >> So when offline container device, devices on container has been 
> >> offlined.
> >>
> >> Thus the idea cannot fulfill my necessary feature.
> >
> > Well, in that case we need to treat containers in a special way at the 
> > ACPI
> > level.  Which is a bit unfortunate so to speak.
> >
> > To that end I'd try to add a new flag to struct acpi_hotplug_profile, 
> > say
> > .verify_offline, such that if set, it would cause 
> > acpi_scan_hot_remove() to
> > check if all of the "physical" companions of the top-level device are 
> > offline
> > to start with, and if not, it would just emit KOBJ_CHANGE for the 
> > companions
> > that are not offline and bail out.
> >
> > So the above algorithm would become:
> >
> > (1) an eject event occurs,
> > (2) acpi_scan_hot_remove() checks the verify_offline flag in the target 
> > device's
> >   scan_handler structure,
> > (3) if set (it would always be set for containers), 
> > acpi_scan_hot_remove()
> >   checks the status of the target device's "physical" companions; 
> > if at least
> >   one of them is offline, KOBJ_CHANGE is emitted for that 
> > "physical" device,
> >   and acpi_scan_hot_remove() returns, [I guess we can just emit 
> > KOBJ_CHANGE
> >   for the first companion that is not offline at this point.]
> > (4) user space notices the KOBJ_CHANGE and does the cleanup as needed; 
> > in the
> >   process it carries out the offline operation for the container's 
> > "physical"
> >   companion (there's only one such companion for each container), 
> > [That
> >   operation for the container itself is trivial, but to succeed it 
> > requires
> >   all devices below the container to be taken offline in advance.]
> > (5) user space uses the sysfs "eject" attribute of the ACPI container 
> > object
> >   to finally eject the container,
> > (6) acpi_scan_hot_remove() is now successful, because the container's 
> > "physical"
> >   companion is now offline,
> > (7) the "physical" container device goes away before executing _EJ0,
> > (8) the container is ejected.
> >
> > I think that should work for you.
> 
>  This idea seems to same as your previous work.
>  http://lkml.org/lkml/2013/2/23/97
> >>>
> >>> No, it is not.  That one didn't involve physical device representations.
> >>>
>  How about add autoremove flag into acpi_hotplug_profile and check it as 
>  follow:
> >>>
> >>> This is very similar to "enable" except that it generates the uevent and
> >>> "enable" doesn't.  You might as well modify "enable" to trigger a uevent 
> >>> if
> >>> eject is not enabled (note that with the latest patches in linux-next 
> >>> "enable"
> >>> only applies to eject).
> >>>
> >>> That said I don't think we should generate any uevents for struct 
> >>> acpi_device
> >>> objects, because they are not devices.
> >>>
>  ---
> drivers/acpi/scan.c | 5 +
>    

[PATCH] PCI / ACPI: Install wakeup notify handlers for all PCI devs with ACPI

2013-12-26 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

It turns out that some BIOSes don't report wakeup GPEs through
_PRW, but use them for signaling wakeup anyway, which causes GPE
storms to occur on some systems after resume from system suspend.
This issue has been uncovered by commit d2e5f0c16ad6 (ACPI / PCI:
Rework the setup and cleanup of device wakeup) during the 3.9
development cycle.

Work around the problem by installing wakeup notify handlers for all
PCI devices with ACPI support (i.e. having ACPI companions) regardless
of whether or not the BIOS reports ACPI wakeup support for them.  The
presence of the wakeup notify handlers alone is not harmful in any
way if there are no events for them to handle (they are simply never
executed then), but on some systems they are needed to take care of
spurious events.

Fixes: d2e5f0c16ad6 (ACPI / PCI: Rework the setup and cleanup of device wakeup)
References: https://bugzilla.kernel.org/show_bug.cgi?id=63021
Reported-and-tested-by: Agustin Barto 
Signed-off-by: Rafael J. Wysocki 
---
 drivers/pci/pci-acpi.c |   21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

Index: linux-pm/drivers/pci/pci-acpi.c
===
--- linux-pm.orig/drivers/pci/pci-acpi.c
+++ linux-pm/drivers/pci/pci-acpi.c
@@ -325,29 +325,32 @@ static struct acpi_device *acpi_pci_find
 static void pci_acpi_setup(struct device *dev)
 {
struct pci_dev *pci_dev = to_pci_dev(dev);
-   acpi_handle handle = ACPI_HANDLE(dev);
-   struct acpi_device *adev;
+   struct acpi_device *adev = ACPI_COMPANION(dev);
 
-   if (acpi_bus_get_device(handle, ) || !adev->wakeup.flags.valid)
+   if (!adev)
+   return;
+
+   pci_acpi_add_pm_notifier(adev, pci_dev);
+   if (!adev->wakeup.flags.valid)
return;
 
device_set_wakeup_capable(dev, true);
acpi_pci_sleep_wake(pci_dev, false);
-
-   pci_acpi_add_pm_notifier(adev, pci_dev);
if (adev->wakeup.flags.run_wake)
device_set_run_wake(dev, true);
 }
 
 static void pci_acpi_cleanup(struct device *dev)
 {
-   acpi_handle handle = ACPI_HANDLE(dev);
-   struct acpi_device *adev;
+   struct acpi_device *adev = ACPI_COMPANION(dev);
+
+   if (!adev)
+   return;
 
-   if (!acpi_bus_get_device(handle, ) && adev->wakeup.flags.valid) {
+   pci_acpi_remove_pm_notifier(adev);
+   if (adev->wakeup.flags.valid) {
device_set_wakeup_capable(dev, false);
device_set_run_wake(dev, false);
-   pci_acpi_remove_pm_notifier(adev);
}
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input parameter

2013-12-26 Thread David Rientjes
On Fri, 20 Dec 2013, Santosh Shilimkar wrote:

> diff --git a/mm/memblock.c b/mm/memblock.c
> index 71b11d9..6af873a 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -707,11 +707,9 @@ void __init_memblock __next_free_mem_range(u64 *idx, int 
> nid,
>   struct memblock_type *rsv = 
>   int mi = *idx & 0x;
>   int ri = *idx >> 32;
> - bool check_node = (nid != NUMA_NO_NODE) && (nid != MAX_NUMNODES);
>  
> - if (nid == MAX_NUMNODES)
> - pr_warn_once("%s: Usage of MAX_NUMNODES is depricated. Use 
> NUMA_NO_NODE instead\n",
> -  __func__);
> + if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is 
> deprecated. Use NUMA_NO_NODE instead\n"))
> + nid = NUMA_NO_NODE;
>  
>   for ( ; mi < mem->cnt; mi++) {
>   struct memblock_region *m = >regions[mi];

Um, why do this at runtime?  This is only used for 
for_each_free_mem_range(), which is used rarely in x86 and memblock-only 
code.  I'm struggling to understand why we can't deterministically fix the 
callers if this condition is possible.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: No freezing of kernel threads (was: Re: [GIT PULL] libata fixes for v3.13-rc5)

2013-12-26 Thread Rafael J. Wysocki
On Thursday, December 26, 2013 11:05:17 AM Tejun Heo wrote:
> Hello, Rafael.

Hi Tejun,

> On Thu, Dec 26, 2013 at 04:05:53PM +0100, Rafael J. Wysocki wrote:
> > First, there is a removal-vs-resume deadlock which technically is related to
> > the freezing, but it is not entirely clear to me that using a more fine 
> > grained
> > mechanism instead of the freezing will actually help here.  It may turn out 
> > to
> > be necessary to defer the removal until the resume is complete anyway.
> > 
> > Second, there is the problem with the freezer being a huge sledgehammer 
> > which
> > sometimes is used too eagerly and without enough understanding.  I agree 
> > that
> > that is a problem and probably the best way to address it would be to make
> > people use more specific things instead of the freezer for 
> > workqueues/kthreads.
> 
> I don't think the two points are separate.  There's no reason for
> anything above device drivers (themselves or whatever midlayer
> implementing command queue) to be participating in the freezer and
> this deadlock occurred only because writeback is freezable for no good
> reason that I can see.  If we make "freezing" specific to the places
> where the actual PM operations are necessary, these lockups cannot
> happen, or rather, if a deadlock happens, the blame would likely be
> clearly on the device driver or its subsystem implementation.

The rule is that system suspend (or hibernation) can happen at any time and
certain things that may be running at that point need to be stopped, this way
or another.  The stopping may be done by individual drivers (through PM
callbacks) or at a higher level (e.g. through the freezer) and what makes more
sense depends on the specific case in my opinion.

Runtime PM has a mechanism by which you can say "do not run PM callbacks for
that device now" which makes things quite a bit different.

> > Well, we agreed long ago that making the freezer any more "complete" (in
> > terms of stopping more things) would be harmful, but then we thought that
> > it was not necessary to rework the subsystems using it already.  Perhaps
> > that was a mistake.
> 
> Hmmm... it doesn't look like we have too many freezable users in the
> kernel at this point.  Hopefully doing a sweep through what's
> remaining wouldn't be too hard?
> 
> > I actually think that khubd is somewhat analogous to the PM workqueue, so
> > it needs to be stopped before we start calling suspend callbacks or we'd
> > have to deal with a lot more complexity than really necessary.  There may
> > be more things like that, but that's hard to tell without reviewing all
> > users of freezable kthreads and workqueues and analysing them all.  So I
> > guess that's the next step if we want to go into that direction.
> 
> I see.  I'm kinda curious how that jives with runtime PM.  One thing
> which bothers me about the freezer is that it's essentially a separate
> entry point for suspend/resume implementation, and not a particularly
> well designed one at that.  Things which depend on freezer for PM ops
> would need completely separate paths for runtime PM.  They probably
> need some deviations anyway but freezer would push it unnecessarily.

As I said above, using the freezer is just one of possible ways to stop things
that need to be stopped.  Whoever choses the freezer for that should better
know why exactly or it most likely is a bug.

> > Well, it looks like we don't really know why things are done the way they
> > are done at least in some cases, so in my personal view it would be good to
> > go through all of the kernel freezer users just for this reason alone.  We
> > can't really say which of them are legitimate without that and how difficult
> > it would be for them to switch over to using something more fine grained 
> > than
> > the freezer.
> 
> I'm a bit worried about things which may not be explicit.
> ie. something which is broken but sorta working because things like
> writeback and jbd are frozen.  I think I worry about that because I
> remember one argument for kernel freezer from way way back, that it's
> too hard to implement proper suspend/resume for all drivers and by
> freezing most kthreads things should mostly work, which sounded pretty
> crazy to me even back then.  Hopefully, we don't have much left
> depending on such magic.

I *hope* we don't.  In any case, we certainly need to know *why* things are
done in a specific way, whatever that way is.  In this particular case, if
some kthread/workqueue is frozen over suspend/resume, we should know why
exactly (i.e. what problem the freezing is supposed to address) or all that
becomes voodoo programming.

> > I'm not worried about workqueues, becuase I see no reason why they can't use
> > workqueue_set_max_active() the way we discussed (after the two patches of 
> > yours
> > that haven't been applied yet), but kthreads are a somewhat different 
> > matter.
> 
> Well, converting kthreads to workqueues are pretty easy and usually
> 

Re: No freezing of kernel threads (was: Re: [GIT PULL] libata fixes for v3.13-rc5)

2013-12-26 Thread Rafael J. Wysocki
On Thursday, December 26, 2013 02:01:20 PM Tejun Heo wrote:
> Hey,
> 
> On Thu, Dec 26, 2013 at 01:42:29PM -0500, Alan Stern wrote:
> > In the case of hibernation, it's not so simple.  We do need to perform 
> > I/O, in order to save the memory image.  But we also need to avoid 
> > unnecessary I/O, in order to keep the on-disk data consistent with the 
> > data in the memory image.  You probably can't accomplish this at the 
> > device driver or subsystem level.
> 
> That was what I assumed too but Rafael tells me it has nothing to do
> with hibernation.

It doesn't prevent on-disk data corruption from happening in case of a failing
hibernation.  In case of a successful hibernation it is key to keep on-disk
data in sync with the contents of the image, but relying on the freezing
for that is rather not a winning strategy, so to speak.  It would be better
to freeze filesystems instead (which has been discussed in another thread
recently).

Thanks,
Rafael

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


Re: [PATCH] ims-pcu: Add commands supported by the new version of the FW

2013-12-26 Thread Dmitry Torokhov
Hi Andrey,

On Sat, Dec 21, 2013 at 11:16:48AM -0800, Andrey Smirnov wrote:
> New version of the PCU firmware supports two new commands:
>   - IMS_PCU_CMD_OFN_SET_CONFIG which allows to write data to the
>   registers of one finger navigation(OFN) chip present on the device
>   - IMS_PCU_CMD_OFN_GET_CONFIG which allows to read data form the
>   registers of said chip.
> 
> This commit adds two helper functions to use those commands and sysfs
> attributes to use them. It also exposes some OFN configuration
> parameters via sysfs.
> 
> Signed-off-by: Andrey Smirnov 
> ---
>  drivers/input/misc/ims-pcu.c | 274 
> +--
>  1 file changed, 263 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
> index e204f26..050c960 100644
> --- a/drivers/input/misc/ims-pcu.c
> +++ b/drivers/input/misc/ims-pcu.c
> @@ -68,6 +68,9 @@ struct ims_pcu {
>   char bl_version[IMS_PCU_BL_VERSION_LEN];
>   char reset_reason[IMS_PCU_BL_RESET_REASON_LEN];
>   int update_firmware_status;
> + u8 device_id;
> +
> + u8 ofn_reg_addr;
>  
>   struct usb_interface *ctrl_intf;
>  
> @@ -371,6 +374,8 @@ static void ims_pcu_destroy_gamepad(struct ims_pcu *pcu)
>  #define IMS_PCU_CMD_GET_DEVICE_ID0xae
>  #define IMS_PCU_CMD_SPECIAL_INFO 0xb0
>  #define IMS_PCU_CMD_BOOTLOADER   0xb1/* Pass data to 
> bootloader */
> +#define IMS_PCU_CMD_OFN_SET_CONFIG   0xb3
> +#define IMS_PCU_CMD_OFN_GET_CONFIG   0xb4
>  
>  /* PCU responses */
>  #define IMS_PCU_RSP_STATUS   0xc0
> @@ -389,6 +394,9 @@ static void ims_pcu_destroy_gamepad(struct ims_pcu *pcu)
>  #define IMS_PCU_RSP_GET_DEVICE_ID0xce
>  #define IMS_PCU_RSP_SPECIAL_INFO 0xd0
>  #define IMS_PCU_RSP_BOOTLOADER   0xd1/* Bootloader response 
> */
> +#define IMS_PCU_RSP_OFN_SET_CONFIG   0xd2
> +#define IMS_PCU_RSP_OFN_GET_CONFIG   0xd3
> +
>  
>  #define IMS_PCU_RSP_EVNT_BUTTONS 0xe0/* Unsolicited, button state */
>  #define IMS_PCU_GAMEPAD_MASK 0x0001ff80UL/* Bits 7 through 16 */
> @@ -1216,6 +1224,226 @@ ims_pcu_update_firmware_status_show(struct device 
> *dev,
>  static DEVICE_ATTR(update_firmware_status, S_IRUGO,
>  ims_pcu_update_firmware_status_show, NULL);
>  
> +enum pcu_ofn_offsets {
> + OFN_REG_RESULT_LSB_OFFSET = 2,
> + OFN_REG_RESULT_MSB_OFFSET = 3,
> +};
> +
> +static ssize_t ims_pcu_ofn_reg_data_show(struct device *dev,
> +  struct device_attribute *dattr,
> +  char *buf)
> +{
> + struct usb_interface *intf = to_usb_interface(dev);
> + struct ims_pcu *pcu = usb_get_intfdata(intf);
> + int error;
> +
> + mutex_lock(>cmd_mutex);
> +
> + error = ims_pcu_execute_command(pcu, OFN_GET_CONFIG,
> + >ofn_reg_addr,
> + sizeof(pcu->ofn_reg_addr));
> + if (error >= 0) {
> + const s16 result = pcu->cmd_buf[OFN_REG_RESULT_MSB_OFFSET] << 8 
> |
> +pcu->cmd_buf[OFN_REG_RESULT_LSB_OFFSET];

const here seems overkill.

> + if (result < 0)
> + error = result;
> + else
> + error = scnprintf(buf, PAGE_SIZE, "%x\n", (u8)result);

Why cast to u8?

> + }
> +
> + mutex_unlock(>cmd_mutex);
> +
> + return error;
> +}
> +
> +static ssize_t ims_pcu_ofn_reg_data_store(struct device *dev,
> +   struct device_attribute *dattr,
> +   const char *buf, size_t count)
> +{
> + struct usb_interface *intf = to_usb_interface(dev);
> + struct ims_pcu *pcu = usb_get_intfdata(intf);
> + int error;
> + int value;
> + u8 buffer[2];
> +
> + error = kstrtoint(buf, 0, );
> + if (error)
> + return error;
> +
> + buffer[0] = pcu->ofn_reg_addr;
> + buffer[1] = (u8) value;

If you want u8 we have kstrtou8().

> +
> + mutex_lock(>cmd_mutex);
> +
> + error = ims_pcu_execute_command(pcu, OFN_SET_CONFIG,
> + , sizeof(buffer));
> +
> + mutex_unlock(>cmd_mutex);
> +
> + if (!error) {
> + const s16 result = pcu->cmd_buf[OFN_REG_RESULT_MSB_OFFSET] << 8 
> |
> +pcu->cmd_buf[OFN_REG_RESULT_LSB_OFFSET];

You should not be checking contents of pcu->cmd_buf after releasing
mutex as someone else could be accessing the same sysfs attribute and
stomping on your data.

> + error = result;

Does firmware guarantee that it would return errors that make sense to
Linux?

> + }
> +
> + return error ?: count;
> +}
> +
> +static DEVICE_ATTR(ofn_reg_data, S_IRUGO | S_IWUSR,
> +ims_pcu_ofn_reg_data_show, ims_pcu_ofn_reg_data_store);
> +
> +static ssize_t ims_pcu_ofn_reg_addr_show(struct device *dev,
> +

Re: [GIT PULL] clk: initial support for Broadcom Kona clocks

2013-12-26 Thread Mike Turquette
Quoting Alex Elder (2013-12-16 07:26:29)
> Mike, please pull the following for 3.14.  It adds clock support
> for Broadcom SoCs having "Kona" clock control units.  Thanks.

Pulled into clk-next.

Thanks!
Mike

> 
> -Alex
> 
> The following changes since commit 1459c837036a44e2dcf14a9452ed330201fb23b5:
> 
>   clk: si570: Add a driver for SI570 oscillators (2013-12-14 21:01:35 -0800)
> 
> are available in the git repository at:
> 
>   git://git.linaro.org/landing-teams/working/broadcom/kernel.git
> pull/mturquette-kona-clocks
> 
> for you to fetch changes up to 143522e704d105bd2b3cbbca6e8fb2d217866ec0:
> 
>   clk: bcm281xx: add initial clock framework support (2013-12-16
> 07:34:52 -0600)
> 
> 
> Alex Elder (2):
>   clk: bcm281xx: define kona clock binding
>   clk: bcm281xx: add initial clock framework support
> 
>  .../devicetree/bindings/clock/bcm-kona-clock.txt   |   93 ++
>  drivers/clk/Kconfig|1 +
>  drivers/clk/Makefile   |1 +
>  drivers/clk/bcm/Kconfig|8 +
>  drivers/clk/bcm/Makefile   |3 +
>  drivers/clk/bcm/clk-bcm281xx.c |  416 
>  drivers/clk/bcm/clk-kona-setup.c   |  769 +++
>  drivers/clk/bcm/clk-kona.c | 1033
> 
>  drivers/clk/bcm/clk-kona.h |  414 
>  include/dt-bindings/clock/bcm281xx.h   |   65 ++
>  10 files changed, 2803 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/clock/bcm-kona-clock.txt
>  create mode 100644 drivers/clk/bcm/Kconfig
>  create mode 100644 drivers/clk/bcm/Makefile
>  create mode 100644 drivers/clk/bcm/clk-bcm281xx.c
>  create mode 100644 drivers/clk/bcm/clk-kona-setup.c
>  create mode 100644 drivers/clk/bcm/clk-kona.c
>  create mode 100644 drivers/clk/bcm/clk-kona.h
>  create mode 100644 include/dt-bindings/clock/bcm281xx.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] Ceph fscache: Fix kernel panic due to a race

2013-12-26 Thread Milosz Tanski
Li,

I looked at the patchset am I correct that this only happens when we
enable caching in the write path?

- Milosz

On Thu, Dec 26, 2013 at 9:29 AM, Li Wang  wrote:
> From: Yunchuan Wen 
>
> The following scripts could easily panic the kernel,
>
> #!/bin/bash
> mount -t ceph -o fsc MONADDR:/ cephfs
> rm -rf cephfs/foo
> dd if=/dev/zero of=cephfs/foo bs=8 count=512
> echo 3 > /proc/sys/vm/drop_caches
> dd if=cephfs/foo of=/dev/null bs=8 count=1024
>
> This is due to when writing a page into fscache, the code will
> assert that the write position does not exceed the
> object->store_limit_l, which is supposed to be equal to inode->i_size.
> However, for current implementation, after file writing, the
> object->store_limit_l is not synchronized with new
> inode->i_size immediately, which introduces a race that if writing
> a new page into fscache, will reach the ASSERT that write position
> has exceeded the object->store_limit_l, and cause kernel panic.
> This patch fixes it.
>
> Yunchuan Wen (3):
>   Ceph fscache: Add an interface to synchronize object store limit
>   Ceph fscache: Update object store limit after writing
>   Ceph fscache: Wait for completion of object initialization
>
>  fs/ceph/cache.c |1 +
>  fs/ceph/cache.h |   10 ++
>  fs/ceph/file.c  |3 +++
>  3 files changed, 14 insertions(+)
>
> --
> 1.7.9.5
>



-- 
Milosz Tanski
CTO
10 East 53rd Street, 37th floor
New York, NY 10022

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


Re: [PATCH v2] Add ff-memless-next module

2013-12-26 Thread Antonio Ospite
On Thu, 26 Dec 2013 19:18:31 +0100
Michal Malý  wrote:

> This patch adds "ff-memless-next" module.
> 
> Changelog:
> v2 - Remove unnecessary "else" branches
>

Michal, these annotations should go after the three dash line (---), and
the commit message must go here, before the three dashes.

> Tested-by: Elias Vanderstuyft 
> Signed-off-by: Michal Malý 
> ---
  ^^^
So put from here on the stuff you want to tell humans but you don't want
to show up in the git history.

git-am will ignore the text between the "---" and the actual "diff"
blocks, so this is the best place to put annotations and patch
commentary.

See git-format-patch and git-am man pages for the details.

Ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] usb patches for v3.14 merge window

2013-12-26 Thread Felipe Balbi
Hi Greg,

Here's my overly extensive pull request for v3.14 merge window. Lots
of work has happened for next merge window.

All patches have been tested with all ARM defconfigs, i386_defconfig,
kvm_guest.config, x86_64_defconfig, plus quite a few randconfigs.

All latest 0-DAY reports have been fixed already a few days back.

I have test-merged this on top of your usb-next and no conflicts showed
up.

Please, consider merging.

Happy New Year

The following changes since commit 413541dd66d51f791a0b169d9b9014e4f56be13c:

  Linux 3.13-rc5 (2013-12-22 13:08:32 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v3.14

for you to fetch changes up to 836a2164491b19dcd4f29d574e548bcadd421a6a:

  usb: phy: keystone: remove redundant return value check of 
platform_get_resource() (2013-12-26 10:19:01 -0600)


usb: changes for v3.14 merge window

This pull request is quite extensive, containing
105 non-merge commits. Because of that, we describe
the changes in sections below:

New drivers:
- Keystone PHY driver and DWC3 Glue Layer
- Aeroflex Gaisler GRUSBDC
- Tahvo PHY driver for N770
- JZ4740 MUSB gluer Layer
- Broadcom PHY Driver

Important new features:
- MUSB DSPS learned about suspend/resume
- New quirk_ep_out_aligned_size flag added to struct usb_gadget
- DWC3 initializes the new quirk flag so gadget drivers can use it.
- AM335x PHY Driver learns about remote wakeup
- Renesas USBHS now requests DMA Engine only once
- s3c-hsotg is now re-used on Broadcom devices
- USB PHY layer now makes sure to initialize the notifier for all
drivers
- omap-control learned about TI's new AM437x devices
- few other usb gadget/function drivers learned about the new
configfs-based binding.

Misc Fixes and Clean Ups:
- Several sparse fixes all over the place
- Removal of redundant of_match_ptr()
- r-car gen2 phy now uses usb_add_phy_dev()
- removal of DEFINE_PCI_DEVICE_TABLE() from a few drivers
- conversion to clk_prepare/clk_unprepare on r8a66597-udc
- some randconfig errors and build warnings were fixed
- removal of unnecessary lock on dwc3-omap.c

Signed-of-by: Felipe Balbi 


Aaro Koskinen (7):
  ARM: OMAP1: USB: move omap_usb_config to platform data
  usb: omap1: add extcon to platform data
  usb: omap1: OTG controller driver
  usb: omap1: Tahvo USB transceiver driver
  usb: phy: tahvo: fix smatch warnings
  usb: phy: isp1301-omap: fix smatch warnings
  usb: phy: fix some Kconfig descriptions

Andreas Larsson (1):
  usb: gadget: Add UDC driver for Aeroflex Gaisler GRUSBDC

Andrzej Pietrasiewicz (21):
  usb: gadget: composite: redirect setup requests
  usb: gadget: factor out alloc_ep_req
  usb: gadget: f_loopback: add configfs support
  usb: gadget: f_sourcesink: add configfs support
  usb: gadget: configfs: allow setting function instance's name
  usb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable
  usb: gadget: g_ffs: convert to new interface of f_ecm
  usb: gadget: f_ecm: remove compatibility layer
  usb: gadget: g_ffs: convert to new interface of f_subset
  usb: gadget: f_subset: remove compatibility layer
  usb: gadget: g_ffs: convert to new interface of f_rndis
  usb: gadget: f_rndis: remove compatibility layer
  usb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko
  usb: gadget: FunctionFS: Remove VLAIS usage from gadget code
  usb: gadget: FunctionFS: create utility file
  usb: gadget: FunctionFS: add devices management code
  usb: gadget: FunctionFS: convert to new function interface with backward 
compatibility
  usb: gadget: g_ffs: convert to new interface of f_fs
  usb: gadget: FunctionFS: Remove compatibility layer
  usb: gadget: FunctionFS: add configfs support
  usb: gadget: nokia: fix error recovery path for optional functions

Anton Tikhomirov (5):
  usb: phy: fsm: protect against multiple inclusions
  usb: phy: replace spinlock with mutex in OTG FSM
  usb: phy: move OTG FSM header
  usb: phy: Add OTG FSM configuration option
  usb: phy: Fix double lock in OTG FSM

Apelete Seketeli (2):
  usb: musb: add support for JZ4740 usb device controller
  usb: musb: fix setting JZ4740 gadget periphal mode on reset

Bin Liu (1):
  usb: musb: dsps: polling ID pin status only in otg mode

Dan Carpenter (1):
  usb: gadget: update some out of date comments

Daniel Mack (7):
  usb: musb: unconditionally save and restore the context on suspend
  usb: musb: call musb_port_suspend from musb_bus_suspend
  usb: musb: dsps: add {tx,rx}_mode to wrapper
  

[PATCH] epoll: Do not take the nested ep->mtx on EPOLL_CTL_DEL

2013-12-26 Thread Jason Baron
The EPOLL_CTL_DEL path of epoll contains a classic, ab-ba deadlock. That is,
epoll_ctl(a, EPOLL_CTL_DEL, b, x), will deadlock with epoll_ctl(b,
EPOLL_CTL_DEL, a, x). The deadlock was introduced with commmit 67347fe4e6326
(epoll: do not take global 'epmutex' for simple topologies).

The acquistion of the ep->mtx for the destination 'ep' was added such that a
concurrent EPOLL_CTL_ADD operation would see the correct state of the ep.
(Specifically, the check for '!list_empty(>f_ep_links'.)
However, by simply not acquiring the lock, we do not serialize behind
the ep->mtx from the add path, and thus may perform a full path check when if we
had waited a little longer it may not have been necessary. However, this is a
transient state, and performing the full loop checking in this case is not
harmful.

The important point is that we wouldn't miss doing the full loop checking when
required, since EPOLL_CTL_ADD always locks any 'ep's that its operating upon.
The reason we don't need to do lock ordering in the add path, is that
we are already are holding the global 'epmutex' whenever we do the
double lock. Further, the original posting of this patch, which was tested
for the intended performance gains, did not perform this additional locking.

Signed-off-by: Jason Baron 
---
 fs/eventpoll.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 8b5e258..af90312 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1907,10 +1907,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
}
}
}
-   if (op == EPOLL_CTL_DEL && is_file_epoll(tf.file)) {
-   tep = tf.file->private_data;
-   mutex_lock_nested(>mtx, 1);
-   }
 
/*
 * Try to lookup the file inside our RB tree, Since we grabbed "mtx"
-- 
1.8.2

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


Re: section miss-matches in older 3.8.3 kernel, and one question

2013-12-26 Thread Gene Heskett
On Thursday 26 December 2013, Gene Heskett wrote:
>On Thursday 26 December 2013, Randy Dunlap wrote:
>>On 12/26/13 10:58, Gene Heskett wrote:
>>> Greetings;
>>> 
>>> In my attempts to find a 64 bit or PAE enabled kernel to run on my
>>> older ASUS M2N-SLI Delux mobo, I saw a note go by during the build
>>> that there were 9 section-miss-matches.
>>> 
>>> But when I applied the cli option recommended to the make lines in my
>>> makeit script, I only got these 2 squawks.
>>> 
>>> WARNING: drivers/net/ethernet/amd/depca.o(.text+0xcce): Section
>>> mismatch in reference from the function depca_isa_probe() to the
>>> function
>>> .init.text:DepcaSignature()
>>> The function depca_isa_probe() references
>>> the function __init DepcaSignature().
>>> This is often because depca_isa_probe lacks a __init
>>> annotation or the annotation of DepcaSignature is wrong.
>>> 
>>> WARNING: drivers/net/ethernet/amd/depca.o(.text+0xd22): Section
>>> mismatch in reference from the function depca_isa_probe() to the
>>> function
>>> .init.text:depca_hw_init()
>>> The function depca_isa_probe() references
>>> the function __init depca_hw_init().
>>> This is often because depca_isa_probe lacks a __init
>>> annotation or the annotation of depca_hw_init is wrong.
>>> 
>>> I am not capable to fixing these, too many years & miles on the wet
>>> ram, but I thought that maybe someone might be interested.
>>
>>This driver was removed from the kernel source tree on Jan. 16, 2013.
>>
>>Sure, it's still in 3.8.x so those section mismatches could be fixed,
>>but most section mismatches have been recently fixed by eliminating
>>CONFIG_HOTPLUG and removing the use of all __devinit* and __devexit*.
>>
>>Do you use this driver?  is it barfing?
>>or you just happened to build it and saw these warnings?
>
>The latter Randy, and I can recall when they were moderately important in
>the 2.6 days.  FWIW, I just built, but haven't reboot tested yet, a
>3.12.0, with no reported errors... But now kmail is back to freezing its
>composer for 2 or 3 minutes at a time while running 3.8.3. 3.8.2 didn't
>do that nearly as often.
>
>Thanks, Randy
>
>Cheers, Gene

A 3rd ps, 3.12.0 now running, but I see this in dmesg:

microcode: CPU0: patch_level=0x0165
microcode: CPU1: patch_level=0x0165
microcode: CPU2: patch_level=0x0165
microcode: CPU3: patch_level=0x0165
microcode: Microcode Update Driver: v2.00 , 
Peter Oruba

The correct patch level for this phenom cpu is 0x0183

I had enabled an option for early microcode, perhaps I should disable it 
and rebuild?

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 

job interview, n.:
The excruciating process during which personnel officers
separate the wheat from the chaff -- then hire the chaff.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   >