Re: [PATCH] commit: Add -f, --fixes option to add Fixes: line

2013-10-26 Thread Michael Haggerty
On 10/27/2013 02:34 AM, Josh Triplett wrote:
> Linux Kernel Summit 2013 decided on a commit message convention to
> identify commits containing bugs fixed by a commit: a "Fixes:" line,
> included in the standard commit footer (along with "Signed-off-by:" if
> present), containing an abbreviated commit hash (at least 12 characters
> to keep it valid for a long time) and the subject of the commit (for
> human readers).  This helps people (or automated tools) determine how
> far to backport a commit.
> 
> Add a command line option for git commit to automatically construct the
> "Fixes:" line for a commit.  This avoids the need to manually construct
> that line by copy-pasting the commit hash and subject.
> 
> Also works with --amend to modify an existing commit's message.  To add
> a Fixes line to an earlier commit in a series, use rebase -i and add the
> following line after the existing commit:
> x git commit --amend --no-edit -f $commit_containing_bug
> 
> Generalize append_signoff to support appending arbitrary extra lines to
> a commit in the signoff block; this avoids duplicating the logic to find
> or construct that block.

I have a few comments and questions about the design of this feature:

First of all, let me show my ignorance.  How formalized is the use of
metadata lines at the end of a commit message?  I don't remember seeing
documentation about such lines in general (as opposed to documentation
about particular types of lines).  Is the format defined well enough
that tools that don't know about a particular line could nonetheless
preserve it correctly?  Is there/should there be a standard recommended
order of metadata lines?  (For example, should "Fixes:" lines always
appear before "Signed-off-by" lines, or vice versa?)  If so, is it
documented somewhere and preserved by tools when such lines are
added/modified?  Should there be support for querying such lines?

There is another thread [1] proposing the addition of a "Change-Id:"
metadata line, so maybe now would be a good time to discuss such lines
in general.


Too bad your proposed new option sounds so similar to --fixup, which
does something conceptually similar albeit very different in effect.
This will likely lead to confusion.  I wonder if the two features could
be combined in some way?

The main difference between the two features is how they are intended to
be used: --fixup is to fix a commit that hasn't been pushed yet (where
the user intends to squash the commits together), whereas --fixes is to
mark a commit as a fix to a commit that has already been pushed (where
the commits will remain separate).  But there seems to be a common
concept here.

For example, what happens if a --fixes commit is "rebase -i"ed at the
same time as the commit that it fixes?  It might make sense to do the
autosquash thing just like with a --fixup/--squash commit.  (Otherwise
the SHA-1 in the "Fixes:" line will become invalid anyway.)

Conversely, I suppose one could ask whether there should be some way to
prevent "fixup!" or "squash!" commits from being pushed, at least
without some kind of --force option.  This could of course be enforced
by a hook but it might be nice to have some protection by default.


I see that there a consistency check that the --fixes argument is a
valid commit.  But is there/should there be a check that it is an
ancestor of the commit being created?  Is there/should there be a check
that both of these facts remain true if the the commit containing it is
rebased, cherry-picked, etc?

In workflows that make more use of cherry-picking, it could be that the
original buggy commit was cherry-picked to a different branch.  In this
case the user would probably want to cherry-pick the fixing commit to
the other branch, too.  But then the commit that it would be fixing
would have a different SHA-1 than it did on the original branch.  A
check that the "Fixes:" line refers to an ancestor of the current commit
could warn against such errors.  (In some cases it might be possible to
use cherry-pick's "-x" lines to figure out how to rewrite the "Fixes:"
line, but I doubt that would work often enough to be worthwhile.)


> Signed-off-by: Josh Triplett 
> ---
>  Documentation/git-commit.txt | 12 ++--
>  builtin/commit.c | 29 +++--
>  sequencer.c  | 31 +++
>  sequencer.h  |  3 +++
>  t/t7502-commit.sh| 39 ++-
>  5 files changed, 101 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
> index 1a7616c..fcc6ed2 100644
> --- a/Documentation/git-commit.txt
> +++ b/Documentation/git-commit.txt
> @@ -8,8 +8,8 @@ git-commit - Record changes to the repository
>  SYNOPSIS
>  
>  [verse]
> -'git commit' [-a | --interactive | --patch] [-s] [-v] [-u] [--amend]
> -[--dry-run] [(-c | -C | --fixup | --squash) ]
> +'git commit' [-a | 

Re: query for idea about a kexec regression

2013-10-26 Thread Dave Young
typo: mail address of x...@kernel.org

On 10/27/13 at 12:30pm, Dave Young wrote:
> Hi
> 
> While I testing efi runtime patches for kexec kernel, there's
> 2 machines kexec fails on them. It can be reproduced with
> non-efi kernel, so it's not related to the patchset.
> 
> Problem is kexec kernel will immediatly reboot after below
> kernel message:
> smpboot: Booting Node   0, Processors  #   1
> 
> The latter CPUs were not printed.
> 
> nr_cpus=1 works, so there might be some bug on smp code.
> 
> Any idea or suspection acout some patches? This is not 100%
> reproducible, to me it's about 30% thus it's hard to bisect.
> 
> Thanks
> Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


query for idea about a kexec regression

2013-10-26 Thread Dave Young
Hi

While I testing efi runtime patches for kexec kernel, there's
2 machines kexec fails on them. It can be reproduced with
non-efi kernel, so it's not related to the patchset.

Problem is kexec kernel will immediatly reboot after below
kernel message:
smpboot: Booting Node   0, Processors  #   1

The latter CPUs were not printed.

nr_cpus=1 works, so there might be some bug on smp code.

Any idea or suspection acout some patches? This is not 100%
reproducible, to me it's about 30% thus it's hard to bisect.

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


[patch 3/6] Cleanup efi_enter_virtual_mode function

2013-10-26 Thread dyoung
Add two small functions:
efi_merge_regions and efi_map_regions, efi_enter_virtual_mode
calls them instead of embedding two long for loop.

Signed-off-by: Dave Young 
---
 arch/x86/platform/efi/efi.c |   83 +++-
 1 file changed, 52 insertions(+), 31 deletions(-)

--- efi.orig/arch/x86/platform/efi/efi.c
+++ efi/arch/x86/platform/efi/efi.c
@@ -789,35 +789,13 @@ void __init old_map_region(efi_memory_de
pr_err("ioremap of 0x%llX failed!\n",
   (unsigned long long)md->phys_addr);
 }
-/*
- * This function will switch the EFI runtime services to virtual mode.
- * Essentially, look through the EFI memmap and map every region that
- * has the runtime attribute bit set in its memory descriptor and update
- * that memory descriptor with the virtual address obtained from ioremap().
- * This enables the runtime services to be called without having to
- * thunk back into physical mode for every invocation.
- */
-void __init efi_enter_virtual_mode(void)
-{
-   efi_memory_desc_t *md, *prev_md = NULL;
-   void *p, *new_memmap = NULL;
-   unsigned long size;
-   efi_status_t status;
-   u64 end, systab;
-   int count = 0;
 
-   efi.systab = NULL;
-
-   /*
-* We don't do virtual mode, since we don't do runtime services, on
-* non-native EFI
-*/
-   if (!efi_is_native()) {
-   efi_unmap_memmap();
-   return;
-   }
+/* Merge contiguous regions of the same type and attribute */
+static void efi_merge_regions(void)
+{
+   void *p;
+   efi_memory_desc_t *md, *prev_md = NULL;
 
-   /* Merge contiguous regions of the same type and attribute */
for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
u64 prev_size;
md = p;
@@ -844,6 +822,19 @@ void __init efi_enter_virtual_mode(void)
prev_md = md;
 
}
+}
+
+/*
+ * Map efi memory ranges for runtime serivce
+ * Return the new memmap with updated virtual addrresses.
+ */
+void efi_map_regions(void **new_memmap, int *count)
+{
+   efi_memory_desc_t *md, *prev_md = NULL;
+   void *p;
+   unsigned long size;
+   efi_status_t status;
+   u64 end, systab;
 
for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
md = p;
@@ -862,14 +853,44 @@ void __init efi_enter_virtual_mode(void)
systab += md->virt_addr - md->phys_addr;
efi.systab = (efi_system_table_t *) (unsigned long) 
systab;
}
-   new_memmap = krealloc(new_memmap,
- (count + 1) * memmap.desc_size,
+   *new_memmap = krealloc(*new_memmap,
+ (*count + 1) * memmap.desc_size,
  GFP_KERNEL);
-   memcpy(new_memmap + (count * memmap.desc_size), md,
+   memcpy(*new_memmap + (*count * memmap.desc_size), md,
   memmap.desc_size);
-   count++;
+   (*count)++;
+   }
+}
+
+/*
+ * This function will switch the EFI runtime services to virtual mode.
+ * Essentially, look through the EFI memmap and map every region that
+ * has the runtime attribute bit set in its memory descriptor and update
+ * that memory descriptor with the virtual address obtained from ioremap().
+ * This enables the runtime services to be called without having to
+ * thunk back into physical mode for every invocation.
+ */
+void __init efi_enter_virtual_mode(void)
+{
+   efi_status_t status;
+   void *p, *new_memmap = NULL;
+   int count = 0;
+
+   efi.systab = NULL;
+
+   /*
+* We don't do virtual mode, since we don't do runtime services, on
+* non-native EFI
+*/
+   if (!efi_is_native()) {
+   efi_unmap_memmap();
+   return;
}
 
+   efi_merge_regions();
+
+   efi_map_regions(_memmap, );
+
 #ifdef CONFIG_X86_64
efi_scratch.efi_pgt = (pgd_t *)(unsigned 
long)real_mode_header->trampoline_pgd;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] export efi runtime memory mapping to sysfs

2013-10-26 Thread dyoung
kexec kernel will need exactly same mapping for
efi runtime memory ranges. Thus here export the
runtime ranges mapping to sysfs, kexec-tools
will assemble them and pass to 2nd kernel via
setup_data.

Introducing a new directly /sys/firmware/efi/efi-runtime-map
Just like /sys/firmware/memmap. Containing below attribute
in each file of that directory:
attribute  num_pages  phys_addr  type  virt_addr

It will not work for efi 32bit. Only x86_64 currently.

Signed-off-by: Dave Young 
---
 arch/x86/include/asm/efi.h |3 
 arch/x86/platform/efi/efi.c|   11 ++
 drivers/firmware/efi/Kconfig   |   10 +
 drivers/firmware/efi/Makefile  |1 
 drivers/firmware/efi/efi-runtime-map.c |  166 +
 drivers/firmware/efi/efi.c |3 
 6 files changed, 193 insertions(+), 1 deletion(-)

--- linux-2.6.orig/arch/x86/platform/efi/efi.c
+++ linux-2.6/arch/x86/platform/efi/efi.c
@@ -57,6 +57,9 @@
 
 #define EFI_MIN_RESERVE 5120
 
+efi_memory_desc_t *efi_runtime_map;
+int nr_efi_runtime_map;
+
 /*
  * We allocate runtime services regions bottom-up, starting from -4G, i.e.
  * 0x___ and limit EFI VA mapping space to 64G.
@@ -865,6 +868,14 @@ void efi_map_regions(void **new_memmap,
  GFP_KERNEL);
memcpy(*new_memmap + (*count * memmap.desc_size), md,
   memmap.desc_size);
+   if (md->type != EFI_BOOT_SERVICES_CODE &&
+   md->type != EFI_BOOT_SERVICES_DATA) {
+   efi_runtime_map = krealloc(efi_runtime_map,
+   (nr_efi_runtime_map + 1) *
+   sizeof(efi_memory_desc_t), GFP_KERNEL);
+   *(efi_runtime_map + nr_efi_runtime_map) = *md;
+   nr_efi_runtime_map++;
+   }
(*count)++;
}
 }
--- linux-2.6.orig/drivers/firmware/efi/Kconfig
+++ linux-2.6/drivers/firmware/efi/Kconfig
@@ -36,4 +36,14 @@ config EFI_VARS_PSTORE_DEFAULT_DISABLE
  backend for pstore by default. This setting can be overridden
  using the efivars module's pstore_disable parameter.
 
+config EFI_RUNTIME_MAP
+   bool "Add efi runtime map to sysfs" if EXPERT
+   default X86 && EFI
+   help
+ Add the efi runtime memory map to /sys/firmware/efi/runtime-map.
+ That memory map is used for example by kexec to set up efi virtual
+ mapping the 2nd kernel, but can also be used for debugging purposes.
+
+ See also Documentation/ABI/testing/sysfs-efi-runtime-map.
+
 endmenu
--- linux-2.6.orig/drivers/firmware/efi/Makefile
+++ linux-2.6/drivers/firmware/efi/Makefile
@@ -4,3 +4,4 @@
 obj-y  += efi.o vars.o
 obj-$(CONFIG_EFI_VARS) += efivars.o
 obj-$(CONFIG_EFI_VARS_PSTORE)  += efi-pstore.o
+obj-$(CONFIG_EFI_RUNTIME_MAP)  += efi-runtime-map.o
--- /dev/null
+++ linux-2.6/drivers/firmware/efi/efi-runtime-map.c
@@ -0,0 +1,166 @@
+/*
+ * linux/drivers/efi/efi-runtime-map.c
+ * Copyright (C) 2013 Red Hat, Inc., Dave Young 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License v2.0 as published by
+ * the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct efi_runtime_map_entry {
+   efi_memory_desc_t md;
+   struct kobject kobj;   /* kobject for each entry */
+};
+
+extern efi_memory_desc_t *efi_runtime_map;
+extern int nr_efi_runtime_map;
+struct efi_runtime_map_entry *map_entries;
+extern struct kobject *efi_kobj;
+
+static ssize_t map_attr_show(struct kobject *kobj,
+   struct attribute *attr, char *buf);
+static ssize_t type_show(struct efi_runtime_map_entry *entry, char *buf);
+static ssize_t phys_addr_show(struct efi_runtime_map_entry *entry, char *buf);
+static ssize_t virt_addr_show(struct efi_runtime_map_entry *entry, char *buf);
+static ssize_t num_pages_show(struct efi_runtime_map_entry *entry, char *buf);
+static ssize_t attribute_show(struct efi_runtime_map_entry *entry, char *buf);
+
+struct map_attribute {
+   struct attribute attr;
+   ssize_t (*show)(struct efi_runtime_map_entry *entry, char *buf);
+};
+
+static struct map_attribute map_type_attr = __ATTR_RO(type);
+static struct map_attribute map_phys_addr_attr   = __ATTR_RO(phys_addr);
+static struct map_attribute map_virt_addr_attr  = __ATTR_RO(virt_addr);
+static struct map_attribute map_num_pages_attr  = __ATTR_RO(num_pages);
+static struct map_attribute map_attribute_attr  = __ATTR_RO(attribute);
+
+/*
+ 

[patch 1/6] Add function efi_remap_region for remapping to saved virt address

2013-10-26 Thread dyoung
Kexec kernel will use saved runtime virtual mapping, so add a
new function efi_remap_region to remapping it directly without
calculate the virt addr from efi_va.

The md is passed in from 1st kernel, the virtual addr is
saved in md->virt_addr.

Signed-off-by: Dave Young 
---
 arch/x86/include/asm/efi.h |1 +
 arch/x86/platform/efi/efi_32.c |4 
 arch/x86/platform/efi/efi_64.c |   13 +
 3 files changed, 18 insertions(+)

--- linux-2.6.orig/arch/x86/include/asm/efi.h
+++ linux-2.6/arch/x86/include/asm/efi.h
@@ -112,6 +112,7 @@ extern void efi_call_phys_epilog(void);
 extern void efi_unmap_memmap(void);
 extern void efi_memory_uc(u64 addr, unsigned long size);
 extern void __init efi_map_region(efi_memory_desc_t *md);
+extern void __init efi_remap_region(efi_memory_desc_t *md);
 extern void efi_sync_low_kernel_mappings(void);
 extern void __init old_map_region(efi_memory_desc_t *md);
 
--- linux-2.6.orig/arch/x86/platform/efi/efi_64.c
+++ linux-2.6/arch/x86/platform/efi/efi_64.c
@@ -177,6 +177,19 @@ void __init efi_map_region(efi_memory_de
md->virt_addr = efi_va;
 }
 
+void __init efi_remap_region(efi_memory_desc_t *md)
+{
+   pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
+   unsigned long pf = 0;
+
+   if (!(md->attribute & EFI_MEMORY_WB))
+   pf |= _PAGE_PCD;
+
+   if(kernel_map_pages_in_pgd(pgd, md->phys_addr, md->virt_addr, 
md->num_pages, pf))
+   pr_warning("Error mapping PA 0x%llx -> VA 0x%llx!\n",
+  md->phys_addr, md->virt_addr);
+}
+
 void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size,
 u32 type, u64 attribute)
 {
--- linux-2.6.orig/arch/x86/platform/efi/efi_32.c
+++ linux-2.6/arch/x86/platform/efi/efi_32.c
@@ -46,6 +46,10 @@ void __init efi_map_region(efi_memory_de
old_map_region(md);
 }
 
+void __init efi_remap_region(efi_memory_desc_t *md)
+{
+}
+
 void efi_call_phys_prelog(void)
 {
struct desc_ptr gdt_descr;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] export more efi table variable to sysfs

2013-10-26 Thread dyoung
Export fw_vendor, runtime and config tables physical
addresses to /sys/firmware/efi/systab becaue kexec
kernel will need them.

>From EFI spec these 3 variables will be updated to
virtual address after entering virtual mode. But
kernel startup code will need the physical address.

Signed-off-by: Dave Young 
---
 arch/x86/platform/efi/efi.c |4 
 drivers/firmware/efi/efi.c  |9 +
 include/linux/efi.h |3 +++
 3 files changed, 16 insertions(+)

--- efi.orig/drivers/firmware/efi/efi.c
+++ efi/drivers/firmware/efi/efi.c
@@ -32,6 +32,9 @@ struct efi __read_mostly efi = {
.hcdp   = EFI_INVALID_TABLE_ADDR,
.uga= EFI_INVALID_TABLE_ADDR,
.uv_systab  = EFI_INVALID_TABLE_ADDR,
+   .fw_vendor  = EFI_INVALID_TABLE_ADDR,
+   .runtime= EFI_INVALID_TABLE_ADDR,
+   .config_tables  = EFI_INVALID_TABLE_ADDR,
 };
 EXPORT_SYMBOL(efi);
 
@@ -64,6 +67,12 @@ static ssize_t systab_show(struct kobjec
str += sprintf(str, "BOOTINFO=0x%lx\n", efi.boot_info);
if (efi.uga != EFI_INVALID_TABLE_ADDR)
str += sprintf(str, "UGA=0x%lx\n", efi.uga);
+   if (efi.fw_vendor!= EFI_INVALID_TABLE_ADDR)
+   str += sprintf(str, "fw_vendor=0x%lx\n", efi.fw_vendor);
+   if (efi.runtime!= EFI_INVALID_TABLE_ADDR)
+   str += sprintf(str, "runtime=0x%lx\n", efi.runtime);
+   if (efi.config_tables != EFI_INVALID_TABLE_ADDR)
+   str += sprintf(str, "config_tables=0x%lx\n", efi.config_tables);
 
return str - buf;
 }
--- efi.orig/include/linux/efi.h
+++ efi/include/linux/efi.h
@@ -556,6 +556,9 @@ extern struct efi {
unsigned long hcdp; /* HCDP table */
unsigned long uga;  /* UGA table */
unsigned long uv_systab;/* UV system table */
+   unsigned long fw_vendor;
+   unsigned long runtime;
+   unsigned long config_tables;
efi_get_time_t *get_time;
efi_set_time_t *set_time;
efi_get_wakeup_time_t *get_wakeup_time;
--- efi.orig/arch/x86/platform/efi/efi.c
+++ efi/arch/x86/platform/efi/efi.c
@@ -670,6 +670,10 @@ void __init efi_init(void)
 
set_bit(EFI_SYSTEM_TABLES, _efi_facility);
 
+   efi.fw_vendor = (unsigned long)efi.systab->fw_vendor;
+   efi.runtime = (unsigned long)efi.systab->runtime;
+   efi.config_tables = (unsigned long)efi.systab->tables;
+
/*
 * Show what we know for posterity
 */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/6] passing kexec necessary efi data via setup_data

2013-10-26 Thread dyoung
Add a new setup_data type SETUP_EFI for kexec use.
Passing the saved fw_vendor, runtime, config tables and
efi runtime mappings.

When entering virtual mode, directly mapping the efi
runtime ragions which we passed in previously. And skip
the step to call SetVirtualAddressMap.

Specially for HP z420 workstation it need another variable
saving, it's the smbios physical address, the HP bios
also update the SMBIOS address after entering virtual mode
besides of the standard fw_vendor,runtime and config table.

Tested on ovmf+qemu, lenovo thinkpad, a dell laptop and an
HP z420 workstation.

Signed-off-by: Dave Young 
---
 arch/x86/include/asm/efi.h|   12 ++
 arch/x86/include/uapi/asm/bootparam.h |1 
 arch/x86/kernel/setup.c   |3 
 arch/x86/platform/efi/efi.c   |  143 +-
 4 files changed, 142 insertions(+), 17 deletions(-)

--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -447,6 +447,9 @@ static void __init parse_setup_data(void
case SETUP_DTB:
add_dtb(pa_data);
break;
+   case SETUP_EFI:
+   parse_efi_setup(pa_data, data_len);
+   break;
default:
break;
}
--- linux-2.6.orig/arch/x86/platform/efi/efi.c
+++ linux-2.6/arch/x86/platform/efi/efi.c
@@ -59,6 +59,7 @@
 
 efi_memory_desc_t *efi_runtime_map;
 int nr_efi_runtime_map;
+struct efi_setup_data *esdata;
 
 /*
  * We allocate runtime services regions bottom-up, starting from -4G, i.e.
@@ -132,6 +133,32 @@ static int __init setup_storage_paranoia
 }
 early_param("efi_no_storage_paranoia", setup_storage_paranoia);
 
+void parse_efi_setup(u64 phys_addr, u32 data_len)
+{
+   int size;
+   struct setup_data *sdata;
+   u64 esdata_phys;
+
+   if (!efi_enabled(EFI_64BIT)) {
+   pr_warning("skipping setup_data on EFI 32BIT!");
+   return;
+   }
+
+   sdata = early_memremap(phys_addr, data_len);
+   if (!sdata)
+   return;
+
+   size = data_len - sizeof(struct setup_data);
+
+   esdata_phys = phys_addr + sizeof(struct setup_data);
+
+   nr_efi_runtime_map = (size - sizeof(struct efi_setup_data)) /
+   sizeof(efi_memory_desc_t);
+   early_iounmap(sdata, data_len);
+
+   /* setup data regions have been reserved by default */
+   esdata = phys_to_virt(esdata_phys);
+}
 
 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
@@ -521,8 +548,12 @@ static int __init efi_systab_init(void *
}
 
efi_systab.hdr = systab64->hdr;
-   efi_systab.fw_vendor = systab64->fw_vendor;
-   tmp |= systab64->fw_vendor;
+
+   if (esdata)
+   efi_systab.fw_vendor = (unsigned long)esdata->fw_vendor;
+   else
+   efi_systab.fw_vendor = systab64->fw_vendor;
+   tmp |= efi_systab.fw_vendor;
efi_systab.fw_revision = systab64->fw_revision;
efi_systab.con_in_handle = systab64->con_in_handle;
tmp |= systab64->con_in_handle;
@@ -536,13 +567,19 @@ static int __init efi_systab_init(void *
tmp |= systab64->stderr_handle;
efi_systab.stderr = systab64->stderr;
tmp |= systab64->stderr;
-   efi_systab.runtime = (void *)(unsigned long)systab64->runtime;
-   tmp |= systab64->runtime;
+   if (esdata)
+   efi_systab.runtime = (void *)(unsigned 
long)esdata->runtime;
+   else
+   efi_systab.runtime = (void *)(unsigned 
long)systab64->runtime;
+   tmp |= (unsigned long)efi_systab.runtime;
efi_systab.boottime = (void *)(unsigned long)systab64->boottime;
tmp |= systab64->boottime;
efi_systab.nr_tables = systab64->nr_tables;
-   efi_systab.tables = systab64->tables;
-   tmp |= systab64->tables;
+   if (esdata)
+   efi_systab.tables = (unsigned long)esdata->tables;
+   else
+   efi_systab.tables = systab64->tables;
+   tmp |= efi_systab.tables;
 
early_iounmap(systab64, sizeof(*systab64));
 #ifdef CONFIG_X86_32
@@ -648,6 +685,41 @@ static int __init efi_memmap_init(void)
return 0;
 }
 
+static int __init efi_reuse_config(u64 tables, int nr_tables)
+{
+   void *p, *tablep;
+   int i, sz;
+
+   if (!efi_enabled(EFI_64BIT))
+   return 0;
+
+   sz = sizeof(efi_config_table_64_t);
+
+   p = tablep = early_memremap(tables, nr_tables * sz);
+   if (!p) {
+   pr_err("Could not map Configuration table!\n");
+   return -ENOMEM;
+   }
+
+   for (i = 0; i < 

[patch 0/6] kexec kernel efi runtime support

2013-10-26 Thread dyoung
Hi,

Here is the 1st version for supporting kexec kernel efi runtime.
Per pervious discussion I pass the 1st kernel efi runtime mapping
via setup_data to 2nd kernel. Besides of the runtime mapping
info I also pass the fw_vendor, runtime, config table, smbios
physical address in setup_data. EFI spec mentioned fw_vendor,
runtime, config table addresses will be converted to virt address
after entering virtual mode, but we will use it as physical address
in efi_init. For smbios EFI spec did not mention about the address
updating, but during my test on a HP workstation, the bios will
convert it to Virt addr, thus pass it in setup_data as well.

For fw_vendor, runtime, config table, I export them in /sys/firmware/
efi/systab, smbios is already in that file.

For efi runtime mapping I add a new directory /sys/firmware/efi/
efi-runtime-map/ like below
[dave@darkstar ~]$ tree /sys/firmware/efi/efi-runtime-map/
/sys/firmware/efi/efi-runtime-map/
├── 0
│   ├── attribute
│   ├── num_pages
│   ├── phys_addr
│   ├── type
│   └── virt_addr
├── 1
│   ├── attribute
│   ├── num_pages
│   ├── phys_addr
│   ├── type
│   └── virt_addr
[snip]
 
kexec-tools will assemble them as setup_data and pass to 2nd kernel.
I will send userspace patches as well.

Limitation is I only write support for x86_64, test on below machines:
Lenovo thinkpad t420
Dell inspiron 14 - 3421
HP Z420 workstation
Qemu + OVMF

Please help to review the patches.

The patches are based on linus tree (3.12.0-rc6+) + matt's next tree + bp's efi 
mapping patches
Boris's last patch can not directly apply, need a little line shifting.
--
Thanks
Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2] usbatm: Fix dynamic_debug / ratelimited atm_dbg and atm_rldbg macros

2013-10-26 Thread Joe Perches
Fix atm_dbg to use normal pr_debug not dynamic_pr_debug
because dynamic_pr_debug may not be compiled in at all.

Signed-off-by: Joe Perches 
---
V2: Fix macro use of arg... vs ... typo
Fix usbatm vs atmusb typo (thanks Krzysiek)

 drivers/usb/atm/usbatm.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h
index 5651231..f3eecd9 100644
--- a/drivers/usb/atm/usbatm.h
+++ b/drivers/usb/atm/usbatm.h
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
 #define VERBOSE_DEBUG
@@ -59,13 +60,12 @@
atm_printk(KERN_INFO, instance , format , ## arg)
 #define atm_warn(instance, format, arg...) \
atm_printk(KERN_WARNING, instance , format , ## arg)
-#define atm_dbg(instance, format, arg...)  \
-   dynamic_pr_debug("ATM dev %d: " format ,\
-   (instance)->atm_dev->number , ## arg)
-#define atm_rldbg(instance, format, arg...)\
-   if (printk_ratelimit()) \
-   atm_dbg(instance , format , ## arg)
-
+#define atm_dbg(instance, format, ...) \
+   pr_debug("ATM dev %d: " format, \
+(instance)->atm_dev->number, ##__VA_ARGS__)
+#define atm_rldbg(instance, format, ...)   \
+   pr_debug_ratelimited("ATM dev %d: " format, \
+(instance)->atm_dev->number, ##__VA_ARGS__)
 
 /* flags, set by mini-driver in bind() */
 



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


[PATCH V2] printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages

2013-10-26 Thread Joe Perches
pr_debug_ratelimited should be coded similarly to dev_dbg_ratelimited
to reduce the "callbacks suppressed" messages.

Add #include  to printk.h. Unfortunately, this
new #include must be after the prototype/declaration of function printk.

It may be better to split out these _ratelimited declarations into
a separate file one day.

Any use of these pr__ratelimited functions must also have another
specific #include .  Most users have this done indirectly
via #include 

printk.h may not #include  as it causes circular
dependencies and compilation failures.

Signed-off-by: Joe Perches 
---
V2: Fix #include dependencies and typos.

Compile tested with and without CONFIG_DYNAMIC_DEBUG

It looks to me as if device.h should also have #include 
It currently gets the #include indirectly via kobject.h -> kernel.h.

 include/linux/printk.h | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a78..6949258 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -233,6 +233,8 @@ extern asmlinkage void dump_stack(void) __cold;
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #endif
 
+#include 
+
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(CONFIG_DYNAMIC_DEBUG)
 /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
@@ -343,7 +345,19 @@ extern asmlinkage void dump_stack(void) __cold;
 #endif
 
 /* If you are writing a driver, please use dev_dbg instead */
-#if defined(DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG)
+/* descriptor check is first to prevent flooding with "callbacks suppressed" */
+#define pr_debug_ratelimited(fmt, ...) \
+do {   \
+   static DEFINE_RATELIMIT_STATE(_rs,  \
+ DEFAULT_RATELIMIT_INTERVAL,   \
+ DEFAULT_RATELIMIT_BURST); \
+   DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
+   if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&\
+   __ratelimit(&_rs))  \
+   __dynamic_pr_debug(, fmt, ##__VA_ARGS__);\
+} while (0)
+#elif defined(DEBUG)
 #define pr_debug_ratelimited(fmt, ...) \
printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] fs/9p: fix flags in the format of printf

2013-10-26 Thread Cong Ding
To print "int" value, we should use %d rather than %u.

Signed-off-by: Cong Ding 
---
 fs/9p/vfs_inode.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index af7d531..dcc099a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -147,7 +147,7 @@ static umode_t p9mode2unixmode(struct v9fs_session_info 
*v9ses,
int major = -1, minor = -1;
 
strlcpy(ext, stat->extension, sizeof(ext));
-   sscanf(ext, "%c %u %u", , , );
+   sscanf(ext, "%c %d %d", , , );
switch (type) {
case 'c':
res |= S_IFCHR;
-- 
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] usb-storage: scsiglue: Changing the command result

2013-10-26 Thread Greg KH
On Sat, 26 Oct 2013, Vishal Annapurve wrote:
> Hi Alan,
> 
> Here is the new patch:
> 
> From: Vishal Annapurve 
> Date: Sat, 26 Oct 2013 21:10:11 +0530
> Subject: [PATCH] usb: storage: Proper cmd result assignment
> 
> This change replaces DID_ABORT with DID_TIMEOUT as a command result
> whenever US_FLIDX_TIMED_OUT bit is set.
> 
> This change is made to bring USB storage inline with a recent change:
> 
> commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8
> 
> [SCSI] Handle disk devices which can not process medium access commands
> We have experienced several devices which fail in a fashion we do not
> currently handle gracefully in SCSI. After a failure these devices will
> respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
> but any command accessing the storage medium will time out.
> 
> As the USB storage was setting command result as aborted rather than
> timed out, SCSI layer was not recognizing the above mentioned failure
> pattern.
> 
> Change-Id: Ic58e2247fed11649f4dbea56382354ba2fe0be1b

What's this line for?  (yeah, I know where it comes from, the point is
it doesn't belong here...)

Also, no signed-off-by, so I can't apply it...

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] DYNAMIC_DEBUG: use select DEBUG_FS instead of depends on

2013-10-26 Thread Greg Kroah-Hartman
On Sat, Oct 26, 2013 at 10:58:13PM +0200, Krzysztof Mazur wrote:
> Depending on options that are configured later makes them hard
> to enable unless the user knows that he must go backwards.

Really?  We've had this for well over 2 years, people are confused about
this?

Where?

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


f2fs: deadlock in mkdir if ACL is enabled

2013-10-26 Thread Alexey Khoroshilov

Dear Jaegeuk,

Testing F2FS in the following configuration:
CONFIG_F2FS_FS=m
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y

I have got a deadlock:

[16921.437845] INFO: task fs-driver-tests:12695 blocked for more than 
120 seconds.

[16921.437899]   Tainted: GW3.12-rc6-284-generic #1
[16921.437941] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.
[16921.437980] fs-driver-tests D 88007dd3fb78 0 12695  12361 
0x
[16921.438017]  88007dd3fae8 0092 880036c4bfa0 
88007dd3ffd8
[16921.438049]  88007dd3ffd8 88007dd3ffd8 81c104e0 
880036c4bfa0
[16921.438078]  880036c4bfa0 880082a14858 0002 
8113f600

[16921.438106] Call Trace:
[16921.438156]  [] ? __lock_page+0x70/0x70
[16921.438196]  [] schedule+0x29/0x70
[16921.438229]  [] io_schedule+0x8f/0xd0
[16921.438257]  [] sleep_on_page+0xe/0x20
[16921.438281]  [] __wait_on_bit_lock+0x5d/0xc0
[16921.438302]  [] __lock_page+0x67/0x70
[16921.438323]  [] ? wake_atomic_t_function+0x40/0x40
[16921.438340]  [] find_lock_page+0x61/0x90
[16921.438355]  [] find_or_create_page+0x3f/0xb0
[16921.438375]  [] get_node_page+0x39/0x180 [f2fs]
[16921.438398]  [] update_inode_page+0x23/0x70 [f2fs]
[16921.438412]  [] sync_inode_page+0xd8/0xe0 [f2fs]
[16921.438425]  [] new_node_page+0x2b8/0x2e0 [f2fs]
[16921.438438]  [] f2fs_setxattr+0x44c/0x650 [f2fs]
[16921.438451]  [] f2fs_set_acl+0x235/0x350 [f2fs]
[16921.438462]  [] ? f2fs_get_acl+0x8a/0xc0 [f2fs]
[16921.438473]  [] f2fs_init_acl+0x140/0x170 [f2fs]
[16921.438483]  [] __f2fs_add_link+0x276/0x720 [f2fs]
[16921.438494]  [] f2fs_mkdir+0x116/0x1b0 [f2fs]
[16921.438503]  [] ? __inode_permission+0x64/0xe0
[16921.438512]  [] vfs_mkdir+0xa6/0x130
[16921.438521]  [] SyS_mkdirat+0xaa/0xf0
[16921.438530]  [] SyS_mkdir+0x19/0x20
[16921.438540]  [] system_call_fastpath+0x16/0x1b
[16921.438545] 4 locks held by fs-driver-tests/12695:
[16921.438550]  #0:  (sb_writers#11){.+.+.+}, at: [] 
mnt_want_write+0x24/0x50
[16921.438559]  #1:  (>i_mutex_dir_key#3/1){+.+.+.}, at: 
[] kern_path_create+0x87/0x170
[16921.438567]  #2:  (>fs_lock[i]){+.+.+.}, at: 
[] f2fs_mkdir+0xcc/0x1b0 [f2fs]
[16921.438576]  #3:  (>fs_lock[i]){+.+.+.}, at: 
[] f2fs_setxattr+0xc4/0x650 [f2fs]


Analysis shown the following problem:

sys_mkdir() calls
  -> f2fs_add_link()
-> __f2fs_add_link()
  -> init_inode_metadata():
static struct page *init_inode_metadata(struct inode *inode,
struct inode *dir, const struct qstr *name)
{
struct page *page;
int err;

if (is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE)) {
page = new_inode_page(inode, name); <--- NEW PAGE CAME LOCKED HERE
if (IS_ERR(page))
return page;

if (S_ISDIR(inode->i_mode)) {
err = make_empty_dir(inode, dir, page);
if (err)
goto error;
}

err = f2fs_init_acl(inode, dir);
...
return page;
PAGE IS RETURNED FROM init_inode_metadata() LOCKED

But
f2fs_init_acl() calls
  -> f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
-> f2fs_setxattr(inode, ...)
-> write_all_xattrs(inode, ...)
-> new_node_page(, ...), where dn->inode = inode
  -> sync_inode_page(dn)
-> update_inode_page(dn->inode):
  -> get_node_page(sbi, inode->i_ino):
struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid)
{
struct address_space *mapping = sbi->node_inode->i_mapping;
struct page *page;
int err;
repeat:
page = grab_cache_page(mapping, nid); <-- DEADLOCK: PAGE IS ALREADY 
LOCKED



Found by Linux File System Verification project (linuxtesting.org).

--
Best regards,
Alexey Khoroshilov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org

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


Re: [PATCH 4/4] staging/lustre: fix coccinelle warnings

2013-10-26 Thread Greg Kroah-Hartman
On Mon, Oct 21, 2013 at 11:18:25PM +0800, Peng Tao wrote:
> From: Fengguang Wu 
> 
> drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c:217:2-3: Unneeded semicolon
> 
> Removes unneeded semicolon.
> 
> Generated by: coccinelle/misc/semicolon.cocci
> 
> CC: Peng Tao 
> CC: Andreas Dilger 
> Signed-off-by: Fengguang Wu 
> ---
>  drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This is already in my tree from someone else, sorry.

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 v7] arm: use built-in byte swap function

2013-10-26 Thread Nicolas Pitre
On Thu, 23 May 2013, Kim Phillips wrote:

> Enable the compiler intrinsic for byte swapping on arch ARM.  This
> allows the compiler to detect and be able to optimize out byte
> swappings, and has a very modest benefit on vmlinux size (Linaro gcc
> 4.8):
> 
>text  data bss dec hex filename
> 2840310123932   61960 3026202  2e2d1a vmlinux-lart #orig
> 2840152123932   61960 3026044  2e2c7c vmlinux-lart #builtin-bswap
> 
> 6473120314840 5616016 12403976 bd4508 vmlinux-mxs #orig
> 6472586314848 5616016 12403450 bd42fa vmlinux-mxs #builtin-bswap
> 
> 7419872318372  379556 8117800  7bde28 vmlinux-imx_v6_v7 #orig
> 7419170318364  379556 8117090  7bdb62 vmlinux-imx_v6_v7 #builtin-bswap
> 
> Signed-off-by: Kim Phillips 
> Reviewed-by: Nicolas Pitre 
> Acked-by: David Woodhouse 

Did this ever go somewhere?

Russell suggested at the time to base it against a mainline kernel 
(since it was patching files which apparently were already patched with 
out-of-tree lz4 patches) and send it to his patch system.


> ---
> resending as v6 appears to have fallen though the cracks.  Russell?
> 
> v7: rebased onto next-20130521, re-ran above vmlinux sizes with
> Linaro gcc 4.8, added Nicolas' Reviewed-by, and David's Acked-by.
> v6 and prior version information:
> https://lkml.org/lkml/2013/2/22/475
> 
>  arch/arm/Kconfig  |  1 +
>  arch/arm/boot/compressed/Makefile | 15 +++
>  arch/arm/kernel/armksyms.c|  4 
>  arch/arm/lib/Makefile |  2 +-
>  arch/arm/lib/bswapsdi2.S  | 36 
>  5 files changed, 53 insertions(+), 5 deletions(-)
>  create mode 100644 arch/arm/lib/bswapsdi2.S
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index a7fc5ea..c2fe04d 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -63,6 +63,7 @@ config ARM
>   select OLD_SIGSUSPEND3
>   select OLD_SIGACTION
>   select HAVE_CONTEXT_TRACKING
> + select ARCH_USE_BUILTIN_BSWAP
>   help
> The ARM series is a line of low-power-consumption RISC chip designs
> licensed by ARM Ltd and targeted at embedded applications and
> diff --git a/arch/arm/boot/compressed/Makefile 
> b/arch/arm/boot/compressed/Makefile
> index 198a4ad..bd8a176 100644
> --- a/arch/arm/boot/compressed/Makefile
> +++ b/arch/arm/boot/compressed/Makefile
> @@ -112,12 +112,12 @@ endif
>  
>  targets   := vmlinux vmlinux.lds \
>piggy.$(suffix_y) piggy.$(suffix_y).o \
> -  lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \
> -  font.o font.c head.o misc.o $(OBJS)
> +  lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S bswapsdi2.o \
> +  bswapsdi2.S font.o font.c head.o misc.o $(OBJS)
>  
>  # Make sure files are removed during clean
>  extra-y   += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
> -  lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs)
> +  lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs)
>  
>  ifeq ($(CONFIG_FUNCTION_TRACER),y)
>  ORIG_CFLAGS := $(KBUILD_CFLAGS)
> @@ -159,6 +159,12 @@ ashldi3 = $(obj)/ashldi3.o
>  $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
>   $(call cmd,shipped)
>  
> +# For __bswapsi2, __bswapdi2
> +bswapsdi2 = $(obj)/bswapsdi2.o
> +
> +$(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S
> + $(call cmd,shipped)
> +
>  # We need to prevent any GOTOFF relocs being used with references
>  # to symbols in the .bss section since we cannot relocate them
>  # independently from the rest at run time.  This can be achieved by
> @@ -180,7 +186,8 @@ if [ $(words $(ZRELADDR)) -gt 1 -a 
> "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
>  fi
>  
>  $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o 
> \
> - $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE
> + $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \
> + $(bswapsdi2) FORCE
>   @$(check_for_multiple_zreladdr)
>   $(call if_changed,ld)
>   @$(check_for_bad_syms)
> diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
> index 60d3b73..ba578f7 100644
> --- a/arch/arm/kernel/armksyms.c
> +++ b/arch/arm/kernel/armksyms.c
> @@ -35,6 +35,8 @@ extern void __ucmpdi2(void);
>  extern void __udivsi3(void);
>  extern void __umodsi3(void);
>  extern void __do_div64(void);
> +extern void __bswapsi2(void);
> +extern void __bswapdi2(void);
>  
>  extern void __aeabi_idiv(void);
>  extern void __aeabi_idivmod(void);
> @@ -114,6 +116,8 @@ EXPORT_SYMBOL(__ucmpdi2);
>  EXPORT_SYMBOL(__udivsi3);
>  EXPORT_SYMBOL(__umodsi3);
>  EXPORT_SYMBOL(__do_div64);
> +EXPORT_SYMBOL(__bswapsi2);
> +EXPORT_SYMBOL(__bswapdi2);
>  
>  #ifdef CONFIG_AEABI
>  EXPORT_SYMBOL(__aeabi_idiv);
> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> index af72969..5383df7 100644
> --- a/arch/arm/lib/Makefile
> +++ 

Re: [PATCH 1/3] vxlan: silence one build warning

2013-10-26 Thread Zhi Yong Wu
HI, Stephen

I saw it on Fedora 17 without latest kernel. Then what do you think
that it is appropriate to solve this problem? discard this patch? If
yes, i can also agree.


On Sat, Oct 26, 2013 at 10:48 PM, Stephen Hemminger
 wrote:
> On Sat, 26 Oct 2013 15:06:04 +0800
> Zhi Yong Wu  wrote:
>
>> On Fri, Oct 25, 2013 at 11:41 PM, Stephen Hemminger
>>  wrote:
>> > On Fri, 25 Oct 2013 15:49:18 +0800
>> > Zhi Yong Wu  wrote:
>> >
>> >> From: Zhi Yong Wu 
>> >>
>> >> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
>> >> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in 
>> >> this function [-Wmaybe-uninitialized]
>> >> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
>> >>   LD  drivers/net/built-in.o
>> >>
>> >> Signed-off-by: Zhi Yong Wu 
>> >> ---
>> >>  drivers/net/vxlan.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
>> >> index 2ef5b62..e15f1af 100644
>> >> --- a/drivers/net/vxlan.c
>> >> +++ b/drivers/net/vxlan.c
>> >> @@ -2272,7 +2272,7 @@ static struct vxlan_sock 
>> >> *vxlan_socket_create(struct net *net, __be16 port,
>> >>  {
>> >>   struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>> >>   struct vxlan_sock *vs;
>> >> - struct socket *sock;
>> >> + struct socket *sock = NULL;
>> >>   struct sock *sk;
>> >>   int rc = 0;
>> >>   unsigned int h;
>> >
>> > This only happens with certain versions of Gcc which have buggy dependency
>> > analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
>> > I would rather not fix the warning this way since it risks masking later 
>> > bugs if this code ever changes.
>> Gcc version is 4.7.2 on my box, this warning took palce.
>> # gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> ...
>> gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
>>
>>
>
> I dont see it on Debian 7.
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc-4.7.real
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' 
> --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs 
> --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr 
> --program-suffix=-4.7 --enable-shared --enable-linker-build-id 
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 
> --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
> --enable-libstdcxx-debug --enable-libstdcxx-time=yes 
> --enable-gnu-unique-object --enable-plugin --enable-objc-gc 
> --with-arch-32=i586 --with-tune=generic --enable-checking=release 
> --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.7.2 (Debian 4.7.2-5)



-- 
Regards,

Zhi Yong Wu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 SDIO and MMC device ID support for CLV

2013-10-26 Thread Chris Ball
Hi Eric,

On Mon, Oct 21 2013, Eric Ernst wrote:
> This patch adds intel_mid clovertrail SDIO and eMMC device
> IDs to the sdhci-pci driver.
>
> Signed-off-by: Eric Ernst 
> Signed-off-by: David Cohen 

Thanks, pushed to mmc-next for 3.13.

- Chris.
-- 
Chris Ball  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] commit: Add -f, --fixes option to add Fixes: line

2013-10-26 Thread Josh Triplett
Linux Kernel Summit 2013 decided on a commit message convention to
identify commits containing bugs fixed by a commit: a "Fixes:" line,
included in the standard commit footer (along with "Signed-off-by:" if
present), containing an abbreviated commit hash (at least 12 characters
to keep it valid for a long time) and the subject of the commit (for
human readers).  This helps people (or automated tools) determine how
far to backport a commit.

Add a command line option for git commit to automatically construct the
"Fixes:" line for a commit.  This avoids the need to manually construct
that line by copy-pasting the commit hash and subject.

Also works with --amend to modify an existing commit's message.  To add
a Fixes line to an earlier commit in a series, use rebase -i and add the
following line after the existing commit:
x git commit --amend --no-edit -f $commit_containing_bug

Generalize append_signoff to support appending arbitrary extra lines to
a commit in the signoff block; this avoids duplicating the logic to find
or construct that block.

Signed-off-by: Josh Triplett 
---
 Documentation/git-commit.txt | 12 ++--
 builtin/commit.c | 29 +++--
 sequencer.c  | 31 +++
 sequencer.h  |  3 +++
 t/t7502-commit.sh| 39 ++-
 5 files changed, 101 insertions(+), 13 deletions(-)

diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 1a7616c..fcc6ed2 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -8,8 +8,8 @@ git-commit - Record changes to the repository
 SYNOPSIS
 
 [verse]
-'git commit' [-a | --interactive | --patch] [-s] [-v] [-u] [--amend]
-  [--dry-run] [(-c | -C | --fixup | --squash) ]
+'git commit' [-a | --interactive | --patch] [-s] [-f ] [-v] [-u]
+  [--amend] [--dry-run] [(-c | -C | --fixup | --squash) ]
   [-F  | -m ] [--reset-author] [--allow-empty]
   [--allow-empty-message] [--no-verify] [-e] [--author=]
   [--date=] [--cleanup=] [--[no-]status]
@@ -156,6 +156,14 @@ OPTIONS
Add Signed-off-by line by the committer at the end of the commit
log message.
 
+-f ::
+--fixes=::
+   Add Fixes line for the specified commit at the end of the commit
+   log message.  This line includes an abbreviated commit hash for
+   the specified commit; the `core.abbrev` option determines the
+   length of the abbreviated commit hash used, with a minimum length
+   of 12 hex digits.
+
 -n::
 --no-verify::
This option bypasses the pre-commit and commit-msg hooks.
diff --git a/builtin/commit.c b/builtin/commit.c
index 6ab4605..9bbcd8a 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -123,6 +123,7 @@ static int use_editor = 1, include_status = 1;
 static int show_ignored_in_status, have_option_m;
 static const char *only_include_assumed;
 static struct strbuf message = STRBUF_INIT;
+static struct strbuf fixes = STRBUF_INIT;
 
 static enum status_format {
STATUS_FORMAT_NONE = 0,
@@ -133,6 +134,28 @@ static enum status_format {
STATUS_FORMAT_UNSPECIFIED
 } status_format = STATUS_FORMAT_UNSPECIFIED;
 
+static int opt_parse_f(const struct option *opt, const char *arg, int unset)
+{
+   struct strbuf *sb = opt->value;
+   if (unset) {
+   strbuf_setlen(sb, 0);
+   } else {
+   struct pretty_print_context ctx = {0};
+   struct commit *commit;
+
+   commit = lookup_commit_reference_by_name(arg);
+   if (!commit)
+   die(_("could not lookup commit %s"), arg);
+   ctx.output_encoding = get_commit_output_encoding();
+   ctx.abbrev = DEFAULT_ABBREV;
+   if (ctx.abbrev < 12)
+   ctx.abbrev = 12;
+   format_commit_message(commit, "Fixes: %h ('%s')\n", sb, );
+   }
+
+   return 0;
+}
+
 static int opt_parse_m(const struct option *opt, const char *arg, int unset)
 {
struct strbuf *buf = opt->value;
@@ -718,7 +741,7 @@ static int prepare_to_commit(const char *index_file, const 
char *prefix,
if (clean_message_contents)
stripspace(, 0);
 
-   if (signoff) {
+   if (signoff || fixes.len) {
/*
 * See if we have a Conflicts: block at the end. If yes, count
 * its size, so we can ignore it.
@@ -742,7 +765,8 @@ static int prepare_to_commit(const char *index_file, const 
char *prefix,
previous = eol;
}
 
-   append_signoff(, ignore_footer, 0);
+   append_signoff_extra(, ignore_footer,
+signoff ? 0 : APPEND_EXTRA_ONLY, );
}
 
if (fwrite(sb.buf, 1, sb.len, s->fp) < sb.len)
@@ -1463,6 +1487,7 @@ int cmd_commit(int argc, const char **argv, const char 
*prefix)
   

Es ist Privat

2013-10-26 Thread George Daniels
Es ist Privat

Ich bin George Daniels, ein Banker und Credit-System-Programmierer (HSBC
Bank). Ich sah Ihre E-Mail-Adresse während des Surfens durch die Bank DTC
Bildschirm in mein Büro gestern so beschloss ich, diese Chance zu nutzen
sehr, Sie kennenzulernen. I glaube, wir sollten jede Gelegenheit nutzen,
um einander besser kennen.
Allerdings bin ich mit Ihnen Kontakt aufnehmen für offensichtliche Grund,
die Sie verstehen.

Ich schicke diese Mail nur wissen, ob diese E-Mail-Adresse ist OK,
antworten Sie mir zurück, damit ich mehr Details zu euch senden.
Ich habe eine sehr wichtige Sache, um mit Ihnen zu diskutieren, ich freue
mich auf Empfangen Sie Ihre Antwort an
georgedani...@postino.net. Haben Sie einen schönen Tag.

George Daniels







--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [3.11.4] Thunderbolt/PCI unplug oops in pci_pme_list_scan

2013-10-26 Thread Andreas Noever
> Sorry, I didn't understand this.  Is this supposed to be an
> explanation of how 928bea fixes the oops that Andreas saw?  If so, can
> you be a little more explicit about when the pci_dev got freed and
> when pci_pme_list_scan() walked the list and accessed the freed area?

I did some more debugging and it seems that 928bea is innocent after
all. I added some debugging statements to pci_pme_active. The
additional delay seems to make the oops easier to trigger and I can
now replicate it up to
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=5137a2ee2007d9cbbbeebd14abe08357a079b607
which makes much more sense.

Here is what's going on (in 3.11). First of all pci_pme_activate is
only ever called with false as the second paramter during boot. Now
when I unplug the adapter, the first call is:
 [] dump_stack+0x54/0x8d
 [] pci_pme_active+0x30/0x210
 [] ? pci_read+0x2c/0x30 (this should be pci_stop_dev imho)
 [] pci_stop_bus_device+0x4e/0xa0
 [] pci_stop_bus_device+0x3b/0xa0
 [] pci_stop_bus_device+0x3b/0xa0
 [] pci_stop_and_remove_bus_device+0x12/0x20
 [] pciehp_unconfigure_device+0xa8/0x1b0
 [] pciehp_disable_slot+0x68/0x200
 [] pciehp_power_thread+0x83/0xf0
 [] process_one_work+0x178/0x470
 [] worker_thread+0x121/0x3a0
 [] ? manage_workers.isra.21+0x2b0/0x2b0
 [] kthread+0xc0/0xd0
 [] ? SyS_unshare+0x220/0x280
 [] ? kthread_create_on_node+0x120/0x120
 [] ret_from_fork+0x7c/0xb0
 [] ? kthread_create_on_node+0x120/0x120
tg3 :0a:00.0: PME# disabled

This is still fine. But then it gets interesting. The next call is:
 [] dump_stack+0x54/0x8d
 [] pci_pme_active+0x30/0x210
 [] __pci_enable_wake+0x65/0x160
 [] pci_wake_from_d3+0x25/0x40
 [] tg3_power_down+0x29/0x40 [tg3]
 [] tg3_close+0x10c/0x1d0 [tg3]
 [] __dev_close_many+0x85/0xd0
 [] dev_close_many+0x8b/0x100
 [] rollback_registered_many+0xd8/0x250
 [] rollback_registered+0x2d/0x40
 [] unregister_netdevice_queue+0x58/0xb0
 [] unregister_netdev+0x1c/0x30
 [] tg3_remove_one+0x6b/0x120 [tg3]
 [] pci_device_remove+0x3b/0xb0
 [] __device_release_driver+0x7f/0xf0
 [] device_release_driver+0x23/0x30
 [] bus_remove_device+0xf4/0x170
 [] device_del+0x135/0x1d0
 [] pci_stop_bus_device+0x94/0xa0
 [] pci_stop_bus_device+0x3b/0xa0
 [] pci_stop_bus_device+0x3b/0xa0
 [] pci_stop_and_remove_bus_device+0x12/0x20
 [] pciehp_unconfigure_device+0xa8/0x1b0
 [] pciehp_disable_slot+0x68/0x200
 [] pciehp_power_thread+0x83/0xf0
 [] process_one_work+0x178/0x470
 [] worker_thread+0x121/0x3a0
 [] ? manage_workers.isra.21+0x2b0/0x2b0
 [] kthread+0xc0/0xd0
 [] ? SyS_unshare+0x220/0x280
 [] ? kthread_create_on_node+0x120/0x120
 [] ret_from_fork+0x7c/0xb0
 [] ? kthread_create_on_node+0x120/0x120
tg3 :0a:00.0: PME# enabled

On removal tg3 calls pci_wake_from_d3 to enable/disable wake-on-lan.
This then calls pci_pme_activate(dev, true) for a device which is
about to be deleted. The linked commit does no longer call
pci_wake_from_d3, which "fixes" the problem.

Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.13 series, sg: O_EXCL and other lock handling

2013-10-26 Thread Douglas Gilbert

The lk 3.12.0-rc series contained four patches against the
sg driver from Vaughan Cao introduced by this post:
   [PATCH v7 0/4][SCSI] sg: fix race condition in sg_open
   http://marc.info/?l=linux-scsi=137774159020002=2

Doubt was thrown on the implementation by Madper Xie in
this thread:
   [Bug] 12.864681  BUG: lock held when returning to user space!
   http://marc.info/?l=linux-kernel=138121455020314=2

There was a second bug report. A patch from me (that needed to
be revised) was judged to be too late in the lk 3.12 rc cycle
to be accepted. Hence Vaughan's patch is queued to be reverted.
That means the sg driver will remain unchanged for at least
three releases: 3.10, 3.11 and 3.12

The patch presented here targets the lk 3.13 merge window
and is functionally equivalent to Vaughan's four part patch
with my revised patch on top.

Testing:
  In the sg3_utils package (version 1.37) examples directory
  there are the sg_tst_excl2 and sg_tst_excl3 ** programs.
  They use multiple threads to bombard the sg driver (or bsg
  or the block layer) with open calls varying the O_EXCL and
  O_NONBLOCK flags. Writer threads check for an even number
  then do a double increment on a given LBA; reader threads
  just read that LBA and check it is even. If the integer
  (4 bytes at the beginning of the LB) starts even, then it
  should remain even, if O_EXCL is doing its job properly.

** sg_tst_excl3 came after version 1.37 was released and is
   in the News section here: http://sg.danny.cz/sg

ChangeLog:
  - introduce a finer grain (per device) lock to protect
access and changes to the file descriptor objects
  - introduce a semaphore for mutual exclusion of co-incident
open and release calls to the same device
  - improve the O_EXCL handling of sg_open() when multiple
callers are waiting for an O_EXCL condition to clear
  - change some seq_printf()s to seq_puts()s as requested
by checkpatch.pl
  - update copyright notice, version number and date


Signed-off-by: Douglas Gilbert 


diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index df5e961..90e4631 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -7,9 +7,7 @@
  * Original driver (sg.c):
  *Copyright (C) 1992 Lawrence Foard
  * Version 2 and 3 extensions to driver:
- *Copyright (C) 1998 - 2005 Douglas Gilbert
- *
- *  Modified  19-JAN-1998  Richard Gooch   Devfs support
+ *Copyright (C) 1998 - 2013 Douglas Gilbert
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,8 +16,8 @@
  *
  */
 
-static int sg_version_num = 30534;	/* 2 digits for each component */
-#define SG_VERSION_STR "3.5.34"
+static int sg_version_num = 30535;	/* 2 digits for each component */
+#define SG_VERSION_STR "3.5.35"
 
 /*
  *  D. P. Gilbert (dgilb...@interlog.com, do...@triode.net.au), notes:
@@ -64,7 +62,7 @@ static int sg_version_num = 30534;	/* 2 digits for each component */
 
 #ifdef CONFIG_SCSI_PROC_FS
 #include 
-static char *sg_version_date = "20061027";
+static char *sg_version_date = "20131026";
 
 static int sg_proc_init(void);
 static void sg_proc_cleanup(void);
@@ -105,11 +103,8 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ;
 static int sg_add(struct device *, struct class_interface *);
 static void sg_remove(struct device *, struct class_interface *);
 
-static DEFINE_SPINLOCK(sg_open_exclusive_lock);
-
 static DEFINE_IDR(sg_index_idr);
-static DEFINE_RWLOCK(sg_index_lock);	/* Also used to lock
-			   file descriptor list for device */
+static DEFINE_RWLOCK(sg_index_lock);
 
 static struct class_interface sg_interface = {
 	.add_dev	= sg_add,
@@ -146,8 +141,7 @@ typedef struct sg_request {	/* SG_MAX_QUEUE requests outstanding per file */
 } Sg_request;
 
 typedef struct sg_fd {		/* holds the state of a file descriptor */
-	/* sfd_siblings is protected by sg_index_lock */
-	struct list_head sfd_siblings;
+	struct list_head sfd_siblings; /* protected by sfd_lock of device */
 	struct sg_device *parentdp;	/* owning device */
 	wait_queue_head_t read_wait;	/* queue read until command done */
 	rwlock_t rq_list_lock;	/* protect access to list in req_arr */
@@ -170,14 +164,14 @@ typedef struct sg_fd {		/* holds the state of a file descriptor */
 
 typedef struct sg_device { /* holds the state of each scsi generic device */
 	struct scsi_device *device;
-	wait_queue_head_t o_excl_wait;	/* queue open() when O_EXCL in use */
 	int sg_tablesize;	/* adapter's max scatter-gather table size */
 	u32 index;		/* device index number */
-	/* sfds is protected by sg_index_lock */
+	spinlock_t sfd_lock;	/* protect file descriptor list for device */
 	struct list_head sfds;
+	struct semaphore or_sem;  /* protect co-incidental opens and releases */
+	wait_queue_head_t open_wait;	/* waits associated with O_EXCL */
 	volatile char detached;	/* 0->attached, 1->detached pending removal */
-	

Re: [GIT PULLv2] For x86/mce ... enhanced error logs

2013-10-26 Thread Christoph Hellwig
On Sat, Oct 26, 2013 at 02:34:52PM -0700, Tony Luck wrote:
> As Chen Gong points out, drivers/acpi isn't the right place ... so if not 
> lib/ ... then where?

A to be created drivers/efi?  There should be a lot more shared EFI code
coming sooner or later, shouldn't it?

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


Re: [GIT PULLv2] For x86/mce ... enhanced error logs

2013-10-26 Thread Tony Luck

> Hm, I'm not sure we should move something named after a hardware 
> feature into lib/. It's not really generic C library functionality, 
> 
Not a hardware feature. CPER stands for Common Platform Error Record from the 
UEFI standard. So applicable to three? architectures.

As Chen Gong points out, drivers/acpi isn't the right place ... so if not lib/ 
... then where?

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


Attention Please...

2013-10-26 Thread Mr. TANKO MUBBASHAR

Hello Dear.
 
I am the General Audit Manager, Accounts Department in our bank. I have the 
opportunity of transferring the sum of ($10.5m) Ten million five hundred 
thousand united states dollars only).This fund originally belongs to one of our 
bank Customers who died many years back.
 
I need you to come as a foreigner to claim this money with my Co-operation as a 
worker here in the bank. My request for a foreigner to stand as next of kin in 
this business is because the late customer was a foreigner. Based on the fact 
that this is a deal, I propose 40% of this fund for you and 60% for me. I will 
let you know what next to do when you have assured me your interest and 
capability to handle this transaction.
 
Thank you,
Mr Tanko Mubbashar.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Documentation: add missing files to timers/00-INDEX

2013-10-26 Thread Henrik Austad
From: Henrik Austad 

- timers-howto was added by commit 0fcb8081 (Documentation: Add
  timers/timers-howto.txt)
- NO_HZ was added by commit 0c87f9b5 (nohz_full: Add documentation.)

Cc: Patrick Pannuto 
Cc: Paul E. McKenney 
Cc: Jiri Kosina 
Signed-off-by: Henrik Austad 
---
 Documentation/timers/00-INDEX |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Documentation/timers/00-INDEX b/Documentation/timers/00-INDEX
index a9248da..ef2ccbf 100644
--- a/Documentation/timers/00-INDEX
+++ b/Documentation/timers/00-INDEX
@@ -8,5 +8,9 @@ hpet_example.c
- sample hpet timer test program
 hrtimers.txt
- subsystem for high-resolution kernel timers
+NO_HZ.txt
+   - Summary of the different methods for the scheduler clock-interrupts 
management.
+timers-howto.txt
+   - how to insert delays in the kernel the right (tm) way.
 timer_stats.txt
- timer usage statistics
-- 
1.7.2.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] CRYPTO: omap-sham: Add missing modalias

2013-10-26 Thread Pali Rohár
From: Joni Lapilainen 

Signed-off-by: Joni Lapilainen 
---
 drivers/crypto/omap-sham.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 8bdde57..236db0a 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -2033,3 +2033,4 @@ module_platform_driver(omap_sham_driver);
 MODULE_DESCRIPTION("OMAP SHA1/MD5 hw acceleration support.");
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Dmitry Kasatkin");
+MODULE_ALIAS("platform:omap-sham");
-- 
1.7.10.4

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


[PATCH] DYNAMIC_DEBUG: use select DEBUG_FS instead of depends on

2013-10-26 Thread Krzysztof Mazur
Depending on options that are configured later makes them hard
to enable unless the user knows that he must go backwards.

Signed-off-by: Krzysztof Mazur 
---
 lib/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 06344d9..d5c9247 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -48,7 +48,7 @@ config DYNAMIC_DEBUG
bool "Enable dynamic printk() support"
default n
depends on PRINTK
-   depends on DEBUG_FS
+   select DEBUG_FS
help
 
  Compiles debug level messages into the kernel, which would not
-- 
1.8.4.1.635.g6a5

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


[PATCH 01/16] mac80211: fix TX device statistics for monitor interfaces

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Count TX packets and bytes also for monitor interfaces.

Signed-of-by: David Gnedt 
---
 net/mac80211/tx.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3456c04..674db8e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1593,6 +1593,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff 
*skb,
if (unlikely(skb->len < len_rthdr))
goto fail; /* skb too short for claimed rt header extent */
 
+   dev->stats.tx_packets++;
+   dev->stats.tx_bytes += skb->len;
+
/*
 * fix up the pointers accounting for the radiotap
 * header still being in there.  We are being given
-- 
1.7.10.4

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


[PATCH 03/16] wl1251: add sysfs interface for bluetooth coexistence mode configuration

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Port the bt_coex_mode sysfs interface from wl1251 driver version included
in the Maemo Fremantle kernel to allow bt-coexistence mode configuration.
This enables userspace applications to set one of the modes
WL1251_BT_COEX_OFF, WL1251_BT_COEX_ENABLE and WL1251_BT_COEX_MONOAUDIO.
The default mode is WL1251_BT_COEX_OFF.
It should be noted that this driver always enabled bt-coexistence before
and enabled bt-coexistence directly affects the receiving performance,
rendering it unusable in some low-signal situations. Especially monitor
mode is affected very badly with bt-coexistence enabled.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/acx.c|   43 ++--
 drivers/net/wireless/ti/wl1251/acx.h|8 ++-
 drivers/net/wireless/ti/wl1251/init.c   |6 +-
 drivers/net/wireless/ti/wl1251/main.c   |  108 +++
 drivers/net/wireless/ti/wl1251/wl1251.h |8 +++
 5 files changed, 161 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c 
b/drivers/net/wireless/ti/wl1251/acx.c
index db6430c..cce50e2 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -581,7 +581,7 @@ out:
return ret;
 }
 
-int wl1251_acx_sg_enable(struct wl1251 *wl)
+int wl1251_acx_sg_enable(struct wl1251 *wl, u8 mode)
 {
struct acx_bt_wlan_coex *pta;
int ret;
@@ -594,7 +594,7 @@ int wl1251_acx_sg_enable(struct wl1251 *wl)
goto out;
}
 
-   pta->enable = SG_ENABLE;
+   pta->enable = mode;
 
ret = wl1251_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta));
if (ret < 0) {
@@ -607,7 +607,7 @@ out:
return ret;
 }
 
-int wl1251_acx_sg_cfg(struct wl1251 *wl)
+int wl1251_acx_sg_cfg(struct wl1251 *wl, u16 wake_up_beacon)
 {
struct acx_bt_wlan_coex_param *param;
int ret;
@@ -632,7 +632,7 @@ int wl1251_acx_sg_cfg(struct wl1251 *wl)
param->wlan_cycle_fast = PTA_CYCLE_TIME_FAST_DEF;
param->bt_anti_starvation_period = PTA_ANTI_STARVE_PERIOD_DEF;
param->next_bt_lp_packet = PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF;
-   param->wake_up_beacon = PTA_TIME_BEFORE_BEACON_DEF;
+   param->wake_up_beacon = wake_up_beacon;
param->hp_dm_max_guard_time = PTA_HPDM_MAX_TIME_DEF;
param->next_wlan_packet = PTA_TIME_OUT_NEXT_WLAN_DEF;
param->antenna_type = PTA_ANTENNA_TYPE_DEF;
@@ -661,6 +661,41 @@ out:
return ret;
 }
 
+int wl1251_acx_sg_configure(struct wl1251 *wl, bool force)
+{
+   int ret;
+
+   if (wl->state == WL1251_STATE_OFF && !force)
+   return 0;
+
+   switch (wl->bt_coex_mode) {
+   case WL1251_BT_COEX_OFF:
+   ret = wl1251_acx_sg_enable(wl, SG_DISABLE);
+   if (ret)
+   break;
+   ret = wl1251_acx_sg_cfg(wl, 0);
+   break;
+   case WL1251_BT_COEX_ENABLE:
+   ret = wl1251_acx_sg_enable(wl, SG_ENABLE);
+   if (ret)
+   break;
+   ret = wl1251_acx_sg_cfg(wl, PTA_TIME_BEFORE_BEACON_DEF);
+   break;
+   case WL1251_BT_COEX_MONOAUDIO:
+   ret = wl1251_acx_sg_enable(wl, SG_ENABLE);
+   if (ret)
+   break;
+   ret = wl1251_acx_sg_cfg(wl, PTA_TIME_BEFORE_BEACON_MONO_AUDIO);
+   break;
+   default:
+   wl1251_error("Invalid BT co-ex mode!");
+   ret = -EOPNOTSUPP;
+   break;
+   }
+
+   return ret;
+}
+
 int wl1251_acx_cca_threshold(struct wl1251 *wl)
 {
struct acx_energy_detection *detection;
diff --git a/drivers/net/wireless/ti/wl1251/acx.h 
b/drivers/net/wireless/ti/wl1251/acx.h
index c2ba100..99ea80e 100644
--- a/drivers/net/wireless/ti/wl1251/acx.h
+++ b/drivers/net/wireless/ti/wl1251/acx.h
@@ -558,7 +558,8 @@ struct acx_bt_wlan_coex {
 #define PTA_ANTI_STARVE_PERIOD_DEF   (500)
 #define PTA_ANTI_STARVE_NUM_CYCLE_DEF(4)
 #define PTA_ALLOW_PA_SD_DEF  (1)
-#define PTA_TIME_BEFORE_BEACON_DEF   (6300)
+#define PTA_TIME_BEFORE_BEACON_DEF   (500)
+#define PTA_TIME_BEFORE_BEACON_MONO_AUDIO (6300)
 #define PTA_HPDM_MAX_TIME_DEF(1600)
 #define PTA_TIME_OUT_NEXT_WLAN_DEF   (2550)
 #define PTA_AUTO_MODE_NO_CTS_DEF (0)
@@ -1455,8 +1456,9 @@ int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 
rts_threshold);
 int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter);
 int wl1251_acx_beacon_filter_table(struct wl1251 *wl);
 int wl1251_acx_conn_monit_params(struct wl1251 *wl);
-int wl1251_acx_sg_enable(struct wl1251 *wl);
-int wl1251_acx_sg_cfg(struct wl1251 *wl);
+int wl1251_acx_sg_enable(struct wl1251 *wl, u8 mode);
+int wl1251_acx_sg_cfg(struct wl1251 *wl, u16 wake_up_beacon);
+int wl1251_acx_sg_configure(struct wl1251 *wl, bool force);
 int wl1251_acx_cca_threshold(struct wl1251 *wl);
 int wl1251_acx_bcn_dtim_options(struct wl1251 

Re: [PATCH] media: Add BCM2048 radio driver

2013-10-26 Thread Pali Rohár
On Saturday 26 October 2013 22:22:09 Hans Verkuil wrote:
> > Hans, so can it be added to drivers/staging/media tree?
> 
> Yes, that is an option. It's up to you to decide what you
> want. Note that if no cleanup work is done on the staging
> driver for a long time, then it can be removed again.
> 
> Regards,
> 
> Hans
> 

Ok, so if you can add it to staging tree. When driver will be in 
mainline other developers can look at it too. Now when driver is 
hidden, nobody know where to find it... You can see how upstream 
development for Nokia N900 HW going on: http://elinux.org/N900

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


[PATCH 04/16] wl1251: retry power save entry

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Port of the power save entry retry code from wl1251 driver version included
in the Maemo Fremantle kernel.
This tries to enable power save mode up to 3 times before failing.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/boot.c   |3 ++-
 drivers/net/wireless/ti/wl1251/event.c  |   44 +++
 drivers/net/wireless/ti/wl1251/event.h  |7 +
 drivers/net/wireless/ti/wl1251/main.c   |2 ++
 drivers/net/wireless/ti/wl1251/wl1251.h |3 +++
 5 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl1251/boot.c 
b/drivers/net/wireless/ti/wl1251/boot.c
index a2e5241..2000cd5 100644
--- a/drivers/net/wireless/ti/wl1251/boot.c
+++ b/drivers/net/wireless/ti/wl1251/boot.c
@@ -299,7 +299,8 @@ int wl1251_boot_run_firmware(struct wl1251 *wl)
ROAMING_TRIGGER_LOW_RSSI_EVENT_ID |
ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID |
REGAINED_BSS_EVENT_ID | BT_PTA_SENSE_EVENT_ID |
-   BT_PTA_PREDICTION_EVENT_ID | JOIN_EVENT_COMPLETE_ID;
+   BT_PTA_PREDICTION_EVENT_ID | JOIN_EVENT_COMPLETE_ID |
+   PS_REPORT_EVENT_ID;
 
ret = wl1251_event_unmask(wl);
if (ret < 0) {
diff --git a/drivers/net/wireless/ti/wl1251/event.c 
b/drivers/net/wireless/ti/wl1251/event.c
index 74ae8e1..192cebd 100644
--- a/drivers/net/wireless/ti/wl1251/event.c
+++ b/drivers/net/wireless/ti/wl1251/event.c
@@ -46,6 +46,43 @@ static int wl1251_event_scan_complete(struct wl1251 *wl,
return ret;
 }
 
+#define WL1251_PSM_ENTRY_RETRIES  3
+static int wl1251_event_ps_report(struct wl1251 *wl,
+ struct event_mailbox *mbox)
+{
+   int ret = 0;
+
+   wl1251_debug(DEBUG_EVENT, "ps status: %x", mbox->ps_status);
+
+   switch (mbox->ps_status) {
+   case EVENT_ENTER_POWER_SAVE_FAIL:
+   wl1251_debug(DEBUG_PSM, "PSM entry failed");
+
+   if (wl->station_mode != STATION_POWER_SAVE_MODE) {
+   /* remain in active mode */
+   wl->psm_entry_retry = 0;
+   break;
+   }
+
+   if (wl->psm_entry_retry < WL1251_PSM_ENTRY_RETRIES) {
+   wl->psm_entry_retry++;
+   ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
+   } else {
+   wl1251_error("Power save entry failed, giving up");
+   wl->psm_entry_retry = 0;
+   }
+   break;
+   case EVENT_ENTER_POWER_SAVE_SUCCESS:
+   case EVENT_EXIT_POWER_SAVE_FAIL:
+   case EVENT_EXIT_POWER_SAVE_SUCCESS:
+   default:
+   wl->psm_entry_retry = 0;
+   break;
+   }
+
+   return 0;
+}
+
 static void wl1251_event_mbox_dump(struct event_mailbox *mbox)
 {
wl1251_debug(DEBUG_EVENT, "MBOX DUMP:");
@@ -80,6 +117,13 @@ static int wl1251_event_process(struct wl1251 *wl, struct 
event_mailbox *mbox)
}
}
 
+   if (vector & PS_REPORT_EVENT_ID) {
+   wl1251_debug(DEBUG_EVENT, "PS_REPORT_EVENT");
+   ret = wl1251_event_ps_report(wl, mbox);
+   if (ret < 0)
+   return ret;
+   }
+
if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) {
wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT");
 
diff --git a/drivers/net/wireless/ti/wl1251/event.h 
b/drivers/net/wireless/ti/wl1251/event.h
index 30eb5d1..88570a5 100644
--- a/drivers/net/wireless/ti/wl1251/event.h
+++ b/drivers/net/wireless/ti/wl1251/event.h
@@ -112,6 +112,13 @@ struct event_mailbox {
u8 padding[19];
 } __packed;
 
+enum {
+   EVENT_ENTER_POWER_SAVE_FAIL = 0,
+   EVENT_ENTER_POWER_SAVE_SUCCESS,
+   EVENT_EXIT_POWER_SAVE_FAIL,
+   EVENT_EXIT_POWER_SAVE_SUCCESS,
+};
+
 int wl1251_event_unmask(struct wl1251 *wl);
 void wl1251_event_mbox_config(struct wl1251 *wl);
 int wl1251_event_handle(struct wl1251 *wl, u8 mbox);
diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index ad2fd18..46a2494 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -480,6 +480,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
wl->next_tx_complete = 0;
wl->elp = false;
wl->station_mode = STATION_ACTIVE_MODE;
+   wl->psm_entry_retry = 0;
wl->tx_queue_stopped = false;
wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
wl->rssi_thold = 0;
@@ -1519,6 +1520,7 @@ struct ieee80211_hw *wl1251_alloc_hw(void)
wl->elp = false;
wl->station_mode = STATION_ACTIVE_MODE;
wl->psm_requested = false;
+   wl->psm_entry_retry = 0;
wl->tx_queue_stopped = false;
wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
wl->rssi_thold = 0;
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h 

[PATCH 02/16] wl1251: fix scan behaviour while not associated

2013-10-26 Thread Pali Rohár
From: David Gnedt 

With a dissacociated card I often encoutered very long scan delays.

My guess is that it has something to do with the cards DTIM handling and
another firmware bug mentioned in the TI WLAN driver, which is described as
the card may never end scanning if the channel is overloaded because it
can't send probe requests. I think the firmware somehow also tries to
receive DTIM messages when the BSSID is not set. Therefore most of the time
it waits for DTIM messages and can't do scanning work.

Anyway we can workaround this misbehaviour by setting the HIGH_PRIORITY
bit for scans in disassociated state.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/cmd.c  |   13 -
 drivers/net/wireless/ti/wl1251/cmd.h  |5 +
 drivers/net/wireless/ti/wl1251/main.c |1 +
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl1251/cmd.c 
b/drivers/net/wireless/ti/wl1251/cmd.c
index 6822b84..16b6479 100644
--- a/drivers/net/wireless/ti/wl1251/cmd.c
+++ b/drivers/net/wireless/ti/wl1251/cmd.c
@@ -3,6 +3,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wl1251.h"
 #include "reg.h"
@@ -410,7 +411,10 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t 
ssid_len,
struct wl1251_cmd_scan *cmd;
int i, ret = 0;
 
-   wl1251_debug(DEBUG_CMD, "cmd scan");
+   wl1251_debug(DEBUG_CMD, "cmd scan channels %d ssid(%d) '%s'",
+n_channels, ssid_len, ssid);
+
+   WARN_ON(n_channels > SCAN_MAX_NUM_OF_CHANNELS);
 
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
@@ -421,6 +425,13 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t 
ssid_len,
CFG_RX_MGMT_EN |
CFG_RX_BCN_EN);
cmd->params.scan_options = 0;
+   /*
+* Use high priority scan when not associated to prevent fw issue
+* causing never-ending scans (sometimes 20+ minutes).
+* Note: This bug may be caused by the fw's DTIM handling.
+*/
+   if (is_zero_ether_addr(wl->bssid))
+   cmd->params.scan_options |= WL1251_SCAN_OPT_PRIORITY_HIGH;
cmd->params.num_channels = n_channels;
cmd->params.num_probe_requests = n_probes;
cmd->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */
diff --git a/drivers/net/wireless/ti/wl1251/cmd.h 
b/drivers/net/wireless/ti/wl1251/cmd.h
index ee4f2b3..126f273 100644
--- a/drivers/net/wireless/ti/wl1251/cmd.h
+++ b/drivers/net/wireless/ti/wl1251/cmd.h
@@ -167,6 +167,11 @@ struct cmd_read_write_memory {
 #define CMDMBOX_HEADER_LEN 4
 #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
 
+#define WL1251_SCAN_OPT_PASSIVE1
+#define WL1251_SCAN_OPT_5GHZ_BAND  2
+#define WL1251_SCAN_OPT_TRIGGERD_SCAN  4
+#define WL1251_SCAN_OPT_PRIORITY_HIGH  8
+
 #define WL1251_SCAN_MIN_DURATION 3
 #define WL1251_SCAN_MAX_DURATION 6
 
diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 3291ffa..4d89ac8 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -930,6 +930,7 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels,
  req->n_channels, WL1251_SCAN_NUM_PROBES);
if (ret < 0) {
+   wl1251_debug(DEBUG_SCAN, "scan failed %d", ret);
wl->scanning = false;
goto out_idle;
}
-- 
1.7.10.4

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


[PATCH 05/16] wl1251: implement hardware ARP filtering

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Update hardware ARP filter configuration on BSS_CHANGED_ARP_FILTER
notification from mac80211.
Ported from wl1271 driver.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/acx.c  |   31 +++
 drivers/net/wireless/ti/wl1251/acx.h  |   15 +++
 drivers/net/wireless/ti/wl1251/main.c |   13 +
 3 files changed, 59 insertions(+)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c 
b/drivers/net/wireless/ti/wl1251/acx.c
index cce50e2..9295090 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -1062,6 +1062,37 @@ out:
return ret;
 }
 
+int wl1251_acx_arp_ip_filter(struct wl1251 *wl, bool enable, __be32 address)
+{
+   struct wl1251_acx_arp_filter *acx;
+   int ret;
+
+   wl1251_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable);
+
+   acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+   if (!acx) {
+   ret = -ENOMEM;
+   goto out;
+   }
+
+   acx->version = ACX_IPV4_VERSION;
+   acx->enable = enable;
+
+   if (enable == true)
+   memcpy(acx->address, , ACX_IPV4_ADDR_SIZE);
+
+   ret = wl1251_cmd_configure(wl, ACX_ARP_IP_FILTER,
+  acx, sizeof(*acx));
+   if (ret < 0) {
+   wl1251_warning("failed to set arp ip filter: %d", ret);
+   goto out;
+   }
+
+out:
+   kfree(acx);
+   return ret;
+}
+
 int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max,
  u8 aifs, u16 txop)
 {
diff --git a/drivers/net/wireless/ti/wl1251/acx.h 
b/drivers/net/wireless/ti/wl1251/acx.h
index 99ea80e..cd0 100644
--- a/drivers/net/wireless/ti/wl1251/acx.h
+++ b/drivers/net/wireless/ti/wl1251/acx.h
@@ -1233,6 +1233,20 @@ struct wl1251_acx_bet_enable {
u8 padding[2];
 } __packed;
 
+#define ACX_IPV4_VERSION 4
+#define ACX_IPV6_VERSION 6
+#define ACX_IPV4_ADDR_SIZE 4
+struct wl1251_acx_arp_filter {
+   struct acx_header header;
+   u8 version; /* The IP version: 4 - IPv4, 6 - IPv6.*/
+   u8 enable;  /* 1 - ARP filtering is enabled, 0 - disabled */
+   u8 padding[2];
+   u8 address[16]; /* The IP address used to filter ARP packets.
+  ARP packets that do not match this address are
+  dropped. When the IP Version is 4, the last 12
+  bytes of the the address are ignored. */
+} __attribute__((packed));
+
 struct wl1251_acx_ac_cfg {
struct acx_header header;
 
@@ -1475,6 +1489,7 @@ int wl1251_acx_mem_cfg(struct wl1251 *wl);
 int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim);
 int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode,
  u8 max_consecutive);
+int wl1251_acx_arp_ip_filter(struct wl1251 *wl, bool enable, __be32 address);
 int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max,
  u8 aifs, u16 txop);
 int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue,
diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 46a2494..9752745 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1078,6 +1078,19 @@ static void wl1251_op_bss_info_changed(struct 
ieee80211_hw *hw,
}
}
 
+   if (changed & BSS_CHANGED_ARP_FILTER) {
+   __be32 addr = bss_conf->arp_addr_list[0];
+   WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS);
+
+   if (bss_conf->arp_addr_cnt == 1 && bss_conf->assoc)
+   ret = wl1251_acx_arp_ip_filter(wl, true, addr);
+   else
+   ret = wl1251_acx_arp_ip_filter(wl, false, addr);
+
+   if (ret < 0)
+   goto out_sleep;
+   }
+
if (changed & BSS_CHANGED_BEACON) {
beacon = ieee80211_beacon_get(hw, vif);
if (!beacon)
-- 
1.7.10.4

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


[PATCH 09/16] wl1251: disable power saving in monitor mode

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Force power saving off while monitor interface is present.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/main.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 727f2ee..62cb374 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -617,7 +617,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
goto out_sleep;
}
 
-   if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
+   if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested &&
+   !wl->monitor_present) {
wl1251_debug(DEBUG_PSM, "psm enabled");
 
wl->psm_requested = true;
@@ -633,8 +634,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
if (ret < 0)
goto out_sleep;
-   } else if (!(conf->flags & IEEE80211_CONF_PS) &&
-  wl->psm_requested) {
+   } else if ((!(conf->flags & IEEE80211_CONF_PS) || wl->monitor_present)
+  && wl->psm_requested) {
wl1251_debug(DEBUG_PSM, "psm disabled");
 
wl->psm_requested = false;
-- 
1.7.10.4

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


[PATCH 12/16] wl1251: disable retry and ACK policy for injected packets

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Set the retry limit to 0 and disable the ACK policy for injected packets.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/acx.c |8 +++-
 drivers/net/wireless/ti/wl1251/tx.c  |7 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c 
b/drivers/net/wireless/ti/wl1251/acx.c
index 14da6de..f98d46f 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -943,12 +943,18 @@ int wl1251_acx_rate_policies(struct wl1251 *wl)
}
 
/* configure one default (one-size-fits-all) rate class */
-   acx->rate_class_cnt = 1;
+   acx->rate_class_cnt = 2;
acx->rate_class[0].enabled_rates = ACX_RATE_MASK_UNSPECIFIED;
acx->rate_class[0].short_retry_limit = ACX_RATE_RETRY_LIMIT;
acx->rate_class[0].long_retry_limit = ACX_RATE_RETRY_LIMIT;
acx->rate_class[0].aflags = 0;
 
+   /* no-retry rate class */
+   acx->rate_class[1].enabled_rates = ACX_RATE_MASK_UNSPECIFIED;
+   acx->rate_class[1].short_retry_limit = 0;
+   acx->rate_class[1].long_retry_limit = 0;
+   acx->rate_class[1].aflags = 0;
+
ret = wl1251_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx));
if (ret < 0) {
wl1251_warning("Setting of rate policies failed: %d", ret);
diff --git a/drivers/net/wireless/ti/wl1251/tx.c 
b/drivers/net/wireless/ti/wl1251/tx.c
index 1de4ccb..e559bc4 100644
--- a/drivers/net/wireless/ti/wl1251/tx.c
+++ b/drivers/net/wireless/ti/wl1251/tx.c
@@ -90,8 +90,12 @@ static void wl1251_tx_control(struct tx_double_buffer_desc 
*tx_hdr,
/* 802.11 packets */
tx_hdr->control.packet_type = 0;
 
-   if (control->flags & IEEE80211_TX_CTL_NO_ACK)
+   /* Also disable retry and ACK policy for injected packets */
+   if ((control->flags & IEEE80211_TX_CTL_NO_ACK) ||
+   (control->flags & IEEE80211_TX_CTL_INJECTED)) {
+   tx_hdr->control.rate_policy = 1;
tx_hdr->control.ack_policy = 1;
+   }
 
tx_hdr->control.tx_complete = 1;
 
@@ -414,6 +418,7 @@ static void wl1251_tx_packet_cb(struct wl1251 *wl,
info = IEEE80211_SKB_CB(skb);
 
if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+   !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
(result->status == TX_SUCCESS))
info->flags |= IEEE80211_TX_STAT_ACK;
 
-- 
1.7.10.4

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


[PATCH 08/16] wl1251: implement multicast address filtering

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Port multicast address filtering from wl1271 driver.
It sets up the hardware multicast address filter in configure_filter() with
addresses supplied through prepare_multicast().

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/acx.c|9 ++---
 drivers/net/wireless/ti/wl1251/acx.h|9 ++---
 drivers/net/wireless/ti/wl1251/init.c   |2 +-
 drivers/net/wireless/ti/wl1251/main.c   |   57 +--
 drivers/net/wireless/ti/wl1251/wl1251.h |1 +
 5 files changed, 67 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c 
b/drivers/net/wireless/ti/wl1251/acx.c
index e79636f..14da6de 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -408,7 +408,8 @@ out:
return ret;
 }
 
-int wl1251_acx_group_address_tbl(struct wl1251 *wl)
+int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable,
+void *mc_list, u32 mc_list_len)
 {
struct acx_dot11_grp_addr_tbl *acx;
int ret;
@@ -422,9 +423,9 @@ int wl1251_acx_group_address_tbl(struct wl1251 *wl)
}
 
/* MAC filtering */
-   acx->enabled = 0;
-   acx->num_groups = 0;
-   memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN);
+   acx->enabled = enable;
+   acx->num_groups = mc_list_len;
+   memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN);
 
ret = wl1251_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
   acx, sizeof(*acx));
diff --git a/drivers/net/wireless/ti/wl1251/acx.h 
b/drivers/net/wireless/ti/wl1251/acx.h
index bea2e67..820573c 100644
--- a/drivers/net/wireless/ti/wl1251/acx.h
+++ b/drivers/net/wireless/ti/wl1251/acx.h
@@ -350,8 +350,8 @@ struct acx_slot {
 } __packed;
 
 
-#define ADDRESS_GROUP_MAX  (8)
-#define ADDRESS_GROUP_MAX_LEN  (ETH_ALEN * ADDRESS_GROUP_MAX)
+#define ACX_MC_ADDRESS_GROUP_MAX   (8)
+#define ACX_MC_ADDRESS_GROUP_MAX_LEN   (ETH_ALEN * ACX_MC_ADDRESS_GROUP_MAX)
 
 struct acx_dot11_grp_addr_tbl {
struct acx_header header;
@@ -359,7 +359,7 @@ struct acx_dot11_grp_addr_tbl {
u8 enabled;
u8 num_groups;
u8 pad[2];
-   u8 mac_table[ADDRESS_GROUP_MAX_LEN];
+   u8 mac_table[ACX_MC_ADDRESS_GROUP_MAX_LEN];
 } __packed;
 
 
@@ -1464,7 +1464,8 @@ int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 
life_time);
 int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter);
 int wl1251_acx_pd_threshold(struct wl1251 *wl);
 int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time);
-int wl1251_acx_group_address_tbl(struct wl1251 *wl);
+int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable,
+void *mc_list, u32 mc_list_len);
 int wl1251_acx_service_period_timeout(struct wl1251 *wl);
 int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold);
 int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter);
diff --git a/drivers/net/wireless/ti/wl1251/init.c 
b/drivers/net/wireless/ti/wl1251/init.c
index 92de289..f8a2ea9 100644
--- a/drivers/net/wireless/ti/wl1251/init.c
+++ b/drivers/net/wireless/ti/wl1251/init.c
@@ -127,7 +127,7 @@ int wl1251_hw_init_phy_config(struct wl1251 *wl)
if (ret < 0)
return ret;
 
-   ret = wl1251_acx_group_address_tbl(wl);
+   ret = wl1251_acx_group_address_tbl(wl, true, NULL, 0);
if (ret < 0)
return ret;
 
diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index c6e2591..727f2ee 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wl1251.h"
 #include "wl12xx_80211.h"
@@ -678,6 +679,44 @@ out:
return ret;
 }
 
+struct wl1251_filter_params {
+   bool enabled;
+   int mc_list_length;
+   u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN];
+};
+
+static u64 wl1251_op_prepare_multicast(struct ieee80211_hw *hw,
+  struct netdev_hw_addr_list *mc_list)
+{
+   struct wl1251_filter_params *fp;
+   struct netdev_hw_addr *ha;
+   struct wl1251 *wl = hw->priv;
+
+   if (unlikely(wl->state == WL1251_STATE_OFF))
+   return 0;
+
+   fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
+   if (!fp) {
+   wl1251_error("Out of memory setting filters.");
+   return 0;
+   }
+
+   /* update multicast filtering parameters */
+   fp->mc_list_length = 0;
+   if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) {
+   fp->enabled = false;
+   } else {
+   fp->enabled = true;
+   netdev_hw_addr_list_for_each(ha, mc_list) {
+   memcpy(fp->mc_list[fp->mc_list_length],
+   ha->addr, ETH_ALEN);
+   

[PATCH 07/16] wl1251: configure hardware en-/decryption for monitor mode

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Disable hardware encryption (DF_ENCRYPTION_DISABLE) and decryption
(DF_SNIFF_MODE_ENABLE) via wl1251_acx_feature_cfg while monitor interface is
present.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/acx.c|6 +++---
 drivers/net/wireless/ti/wl1251/acx.h|2 +-
 drivers/net/wireless/ti/wl1251/init.c   |2 +-
 drivers/net/wireless/ti/wl1251/main.c   |   34 ++-
 drivers/net/wireless/ti/wl1251/rx.c |2 +-
 drivers/net/wireless/ti/wl1251/tx.c |3 +++
 drivers/net/wireless/ti/wl1251/wl1251.h |1 +
 7 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c 
b/drivers/net/wireless/ti/wl1251/acx.c
index 9295090..e79636f 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -209,7 +209,7 @@ out:
return ret;
 }
 
-int wl1251_acx_feature_cfg(struct wl1251 *wl)
+int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options)
 {
struct acx_feature_config *feature;
int ret;
@@ -222,8 +222,8 @@ int wl1251_acx_feature_cfg(struct wl1251 *wl)
goto out;
}
 
-   /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
-   feature->data_flow_options = 0;
+   /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE can be set */
+   feature->data_flow_options = data_flow_options;
feature->options = 0;
 
ret = wl1251_cmd_configure(wl, ACX_FEATURE_CFG,
diff --git a/drivers/net/wireless/ti/wl1251/acx.h 
b/drivers/net/wireless/ti/wl1251/acx.h
index cd0..bea2e67 100644
--- a/drivers/net/wireless/ti/wl1251/acx.h
+++ b/drivers/net/wireless/ti/wl1251/acx.h
@@ -1455,7 +1455,7 @@ int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 
wake_up_event,
 int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth);
 int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len);
 int wl1251_acx_tx_power(struct wl1251 *wl, int power);
-int wl1251_acx_feature_cfg(struct wl1251 *wl);
+int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options);
 int wl1251_acx_mem_map(struct wl1251 *wl,
   struct acx_header *mem_map, size_t len);
 int wl1251_acx_data_path_params(struct wl1251 *wl,
diff --git a/drivers/net/wireless/ti/wl1251/init.c 
b/drivers/net/wireless/ti/wl1251/init.c
index 424ce01..92de289 100644
--- a/drivers/net/wireless/ti/wl1251/init.c
+++ b/drivers/net/wireless/ti/wl1251/init.c
@@ -33,7 +33,7 @@ int wl1251_hw_init_hwenc_config(struct wl1251 *wl)
 {
int ret;
 
-   ret = wl1251_acx_feature_cfg(wl);
+   ret = wl1251_acx_feature_cfg(wl, 0);
if (ret < 0) {
wl1251_warning("couldn't set feature config");
return ret;
diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 9752745..c6e2591 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -485,6 +485,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
wl->rssi_thold = 0;
wl->channel = WL1251_DEFAULT_CHANNEL;
+   wl->monitor_present = false;
 
wl1251_debugfs_reset(wl);
 
@@ -577,8 +578,10 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
channel = ieee80211_frequency_to_channel(
conf->chandef.chan->center_freq);
 
-   wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
+   wl1251_debug(DEBUG_MAC80211,
+"mac80211 config ch %d monitor %s psm %s power %d",
 channel,
+conf->flags & IEEE80211_CONF_MONITOR ? "on" : "off",
 conf->flags & IEEE80211_CONF_PS ? "on" : "off",
 conf->power_level);
 
@@ -588,6 +591,22 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
if (ret < 0)
goto out;
 
+   if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
+   u32 mode;
+
+   if (conf->flags & IEEE80211_CONF_MONITOR) {
+   wl->monitor_present = true;
+   mode = DF_SNIFF_MODE_ENABLE | DF_ENCRYPTION_DISABLE;
+   } else {
+   wl->monitor_present = false;
+   mode = 0;
+   }
+
+   ret = wl1251_acx_feature_cfg(wl, mode);
+   if (ret < 0)
+   goto out_sleep;
+   }
+
if (channel != wl->channel) {
wl->channel = channel;
 
@@ -804,12 +823,12 @@ static int wl1251_op_set_key(struct ieee80211_hw *hw, 
enum set_key_cmd cmd,
 
mutex_lock(>mutex);
 
-   ret = wl1251_ps_elp_wakeup(wl);
-   if (ret < 0)
-   goto out_unlock;
-
switch (cmd) {
case SET_KEY:
+   if (wl->monitor_present) {
+   ret = -EOPNOTSUPP;
+

[PATCH 11/16] wl1251: enable tx path in monitor mode if necessary for packet injection

2013-10-26 Thread Pali Rohár
From: David Gnedt 

If necessary enable the tx path in monitor mode for packet injection using
the JOIN command with BSS_TYPE_STA_BSS and zero BSSID.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/main.c   |5 +
 drivers/net/wireless/ti/wl1251/tx.c |   17 +
 drivers/net/wireless/ti/wl1251/wl1251.h |1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 7e6b6d1..174f403 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -487,6 +487,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
wl->rssi_thold = 0;
wl->channel = WL1251_DEFAULT_CHANNEL;
wl->monitor_present = false;
+   wl->joined = false;
 
wl1251_debugfs_reset(wl);
 
@@ -546,6 +547,7 @@ static void wl1251_op_remove_interface(struct ieee80211_hw 
*hw,
mutex_lock(>mutex);
wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface");
wl->vif = NULL;
+   memset(wl->bssid, 0, ETH_ALEN);
mutex_unlock(>mutex);
 }
 
@@ -619,6 +621,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
 * at firmware level.
 */
if (wl->vif == NULL) {
+   wl->joined = false;
ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1);
} else {
ret = wl1251_join(wl, wl->bss_type, wl->channel,
@@ -1610,7 +1613,9 @@ struct ieee80211_hw *wl1251_alloc_hw(void)
INIT_DELAYED_WORK(>elp_work, wl1251_elp_work);
wl->channel = WL1251_DEFAULT_CHANNEL;
wl->monitor_present = false;
+   wl->joined = false;
wl->scanning = false;
+   wl->bss_type = MAX_BSS_TYPE;
wl->default_key = 0;
wl->listen_int = 1;
wl->rx_counter = 0;
diff --git a/drivers/net/wireless/ti/wl1251/tx.c 
b/drivers/net/wireless/ti/wl1251/tx.c
index 3cc82fd..1de4ccb 100644
--- a/drivers/net/wireless/ti/wl1251/tx.c
+++ b/drivers/net/wireless/ti/wl1251/tx.c
@@ -28,6 +28,7 @@
 #include "tx.h"
 #include "ps.h"
 #include "io.h"
+#include "event.h"
 
 static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count)
 {
@@ -298,6 +299,22 @@ static int wl1251_tx_frame(struct wl1251 *wl, struct 
sk_buff *skb)
}
}
 
+   /* Enable tx path in monitor mode for packet injection */
+   if ((wl->vif == NULL) && !wl->joined) {
+   ret = wl1251_cmd_join(wl, BSS_TYPE_STA_BSS, wl->channel,
+ wl->beacon_int, wl->dtim_period);
+   if (ret < 0)
+   wl1251_warning("join failed");
+   else {
+   ret = wl1251_event_wait(wl, JOIN_EVENT_COMPLETE_ID,
+   100);
+   if (ret < 0)
+   wl1251_warning("join timeout");
+   else
+   wl->joined = true;
+   }
+   }
+
ret = wl1251_tx_path_status(wl);
if (ret < 0)
return ret;
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h 
b/drivers/net/wireless/ti/wl1251/wl1251.h
index e478e61..1bdf779 100644
--- a/drivers/net/wireless/ti/wl1251/wl1251.h
+++ b/drivers/net/wireless/ti/wl1251/wl1251.h
@@ -311,6 +311,7 @@ struct wl1251 {
u8 listen_int;
int channel;
bool monitor_present;
+   bool joined;
 
void *target_mem_map;
struct acx_data_path_params_resp *data_path;
-- 
1.7.10.4

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


[PATCH 10/16] wl1251: fix channel switching in monitor mode

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Use the ENABLE_RX command for channel switching when no interface is present
(monitor mode only).
The advantage of ENABLE_RX is that it leaves the tx data path disabled in
firmware, whereas the usual JOIN command seems to transmit some frames at
firmware level.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/main.c |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 62cb374..7e6b6d1 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -611,8 +611,19 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
if (channel != wl->channel) {
wl->channel = channel;
 
-   ret = wl1251_join(wl, wl->bss_type, wl->channel,
- wl->beacon_int, wl->dtim_period);
+   /*
+* Use ENABLE_RX command for channel switching when no
+* interface is present (monitor mode only).
+* This leaves the tx path disabled in firmware, whereas
+* the usual JOIN command seems to transmit some frames
+* at firmware level.
+*/
+   if (wl->vif == NULL) {
+   ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1);
+   } else {
+   ret = wl1251_join(wl, wl->bss_type, wl->channel,
+ wl->beacon_int, wl->dtim_period);
+   }
if (ret < 0)
goto out_sleep;
}
-- 
1.7.10.4

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


[PATCH 13/16] wl1251: enforce changed hw encryption support on monitor state change

2013-10-26 Thread Pali Rohár
From: David Gnedt 

The firmware doesn't support per packet encryption selection, so disable hw
encryption support completly while a monitor interface is present to support
injection of packets (which shouldn't get encrypted by hw).
To enforce the changed hw encryption support force a disassociation on
non-monitor interfaces.
For disassociation a workaround using hw connection monitor is employed,
which temporary enables hw connection manager flag.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/main.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 174f403..f054741 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -685,6 +685,16 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 
changed)
wl->power_level = conf->power_level;
}
 
+   /*
+* Tell stack that connection is lost because hw encryption isn't
+* supported in monitor mode.
+* XXX This requires temporary enabling the hw connection monitor flag
+*/
+   if ((changed & IEEE80211_CONF_CHANGE_MONITOR) && wl->vif) {
+   wl->hw->flags |= IEEE80211_HW_CONNECTION_MONITOR;
+   ieee80211_connection_loss(wl->vif);
+   }
+
 out_sleep:
wl1251_ps_elp_sleep(wl);
 
@@ -1116,6 +1126,9 @@ static void wl1251_op_bss_info_changed(struct 
ieee80211_hw *hw,
}
 
if (changed & BSS_CHANGED_ASSOC) {
+   /* XXX Disable temporary enabled hw connection monitor flag */
+   wl->hw->flags &= ~IEEE80211_HW_CONNECTION_MONITOR;
+
if (bss_conf->assoc) {
wl->beacon_int = bss_conf->beacon_int;
 
-- 
1.7.10.4

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


[PATCH 14/16] wl1251: add nvs file name to module firmware list

2013-10-26 Thread Pali Rohár
Signed-off-by: Pali Rohár 
---
 drivers/net/wireless/ti/wl1251/main.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index f054741..7b9efc8 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1709,3 +1709,4 @@ MODULE_DESCRIPTION("TI wl1251 Wireles LAN Driver Core");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo ");
 MODULE_FIRMWARE(WL1251_FW_NAME);
+MODULE_FIRMWARE(WL1251_NVS_NAME);
-- 
1.7.10.4

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


[PATCH 16/16] wl1251: Add sysfs file address for setting permanent mac address

2013-10-26 Thread Pali Rohár
Driver wl1251 generating mac address randomly at startup and there is no way to
set permanent mac address via SET_IEEE80211_PERM_ADDR. This patch export sysfs
file which can set permanent mac address by userspace helper program. Patch is
needed for devices which do not store mac address in internal wl1251 eeprom.

Signed-off-by: Pali Rohár 
---
 drivers/net/wireless/ti/wl1251/main.c |   52 +
 1 file changed, 52 insertions(+)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 29625c2..91a009c 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1375,6 +1375,46 @@ static const struct ieee80211_ops wl1251_ops = {
.get_survey = wl1251_op_get_survey,
 };
 
+static ssize_t wl1251_sysfs_show_address(struct device *dev,
+struct device_attribute *attr,
+char *buf)
+{
+   struct wl1251 *wl = dev_get_drvdata(dev);
+   ssize_t len;
+
+   /* FIXME: what's the maximum length of buf? page size?*/
+   len = 500;
+
+   len = snprintf(buf, len, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+  wl->mac_addr[0], wl->mac_addr[1], wl->mac_addr[2],
+  wl->mac_addr[3], wl->mac_addr[4], wl->mac_addr[5]);
+
+   return len;
+}
+
+static ssize_t wl1251_sysfs_store_address(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+   struct wl1251 *wl = dev_get_drvdata(dev);
+   unsigned int addr[6];
+   int ret, i;
+
+   ret = sscanf(buf, "%2x:%2x:%2x:%2x:%2x:%2x\n",
+   [0], [1], [2],
+   [3], [4], [5]);
+
+   if (ret != 6)
+   return -EINVAL;
+
+   for (i = 0; i < 6; i++)
+   wl->mac_addr[i] = addr[i] & 0xff;
+
+   SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr);
+
+   return count;
+}
+
 static ssize_t wl1251_sysfs_show_tx_mgmt_frm_rate(struct device *dev,
  struct device_attribute *attr,
  char *buf)
@@ -1584,6 +1624,10 @@ out:
return count;
 }
 
+static DEVICE_ATTR(address, S_IRUGO | S_IWUSR,
+  wl1251_sysfs_show_address,
+  wl1251_sysfs_store_address);
+
 static DEVICE_ATTR(tx_mgmt_frm_rate, S_IRUGO | S_IWUSR,
   wl1251_sysfs_show_tx_mgmt_frm_rate,
   wl1251_sysfs_store_tx_mgmt_frm_rate);
@@ -1728,6 +1772,14 @@ int wl1251_init_ieee80211(struct wl1251 *wl)
}
dev_set_drvdata(_device.dev, wl);
 
+   /* Create sysfs file address */
+   ret = device_create_file(_device.dev,
+_attr_address);
+   if (ret < 0) {
+   wl1251_error("failed to create sysfs file address");
+   goto out;
+   }
+
/* Create sysfs file tx_mgmt_frm_rate */
ret = device_create_file(_device.dev,
 _attr_tx_mgmt_frm_rate);
-- 
1.7.10.4

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


[PATCH 06/16] wl1251: split RX and TX data path initialisation

2013-10-26 Thread Pali Rohár
From: David Gnedt 

Split up data path initialisation into RX and TX data path initialisation
functions. This change is required for channel switching in monitor mode.

Signed-off-by: David Gnedt 
---
 drivers/net/wireless/ti/wl1251/cmd.c  |   37 ++---
 drivers/net/wireless/ti/wl1251/cmd.h  |3 ++-
 drivers/net/wireless/ti/wl1251/init.c |9 ++--
 3 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/cmd.c 
b/drivers/net/wireless/ti/wl1251/cmd.c
index 16b6479..055924c 100644
--- a/drivers/net/wireless/ti/wl1251/cmd.c
+++ b/drivers/net/wireless/ti/wl1251/cmd.c
@@ -204,11 +204,11 @@ out:
return ret;
 }
 
-int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable)
+int wl1251_cmd_data_path_rx(struct wl1251 *wl, u8 channel, bool enable)
 {
struct cmd_enabledisable_path *cmd;
int ret;
-   u16 cmd_rx, cmd_tx;
+   u16 cmd_rx;
 
wl1251_debug(DEBUG_CMD, "cmd data path");
 
@@ -220,13 +220,10 @@ int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, 
bool enable)
 
cmd->channel = channel;
 
-   if (enable) {
+   if (enable)
cmd_rx = CMD_ENABLE_RX;
-   cmd_tx = CMD_ENABLE_TX;
-   } else {
+   else
cmd_rx = CMD_DISABLE_RX;
-   cmd_tx = CMD_DISABLE_TX;
-   }
 
ret = wl1251_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd));
if (ret < 0) {
@@ -238,6 +235,32 @@ int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, 
bool enable)
wl1251_debug(DEBUG_BOOT, "rx %s cmd channel %d",
 enable ? "start" : "stop", channel);
 
+out:
+   kfree(cmd);
+   return ret;
+}
+
+int wl1251_cmd_data_path_tx(struct wl1251 *wl, u8 channel, bool enable)
+{
+   struct cmd_enabledisable_path *cmd;
+   int ret;
+   u16 cmd_tx;
+
+   wl1251_debug(DEBUG_CMD, "cmd data path");
+
+   cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+   if (!cmd) {
+   ret = -ENOMEM;
+   goto out;
+   }
+
+   cmd->channel = channel;
+
+   if (enable)
+   cmd_tx = CMD_ENABLE_TX;
+   else
+   cmd_tx = CMD_DISABLE_TX;
+
ret = wl1251_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd));
if (ret < 0) {
wl1251_error("tx %s cmd for channel %d failed",
diff --git a/drivers/net/wireless/ti/wl1251/cmd.h 
b/drivers/net/wireless/ti/wl1251/cmd.h
index 126f273..d824ff9 100644
--- a/drivers/net/wireless/ti/wl1251/cmd.h
+++ b/drivers/net/wireless/ti/wl1251/cmd.h
@@ -35,7 +35,8 @@ int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void 
*buf, size_t len);
 int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len);
 int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
   void *bitmap, u16 bitmap_len, u8 bitmap_control);
-int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable);
+int wl1251_cmd_data_path_rx(struct wl1251 *wl, u8 channel, bool enable);
+int wl1251_cmd_data_path_tx(struct wl1251 *wl, u8 channel, bool enable);
 int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
u16 beacon_interval, u8 dtim_interval);
 int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
diff --git a/drivers/net/wireless/ti/wl1251/init.c 
b/drivers/net/wireless/ti/wl1251/init.c
index a6ad223..424ce01 100644
--- a/drivers/net/wireless/ti/wl1251/init.c
+++ b/drivers/net/wireless/ti/wl1251/init.c
@@ -390,8 +390,13 @@ int wl1251_hw_init(struct wl1251 *wl)
if (ret < 0)
goto out_free_data_path;
 
-   /* Enable data path */
-   ret = wl1251_cmd_data_path(wl, wl->channel, 1);
+   /* Enable rx data path */
+   ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1);
+   if (ret < 0)
+   goto out_free_data_path;
+
+   /* Enable tx data path */
+   ret = wl1251_cmd_data_path_tx(wl, wl->channel, 1);
if (ret < 0)
goto out_free_data_path;
 
-- 
1.7.10.4

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


[PATCH 15/16] wl1251: Add sysfs file tx_mgmt_frm_rate for setting rate

2013-10-26 Thread Pali Rohár
This patch was extracted from Maemo 2.6.28 kernel

Signed-off-by: Pali Rohár 
---
 drivers/net/wireless/ti/wl1251/main.c |  152 +
 1 file changed, 152 insertions(+)

diff --git a/drivers/net/wireless/ti/wl1251/main.c 
b/drivers/net/wireless/ti/wl1251/main.c
index 7b9efc8..29625c2 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1375,6 +1375,147 @@ static const struct ieee80211_ops wl1251_ops = {
.get_survey = wl1251_op_get_survey,
 };
 
+static ssize_t wl1251_sysfs_show_tx_mgmt_frm_rate(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+   struct wl1251 *wl = dev_get_drvdata(dev);
+   ssize_t len;
+   int val;
+
+   /* FIXME: what's the maximum length of buf? page size?*/
+   len = 500;
+
+   switch (wl->tx_mgmt_frm_rate) {
+   /* skip 1 and 12 Mbps because they have same value 0x0a */
+   case RATE_2MBPS:
+   val = 20;
+   break;
+   case RATE_5_5MBPS:
+   val = 55;
+   break;
+   case RATE_11MBPS:
+   val = 110;
+   break;
+   case RATE_6MBPS:
+   val = 60;
+   break;
+   case RATE_9MBPS:
+   val = 90;
+   break;
+   case RATE_12MBPS:
+   val = 120;
+   break;
+   case RATE_18MBPS:
+   val = 180;
+   break;
+   case RATE_24MBPS:
+   val = 240;
+   break;
+   case RATE_36MBPS:
+   val = 360;
+   break;
+   case RATE_48MBPS:
+   val = 480;
+   break;
+   case RATE_54MBPS:
+   val = 540;
+   break;
+   default:
+   val = 10;
+   }
+
+   /* for 1 and 12 Mbps we have to check the modulation */
+   if (wl->tx_mgmt_frm_rate == RATE_1MBPS) {
+   switch (wl->tx_mgmt_frm_rate) {
+   case CCK_LONG:
+   val = 10;
+   break;
+   case OFDM:
+   val = 120;
+   break;
+   default:
+   val = 10;
+   break;
+   }
+   }
+   len = snprintf(buf, len, "%d", val);
+
+   return len;
+}
+
+static ssize_t wl1251_sysfs_store_tx_mgmt_frm_rate(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   struct wl1251 *wl = dev_get_drvdata(dev);
+   unsigned long res;
+   int ret;
+
+   ret = strict_strtoul(buf, 10, );
+
+   if (ret < 0) {
+   wl1251_warning("incorrect value written to tx_mgmt_frm_rate");
+   return 0;
+   }
+
+   switch (res) {
+   case 10:
+   wl->tx_mgmt_frm_rate = RATE_1MBPS;
+   wl->tx_mgmt_frm_mod = CCK_LONG;
+   break;
+   case 20:
+   wl->tx_mgmt_frm_rate = RATE_2MBPS;
+   wl->tx_mgmt_frm_mod = CCK_LONG;
+   break;
+   case 55:
+   wl->tx_mgmt_frm_rate = RATE_5_5MBPS;
+   wl->tx_mgmt_frm_mod = CCK_LONG;
+   break;
+   case 110:
+   wl->tx_mgmt_frm_rate = RATE_11MBPS;
+   wl->tx_mgmt_frm_mod = CCK_LONG;
+   break;
+   case 60:
+   wl->tx_mgmt_frm_rate = RATE_6MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 90:
+   wl->tx_mgmt_frm_rate = RATE_9MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 120:
+   wl->tx_mgmt_frm_rate = RATE_12MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 180:
+   wl->tx_mgmt_frm_rate = RATE_18MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 240:
+   wl->tx_mgmt_frm_rate = RATE_24MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 360:
+   wl->tx_mgmt_frm_rate = RATE_36MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 480:
+   wl->tx_mgmt_frm_rate = RATE_48MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   case 540:
+   wl->tx_mgmt_frm_rate = RATE_54MBPS;
+   wl->tx_mgmt_frm_mod = OFDM;
+   break;
+   default:
+   wl1251_warning("incorrect value written to tx_mgmt_frm_rate");
+   return 0;
+   }
+
+   return count;
+}
+
 static ssize_t wl1251_sysfs_show_bt_coex_mode(struct device *dev,
  struct device_attribute *attr,
  char *buf)

[PATCH 00/16] wl1251 patches from linux-n900 tree

2013-10-26 Thread Pali Rohár
Hello, I'm sending wl1251 patches from linux-n900 tree [1] for comments. More
patches come from David's monitor & packet injection work. Patches are tested
with 3.12 rc5 kernel on Nokia N900.

[1] - https://gitorious.org/linux-n900/linux-n900

David Gnedt (13):
  mac80211: fix TX device statistics for monitor interfaces
  wl1251: fix scan behaviour while not associated
  wl1251: add sysfs interface for bluetooth coexistence mode
configuration
  wl1251: retry power save entry
  wl1251: implement hardware ARP filtering
  wl1251: split RX and TX data path initialisation
  wl1251: configure hardware en-/decryption for monitor mode
  wl1251: implement multicast address filtering
  wl1251: disable power saving in monitor mode
  wl1251: fix channel switching in monitor mode
  wl1251: enable tx path in monitor mode if necessary for packet
injection
  wl1251: disable retry and ACK policy for injected packets
  wl1251: enforce changed hw encryption support on monitor state change

Pali Rohár (3):
  wl1251: add nvs file name to module firmware list
  wl1251: Add sysfs file tx_mgmt_frm_rate for setting rate
  wl1251: Add sysfs file address for setting permanent mac address

 drivers/net/wireless/ti/wl1251/acx.c|   97 ++-
 drivers/net/wireless/ti/wl1251/acx.h|   34 ++-
 drivers/net/wireless/ti/wl1251/boot.c   |3 +-
 drivers/net/wireless/ti/wl1251/cmd.c|   50 +++-
 drivers/net/wireless/ti/wl1251/cmd.h|8 +-
 drivers/net/wireless/ti/wl1251/event.c  |   44 +++
 drivers/net/wireless/ti/wl1251/event.h  |7 +
 drivers/net/wireless/ti/wl1251/init.c   |   19 +-
 drivers/net/wireless/ti/wl1251/main.c   |  460 ++-
 drivers/net/wireless/ti/wl1251/rx.c |2 +-
 drivers/net/wireless/ti/wl1251/tx.c |   27 +-
 drivers/net/wireless/ti/wl1251/wl1251.h |   14 +
 net/mac80211/tx.c   |3 +
 13 files changed, 715 insertions(+), 53 deletions(-)

-- 
1.7.10.4

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


Re: [PATCH] media: Add BCM2048 radio driver

2013-10-26 Thread Hans Verkuil
> Hans, so can it be added to drivers/staging/media tree?

Yes, that is an option. It's up to you to decide what you want. Note that
if no cleanup work is done on the staging driver for a long time, then it
can be removed again.

Regards,

Hans

>
> On Thursday 17 October 2013 21:31:04 Pali Rohár wrote:
>> Hello,
>>
>> so what do you suggest? Add it to staging for now (or not)?
>>
>> On Tuesday 15 October 2013 17:08:39 Hans Verkuil wrote:
>> > Hi Pali,
>> >
>> > Thanks for the patch, but I am afraid it will need some work
>> > to make this acceptable for inclusion into the kernel.
>> >
>> > The main thing you need to do is to implement all the
>> > controls using the control framework (see
>> > Documentation/video4linux/v4l2-controls.txt). Most drivers
>> > are by now converted to the control framework, so you will
>> > find many examples of how to do this in drivers/media/radio.
>> >
>> > The sysfs stuff should be replaced by controls as well. A
>> > lot of the RDS support is now available as controls
>> > (although there may well be some missing features, but that
>> > is easy enough to add). Since the RDS data is actually
>> > read() from the device I am not sure whether the RDS
>> > properties/controls should be there at all.
>> >
>> > Finally this driver should probably be split up into two
>> > parts: one v4l2_subdev-based core driver and one platform
>> > driver. See e.g. radio-si4713/si4713-i2c.c as a good
>> > example. But I would wait with that until the rest of the
>> > driver is cleaned up. Then I have a better idea of whether
>> > this is necessary or not.
>> >
>> > It's also very useful to run v4l2-compliance (available in
>> > the v4l-utils.git repo on git.linuxtv.org). That does lots
>> > of sanity checks.
>> >
>> > Another option is to add the driver as-is to
>> > drivers/staging/media, and clean it up bit by bit.
>> >
>> > Regards,
>> >
>> >Hans
>> >
>> > On 10/15/2013 04:26 PM, Pali Rohár wrote:
>> > > This adds support for the BCM2048 radio module found in
>> > > Nokia N900
>> > >
>> > > Signed-off-by: Eero Nurkkala 
>> > > Signed-off-by: Nils Faerber
>> > >  Signed-off-by: Joni
>> > > Lapilainen  Signed-off-by:
>> > > Pali Rohár 
>> > > ---
>> > >
>> > >  drivers/media/radio/Kconfig |   10 +
>> > >  drivers/media/radio/Makefile|1 +
>> > >  drivers/media/radio/radio-bcm2048.c | 2744
>> > >  +++
>> > >  include/media/radio-bcm2048.h   |   30 +
>> > >  4 files changed, 2785 insertions(+)
>> > >  create mode 100644 drivers/media/radio/radio-bcm2048.c
>> > >  create mode 100644 include/media/radio-bcm2048.h
>
> --
> Pali Rohár
> pali.ro...@gmail.com
>


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


Re: [PATCH] media: Add BCM2048 radio driver

2013-10-26 Thread Pali Rohár
Hans, so can it be added to drivers/staging/media tree?

On Thursday 17 October 2013 21:31:04 Pali Rohár wrote:
> Hello,
> 
> so what do you suggest? Add it to staging for now (or not)?
> 
> On Tuesday 15 October 2013 17:08:39 Hans Verkuil wrote:
> > Hi Pali,
> > 
> > Thanks for the patch, but I am afraid it will need some work
> > to make this acceptable for inclusion into the kernel.
> > 
> > The main thing you need to do is to implement all the
> > controls using the control framework (see
> > Documentation/video4linux/v4l2-controls.txt). Most drivers
> > are by now converted to the control framework, so you will
> > find many examples of how to do this in drivers/media/radio.
> > 
> > The sysfs stuff should be replaced by controls as well. A
> > lot of the RDS support is now available as controls
> > (although there may well be some missing features, but that
> > is easy enough to add). Since the RDS data is actually
> > read() from the device I am not sure whether the RDS
> > properties/controls should be there at all.
> > 
> > Finally this driver should probably be split up into two
> > parts: one v4l2_subdev-based core driver and one platform
> > driver. See e.g. radio-si4713/si4713-i2c.c as a good
> > example. But I would wait with that until the rest of the
> > driver is cleaned up. Then I have a better idea of whether
> > this is necessary or not.
> > 
> > It's also very useful to run v4l2-compliance (available in
> > the v4l-utils.git repo on git.linuxtv.org). That does lots
> > of sanity checks.
> > 
> > Another option is to add the driver as-is to
> > drivers/staging/media, and clean it up bit by bit.
> > 
> > Regards,
> > 
> > Hans
> > 
> > On 10/15/2013 04:26 PM, Pali Rohár wrote:
> > > This adds support for the BCM2048 radio module found in
> > > Nokia N900
> > > 
> > > Signed-off-by: Eero Nurkkala 
> > > Signed-off-by: Nils Faerber
> > >  Signed-off-by: Joni
> > > Lapilainen  Signed-off-by:
> > > Pali Rohár 
> > > ---
> > > 
> > >  drivers/media/radio/Kconfig |   10 +
> > >  drivers/media/radio/Makefile|1 +
> > >  drivers/media/radio/radio-bcm2048.c | 2744
> > >  +++
> > >  include/media/radio-bcm2048.h   |   30 +
> > >  4 files changed, 2785 insertions(+)
> > >  create mode 100644 drivers/media/radio/radio-bcm2048.c
> > >  create mode 100644 include/media/radio-bcm2048.h

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: Disabling in-memory write cache for x86-64 in Linux II

2013-10-26 Thread Linus Torvalds
On Sat, Oct 26, 2013 at 4:32 AM, Pavel Machek  wrote:
>
> Hmm, I'd expect the result to be "dead USB key". Putting
> ext3 on cheap flash device normally just kills the devic :-(.

Not my experience. It may be true for some really cheap devices, but
normal USB keys seem to just get really slow, probably due to having
had their flash rewrite algorithm tuned for FAT accesses.

I *do* suspect that to see the really bad behavior, you don't write
just one large file to it, but many smaller ones. "git clone" will
check out all the kernel tree files, obviously.

 Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] atmusb: Fix dynamic_debug macros

2013-10-26 Thread Krzysztof Mazur
On Sat, Oct 26, 2013 at 12:28:56PM -0700, Joe Perches wrote:
> On Sat, 2013-10-26 at 11:55 -0700, Joe Perches wrote:
> > Fix use of atm_dbg to all normal pr_debug not dynamic_pr_debug
> > because dynamic_pr_debug may not be compiled in at all.
> 
> Greg, please don't apply this one.
> I'll resubmit one that actually works.
> 
> (the arg...) should be ...
> 
> > +#define atm_dbg(instance, format, arg...)  \
>  ^ oops.
> 
> > +#define atm_rldbg(instance, format, arg...)
> > \
> > +   pr_debug_ratelimited("ATM dev %d: " format, \
> > +(instance)->atm_dev->number, ##__VA_ARGS__)
> 
> here too.
> 

Yeah, I initially fixed that with changing "##__VAR_ARGS" to "## arg",
but without with "arg..." -> "..." it also compiles and runs correctly.

I tested that only in my configuration - without DEBUG and DYNAMIC_DEBUG
- and compile tested that it with DYNAMIC_DEBUG. If you like you can add:

Tested-by: Krzysztof Mazur 

BTW: the driver is named usbatm, not atmusb.

Thanks,
Krzysiek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] x86/ACPI: Make Sony Vaio Z1 series to use "reboot=pci" default

2013-10-26 Thread Linus Torvalds
On Sat, Oct 26, 2013 at 10:08 AM, Adam Williamson  wrote:
>
> Thanks, I'll give it a shot. Note - I suspect some of the other cases
> may really be delays rather than hangs too. It's very easy to look at
> the screen sitting there doing absolutely nothing at all for 30-60
> seconds, lose patience, conclude it's hung, and force a shutdown/reboot.
> Several of the earlier Z1 reporters on the vaio-z mailing list reported
> it as a 'hang', but after I pointed out that it wasn't, confirmed the
> same behaviour on their systems. This could possibly apply to others
> too.

I agree that a delay of 60s may well be reported as a hang, but at
least for the Dell case I can test, the hang is definitely at least
close to infinite. Definitely longer than a couple of minutes.

So the Sony and Dell issues may be different. That said, vt-d was
suspected for both, and apparently does match your kernel versions, so
it's entirely possible that the fundamental cause is the same even if
the symptoms are slightly different.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages

2013-10-26 Thread Joe Perches
On Sat, 2013-10-26 at 20:01 +0100, Greg Kroah-Hartman wrote:
> On Sat, Oct 26, 2013 at 11:52:02AM -0700, Joe Perches wrote:
> > pr_debug_ratelimited should be coded similar to dev_dbg_ratelimited
> > to reduce the "callbacks suppressed" messages.
> > Signed-off-by: Joe Perches 
> Looks good, I'll queue both of these up soon.

Sorry Greg, hand out the brown paper bag please.

Just ignore these both, I'll resubmit properly tested ones.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] usb-storage: scsiglue: Changing the command result

2013-10-26 Thread Alan Stern
On Sat, 26 Oct 2013, Vishal Annapurve wrote:

> Hi Alan,
> 
> Here is the new patch:
> 
> From: Vishal Annapurve 
> Date: Sat, 26 Oct 2013 21:10:11 +0530
> Subject: [PATCH] usb: storage: Proper cmd result assignment
> 
> This change replaces DID_ABORT with DID_TIMEOUT as a command result
> whenever US_FLIDX_TIMED_OUT bit is set.
> 
> This change is made to bring USB storage inline with a recent change:
> 
> commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8
> 
> [SCSI] Handle disk devices which can not process medium access commands
> We have experienced several devices which fail in a fashion we do not
> currently handle gracefully in SCSI. After a failure these devices will
> respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
> but any command accessing the storage medium will time out.
> 
> As the USB storage was setting command result as aborted rather than
> timed out, SCSI layer was not recognizing the above mentioned failure
> pattern.
> 
> Change-Id: Ic58e2247fed11649f4dbea56382354ba2fe0be1b
> ---
>  drivers/staging/keucr/transport.c   | 6 +++---
>  drivers/staging/keucr/usb.c | 5 +++--

Those two files aren't part of usb-storage; they belong to a different 
driver.  It would be better to have a separate patch for them, and you 
should copy that patch to the driver's maintainer.

>  drivers/usb/storage/cypress_atacb.c | 1 +
>  drivers/usb/storage/isd200.c| 2 +-
>  drivers/usb/storage/transport.c | 8 
>  drivers/usb/storage/usb.c   | 9 +
>  6 files changed, 17 insertions(+), 14 deletions(-)

Otherwise this is okay.  You might also want to submit a third patch 
for the uas driver.

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] atmusb: Fix dynamic_debug macros

2013-10-26 Thread Joe Perches
On Sat, 2013-10-26 at 11:55 -0700, Joe Perches wrote:
> Fix use of atm_dbg to all normal pr_debug not dynamic_pr_debug
> because dynamic_pr_debug may not be compiled in at all.

Greg, please don't apply this one.
I'll resubmit one that actually works.

(the arg...) should be ...

> +#define atm_dbg(instance, format, arg...)\
 ^ oops.

> +#define atm_rldbg(instance, format, arg...)  \
> + pr_debug_ratelimited("ATM dev %d: " format, \
> +  (instance)->atm_dev->number, ##__VA_ARGS__)

here too.


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

2013-10-26 Thread Pali Rohár
On Thursday 24 October 2013 20:41:53 Joe Perches wrote:
> On Fri, 2013-10-18 at 12:30 +0200, Pali Rohár wrote:
> > I rebased patch on top of
> > https://git.kernel.org/cgit/linux/kernel/git/bluetooth/blue
> > tooth-next.git branch master
> 
> Hi Pali, just some trivial notes:
> 
> []
> 
> +static ssize_t hci_h4p_show_bdaddr(struct device *dev,
> 
> > +  struct device_attribute
> > *attr, char *buf) +{
> > +   struct hci_h4p_info *info = dev_get_drvdata(dev);
> > +
> > +   return sprintf(buf,
> > "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", + 
> > info->bd_addr[0], info->bd_addr[1], info->bd_addr[2], +
> >  info->bd_addr[3], info->bd_addr[4],
> > info->bd_addr[5]);
> 
> sprintf(buf, "%pM", info->bd_addr)
> 

"%pM" modifier printing mac address?

> and if this is really bluetooth, does the output need to
> be emitted in reverse order?  ie: %pMR
> 

I'm sure that actual order of above code is correct.
So what to use? "%pM" or "%pMR"?

> []
> 
> > +#define NBT_DBG(fmt, arg...) \
> > +   pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_FW(fmt, arg...) \
> > +   pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_POWER(fmt, arg...) \
> > +   pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_TRANSFER(fmt, arg...) \
> > +   pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_TRANSFER_NF(fmt, arg...) \
> > +   pr_debug(fmt "" , ## arg)
> > +
> > +#define NBT_DBG_DMA(fmt, arg...) \
> > +   pr_debug("%s: " fmt "" , __func__ , ## arg)
> 
> The "" isn't useful.
> 
> dynamic_debugging can add __func__ to each message output
> with +f.
> 
> I think all of these should be converted to pr_debug
> where used or consolidated into a single
> #define nbt_dbg(mask, fmt, ...)   \
> do {  \
>   if (mask & debug)   \
>   pr_debug(fmt, ##__VA_ARGS__);
> } while (0)
> 
> and used like:
>   nbt_dbg(TRANSFER, fmt, etc...);
> where debug is some static.
> 
> Also there are many uses missing "\n" which can
> cause interleaving problems with other printks.
> 
> []
> 
> > +int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int
> > active, +int timeout_ms)
> > +{
> > +   unsigned long timeout;
> > +   int state;
> > +
> > +   timeout = jiffies + msecs_to_jiffies(timeout_ms);
> > +   for (;;) {
> 
>   while (time_before(jiffies, timeout)) {
> 
> > +   state = hci_h4p_inb(info, UART_MSR) &
> > UART_MSR_CTS; +   if (active) {
> > +   if (state)
> > +   return 0;
> > +   } else {
> > +   if (!state)
> > +   return 0;
> > +   }
> > +   if (time_after(jiffies, timeout))
> > +   return -ETIMEDOUT;
> > 
> > +   msleep(1);
> > +   }
> 
>   return -ETIMEDOUT;
> 
> > +}

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Dear Friend.

2013-10-26 Thread mrs maria

Dear Friend.

I am Mrs Maria ,The Head of file Department in Bank Of Africa.I seek your a
ssistance and i assured of your capability to champion this business opport
unity to remit $15 million U.S.A dollars. Into your account if you are inte
rested let me know so that i can send you the details of this transaction. 
I agree that 40% of this money will be for you 10% will be set aside for ex
penses incurred during the business and 50% would be for me. this is the we
bsit http://news.bbc.co.uk/1/hi/world/europe/859479.stm my private email ID
:msmaria...@gmail.com

Regards,
Mrs Maria
call  me +226 65 36 97 57
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages

2013-10-26 Thread Greg Kroah-Hartman
On Sat, Oct 26, 2013 at 11:52:02AM -0700, Joe Perches wrote:
> pr_debug_ratelimited should be coded similar to dev_dbg_ratelimited
> to reduce the "callbacks suppressed" messages.
> 
> Signed-off-by: Joe Perches 

Looks good, I'll queue both of these up soon.

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] atmusb: Fix dynamic_debug macros

2013-10-26 Thread Joe Perches
Fix use of atm_dbg to all normal pr_debug not dynamic_pr_debug
because dynamic_pr_debug may not be compiled in at all.

Signed-off-by: Joe Perches 
---
 drivers/usb/atm/usbatm.h | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h
index 5651231..2104b4b 100644
--- a/drivers/usb/atm/usbatm.h
+++ b/drivers/usb/atm/usbatm.h
@@ -59,13 +59,12 @@
atm_printk(KERN_INFO, instance , format , ## arg)
 #define atm_warn(instance, format, arg...) \
atm_printk(KERN_WARNING, instance , format , ## arg)
-#define atm_dbg(instance, format, arg...)  \
-   dynamic_pr_debug("ATM dev %d: " format ,\
-   (instance)->atm_dev->number , ## arg)
-#define atm_rldbg(instance, format, arg...)\
-   if (printk_ratelimit()) \
-   atm_dbg(instance , format , ## arg)
-
+#define atm_dbg(instance, format, arg...)  \
+   pr_debug("ATM dev %d: " format, \
+(instance)->atm_dev->number, ##__VA_ARGS__)
+#define atm_rldbg(instance, format, arg...)\
+   pr_debug_ratelimited("ATM dev %d: " format, \
+(instance)->atm_dev->number, ##__VA_ARGS__)
 
 /* flags, set by mini-driver in bind() */
 


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


[PATCH] perf tools: Add missing data.h into LIB_H headers

2013-10-26 Thread Jiri Olsa
On Wed, Oct 23, 2013 at 09:34:36AM +0300, Adrian Hunter wrote:
> On 15/10/13 17:27, Jiri Olsa wrote:
> > Adding perf_data_file__open interface to data object
> > to open the perf.data file for both read and write.
> > 
> > Signed-off-by: Jiri Olsa 
> > Cc: Corey Ashford 
> > Cc: Frederic Weisbecker 
> > Cc: Ingo Molnar 
> > Cc: Namhyung Kim 
> > Cc: Paul Mackerras 
> > Cc: Peter Zijlstra 
> > Cc: Arnaldo Carvalho de Melo 
> > Cc: David Ahern 
> > Cc: Adrian Hunter 
> > Cc: Andi Kleen 
> > ---
> >  tools/perf/Makefile.perf|   1 +
> >  tools/perf/builtin-record.c |  34 +
> >  tools/perf/builtin-top.c|   9 +---
> >  tools/perf/util/data.c  | 120 
> > 
> >  tools/perf/util/data.h  |   4 ++
> >  tools/perf/util/session.c   |  95 +++
> >  tools/perf/util/session.h   |   2 +-
> >  7 files changed, 158 insertions(+), 107 deletions(-)
> >  create mode 100644 tools/perf/util/data.c
> > 
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index c873e03..326a26e 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -365,6 +365,7 @@ LIB_OBJS += $(OUTPUT)util/vdso.o
> >  LIB_OBJS += $(OUTPUT)util/stat.o
> >  LIB_OBJS += $(OUTPUT)util/record.o
> >  LIB_OBJS += $(OUTPUT)util/srcline.o
> > +LIB_OBJS += $(OUTPUT)util/data.o
> 
> Also needs:
> 
>   LIB_H += util/data.h
> 

oops, I knew I forgot something.. patch is attached

thanks,
jirka


---
Adding missing data.h into LIB_H headers so the build
could keep up with its changes.

Reported-by: Adrian Hunter 
Signed-off-by: Jiri Olsa 
Cc: Corey Ashford 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Adrian Hunter 
---
 tools/perf/Makefile.perf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8a9ca38..bc7cfa1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -295,6 +295,7 @@ LIB_H += ui/helpline.h
 LIB_H += ui/progress.h
 LIB_H += ui/util.h
 LIB_H += ui/ui.h
+LIB_H += util/data.h
 
 LIB_OBJS += $(OUTPUT)util/abspath.o
 LIB_OBJS += $(OUTPUT)util/alias.o
-- 
1.7.11.7

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


[PATCH] printk: pr_debug_ratelimited: check state first to reduce "callbacks suppressed" messages

2013-10-26 Thread Joe Perches
pr_debug_ratelimited should be coded similar to dev_dbg_ratelimited
to reduce the "callbacks suppressed" messages.

Signed-off-by: Joe Perches 
---
On Sat, 2013-10-26 at 18:37 +0100, Greg Kroah-Hartman wrote:
> On Sat, Oct 26, 2013 at 03:29:56PM +0200, Krzysztof Mazur wrote:
> > Hi,
> > 
> > commit 2d6401cf4ca3861692a4779745e0049cac769d10
> > ("USB: usbatm: move the atm_dbg() call to use dynamic debug")
> > changed the atm_rldbg() to:
> > 
> > #define atm_rldbg(instance, format, arg...) \
> > if (printk_ratelimit()) \
> > atm_dbg(instance , format , ## arg)
> > 
> > and now printk_ratelimit() is always called even when debugging is
> > disabled and a lot of "callbacks suppressed" messages are printed
> > by the printk_ratelimit():
> > 
> > [...]
> > usbatm_rx_process: 4977 callbacks suppressed
> > usbatm_extract_one_cell: 2920 callbacks suppressed
> > [...]
> > 
> > 
> > I'm not sure how to fix that, maybe we need dynamic_pr_debug_ratelimit()?
> 
> How about just deleting the use of that macro entirely?  Odds are it's
> not really needed anymore, right?

 include/linux/printk.h | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a78..449d924 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -343,7 +343,19 @@ extern asmlinkage void dump_stack(void) __cold;
 #endif
 
 /* If you are writing a driver, please use dev_dbg instead */
-#if defined(DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG)
+/* descriptor check is first to prevent flooding with "callbacks suppressed" */
+#define pr_debug_ratelimited(dev, fmt, ...)\
+do {   \
+   static DEFINE_RATELIMIT_STATE(_rs,  \
+ DEFAULT_RATELIMIT_INTERVAL,   \
+ DEFAULT_RATELIMIT_BURST); \
+   DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
+   if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&\
+   __ratelimit(&_rs))  \
+   __dynamic_pr_debug(fmt, ##__VA_ARGS__); \
+} while (0)
+#elif defined(DEBUG)
 #define pr_debug_ratelimited(fmt, ...) \
printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else


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


Re: [PATCH 2/3] fs: nfsd: remove calls to simple_strtoll

2013-10-26 Thread J. Bruce Fields
On Fri, Oct 25, 2013 at 07:33:12PM -0700, Daniel Walker wrote:
> Signed-off-by: Daniel Walker 
> ---
>  fs/nfsd/fault_inject.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c
> index d620e7f..41165f0 100644
> --- a/fs/nfsd/fault_inject.c
> +++ b/fs/nfsd/fault_inject.c
> @@ -125,20 +125,24 @@ static ssize_t fault_inject_write(struct file *file, 
> const char __user *buf,
>   size_t size = min(sizeof(write_buf) - 1, len);
>   struct net *net = current->nsproxy->net_ns;
>   struct sockaddr_storage sa;
> + int ret = -EFAULT;
>   u64 val;
>  
>   if (copy_from_user(write_buf, buf, size))
> - return -EFAULT;
> + return ret;
>   write_buf[size] = '\0';
>  
>   size = rpc_pton(net, write_buf, size, (struct sockaddr *), 
> sizeof(sa));
>   if (size > 0)
>   nfsd_inject_set_client(file_inode(file)->i_private, , size);

If we take this branch, don't we end up returning -EFAULT below?

--b.

>   else {
> - val = simple_strtoll(write_buf, NULL, 0);
> - nfsd_inject_set(file_inode(file)->i_private, val);
> + ret = kstrtoll(write_buf, 0, );
> + if (ret == 0) {
> + nfsd_inject_set(file_inode(file)->i_private, val);
> + ret = len;
> + }
>   }
> - return len; /* on success, claim we got the whole input */
> + return ret; /* on success, claim we got the whole input */
>  }
>  
>  static const struct file_operations fops_nfsd = {
> -- 
> 1.8.3.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] target fixes for v3.12-rc7

2013-10-26 Thread Nicholas A. Bellinger
Hello Linus!

Here are the outstanding target pending fixes for v3.12-rc7.

Please go ahead and pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master

It includes a number of EXTENDED_COPY related fixes as a result of
Thomas and Doug's continuing testing and feedback.

Also included is an important vhost/scsi fix that addresses a long
standing issue where the 'write' parameter for get_user_pages_fast() was
incorrectly set for virtio-scsi WRITEs -> DMA_TO_DEVICE, and not for
virtio-scsi READs -> DMA_FROM_DEVICE.

This resulted in random userspace segfaults and other unpleasantness on
KVM host, and unfortunately has been an issue since the initial merge of
vhost/scsi in v3.6.  This patch is CC'ed to stable, along with two other
less critical items.

Thank you,

--nab

Nicholas Bellinger (7):
  target: Make target_do_xcopy failures return INVALID_PARAMETER_LIST
  target: Allow non zero ListID in EXTENDED_COPY parameter list
  target: Reject EXTENDED_COPY when emulate_3pc is disabled
  target: Add missing XCOPY I/O operation sense_buffer
  target: Generate failure for XCOPY I/O with non-zero scsi_status
  target: Fail XCOPY for non matching source + destination block_size
  vhost/scsi: Fix incorrect usage of get_user_pages_fast write
parameter

Roland Dreier (2):
  target: Fix assignment of LUN in tracepoints
  target: Return an error for WRITE SAME with ANCHOR==1

Vu Pham (1):
  iser-target: check device before dereferencing its variable

Wei Yongjun (1):
  target/pscsi: fix return value check

 drivers/infiniband/ulp/isert/ib_isert.c |2 +-
 drivers/target/target_core_pscsi.c  |8 ++--
 drivers/target/target_core_sbc.c|5 +++
 drivers/target/target_core_xcopy.c  |   53 +-
 drivers/vhost/scsi.c|2 +-
 include/trace/events/target.h   |4 +-
 6 files changed, 50 insertions(+), 24 deletions(-)

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


[PATCH v2] mmc: fix host release issue after discard operation

2013-10-26 Thread Ray Jui
Under function mmc_blk_issue_rq, after an MMC discard operation,
the MMC request data structure may be freed in memory. Later in
the same function, the check of req->cmd_flags & MMC_REQ_SPECIAL_MASK
is dangerous and invalid. It causes the MMC host not to be released
when it should

This patch fixes the issue by marking the special request down before
the discard/flush operation

Reported by: Harold (SoonYeal) Yang 
Signed-off-by: Ray Jui 
Reviewed-by: Seungwon Jeon 
---
 drivers/mmc/card/block.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1a3163f..4e8212c 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1959,6 +1959,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct 
request *req)
struct mmc_card *card = md->queue.card;
struct mmc_host *host = card->host;
unsigned long flags;
+   unsigned int cmd_flags = req ? req->cmd_flags : 0;
 
if (req && !mq->mqrq_prev->req)
/* claim host only for the first request */
@@ -1974,7 +1975,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct 
request *req)
}
 
mq->flags &= ~MMC_QUEUE_NEW_REQUEST;
-   if (req && req->cmd_flags & REQ_DISCARD) {
+   if (cmd_flags & REQ_DISCARD) {
/* complete ongoing async transfer before issuing discard */
if (card->host->areq)
mmc_blk_issue_rw_rq(mq, NULL);
@@ -1983,7 +1984,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct 
request *req)
ret = mmc_blk_issue_secdiscard_rq(mq, req);
else
ret = mmc_blk_issue_discard_rq(mq, req);
-   } else if (req && req->cmd_flags & REQ_FLUSH) {
+   } else if (cmd_flags & REQ_FLUSH) {
/* complete ongoing async transfer before issuing flush */
if (card->host->areq)
mmc_blk_issue_rw_rq(mq, NULL);
@@ -1999,7 +2000,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct 
request *req)
 
 out:
if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) ||
-(req && (req->cmd_flags & MMC_REQ_SPECIAL_MASK)))
+(cmd_flags & MMC_REQ_SPECIAL_MASK))
/*
 * Release host when there are no more requests
 * and after special request(discard, flush) is done.
-- 
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 v3 4/4] perf,x86: add RAPL hrtimer support

2013-10-26 Thread Jiri Olsa
On Sat, Oct 26, 2013 at 07:07:06PM +0200, Stephane Eranian wrote:
> On Fri, Oct 25, 2013 at 7:44 PM, Jiri Olsa  wrote:
> > On Wed, Oct 23, 2013 at 02:58:05PM +0200, Stephane Eranian wrote:

SNIP

> >> + list_for_each_entry(event, >active_list, active_entry) {
> >> + rapl_event_update(event);
> >> + }
> >
> > hi,
> > I dont fully understand the reason for the timer,
> > I'm probably missing something..
> >
> The reason is rather simple and is similar to what happens with uncore.
> The counter are narrow, 32-bit and there is no interrupt capability. We
> need to poll the counters and accumulate in the sw counter to avoid missing
> an overflow.
> 
> > - the timer calls rapl_event_update for all defined events
> 
> No, only for the defined RAPL events which is what we want.

ok, that's what I meant

> 
> > - but rapl_pmu_event_read calls rapl_event_update any time the
> >   event is read (sys_read)
> >
> Yes, but we want to prevent missing a counter overflow. It may happen
> if the counter counts in a unit which increments fast.
> 
> > The rapl_event_update only read msr and updates
> > event->count|hw,prev_count.
> No, it does update the count:
> local64_add(sdelta, >count);

ah, there's the shift that takes care of the
overflowed msr value.. ok

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


Re: [PATCH v3 1/4] perf: add active_entry list head to struct perf_event

2013-10-26 Thread Jiri Olsa
On Sat, Oct 26, 2013 at 06:57:37PM +0200, Stephane Eranian wrote:
> On Fri, Oct 25, 2013 at 4:56 PM, Jiri Olsa  wrote:
> >
> > On Wed, Oct 23, 2013 at 02:58:02PM +0200, Stephane Eranian wrote:
> > > This patch adds a new fields to the struct perf_event.
> > > It is intended to be used to chain events which are
> > > active (enabled). It helps in the hardware layer
> > > for PMU which do not have actual counter restrictions, i.e.,
> > > free running read-only counters. Active events are chained
> > > as opposed to being tracked via the counter they use.
> > >
> > > Signed-off-by: Stephane Eranian 
> > > ---
> > >  include/linux/perf_event.h |1 +
> > >  kernel/events/core.c   |1 +
> > >  2 files changed, 2 insertions(+)
> > >
> > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > > index 2e069d1..a376384 100644
> > > --- a/include/linux/perf_event.h
> > > +++ b/include/linux/perf_event.h
> > > @@ -435,6 +435,7 @@ struct perf_event {
> > >   struct perf_cgroup  *cgrp; /* cgroup event is attach to 
> > > */
> > >   int cgrp_defer_enabled;
> > >  #endif
> > > + struct list_headactive_entry;
> >
> > Could this be in union with 'hlist_entry' ? It looks
> > as 'same purpose' and 'mutualy exclusive stuff.
> >
> You're saying that I could use the hlist_entry field because
> it is currently only used by the sw events in the generic layer.
> But it seems to be a complicated rcu list for the purpose here.

nope, I just meant saving little space like:

union {
struct list_headactive_entry;
struct hlist_node   hlist_entry;
}

just a nitpick

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: usbatm: printk_ratelimit() always called in the atm_rldbg()

2013-10-26 Thread Greg Kroah-Hartman
On Sat, Oct 26, 2013 at 03:29:56PM +0200, Krzysztof Mazur wrote:
> Hi,
> 
> commit 2d6401cf4ca3861692a4779745e0049cac769d10
> ("USB: usbatm: move the atm_dbg() call to use dynamic debug")
> changed the atm_rldbg() to:
> 
> #define atm_rldbg(instance, format, arg...)   \
>   if (printk_ratelimit()) \
>   atm_dbg(instance , format , ## arg)
> 
> and now printk_ratelimit() is always called even when debugging is
> disabled and a lot of "callbacks suppressed" messages are printed
> by the printk_ratelimit():
> 
> [...]
> usbatm_rx_process: 4977 callbacks suppressed
> usbatm_extract_one_cell: 2920 callbacks suppressed
> [...]
> 
> 
> I'm not sure how to fix that, maybe we need dynamic_pr_debug_ratelimit()?

How about just deleting the use of that macro entirely?  Odds are it's
not really needed anymore, right?

thanks,

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


Re: [PATCH 2/2] extcon: arizona: Fix reset of HPDET after race with removal

2013-10-26 Thread Charles Keepax
On Sat, Oct 26, 2013 at 09:29:07AM -0700, Lee Jones wrote:
> What happens if we don't update the bits and we still do magic in the
> new error path? Does that adversely affect any later 'goto done's?

I think best leave this patch for now I should probably rethink
it slightly, as you say I am not sure all the paths through are
correct there.

I will post a new version shortly.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: ARM/kirkwood: v3.12-rc6: kernel BUG at mm/util.c:390!

2013-10-26 Thread Aaro Koskinen
Hi,

On Sat, Oct 26, 2013 at 03:36:17PM +0100, Will Deacon wrote:
> On Thu, Oct 24, 2013 at 09:07:30PM +0100, Aaro Koskinen wrote:
> > [   26.694345] ata2: link is slow to respond, please be patient (ready=0)
> > [   31.194346] ata2: SRST failed (errno=-16)
> > [   31.754426] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
> > [   31.834619] ata2.00: ATA-6: eSATA-2 WD5000AAKX-00ERMA0, 15.01H15, max 
> > UDMA/133
> > [   31.899627] ata2.00: 976773168 sectors, multi 0: LBA48
> > [   31.994458] ata2.00: configured for UDMA/133
> > [   32.075306] [ cut here ]
> > [   32.136256] kernel BUG at mm/util.c:390!
> > [   32.195446] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
> > [   32.255893] Modules linked in:
> > [   32.313109] CPU: 0 PID: 12 Comm: kworker/u2:1 Not tainted 
> > 3.12.0-rc6-openrd-los.git-1836ad9-dirty #3
> > [   32.435821] Workqueue: events_unbound async_run_entry_fn
> > [   32.498701] task: df854700 ti: df8a8000 task.ti: df8a8000
> > [   32.561662] PC is at page_mapping+0x48/0x50
> > [   32.622764] LR is at flush_kernel_dcache_page+0x14/0x98
> > [   32.685421] pc : []lr : []psr: 2093
> > [   32.685421] sp : df8a99f8  ip : df8a9a08  fp : df8a9a04
> > [   32.812754] r10: 6093  r9 : df8a9c24  r8 : 0024
> > [   32.874269] r7 :   r6 : c0a3cd0c  r5 : 1000  r4 : c0e2732c
> > [   32.936395] r3 :   r2 : 0080  r1 : 0564  r0 : c0e2732c
> > [   32.996978] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  
> > Segment kernel
> > [   33.059012] Control: 0005317f  Table: 1a8dc000  DAC: 0017
> > [   33.119473] Process kworker/u2:1 (pid: 12, stack limit = 0xdf8a81c0)
> 
> The BUG is because page_mapping is being given a slab page...
> 
> > [   36.477203] Backtrace:
> > [   36.535603] [] (page_mapping+0x0/0x50) from [] 
> > (flush_kernel_dcache_page+0x14/0x98)
> > [   36.661070] [] (flush_kernel_dcache_page+0x0/0x98) from 
> > [] (sg_miter_stop+0xc8/0x10c)
> > [   36.792813]  r4:df8a9a64 r3:0003
> > [   36.857524] [] (sg_miter_stop+0x0/0x10c) from [] 
> > (sg_miter_next+0x14/0x13c)
> 
> ... assumedly for scatter/gather DMA. How is your block driver allocating
> its buffers? If you're using the DMA API, I can't see how this would happen.

This is sata_mv driver. As far as I understand, it's using DMA API
(dma_pool_alloc() etc.).

I noticed that for some reason CMA has gotten disabled on my
.config. However, enabling both CMA and DMA_CMA will still trigger
this BUG...

A.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] x86/ACPI: Make Sony Vaio Z1 series to use "reboot=pci" default

2013-10-26 Thread Adam Williamson
On Sat, 2013-10-26 at 11:15 +0200, Ingo Molnar wrote:

> So, the best range for the breakage we have is v3.3..v3.5.

So far, yeah. I will try and narrow it down.

> As a blind shot into the dark, that turns out to be a range when a 
> number of irq-remapping, vt-d changes went upstream:
> 
> comet:~/tip> gll v3.3..v3.6 arch/x86 | grep -i remap
> 399988eea194 irq_remap: Fix compiler warning with CONFIG_IRQ_REMAP=y
> 79fec2c557cf Merge tag 'intr-remapping-ops-for-ingo' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu into core/iommu
> 8a8f422d3b4f iommu: rename intr_remapping.[ch] to irq_remapping.[ch]
> 95a02e976c39 iommu: rename intr_remapping references to irq_remapping
> 263b5e8629c9 x86, iommu/vt-d: Clean up interfaces for interrupt remapping
> 5e2b930b0784 iommu/vt-d: Convert MSI remapping setup to remap_ops
> 9d619f657222 iommu/vt-d: Convert free_irte into a remap_ops callback
> 4c1bad6a0af1 iommu/vt-d: Convert IR set_affinity function to remap_ops
> 0c3f173a88c4 iommu/vt-d: Convert IR ioapic-setup to use remap_ops
> 4f3d8b67ad30 iommu/vt-d: Convert missing apic.c intr-remapping call to 
> remap_ops
> 736baef4472d iommu/vt-d: Make intr-remapping initialization generic
> f7219a5300ba x86: Introduce CONFIG_X86_DMA_REMAP
> 
> So if you are able to test current kernels, it might be an 
> additional data point to see whether the reboot delay (which appears 
> to be a reboot hang on other systems) is related to the following 
> kernel option:

Thanks, I'll give it a shot. Note - I suspect some of the other cases
may really be delays rather than hangs too. It's very easy to look at
the screen sitting there doing absolutely nothing at all for 30-60
seconds, lose patience, conclude it's hung, and force a shutdown/reboot.
Several of the earlier Z1 reporters on the vaio-z mailing list reported
it as a 'hang', but after I pointed out that it wasn't, confirmed the
same behaviour on their systems. This could possibly apply to others
too.

>   CONFIG_IRQ_REMAP=y
> 
> (CONFIG_X86_DMA_REMAP is off on Fedora.)
> 
> IRQ_REMAP is somewhat of a dual personality feature, living half in 
> arch/x86/, half in drivers/iommu/. It should normally matter for 
> servers more than for laptops.
> 
> Btw., regarding your encrypted partitions boot problem, do you have 
> any non-encrypted filesystem? If yes then you could copy /[s]bin and 
> /lib to it and boot via init=/bin/bash, you ought to get a minimal 
> shell and be able to run /sbin/reboot.
> 
> Thanks,
> 
>   Ingo
> 

-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net

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


Re: [PATCH v3 4/4] perf,x86: add RAPL hrtimer support

2013-10-26 Thread Stephane Eranian
On Fri, Oct 25, 2013 at 7:44 PM, Jiri Olsa  wrote:
> On Wed, Oct 23, 2013 at 02:58:05PM +0200, Stephane Eranian wrote:
>> The RAPL PMU counters do not interrupt on overflow.
>> Therefore, the kernel needs to poll the counters
>> to avoid missing an overflow. This patch adds
>> the hrtimer code to do this.
>>
>> The timer internval is calculated at boot time
>> based on the power unit used by the HW.
>>
>> Signed-off-by: Stephane Eranian 
>> ---
>>  arch/x86/kernel/cpu/perf_event_intel_rapl.c |   75 
>> +--
>>  1 file changed, 70 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c 
>> b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
>> index 3d71d39..ed0566a 100644
>> --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
>> +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
>> @@ -92,11 +92,13 @@ static struct kobj_attribute format_attr_##_var =
>>  \
>>
>>  struct rapl_pmu {
>>   spinlock_t  lock;
>> - atomic_trefcnt;
>>   int hw_unit;  /* 1/2^hw_unit Joule */
>> - int phys_id;
>> - int n_active; /* number of active events */
>> + struct hrtimer  hrtimer;
>>   struct list_head active_list;
>> + ktime_t timer_interval; /* in ktime_t unit */
>> + int n_active; /* number of active events */
>> + int phys_id;
>> + atomic_trefcnt;
>>  };
>>
>>  static struct pmu rapl_pmu_class;
>> @@ -161,6 +163,47 @@ static u64 rapl_event_update(struct perf_event *event)
>>   return new_raw_count;
>>  }
>>
>> +static void rapl_start_hrtimer(struct rapl_pmu *pmu)
>> +{
>> + __hrtimer_start_range_ns(>hrtimer,
>> + pmu->timer_interval, 0,
>> + HRTIMER_MODE_REL_PINNED, 0);
>> +}
>> +
>> +static void rapl_stop_hrtimer(struct rapl_pmu *pmu)
>> +{
>> + hrtimer_cancel(>hrtimer);
>> +}
>> +
>> +static enum hrtimer_restart rapl_hrtimer_handle(struct hrtimer *hrtimer)
>> +{
>> + struct rapl_pmu *pmu = container_of(hrtimer, struct rapl_pmu, hrtimer);
>> + struct perf_event *event;
>> + unsigned long flags;
>> +
>> + if (!pmu->n_active)
>> + return HRTIMER_NORESTART;
>> +
>> + spin_lock_irqsave(>lock, flags);
>> +
>> + list_for_each_entry(event, >active_list, active_entry) {
>> + rapl_event_update(event);
>> + }
>
> hi,
> I dont fully understand the reason for the timer,
> I'm probably missing something..
>
The reason is rather simple and is similar to what happens with uncore.
The counter are narrow, 32-bit and there is no interrupt capability. We
need to poll the counters and accumulate in the sw counter to avoid missing
an overflow.

> - the timer calls rapl_event_update for all defined events

No, only for the defined RAPL events which is what we want.

> - but rapl_pmu_event_read calls rapl_event_update any time the
>   event is read (sys_read)
>
Yes, but we want to prevent missing a counter overflow. It may happen
if the counter counts in a unit which increments fast.

> The rapl_event_update only read msr and updates
> event->count|hw,prev_count.
No, it does update the count:
local64_add(sdelta, >count);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] perf,x86: add Intel RAPL PMU support

2013-10-26 Thread Stephane Eranian
On Fri, Oct 25, 2013 at 1:14 PM, Jiri Olsa  wrote:
> On Wed, Oct 23, 2013 at 02:58:04PM +0200, Stephane Eranian wrote:
>
> SNIP
>
>> +
>> +static void rapl_init_cpu(int cpu)
>> +{
>> + int i, phys_id = topology_physical_package_id(cpu);
>> +
>> + spin_lock(_hotplug_lock);
>> +
>> + /* check if phys_is is already covered */
>> + for_each_cpu(i, _cpu_mask) {
>> + if (phys_id == topology_physical_package_id(i))
>> + return;
>
> missing 'spin_unlock(_hotplug_lock)' above
>
Good catch. I fixed that now.

>> + }
>> + /* was not found, so add it */
>> + cpumask_set_cpu(cpu, _cpu_mask);
>> +
>> + spin_unlock(_hotplug_lock);
>> +}
>> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Account

2013-10-26 Thread Webamail

Email Account Warning !!!

This mail is from Administrator; we wish to bring to your notice the Condition 
of your email account.
We have just noticed that you have exceeded your email Database limit of 500 MB 
quota and your email IP is causing conflict because it is been accessed in 
different server location. You need to Upgrade and expand your email quota 
limit before you can continue to use your email.Update your email quota limit 
to 2.6 GB, fill up the detail to upgrade your account
{user-name:
{Password:
{Confirm Password:

Failure to do this will result to email deactivation within 24hours
 Thank you for your understanding.

Copyright 2013 Help Desk
Email Upgrade 




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


Re: linux-next: Tree for Oct 25

2013-10-26 Thread Mark Brown
On Fri, Oct 25, 2013 at 03:31:44PM -0700, Randy Dunlap wrote:

> That's unfortunate.  The fixes should be part of the tree IMO.

What Stephen does (which does seem like a good policy) is to keep the
tree at the previous day's version instead of taking a new version if it
introduces breakages on the architectures he tests.  That seems to
strike a good balance between keeping things working for users and
providing pushback to get things fixed before they go to Linus.


signature.asc
Description: Digital signature


Re: [PATCH v3 1/4] perf: add active_entry list head to struct perf_event

2013-10-26 Thread Stephane Eranian
On Fri, Oct 25, 2013 at 4:56 PM, Jiri Olsa  wrote:
>
> On Wed, Oct 23, 2013 at 02:58:02PM +0200, Stephane Eranian wrote:
> > This patch adds a new fields to the struct perf_event.
> > It is intended to be used to chain events which are
> > active (enabled). It helps in the hardware layer
> > for PMU which do not have actual counter restrictions, i.e.,
> > free running read-only counters. Active events are chained
> > as opposed to being tracked via the counter they use.
> >
> > Signed-off-by: Stephane Eranian 
> > ---
> >  include/linux/perf_event.h |1 +
> >  kernel/events/core.c   |1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > index 2e069d1..a376384 100644
> > --- a/include/linux/perf_event.h
> > +++ b/include/linux/perf_event.h
> > @@ -435,6 +435,7 @@ struct perf_event {
> >   struct perf_cgroup  *cgrp; /* cgroup event is attach to */
> >   int cgrp_defer_enabled;
> >  #endif
> > + struct list_headactive_entry;
>
> Could this be in union with 'hlist_entry' ? It looks
> as 'same purpose' and 'mutualy exclusive stuff.
>
You're saying that I could use the hlist_entry field because
it is currently only used by the sw events in the generic layer.
But it seems to be a complicated rcu list for the purpose here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Resend PATCH 5/5] IA64/PCI/ACPI: Rework PCI root bridge ACPI resource conversion

2013-10-26 Thread Lan Tianyu

On 10/24/2013 06:39 AM, Bjorn Helgaas wrote:

[+cc Greg]

On Fri, Oct 18, 2013 at 08:44:12PM +0800, Lan Tianyu wrote:

On 10/18/2013 04:33 AM, Bjorn Helgaas wrote:

On Thu, Oct 17, 2013 at 12:09 AM, Lan Tianyu  wrote:

On 2013年10月17日 07:55, Bjorn Helgaas wrote:

On Fri, Oct 11, 2013 at 08:19:01PM +0800, tianyu@intel.com wrote:



I wonder if it would make sense to make
acpi_dev_resource_address_space() ignore addr.translation_offset for
IO resources.  Or maybe ignore it if the _TTP (type translation) bit
is set?


I wonder why current code doesn't check _TTP? The code in the
add_io_space() seems to think _TTP is always set, right?


I think it's an oversight, and you should fix it.  I suggest that you
ignore the _TRA value when _TTP is set.  Obviously this only applies
to I/O port resources, since _TTP is only defined in the I/O Resource
Flag (Table 6-185 in ACPI 5.0 spec).


_TTP is also defined in the Memory Resource flag, Please have a look at
Table 6-184 in the ACPI 5.0 Spec.

I am not sure how to deal with _TTP unsetting io resource? _TTP 
unsetting mean the resource is IO on the primary side and also IO on the 
secondary side.





Mike, is there any chance you could collect an acpidump from an
rx7620 or similar ia64 system?  In particular, I want to see a
multi-node system where we have several PCI domains, and whether it
sets the _TTP bits.


Greg collected an acpidump from an HP system that uses these I/O port
ranges.  Unfortunately the system wasn't running Linux, so it's an EFI
dump, not the usual one we get from the "pmtools" package.  But I
think it has the information we want.

It's huge, and I put some of the relevant parts of it here:
https://bugzilla.kernel.org/show_bug.cgi?id=63581  Here's a sample
that shows the _TTP bit is set for the I/O aperture:

 Device E000 (\_SB_.N000.E000)
   Name _SEG (\_SB_.N000.E000._SEG)
 0x01
   Name _CRS (\_SB_.N000.E001._CRS)
 Buffer
   0x0092
   ByteList <0x88 0x0d 0x00 0x02 0x0e 0x00 0x00 0x00
 0x00 0x00 0xff 0x00 0x00 0x00 0x00 0x01

 0x8a 0x2b 0x00 0x01 0x0c 0x33 0x00 0x00
 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff
 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 0x00 0xd0 0x00 0x04 0x00 0x00 0x00 0x00
 0x01 0x00 0x00 0x00 0x00 0x00

Byte 0: 0x8a (QWORD address space descriptor)
Byte 3: Resource Type = 0x01 (I/O range)
Byte 5: Type Specific Flags = 0x33 (_TRS, _TTP, _RNG = 3)

   QWORD Address Space Descriptor:
  Type: I/O
  Flags:  Sparse, Translate, ISA I/O addresses, Non-ISA I/O 
addresses
  GRA: 0x
  MIN: 0x  MAX: 0x
  TRA: 0x0400d000  LEN: 0x0001
  MAX address fixed
  MIN address fixed
  Address positively decoded
  Device produces and consumes this resource

Bjorn



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


Re: kprobe: "BUG: unable to handle kernel paging request"

2013-10-26 Thread Azat Khuzhin
On Sat, Oct 26, 2013 at 1:01 AM, Azat Khuzhin  wrote:
> With some kernel's configuration there is such messages in dmesg in
> different places while using kprobes.
>
> I investigated this and founded that it reproduced with
> https://gist.github.com/azat/7078890#file-config-3-12-0-rc5-deb
> And not reproduced with
> https://gist.github.com/azat/7078890#file-config-3-12-0-rc5-worked-kprobe

I reduced difference between this two configs,
and the new one with not worked kprobe is here:
https://gist.github.com/azat/7078890#file-config-3-12-0-rc5-dont-worked-kprobe

The only thing I changed in "make menuconfig" is preemption model,
from CONFIG_PREEMPT_VOLUNTARY(good) to CONFIG_PREEMPT(bad)

U=https://gist.github.com/azat/7078890/raw/
diff -u0 <(curl -s
$U/8268502680c9b1c5924ce6bf45dd08381bc9ddb3/config-3.12.0-rc5%2Bdont-worked-kprobe)
<(curl -s 
$U/b7a9367506fa1c9598f5752c045cff582c3588ba/config-3.12.0-rc5%2Bworked-kprobe)

--- /dev/fd/63  2013-10-26 20:35:00.679801733 +0400
+++ /dev/fd/62  2013-10-26 20:35:00.679801733 +0400
@@ -128,2 +128,2 @@
-CONFIG_TREE_PREEMPT_RCU=y
-CONFIG_PREEMPT_RCU=y
+CONFIG_TREE_RCU=y
+# CONFIG_PREEMPT_RCU is not set
@@ -137 +136,0 @@
-# CONFIG_RCU_BOOST is not set
@@ -224,0 +224 @@
+CONFIG_OPTPROBES=y
@@ -332 +332,5 @@
-CONFIG_UNINLINE_SPIN_UNLOCK=y
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+CONFIG_INLINE_READ_UNLOCK=y
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+CONFIG_INLINE_WRITE_UNLOCK=y
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
@@ -378,2 +382,2 @@
-# CONFIG_PREEMPT_VOLUNTARY is not set
-CONFIG_PREEMPT=y
+CONFIG_PREEMPT_VOLUNTARY=y
+# CONFIG_PREEMPT is not set
@@ -3547,0 +3552 @@
+# CONFIG_DRM_I810 is not set
@@ -5047 +5051,0 @@
-CONFIG_DEBUG_PREEMPT=y
@@ -5075 +5078,0 @@
-# CONFIG_PROVE_RCU_DELAY is not set
@@ -5079 +5081,0 @@
-CONFIG_RCU_CPU_STALL_VERBOSE=y
@@ -5111 +5112,0 @@
-# CONFIG_PREEMPT_TRACER is not set

>
> I used the next script for testing
> https://gist.github.com/azat/7078890#file-ktap-sh
>
> Here is the initial email log with Jovi (ktap author):
> http://www.freelists.org/post/ktap/BUG-unable-to-handle-kernel-paging-request-after-ktap-script-to-trace-SyS-write
>
> If I can help, please let me know!
> Thanks!
>
> --
> Respectfully
> Azat Khuzhin



-- 
Respectfully
Azat Khuzhin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] mfd: wm5110: Enable micd clamp functionality

2013-10-26 Thread Lee Jones
On Sat, 26 Oct 2013, Charles Keepax wrote:

> Add missing registers and interrupts required for the microphone
> detection clamping.
> 
> Signed-off-by: Charles Keepax 
> ---
>  drivers/mfd/wm5110-tables.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] extcon: arizona: Fix reset of HPDET after race with removal

2013-10-26 Thread Lee Jones
On Sat, 26 Oct 2013, Charles Keepax wrote:

> We need to make sure we reset back to our starting state, especially
> making sure that we have disabled poll in the register cache.
> 
> Signed-off-by: Charles Keepax 
> ---
>  drivers/extcon/extcon-arizona.c |   10 +-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 92eb486..3ce7b49 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -572,6 +572,14 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>   goto out;
>   } else if (!ret) {
>   dev_dbg(arizona->dev, "Ignoring HPDET for removed cable\n");
> +
> + /* Reset back to starting range */
> + regmap_update_bits(arizona->regmap,
> +ARIZONA_HEADPHONE_DETECT_1,
> +ARIZONA_HP_IMPEDANCE_RANGE_MASK |
> +ARIZONA_HP_POLL,
> +0);
> +
>   goto done;
>   }
>  
> @@ -607,9 +615,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>   dev_err(arizona->dev, "Failed to report HP/line: %d\n",
>   ret);
>  
> +done:
>   arizona_extcon_do_magic(info, 0);
>  
> -done:
>   if (id_gpio)
>   gpio_set_value_cansleep(id_gpio, 0);
>  

What happens if we don't update the bits and we still do magic in the
new error path? Does that adversely affect any later 'goto done's?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] extcon: arizona: Add defines for microphone detection levels

2013-10-26 Thread Lee Jones
On Sat, 26 Oct 2013, Charles Keepax wrote:

> Improve readability by creating a define for each microphone detection
> level.
> 
> Signed-off-by: Charles Keepax 
> ---
>  drivers/extcon/extcon-arizona.c   |   21 -
>  include/linux/mfd/arizona/registers.h |9 +
>  2 files changed, 25 insertions(+), 5 deletions(-)

I haven't checked the actual 'values' of the new defines, but I assume
you know what you're doing. I like the basic premise of the patch so
I've applied it.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V5 REPOST] mfd: add support for ams AS3722 PMIC

2013-10-26 Thread Lee Jones
Hi Grant,

> > Acked-by: Stephen Warren 
> > Signed-off-by: Laxman Dewangan 
> > Signed-off-by: Florian Lobmaier 
> > Signed-off-by: Lee Jones 



> > +Optional properties:
> > +---
> > +   The input supply of regulators are the optional properties on the
> > +   regulator node. The input supply of these regulators are provided
> > +   through following properties:
> > +   vsup-sd2-supply: Input supply for SD2.
> > +   vsup-sd3-supply: Input supply for SD3.
> > +   vsup-sd4-supply: Input supply for SD4.
> > +   vsup-sd5-supply: Input supply for SD5.
> > +   vin-ldo0-supply: Input supply for LDO0.
> > +   vin-ldo1-6-supply: Input supply for LDO1 and LDO6.
> > +   vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7.
> > +   vin-ldo3-4-supply: Input supply for LDO3 and LDO4.
> > +   vin-ldo9-10-supply: Input supply for LDO9 and LDO10.
> > +   vin-ldo11-supply: Input supply for LDO11.
> 
> What is the data in these properties? The documentation isn't clear.
> 
> In principle, the binding looks okay to me.

The properties to which you refer are standard regulator supply
bindings specified here [1]. Specifically:

  "-supply: phandle to the parent supply/regulator node"

The DT portion has already been Acked by Stephen and applied by me.

[1] Documentation/devicetree/bindings/regulator/regulator.txt

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] x86: unify copy_from_user() size checking

2013-10-26 Thread Guenter Roeck

On 10/26/2013 03:31 AM, Ingo Molnar wrote:


* Jan Beulich  wrote:


Commits 4a3127693001c61a21d1ce680db6340623f52e93 ("x86: Turn the
copy_from_user check into an (optional) compile time warning") and
63312b6a6faae3f2e5577f2b001e3b504f10a2aa ("x86: Add a Kconfig option to
turn the copy_from_user warnings into errors") touched only the 32-bit
variant of copy_from_user(), whereas the original commit
9f0cf4adb6aa0bfccf675c938124e68f7f06349d ("x86: Use
__builtin_object_size() to validate the buffer size for
copy_from_user()") also added the same code to the 64-bit one.

Further the earlier conversion from an inline WARN() to the call to
copy_from_user_overflow() went a little too far: When the number of
bytes to be copied is not a constant (e.g. [looking at 3.11] in
drivers/net/tun.c:__tun_chr_ioctl() or
drivers/pci/pcie/aer/aer_inject.c:aer_inject_write()), the compiler
will always have to keep the funtion call, and hence there will always
be a warning. By using __builtin_constant_p() we can avoid this.

And then this slightly extends the effect of
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS in that apart from converting
warnings to errors in the constant size case, it retains the (possibly
wrong) warnings in the non-constant size case, such that if someone is
prepared to get a few false positives, (s)he'll be able to recover the
current behavior (except that these diagnostics now will never be
converted to errors).

Since the 32-bit variant (intentionally) didn't call might_fault(), the
unification results in this being called twice now. Adding a suitable
#ifdef would be the alternative if that's a problem.


Addressing that sanely would be nice.


I'd like to point out though that with __compiletime_object_size()
being restricted to gcc before 4.6, the whole construct is going to
become more and more pointless going forward. I would question
however that commit 2fb0815c9ee6b9ac50e15dd8360ec76d9fa46a2 ("gcc4:
disable __compiletime_object_size for GCC 4.6+") was really necessary,
and instead this should have been dealt with as is done here from the
beginning.


Can we now revert 2fb0815c9ee6?



I sure don't mind if there is a different and better solution.

Guenter

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


Re: EFI boot problem in 3.11

2013-10-26 Thread Matt Fleming
On Thu, 24 Oct, at 12:14:26PM, Jasper Bryant-Greene wrote:
> I have a box here which is set up for EFI boot with no boot loader.
> 
> The kernel is compiled with a built-in initrd and command line.
> 
> In 3.10 this was all working well. However, after updating to 3.11.5 a
> reboot leads to the EFI firmware boot screen appearing followed by the
> middle section of it going black (just leaving two vertical stripes of
> the EFI firmware boot screen on either side of the screen) and the
> system locking up (numlock etc do not work).
> 
> However, if I hit ‘delete’ quickly when powering on, and enter the
> firmware setup screen, I can then ‘exit without saving’ and the system
> will boot successfully — ‘save and exit’ does not work as that
> performs a full reboot while ‘exit without saving’ seems to continue
> the boot where it left off.
> 
> Due to the aforementioned graphics corruption, I am wondering whether
> it is somehow related to the frame buffer? As this is a production
> system I unfortunately do not have flexibility to try a number of
> kernel versions in-between to locate where the issue was introduced.

Nothing springs to mind and nothing jumps out of the log in
drivers/video or arch/x86/platform/efi.

The best way to figure out what's causing this issue really is to bisect
the kernel versions. What hardware are you running on?

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


Re: [PATCH 12/12] EFI: Runtime services virtual mapping

2013-10-26 Thread Matt Fleming
On Mon, 21 Oct, at 03:37:41PM, Borislav Petkov wrote:
> On Mon, Oct 21, 2013 at 08:47:39PM +0800, Dave Young wrote:
> > What's the status of this series?
> 
> They should appear at some point in Matt's efi-next branch, I think.
> 
> > I need below patch for mapping to fixed virt addr passed
> > from 1st kernel.
> 
> You need this to map the runtime regions in the kexec kernel, right?
> Please write that in the commit message.
> 
> > Would you like to add it to your series or I send out it later?
> 
> Yeah, just add it to your patchset.
> 
> > BTW, what tree should my patches based on? Matt's next tree?
> 
> Yeah, I think efi-next. Matt?

Yes please.

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


RE: [PATCH] usb-storage: scsiglue: Changing the command result

2013-10-26 Thread Vishal Annapurve
Hi Alan,

Here is the new patch:

From: Vishal Annapurve 
Date: Sat, 26 Oct 2013 21:10:11 +0530
Subject: [PATCH] usb: storage: Proper cmd result assignment

This change replaces DID_ABORT with DID_TIMEOUT as a command result
whenever US_FLIDX_TIMED_OUT bit is set.

This change is made to bring USB storage inline with a recent change:

commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8

[SCSI] Handle disk devices which can not process medium access commands
We have experienced several devices which fail in a fashion we do not
currently handle gracefully in SCSI. After a failure these devices will
respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
but any command accessing the storage medium will time out.

As the USB storage was setting command result as aborted rather than
timed out, SCSI layer was not recognizing the above mentioned failure
pattern.

Change-Id: Ic58e2247fed11649f4dbea56382354ba2fe0be1b
---
 drivers/staging/keucr/transport.c   | 6 +++---
 drivers/staging/keucr/usb.c | 5 +++--
 drivers/usb/storage/cypress_atacb.c | 1 +
 drivers/usb/storage/isd200.c| 2 +-
 drivers/usb/storage/transport.c | 8 
 drivers/usb/storage/usb.c   | 9 +
 6 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/keucr/transport.c 
b/drivers/staging/keucr/transport.c
index 1a8837d..ac0e3c2 100644
--- a/drivers/staging/keucr/transport.c
+++ b/drivers/staging/keucr/transport.c
@@ -312,7 +312,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
we need to short-circuit all other processing */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- command was aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
@@ -371,7 +371,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
 
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- auto-sense aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
if (temp_result != USB_STOR_TRANSPORT_GOOD) {
@@ -447,7 +447,7 @@ void ENE_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
we need to short-circuit all other processing */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- command was aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c
index 66aad3a..79405be 100644
--- a/drivers/staging/keucr/usb.c
+++ b/drivers/staging/keucr/usb.c
@@ -200,7 +200,7 @@ static int usb_stor_control_thread(void * __us)
/* has the command timed out *already* ? */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags))
{
-   us->srb->result = DID_ABORT << 16;
+   us->srb->result = DID_TIME_OUT << 16;
goto SkipForAbort;
}
 
@@ -234,7 +234,8 @@ static int usb_stor_control_thread(void * __us)
scsi_lock(host);
 
/* indicate that the command is done */
-   if (us->srb->result != DID_ABORT << 16)
+   if ((us->srb->result != DID_ABORT << 16) &&
+   (us->srb->result != DID_TIME_OUT << 16))
{
us->srb->scsi_done(us->srb);
}
diff --git a/drivers/usb/storage/cypress_atacb.c 
b/drivers/usb/storage/cypress_atacb.c
index c844718..af24894 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -168,6 +168,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
 */
if ((srb->result != (DID_ERROR << 16) &&
srb->result != (DID_ABORT << 16)) &&
+   srb->result != (DID_TIME_OUT << 16) &&
save_cmnd[2] & 0x20) {
struct scsi_eh_save ses;
unsigned char regs[8];
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index ffc4193..28b688b 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -705,7 +705,7 @@ static void isd200_invoke_transport( struct us_data *us,
/* abort processing: the bulk-only transport requires a reset
 * following an abort */
Handle_Abort:
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
 
/* permit the reset transfer to take place */
clear_bit(US_FLIDX_ABORTING, >dflags);
diff --git a/drivers/usb/storage/transport.c 

Re: RIP: mem_cgroup_move_account+0xf4/0x290

2013-10-26 Thread Greg Thelen
On Sat, Oct 26 2013, 含黛 wrote:

> On 10/26/2013 11:39 AM, Johannes Weiner wrote:
>> On Fri, Oct 25, 2013 at 02:15:55PM -0200, Flavio Leitner wrote:
>>> While playing with guests and net-next kernel, I've triggered
>>> this with some frequency.  Even Fedora 19 kernel reproduces.
>>>
>>> It it a known issue?
>>>
>>> Thanks,
>>> fbl
>>>
>>> [ 6790.349763] kvm: zapping shadow pages for mmio generation wraparound
>>> [ 6792.283879] kvm: zapping shadow pages for mmio generation wraparound
>>> [ 7535.654438] perf samples too long (2719 > 2500), lowering 
>>> kernel.perf_event_max_sample_rate to 5
>>> [ 7535.665948] INFO: NMI handler (perf_event_nmi_handler) took too long to 
>>> run: 11.560 msecs
>>> [ 7691.048392] virbr0: port 1(vnet0) entered disabled state
>>> [ 7691.056281] device vnet0 left promiscuous mode
>>> [ 7691.061674] virbr0: port 1(vnet0) entered disabled state
>>> [ 7691.163363] BUG: unable to handle kernel paging request at 
>>> 60fbc0002a20
>>> [ 7691.171145] IP: [] mem_cgroup_move_account+0xf4/0x290
>>> [ 7691.178574] PGD 0
>>> [ 7691.181042] Oops:  [#1] SMP
>>> [ 7691.184761] Modules linked in: vhost_net vhost macvtap macvlan tun veth
>>> openvswitch xt_CHECKSUM nf_conntrack_netbios_ns nf_conntrack_broadcast
>>> ipt_MASQUERADE ip6t_REJECT xt_conntrack ebtable_nat ebtable_broute bridge 
>>> stp
>>> llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6
>>> nf_nat_ipv6 vxlan ip_tunnel gre libcrc32c 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 coretemp kvm_intel snd_hda_codec_realtek
>>> snd_hda_intel nfsd snd_hda_codec kvm auth_rpcgss nfs_acl snd_hwdep lockd
>>> snd_seq snd_seq_device snd_pcm e1000e snd_page_alloc sunrpc snd_timer
>>> crc32c_intel i7core_edac bnx2 shpchp ptp snd iTCO_wdt joydev pps_core
>>> iTCO_vendor_support pcspkr soundcore microcode serio_raw lpc_ich edac_core
>>> mfd_core i2c_i801 acpi_cpufreq hid_logitech_dj nouveau ata_generic pata_acpi
>>> video i2c_algo_bit drm_kms_helper ttm drm mxm_wmi i2c_core pata_marvell wmi
>>> [last unloaded: openvswitch]
>>> [ 7691.285989] CPU: 1 PID: 14 Comm: kworker/1:0 Tainted: G  I  
>>> 3.12.0-rc6-01188-gb45bd46 #1
>>> [ 7691.295779] Hardware name:  /DX58SO, BIOS 
>>> SOX5810J.86A.5599.2012.0529.2218 05/29/2012
>>> [ 7691.306066] Workqueue: events css_killed_work_fn
>>> [ 7691.311303] task: 880429555dc0 ti: 88042957a000 task.ti: 
>>> 88042957a000
>>> [ 7691.319673] RIP: 0010:[]  [] 
>>> mem_cgroup_move_account+0xf4/0x290
>>> [ 7691.329728] RSP: 0018:88042957bcc8  EFLAGS: 00010002
>>> [ 7691.335747] RAX: 0246 RBX: 88042b17bc30 RCX: 
>>> 0004
>>> [ 7691.343720] RDX: 880424cd6000 RSI: 60fbc0002a08 RDI: 
>>> 880424cd622c
>>> [ 7691.351735] RBP: 88042957bd20 R08: 880424cd4000 R09: 
>>> 0001
>>> [ 7691.359751] R10: 0001 R11: 0001 R12: 
>>> ea00103ef0c0
>>> [ 7691.367745] R13: 880424cd6000 R14:  R15: 
>>> 880424cd622c
>>> [ 7691.375738] FS:  () GS:88043fc2() 
>>> knlGS:
>>> [ 7691.384755] CS:  0010 DS:  ES:  CR0: 8005003b
>>> [ 7691.391238] CR2: 60fbc0002a20 CR3: 01c0c000 CR4: 
>>> 27e0
>>> [ 7691.399235] Stack:
>>> [ 7691.401672]  88042957bce8 88042957bce8 81312b6d 
>>> 880424cd4000
>>> [ 7691.409968]  88040001 880424cd6000 ea00103ef0c0 
>>> 880424cd0430
>>> [ 7691.418264]  88042b17bc30 ea00103ef0e0 880424cd6000 
>>> 88042957bda8
>>> [ 7691.426578] Call Trace:
>>> [ 7691.429513]  [] ? list_del+0xd/0x30
>>> [ 7691.435250]  [] mem_cgroup_reparent_charges+0x247/0x460
>>> [ 7691.442874]  [] mem_cgroup_css_offline+0xaf/0x1b0
>>> [ 7691.449942]  [] offline_css+0x27/0x50
>>> [ 7691.455874]  [] css_killed_work_fn+0x2d/0xa0
>>> [ 7691.462466]  [] process_one_work+0x175/0x430
>>> [ 7691.469041]  [] worker_thread+0x11b/0x3a0
>>> [ 7691.475345]  [] ? rescuer_thread+0x340/0x340
>>> [ 7691.481919]  [] kthread+0xc0/0xd0
>>> [ 7691.487478]  [] ? insert_kthread_work+0x40/0x40
>>> [ 7691.494352]  [] ret_from_fork+0x7c/0xb0
>>> [ 7691.500464]  [] ? insert_kthread_work+0x40/0x40
>>> [ 7691.507335] Code: 85 f6 48 8b 55 d0 44 8b 4d c8 4c 8b 45 c0 0f 85 b3 00 
>>> 00
>>> 00 41 8b 4c 24 18 85 c9 0f 88 a6 00 00 00 48 8b b2 30 02 00 00 45 89 ca <4c>
>>> 39 56 18 0f 8c 36 01 00 00 44 89 c9 f7 d9 89 cf 65 48 01 7e
>> This is
>>
>> All code
>> 
>> 0:   85 f6   test   %esi,%esi
>> 2:   48 8b 55 d0 mov-0x30(%rbp),%rdx
>> 6:   44 8b 4d c8 mov-0x38(%rbp),%r9d
>> a:   4c 8b 45 c0 mov-0x40(%rbp),%r8
>> e:   0f 85 b3 00 00 00   jne0xc7
>>14:   41 8b 4c 24 18  mov0x18(%r12),%ecx
>>19:  

Re: blk-mq flush fix

2013-10-26 Thread Christoph Hellwig
I think this variant of the patch from Alexander should fix the issue
in a minimally invasive way.  Longer term I'd prefer to use q->flush_rq
like in the non-mq case by copying over the context and tag information.


diff --git a/block/blk-core.c b/block/blk-core.c
index 3bb9e9f..9677c65 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1102,7 +1102,7 @@ static struct request *blk_old_get_request(struct 
request_queue *q, int rw,
 struct request *blk_get_request(struct request_queue *q, int rw, gfp_t 
gfp_mask)
 {
if (q->mq_ops)
-   return blk_mq_alloc_request(q, rw, gfp_mask);
+   return blk_mq_alloc_request(q, rw, gfp_mask, false);
else
return blk_old_get_request(q, rw, gfp_mask);
 }
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 3e4cc9c..331e627 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -286,7 +286,7 @@ static void mq_flush_work(struct work_struct *work)
 
/* We don't need set REQ_FLUSH_SEQ, it's for consistency */
rq = blk_mq_alloc_request(q, WRITE_FLUSH|REQ_FLUSH_SEQ,
-   __GFP_WAIT|GFP_ATOMIC);
+   __GFP_WAIT|GFP_ATOMIC, true);
rq->cmd_type = REQ_TYPE_FS;
rq->end_io = flush_end_io;
 
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c88c0de..134100d1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -204,14 +204,15 @@ static struct request *blk_mq_alloc_request_pinned(struct 
request_queue *q,
return rq;
 }
 
-struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t 
gfp)
+struct request *blk_mq_alloc_request(struct request_queue *q, int rw,
+   gfp_t gfp, bool reserved)
 {
struct request *rq;
 
if (blk_mq_queue_enter(q))
return NULL;
 
-   rq = blk_mq_alloc_request_pinned(q, rw, gfp, false);
+   rq = blk_mq_alloc_request_pinned(q, rw, gfp, reserved);
blk_mq_put_ctx(rq->mq_ctx);
return rq;
 }
@@ -1286,6 +1287,15 @@ struct request_queue *blk_mq_init_queue(struct 
blk_mq_reg *reg,
reg->queue_depth = BLK_MQ_MAX_DEPTH;
}
 
+   /*
+* Set aside a tag for flush requests.  It will only be used while
+* another flush request is in progress but outside the driver.
+*
+* TODO: only allocate if flushes are supported
+*/
+   reg->queue_depth++;
+   reg->reserved_tags++;
+
if (reg->queue_depth < (reg->reserved_tags + BLK_MQ_TAG_MIN))
return ERR_PTR(-EINVAL);
 
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 158da52..3eb1beb 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -123,7 +123,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool 
from_schedule);
 void blk_mq_run_queues(struct request_queue *q, bool async);
 void blk_mq_free_request(struct request *rq);
 bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
-struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t 
gfp);
+struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t 
gfp, bool reserved);
 struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, 
gfp_t gfp);
 struct request *blk_mq_rq_from_tag(struct request_queue *q, unsigned int tag);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v8] watchdog: Add MOXA ART watchdog driver

2013-10-26 Thread Wim Van Sebroeck
Hi Jonas,

> This patch adds a watchdog driver for the main hardware watchdog timer
> found on MOXA ART SoCs.
> 
> The MOXA ART SoC provides one writable timer register, restarting
> the hardware once it reaches zero. The register is auto decremented
> every APB clock cycle.
> 
> Signed-off-by: Jonas Jensen 

Added to linux-watchdog-next.

Kind regards,
Wim.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] drivers: video: metronomefb: avoid out-of-bounds array access

2013-10-26 Thread Michal Nazarewicz
From: Michal Nazarewicz 

load_waveform function checks whether padding bytes in stuff2a
and stuff2b are all zero, but does so by treating those arrays
as a single longer array.  Since the structure is packed, and
the size sum matches, it all works, but creates some confusion
in the code.

This commit changes the stuff2a and stuff2b arrays into pad1 and
pad2 fields such that they cover the same bytes as the arrays
covered, and changes the check in the load_waveform function so
that the fields are read instead of iterating over an arary.

It also renames the other “stuff” fields to “ignore*” fields to
give them more semantic meaning.

Signed-off-by: Michal Nazarewicz 
---
 drivers/video/metronomefb.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c
index f30150d..44ef8b0 100644
--- a/drivers/video/metronomefb.c
+++ b/drivers/video/metronomefb.c
@@ -126,7 +126,7 @@ static struct fb_var_screeninfo metronomefb_var = {
 
 /* the waveform structure that is coming from userspace firmware */
 struct waveform_hdr {
-   u8 stuff[32];
+   u8 ignore1[32];
 
u8 wmta[3];
u8 fvsn;
@@ -134,13 +134,14 @@ struct waveform_hdr {
u8 luts;
u8 mc;
u8 trc;
-   u8 stuff3;
+   u8 ignore2;
 
u8 endb;
u8 swtb;
-   u8 stuff2a[2];
+   u32 pad1; /* u16 halfof(pad1) */
 
-   u8 stuff2b[3];
+   /* u16 halfof(pad1) */
+   u8 pad2;
u8 wfm_cs;
 } __attribute__ ((packed));
 
@@ -210,11 +211,9 @@ static int load_waveform(u8 *mem, size_t size, int m, int 
t,
}
wfm_hdr->mc += 1;
wfm_hdr->trc += 1;
-   for (i = 0; i < 5; i++) {
-   if (*(wfm_hdr->stuff2a + i) != 0) {
-   dev_err(dev, "Error: unexpected value in padding\n");
-   return -EINVAL;
-   }
+   if (wfm_hdr->pad1 || wfm_hdr->pad2) {
+   dev_err(dev, "Error: unexpected value in padding\n");
+   return -EINVAL;
}
 
/* calculating trn. trn is something used to index into
-- 
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/


Re: [PATCH 1/3] vxlan: silence one build warning

2013-10-26 Thread Stephen Hemminger
On Sat, 26 Oct 2013 15:06:04 +0800
Zhi Yong Wu  wrote:

> On Fri, Oct 25, 2013 at 11:41 PM, Stephen Hemminger
>  wrote:
> > On Fri, 25 Oct 2013 15:49:18 +0800
> > Zhi Yong Wu  wrote:
> >
> >> From: Zhi Yong Wu 
> >>
> >> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
> >> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in 
> >> this function [-Wmaybe-uninitialized]
> >> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
> >>   LD  drivers/net/built-in.o
> >>
> >> Signed-off-by: Zhi Yong Wu 
> >> ---
> >>  drivers/net/vxlan.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> >> index 2ef5b62..e15f1af 100644
> >> --- a/drivers/net/vxlan.c
> >> +++ b/drivers/net/vxlan.c
> >> @@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct 
> >> net *net, __be16 port,
> >>  {
> >>   struct vxlan_net *vn = net_generic(net, vxlan_net_id);
> >>   struct vxlan_sock *vs;
> >> - struct socket *sock;
> >> + struct socket *sock = NULL;
> >>   struct sock *sk;
> >>   int rc = 0;
> >>   unsigned int h;
> >
> > This only happens with certain versions of Gcc which have buggy dependency
> > analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
> > I would rather not fix the warning this way since it risks masking later 
> > bugs if this code ever changes.
> Gcc version is 4.7.2 on my box, this warning took palce.
> # gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> ...
> gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
> 
> 

I dont see it on Debian 7.
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.7.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' 
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs 
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.7 --enable-shared --enable-linker-build-id 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object 
--enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic 
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu 
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-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] kernel/modsign_certificate.S: use real contents instead of macro GLOBAL()

2013-10-26 Thread Chen Gang F T
On 10/26/2013 10:42 AM, Chen Gang wrote:
> On 10/24/2013 11:29 PM, Josh Boyer wrote:
>> On Wed, Oct 23, 2013 at 10:31 PM, Chen Gang  wrote:
>>> For some architectures, tool chain is not smart enough to recognize the
>>> macro with multiple lines (e.g. arc tool chain), and for common ".S"
>>> file, this kind of macro is also rarely used.
>>>
>>> So expand the related contents of macro to let it pass compiling (can
>>> use "arc-elf32-objdump -x" to know about it).
>>>
>>> The related error (allmodconfig for arc):
>>>
>>> LD  init/built-in.o
>>>   kernel/built-in.o: In function `load_module_signing_keys':
>>>   kernel/modsign_pubkey.c:66: undefined reference to 
>>> `modsign_certificate_list'
>>>   kernel/modsign_pubkey.c:71: undefined reference to 
>>> `modsign_certificate_list_end'
>>>   kernel/modsign_pubkey.c:67: undefined reference to 
>>> `modsign_certificate_list_end'
>>>
>>> The related tool chain information:
>>>
>>>   [root@gchenlinux linux-next]# arc-elf32-as -v
>>>   GNU assembler version 2.23.2 (arc-elf32) using BFD version (GNU Binutils) 
>>> 2.23.2
>>>   [root@gchenlinux linux-next]# arc-elf32-ld -v
>>>   GNU ld (GNU Binutils) 2.23.2
>>>   [root@gchenlinux linux-next]# arc-elf32-gcc -v
>>>   Using built-in specs.
>>>   COLLECT_GCC=arc-elf32-gcc
>>>   COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/arc-elf32/4.8.0/lto-wrapper
>>>   Target: arc-elf32
>>>   Configured with: ../gcc/configure --without-header --disable-nls 
>>> --enable-language=c --disable-threads --disable-shared --enable-werror=no 
>>> target_configargs=enable_vtable_verify=yes --target=arc-elf32 
>>> --with-cpu=arc700 : (reconfigured) ../gcc/configure --disable-nls 
>>> --enable-language=c --disable-threads --disable-shared --enable-werror=no 
>>> target_configargs=enable_vtable_verify=yes --target=arc-elf32 
>>> --with-cpu=arc700 : (reconfigured) ../gcc/configure --without-header 
>>> --disable-nls --enable-language=c --disable-threads --disable-shared 
>>> --enable-werror=no target_configargs=enable_vtable_verify=yes 
>>> --target=arc-elf32 --with-cpu=arc700 --disable-multilib 
>>> --with-headers=../newlib/newlib/libc/include
>>>   Thread model: single
>>>   gcc version 4.8.0 (GCC)
>>
>> Is this only an issue with using multi-line macro definitions in .S
>> files?  The practice of using multi-line macro definitions isn't rare.
>>  Look at e.g. include/linux/module.h, and a number of other header
>> files.
>>

> 
> Yes, excluding "arch/*", for all ".S" files, except x86 driver and this
> file, no others use multi-line macro definition, and "arch/arc" don't
> use mulit-line macro definitions, either.
> 

Oh, sorry, what my written is not quite precise, and my real meaning is:
"no others *intend* to use multi-line macro definition in *.S".

> The related search command is:
> 
>   "find | grep -i "\.S$" | grep -v "/arch/"  | grep -v "Documentation" | 
> xargs grep define".
> 
> Hmm... at least, in our case, we need not use the multi-line macro
> definition, if expand it, the total lines will be shrunk, that will
> be more clearer and simpler to source code readers and writers.
> 
> 
>> This seems like a toolchain bug that should be fixable if it works for
>> other architectures.
>>
> 
> Hmm... at least, we are sure the toolchain is not quite smart enough
> (but we can not say it must be a bug).
> 
> 
> So for me, I recommend to apply this patch (maybe the patch comment
> need improvement). It is quite valuable to continue discussing about
> it, but it is not related with whether applying this patch or not.
> 
>> josh
>>
>>
> 
> Thanks.
> 


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


[PATCH] mfd: wm5110: Enable micd clamp functionality

2013-10-26 Thread Charles Keepax
Add missing registers and interrupts required for the microphone
detection clamping.

Signed-off-by: Charles Keepax 
---
 drivers/mfd/wm5110-tables.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index c5c116a..bf8b3b5 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -243,6 +243,12 @@ int wm5110_patch(struct arizona *arizona)
 EXPORT_SYMBOL_GPL(wm5110_patch);
 
 static const struct regmap_irq wm5110_aod_irqs[ARIZONA_NUM_IRQ] = {
+   [ARIZONA_IRQ_MICD_CLAMP_FALL] = {
+   .mask = ARIZONA_MICD_CLAMP_FALL_EINT1
+   },
+   [ARIZONA_IRQ_MICD_CLAMP_RISE] = {
+   .mask = ARIZONA_MICD_CLAMP_RISE_EINT1
+   },
[ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 },
[ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 },
[ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 },
@@ -505,6 +511,7 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x0293, 0x },/* R659   - Accessory Detect Mode 1 */
{ 0x029B, 0x0020 },/* R667   - Headphone Detect 1 */
{ 0x029C, 0x },/* R668   - Headphone Detect 2 */
+   { 0x02A2, 0x },/* R674   - Micd clamp control */
{ 0x02A3, 0x1102 },/* R675   - Mic Detect 1 */
{ 0x02A4, 0x009F },/* R676   - Mic Detect 2 */
{ 0x02A5, 0x },/* R677   - Mic Detect 3 */
@@ -1439,6 +1446,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_ACCESSORY_DETECT_MODE_1:
case ARIZONA_HEADPHONE_DETECT_1:
case ARIZONA_HEADPHONE_DETECT_2:
+   case ARIZONA_MICD_CLAMP_CONTROL:
case ARIZONA_MIC_DETECT_1:
case ARIZONA_MIC_DETECT_2:
case ARIZONA_MIC_DETECT_3:
-- 
1.7.2.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: ARM/kirkwood: v3.12-rc6: kernel BUG at mm/util.c:390!

2013-10-26 Thread Will Deacon
On Thu, Oct 24, 2013 at 09:07:30PM +0100, Aaro Koskinen wrote:
> Hi,

Hello,

[adding Catalin and Simon]

> I was trying to debug kernel crashes on Marvell Kirkwood (openrd)
> when upgrading from GCC 4.7.3 -> GCC 4.8.2. So I enabled most of the
> kernel debug options. However, I noticed that already when compiled with
> GCC 4.7.3 kernel crashes consistently at boot when DEBUG_VM is enabled
> (without it there are no issues with 4.7.3). See below for the boot/crash
> log & kernel config.

Ok, but this doesn't seem to be related to GCC.

[...]

> [   26.694345] ata2: link is slow to respond, please be patient (ready=0)
> [   31.194346] ata2: SRST failed (errno=-16)
> [   31.754426] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
> [   31.834619] ata2.00: ATA-6: eSATA-2 WD5000AAKX-00ERMA0, 15.01H15, max 
> UDMA/133
> [   31.899627] ata2.00: 976773168 sectors, multi 0: LBA48
> [   31.994458] ata2.00: configured for UDMA/133
> [   32.075306] [ cut here ]
> [   32.136256] kernel BUG at mm/util.c:390!
> [   32.195446] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
> [   32.255893] Modules linked in:
> [   32.313109] CPU: 0 PID: 12 Comm: kworker/u2:1 Not tainted 
> 3.12.0-rc6-openrd-los.git-1836ad9-dirty #3
> [   32.435821] Workqueue: events_unbound async_run_entry_fn
> [   32.498701] task: df854700 ti: df8a8000 task.ti: df8a8000
> [   32.561662] PC is at page_mapping+0x48/0x50
> [   32.622764] LR is at flush_kernel_dcache_page+0x14/0x98
> [   32.685421] pc : []lr : []psr: 2093
> [   32.685421] sp : df8a99f8  ip : df8a9a08  fp : df8a9a04
> [   32.812754] r10: 6093  r9 : df8a9c24  r8 : 0024
> [   32.874269] r7 :   r6 : c0a3cd0c  r5 : 1000  r4 : c0e2732c
> [   32.936395] r3 :   r2 : 0080  r1 : 0564  r0 : c0e2732c
> [   32.996978] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment 
> kernel
> [   33.059012] Control: 0005317f  Table: 1a8dc000  DAC: 0017
> [   33.119473] Process kworker/u2:1 (pid: 12, stack limit = 0xdf8a81c0)

The BUG is because page_mapping is being given a slab page...

> [   36.477203] Backtrace:
> [   36.535603] [] (page_mapping+0x0/0x50) from [] 
> (flush_kernel_dcache_page+0x14/0x98)
> [   36.661070] [] (flush_kernel_dcache_page+0x0/0x98) from 
> [] (sg_miter_stop+0xc8/0x10c)
> [   36.792813]  r4:df8a9a64 r3:0003
> [   36.857524] [] (sg_miter_stop+0x0/0x10c) from [] 
> (sg_miter_next+0x14/0x13c)

... assumedly for scatter/gather DMA. How is your block driver allocating
its buffers? If you're using the DMA API, I can't see how this would happen.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/4] perf tools: Fix -g option handling

2013-10-26 Thread Jiri Olsa
On Sat, Oct 26, 2013 at 04:25:32PM +0200, Jiri Olsa wrote:
> hi,
> changing the '-g/-G' options for record/top commands
> to take NO argument and enable unwind method based
> on .perfconfig setup (using FP by default).
> 
> The current -g option parsing moves into the
> '--call-graph' option.

forgot to mention branch:

  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/cc

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


[PATCH 2/4] perf tools: Split -G and --call-graph for top command

2013-10-26 Thread Jiri Olsa
Splitting -G and --call-graph for record command, so we could
use '-G' with no option.

The '-G' option now takes NO argument and enables the configured
unwind method, which is currently the frame pointers method.

It will be possible to configure unwind method via config
file in upcoming patches.

All current '-G' arguments is overtaken by --call-graph option.

NOTE The documentation for top --call-graph option
 was wrongly copied from report command.

Signed-off-by: Jiri Olsa 
Cc: Corey Ashford 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Adrian Hunter 
---
 tools/perf/Documentation/perf-top.txt | 18 +-
 tools/perf/builtin-top.c  | 23 +--
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/tools/perf/Documentation/perf-top.txt 
b/tools/perf/Documentation/perf-top.txt
index c16a09e..d311974 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -143,20 +143,12 @@ Default is to monitor all CPUS.
 --asm-raw::
Show raw instruction encoding of assembly instructions.
 
--G [type,min,order]::
+-G::
+   Enables call-graph (stack chain/backtrace) recording.
+
 --call-graph::
-Display call chains using type, min percent threshold and order.
-   type can be either:
-   - flat: single column, linear exposure of call chains.
-   - graph: use a graph tree, displaying absolute overhead rates.
-   - fractal: like graph, but displays relative rates. Each branch of
-the tree is considered as a new profiled object.
-
-   order can be either:
-   - callee: callee based call graph.
-   - caller: inverted caller based call graph.
-
-   Default: fractal,0.5,callee.
+   Setup and enable call-graph (stack chain/backtrace) recording,
+   implies -g.
 
 --max-stack::
Set the stack depth limit when parsing the callchain, anything
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 04f5bf2..488fec3 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1015,16 +1015,16 @@ out_delete:
 }
 
 static int
-parse_callchain_opt(const struct option *opt, const char *arg, int unset)
+callchain_opt(const struct option *opt, const char *arg, int unset)
 {
-   /*
-* --no-call-graph
-*/
-   if (unset)
-   return 0;
-
symbol_conf.use_callchain = true;
+   return record_callchain_opt(opt, arg, unset);
+}
 
+static int
+parse_callchain_opt(const struct option *opt, const char *arg, int unset)
+{
+   symbol_conf.use_callchain = true;
return record_parse_callchain_opt(opt, arg, unset);
 }
 
@@ -1110,9 +1110,12 @@ int cmd_top(int argc, const char **argv, const char 
*prefix __maybe_unused)
   " abort, in_tx, transaction"),
OPT_BOOLEAN('n', "show-nr-samples", _conf.show_nr_samples,
"Show a column with the number of samples"),
-   OPT_CALLBACK_DEFAULT('G', "call-graph", _opts,
-"mode[,dump_size]", record_callchain_help,
-_callchain_opt, "fp"),
+   OPT_CALLBACK(0, "call-graph", _opts,
+"mode[,dump_size]", record_callchain_help,
+_callchain_opt),
+   OPT_CALLBACK_NOOPT('G', NULL, _opts,
+NULL, "enables call-graph recording",
+_opt),
OPT_INTEGER(0, "max-stack", _stack,
"Set the maximum stack depth when parsing the callchain. "
"Default: " __stringify(PERF_MAX_STACK_DEPTH)),
-- 
1.7.11.7

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


[PATCH 3/4] perf tools: Add call-graph option support into .perfconfig

2013-10-26 Thread Jiri Olsa
Adding call-graph option support into .perfconfig file,
so it's now possible use call-graph option like:

  [top]
call-graph = fp

  [record]
call-graph = dwarf,8192

Above options ONLY setup the unwind method. To enable
perf record/top to actually use it the command line
option -g/-G must be specified.

The --call-graph option overloads .perfconfig setup.

Assuming above configuration:

  $ perf record -g ls
  - enables dwarf unwind with user stack size dump 8192 bytes

  $ perf top -G
  - enables frame pointer unwind

  $ perf record --call-graph=fp ls
  - enables frame pointer unwind

  $ perf top --call-graph=dwarf,4096 ls
  - enables dwarf unwind with user stack size dump 4096 bytes

Signed-off-by: Jiri Olsa 
Cc: Corey Ashford 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Adrian Hunter 
---
 tools/perf/builtin-record.c | 16 
 tools/perf/builtin-top.c| 12 
 tools/perf/perf.h   |  1 +
 tools/perf/util/evsel.c |  2 +-
 4 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 27622bb..f597b9b 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -750,6 +750,8 @@ int record_parse_callchain_opt(const struct option *opt,
struct perf_record_opts *opts = opt->value;
int ret;
 
+   opts->call_graph_enabled = !unset;
+
/* --no-call-graph */
if (unset) {
opts->call_graph = CALLCHAIN_NONE;
@@ -770,6 +772,8 @@ int record_callchain_opt(const struct option *opt,
 {
struct perf_record_opts *opts = opt->value;
 
+   opts->call_graph_enabled = !unset;
+
if (opts->call_graph == CALLCHAIN_NONE)
opts->call_graph = CALLCHAIN_FP;
 
@@ -777,6 +781,16 @@ int record_callchain_opt(const struct option *opt,
return 0;
 }
 
+static int perf_record_config(const char *var, const char *value, void *cb)
+{
+   struct perf_record *rec = cb;
+
+   if (!strcmp(var, "record.call-graph"))
+   return record_parse_callchain(value, >opts);
+
+   return perf_default_config(var, value, cb);
+}
+
 static const char * const record_usage[] = {
"perf record [] []",
"perf record [] --  []",
@@ -905,6 +919,8 @@ int cmd_record(int argc, const char **argv, const char 
*prefix __maybe_unused)
 
rec->evlist = evsel_list;
 
+   perf_config(perf_record_config, rec);
+
argc = parse_options(argc, argv, record_options, record_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc && perf_target__none(>opts.target))
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 488fec3..b326f61 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1028,6 +1028,16 @@ parse_callchain_opt(const struct option *opt, const char 
*arg, int unset)
return record_parse_callchain_opt(opt, arg, unset);
 }
 
+static int perf_top_config(const char *var, const char *value, void *cb)
+{
+   struct perf_top *top = cb;
+
+   if (!strcmp(var, "top.call-graph"))
+   return record_parse_callchain(value, >record_opts);
+
+   return perf_default_config(var, value, cb);
+}
+
 static int
 parse_percent_limit(const struct option *opt, const char *arg,
int unset __maybe_unused)
@@ -1152,6 +1162,8 @@ int cmd_top(int argc, const char **argv, const char 
*prefix __maybe_unused)
if (top.evlist == NULL)
return -ENOMEM;
 
+   perf_config(perf_top_config, );
+
argc = parse_options(argc, argv, options, top_usage, 0);
if (argc)
usage_with_options(top_usage, options);
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index f61c230..c4ed633 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -215,6 +215,7 @@ enum perf_call_graph_mode {
 struct perf_record_opts {
struct perf_target target;
int  call_graph;
+   bool call_graph_enabled;
bool group;
bool inherit_stat;
bool no_delay;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index ec0cc1e..f1ed2ad 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -633,7 +633,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
attr->mmap_data = track;
}
 
-   if (opts->call_graph) {
+   if (opts->call_graph_enabled) {
perf_evsel__set_sample_bit(evsel, CALLCHAIN);
 
if (opts->call_graph == CALLCHAIN_DWARF) {
-- 
1.7.11.7

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


[PATCH 4/4] perf tools: Add readable output for callchain debug

2013-10-26 Thread Jiri Olsa
Adding people readable output for callchain debug,
to get following '-v' output:

  $ perf record -v -g ls
  callchain: type DWARF
  callchain: stack dump size 4096
  ...

Signed-off-by: Jiri Olsa 
Cc: Corey Ashford 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Adrian Hunter 
---
 tools/perf/builtin-record.c | 4 +++-
 tools/perf/perf.h   | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f597b9b..8bdd608 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -736,7 +736,9 @@ int record_parse_callchain(const char *arg, struct 
perf_record_opts *opts)
 
 static void callchain_debug(struct perf_record_opts *opts)
 {
-   pr_debug("callchain: type %d\n", opts->call_graph);
+   static const char *str[CALLCHAIN_MAX] = { "NONE", "FP", "DWARF" };
+
+   pr_debug("callchain: type %s\n", str[opts->call_graph]);
 
if (opts->call_graph == CALLCHAIN_DWARF)
pr_debug("callchain: stack dump size %d\n",
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index c4ed633..e84aeeb 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -209,7 +209,8 @@ void pthread__unblock_sigwinch(void);
 enum perf_call_graph_mode {
CALLCHAIN_NONE,
CALLCHAIN_FP,
-   CALLCHAIN_DWARF
+   CALLCHAIN_DWARF,
+   CALLCHAIN_MAX
 };
 
 struct perf_record_opts {
-- 
1.7.11.7

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


[PATCH 0/4] perf tools: Fix -g option handling

2013-10-26 Thread Jiri Olsa
hi,
changing the '-g/-G' options for record/top commands
to take NO argument and enable unwind method based
on .perfconfig setup (using FP by default).

The current -g option parsing moves into the
'--call-graph' option.

Examples:
  $ cat ~/.perfconfig:
[top]
  call-graph = fp

[record]
  call-graph = dwarf,8192

  $ perf record -g ls
  - enables dwarf unwind with user stack size dump 8192 bytes

  $ perf top -G
  - enables frame pointer unwind

  $ perf record --call-graph=fp ls
  - enables frame pointer unwind

  $ perf top --call-graph=dwarf,4096 ls
  - enables dwarf unwind with user stack size dump 4096 bytes

thanks,
jirka

Cc: Corey Ashford 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Adrian Hunter 
---
Jiri Olsa (4):
  perf tools: Split -g and --call-graph for record command
  perf tools: Split -G and --call-graph for top command
  perf tools: Add call-graph option support into .perfconfig
  perf tools: Add readable output for callchain debug

 tools/perf/Documentation/perf-record.txt |  6 +-
 tools/perf/Documentation/perf-top.txt| 18 +-
 tools/perf/builtin-record.c  | 89 
-
 tools/perf/builtin-top.c | 35 
+--
 tools/perf/perf.h|  4 +++-
 tools/perf/util/callchain.h  |  3 +++
 tools/perf/util/evsel.c  |  2 +-
 7 files changed, 110 insertions(+), 47 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] perf tools: Split -g and --call-graph for record command

2013-10-26 Thread Jiri Olsa
Splitting -g and --call-graph for record command, so we could
use '-g' with no option.

The '-g' option now takes NO argument and enables the configured
unwind method, which is currently the frame pointers method.

It will be possible to configure unwind method via config
file in upcoming patches.

All current '-g' arguments is overtaken by --call-graph option.

Signed-off-by: Jiri Olsa 
Cc: Corey Ashford 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Adrian Hunter 
---
 tools/perf/Documentation/perf-record.txt |  6 ++-
 tools/perf/builtin-record.c  | 71 ++--
 tools/perf/util/callchain.h  |  3 ++
 3 files changed, 58 insertions(+), 22 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index f10ab63..7be62770 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -92,8 +92,12 @@ OPTIONS
size is rounded up to have nearest pages power of two value.
 
 -g::
+   Enables call-graph (stack chain/backtrace) recording.
+
 --call-graph::
-   Do call-graph (stack chain/backtrace) recording.
+   Setup and enable call-graph (stack chain/backtrace) recording,
+   implies -g.
+
 
 -q::
 --quiet::
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ab8d15e..27622bb 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -678,21 +678,12 @@ static int get_stack_size(char *str, unsigned long *_size)
 }
 #endif /* HAVE_LIBUNWIND_SUPPORT */
 
-int record_parse_callchain_opt(const struct option *opt,
-  const char *arg, int unset)
+int record_parse_callchain(const char *arg, struct perf_record_opts *opts)
 {
-   struct perf_record_opts *opts = opt->value;
char *tok, *name, *saveptr = NULL;
char *buf;
int ret = -1;
 
-   /* --no-call-graph */
-   if (unset)
-   return 0;
-
-   /* We specified default option if none is provided. */
-   BUG_ON(!arg);
-
/* We need buffer that we know we can write to. */
buf = malloc(strlen(arg) + 1);
if (!buf)
@@ -730,10 +721,6 @@ int record_parse_callchain_opt(const struct option *opt,
ret = get_stack_size(tok, );
opts->stack_dump_size = size;
}
-
-   if (!ret)
-   pr_debug("callchain: stack dump size %d\n",
-opts->stack_dump_size);
 #endif /* HAVE_LIBUNWIND_SUPPORT */
} else {
pr_err("callchain: Unknown -g option "
@@ -744,13 +731,52 @@ int record_parse_callchain_opt(const struct option *opt,
} while (0);
 
free(buf);
+   return ret;
+}
+
+static void callchain_debug(struct perf_record_opts *opts)
+{
+   pr_debug("callchain: type %d\n", opts->call_graph);
 
+   if (opts->call_graph == CALLCHAIN_DWARF)
+   pr_debug("callchain: stack dump size %d\n",
+opts->stack_dump_size);
+}
+
+int record_parse_callchain_opt(const struct option *opt,
+  const char *arg,
+  int unset)
+{
+   struct perf_record_opts *opts = opt->value;
+   int ret;
+
+   /* --no-call-graph */
+   if (unset) {
+   opts->call_graph = CALLCHAIN_NONE;
+   pr_debug("callchain: disabled\n");
+   return 0;
+   }
+
+   ret = record_parse_callchain(arg, opts);
if (!ret)
-   pr_debug("callchain: type %d\n", opts->call_graph);
+   callchain_debug(opts);
 
return ret;
 }
 
+int record_callchain_opt(const struct option *opt,
+const char *arg __maybe_unused,
+int unset __maybe_unused)
+{
+   struct perf_record_opts *opts = opt->value;
+
+   if (opts->call_graph == CALLCHAIN_NONE)
+   opts->call_graph = CALLCHAIN_FP;
+
+   callchain_debug(opts);
+   return 0;
+}
+
 static const char * const record_usage[] = {
"perf record [] []",
"perf record [] --  []",
@@ -779,12 +805,12 @@ static struct perf_record record = {
},
 };
 
-#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
+#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) 
recording: "
 
 #ifdef HAVE_LIBUNWIND_SUPPORT
-const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
+const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
 #else
-const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
+const char record_callchain_help[] = CALLCHAIN_HELP "fp";
 #endif
 
 /*
@@ -825,9 +851,12 @@ const struct option record_options[] = {
 

[PATCH 1/2] extcon: arizona: Add defines for microphone detection levels

2013-10-26 Thread Charles Keepax
Improve readability by creating a define for each microphone detection
level.

Signed-off-by: Charles Keepax 
---
 drivers/extcon/extcon-arizona.c   |   21 -
 include/linux/mfd/arizona/registers.h |9 +
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index ec9a14e..92eb486 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
+enum {
+   MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+ ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+ ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+ ARIZONA_MICD_LVL_7,
+
+   MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+   MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};
+
 struct arizona_extcon_info {
struct device *dev;
struct arizona *arizona;
@@ -767,7 +778,7 @@ static void arizona_micd_detect(struct work_struct *work)
 
mutex_lock(>lock);
 
-   for (i = 0; i < 10 && !(val & 0x7fc); i++) {
+   for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, );
if (ret != 0) {
dev_err(arizona->dev, "Failed to read MICDET: %d\n", 
ret);
@@ -784,7 +795,7 @@ static void arizona_micd_detect(struct work_struct *work)
}
}
 
-   if (i == 10 && !(val & 0x7fc)) {
+   if (i == 10 && !(val & MICD_LVL_0_TO_8)) {
dev_err(arizona->dev, "Failed to get valid MICDET value\n");
mutex_unlock(>lock);
return;
@@ -798,7 +809,7 @@ static void arizona_micd_detect(struct work_struct *work)
}
 
/* If we got a high impedence we should have a headset, report it. */
-   if (info->detecting && (val & 0x400)) {
+   if (info->detecting && (val & ARIZONA_MICD_LVL_8)) {
arizona_identify_headphone(info);
 
ret = extcon_update_state(>edev,
@@ -827,7 +838,7 @@ static void arizona_micd_detect(struct work_struct *work)
 * plain headphones.  If both polarities report a low
 * impedence then give up and report headphones.
 */
-   if (info->detecting && (val & 0x3f8)) {
+   if (info->detecting && (val & MICD_LVL_1_TO_7)) {
if (info->jack_flips >= info->micd_num_modes * 10) {
dev_dbg(arizona->dev, "Detected HP/line\n");
arizona_identify_headphone(info);
@@ -851,7 +862,7 @@ static void arizona_micd_detect(struct work_struct *work)
 * If we're still detecting and we detect a short then we've
 * got a headphone.  Otherwise it's a button press.
 */
-   if (val & 0x3fc) {
+   if (val & MICD_LVL_0_TO_7) {
if (info->mic) {
dev_dbg(arizona->dev, "Mic button detected\n");
 
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 4706d3d..10d9e70 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -2196,6 +2196,15 @@
 /*
  * R677 (0x2A5) - Mic Detect 3
  */
+#define ARIZONA_MICD_LVL_0   0x0004  /* MICD_LVL - [2] */
+#define ARIZONA_MICD_LVL_1   0x0008  /* MICD_LVL - [3] */
+#define ARIZONA_MICD_LVL_2   0x0010  /* MICD_LVL - [4] */
+#define ARIZONA_MICD_LVL_3   0x0020  /* MICD_LVL - [5] */
+#define ARIZONA_MICD_LVL_4   0x0040  /* MICD_LVL - [6] */
+#define ARIZONA_MICD_LVL_5   0x0080  /* MICD_LVL - [7] */
+#define ARIZONA_MICD_LVL_6   0x0100  /* MICD_LVL - [8] */
+#define ARIZONA_MICD_LVL_7   0x0200  /* MICD_LVL - [9] */
+#define ARIZONA_MICD_LVL_8   0x0400  /* MICD_LVL - [10] */
 #define ARIZONA_MICD_LVL_MASK0x07FC  /* MICD_LVL - [10:2] 
*/
 #define ARIZONA_MICD_LVL_SHIFT2  /* MICD_LVL - [10:2] 
*/
 #define ARIZONA_MICD_LVL_WIDTH9  /* MICD_LVL - [10:2] 
*/
-- 
1.7.2.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/


  1   2   3   4   >