[PATCH] trace: don't use __weak in header files

2015-03-11 Thread Stephen Rothwell
The commit that added a check for this to checkpatch says:

"Using weak declarations can have unintended link defects.  The __weak on
the declaration causes non-weak definitions to become weak."

In this case, when a PowerPC kernel is built with CONFIG_KPROBE_EVENT
but not CONFIG_UPROBE_EVENT, it generates the following warning:

WARNING: 1 bad relocations
c14f2190 R_PPC64_ADDR64uprobes_fetch_type_table

This is fixed by passing the fetch_table arrays to
traceprobe_parse_probe_arg() which also means that they can never be NULL.

Signed-off-by: Stephen Rothwell 
---
 kernel/trace/trace_kprobe.c |  5 +++--
 kernel/trace/trace_probe.c  | 19 +++
 kernel/trace/trace_probe.h  | 10 ++
 kernel/trace/trace_uprobe.c |  5 +++--
 4 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 5edb518be345..e6f9cbf4388d 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -250,7 +250,7 @@ DEFINE_FETCH_symbol(string_size)
 #define fetch_file_offset_string_size  NULL
 
 /* Fetch type information table */
-const struct fetch_type kprobes_fetch_type_table[] = {
+static const struct fetch_type kprobes_fetch_type_table[] = {
/* Special types */
[FETCH_TYPE_STRING] = __ASSIGN_FETCH_TYPE("string", string, string,
sizeof(u32), 1, "__data_loc char[]"),
@@ -760,7 +760,8 @@ static int create_trace_kprobe(int argc, char **argv)
 
/* Parse fetch argument */
ret = traceprobe_parse_probe_arg(arg, >tp.size, parg,
-   is_return, true);
+   is_return, true,
+   kprobes_fetch_type_table);
if (ret) {
pr_info("Parse error at argument[%d]. (%d)\n", i, ret);
goto error;
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index b983b2fd2ca1..1769a81da8a7 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -356,17 +356,14 @@ static int parse_probe_vars(char *arg, const struct 
fetch_type *t,
 
 /* Recursive argument parser */
 static int parse_probe_arg(char *arg, const struct fetch_type *t,
-struct fetch_param *f, bool is_return, bool is_kprobe)
+struct fetch_param *f, bool is_return, bool is_kprobe,
+const struct fetch_type *ftbl)
 {
-   const struct fetch_type *ftbl;
unsigned long param;
long offset;
char *tmp;
int ret = 0;
 
-   ftbl = is_kprobe ? kprobes_fetch_type_table : uprobes_fetch_type_table;
-   BUG_ON(ftbl == NULL);
-
switch (arg[0]) {
case '$':
ret = parse_probe_vars(arg + 1, t, f, is_return, is_kprobe);
@@ -447,7 +444,7 @@ static int parse_probe_arg(char *arg, const struct 
fetch_type *t,
dprm->fetch_size = get_fetch_size_function(t,
dprm->fetch, ftbl);
ret = parse_probe_arg(arg, t2, >orig, is_return,
-   is_kprobe);
+   is_kprobe, ftbl);
if (ret)
kfree(dprm);
else {
@@ -505,15 +502,12 @@ static int __parse_bitfield_probe_arg(const char *bf,
 
 /* String length checking wrapper */
 int traceprobe_parse_probe_arg(char *arg, ssize_t *size,
-   struct probe_arg *parg, bool is_return, bool is_kprobe)
+   struct probe_arg *parg, bool is_return, bool is_kprobe,
+   const struct fetch_type *ftbl)
 {
-   const struct fetch_type *ftbl;
const char *t;
int ret;
 
-   ftbl = is_kprobe ? kprobes_fetch_type_table : uprobes_fetch_type_table;
-   BUG_ON(ftbl == NULL);
-
if (strlen(arg) > MAX_ARGSTR_LEN) {
pr_info("Argument is too long.: %s\n",  arg);
return -ENOSPC;
@@ -535,7 +529,8 @@ int traceprobe_parse_probe_arg(char *arg, ssize_t *size,
}
parg->offset = *size;
*size += parg->type->size;
-   ret = parse_probe_arg(arg, parg->type, >fetch, is_return, 
is_kprobe);
+   ret = parse_probe_arg(arg, parg->type, >fetch, is_return,
+ is_kprobe, ftbl);
 
if (ret >= 0 && t != NULL)
ret = __parse_bitfield_probe_arg(t, parg->type, >fetch);
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 4f815fbce16d..e30f6cce4af6 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -229,13 +229,6 @@ ASSIGN_FETCH_FUNC(file_offset, ftype), 
\
 #define FETCH_TYPE_STRING  0
 #define FETCH_TYPE_STRSIZE 1
 
-/*
- * Fetch type information table.
- * It's 

[PATCH net] virtio-net: correctly delete napi hash

2015-03-11 Thread Jason Wang
We don't delete napi from hash list during module exit. This will
cause the following panic when doing module load and unload:

BUG: unable to handle kernel paging request at 004e0075
IP: [] napi_hash_add+0x6b/0xf0
PGD 3c5d5067 PUD 0
Oops:  [#1] SMP
...
Call Trace:
[] init_vqs+0x107/0x490 [virtio_net]
[] virtnet_probe+0x562/0x791815639d880be [virtio_net]
[] virtio_dev_probe+0x137/0x200
[] driver_probe_device+0x7a/0x250
[] __driver_attach+0x93/0xa0
[] ? __device_attach+0x40/0x40
[] bus_for_each_dev+0x63/0xa0
[] driver_attach+0x19/0x20
[] bus_add_driver+0x170/0x220
[] ? 0xa0a6
[] driver_register+0x5f/0xf0
[] register_virtio_driver+0x1b/0x30
[] virtio_net_driver_init+0x10/0x12 [virtio_net]

This patch fixes this by doing this in virtnet_free_queues(). And also
don't delete napi in virtnet_freeze() since it will call
virtnet_free_queues() which has already did this.

Fixes 91815639d880 ("virtio-net: rx busy polling support")
Cc: Rusty Russell 
Cc: Michael S. Tsirkin 
Signed-off-by: Jason Wang 
---
 drivers/net/virtio_net.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index f1ff366..59b0e97 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1448,8 +1448,10 @@ static void virtnet_free_queues(struct virtnet_info *vi)
 {
int i;
 
-   for (i = 0; i < vi->max_queue_pairs; i++)
+   for (i = 0; i < vi->max_queue_pairs; i++) {
+   napi_hash_del(>rq[i].napi);
netif_napi_del(>rq[i].napi);
+   }
 
kfree(vi->rq);
kfree(vi->sq);
@@ -1948,11 +1950,8 @@ static int virtnet_freeze(struct virtio_device *vdev)
cancel_delayed_work_sync(>refill);
 
if (netif_running(vi->dev)) {
-   for (i = 0; i < vi->max_queue_pairs; i++) {
+   for (i = 0; i < vi->max_queue_pairs; i++)
napi_disable(>rq[i].napi);
-   napi_hash_del(>rq[i].napi);
-   netif_napi_del(>rq[i].napi);
-   }
}
 
remove_vq_common(vi);
-- 
2.1.0

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


Re: [PATCH 02/12] clocksource: Simplify logic around clocksource wrapping safety margins

2015-03-11 Thread Ingo Molnar

* John Stultz  wrote:

> The clocksource logic has a number of places where we try to
> include a safety margin. Most of these are 12% safety margins,
> but they are inconsistently applied and sometimes are applied
> on top of each other.
> 
> Additionally, in the previous patch, we corrected an issue
> where we unintentionally in effect created a 50% safety margin,
> which these 12.5% margins where then added to.
> 
> So to simplify the logic here, this patch removes the various
> 12.5% margins, and consolidates adding the margin in one place:
> clocks_calc_max_nsecs().
> 
> Additionally, Linus prefers a 50% safety margin, as it allows
> bad clock values to be more easily caught. This should really
> have no net effect, due to the corrected issue earlier which
> caused greater then 50% margins to be used w/o issue.

> +++ b/kernel/time/clocksource.c
> @@ -469,6 +469,9 @@ static u32 clocksource_max_adjustment(struct clocksource 
> *cs)
>   * @shift:   cycle to nanosecond divisor (power of two)
>   * @maxadj:  maximum adjustment value to mult (~11%)
>   * @mask:bitmask for two's complement subtraction of non 64 bit counters
> + *
> + * NOTE: This function includes a safety margin of 50%, so that bad clock 
> values
> + * can be detected.
>   */
>  u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask)
>  {

So it would be nice if there was also a comment here explaining the 
'safety margin': what values are checked, what stream of values is 
expected from clocksources, why clocksources can be off, what the core 
clocksource code does with that, what symptoms it can cause, what is 
considered 'normal', what is considered 'abnormal', what happens if a 
'safety margin' is exceeded, etc.

I.e. all the code and all the changelogs talk about 'safety margins' 
in a somewhat circular, self-defining fashion - without there being 
any easily visible place where it's explained from first principles.

Thanks,

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


linux-next: Tree for Mar 12

2015-03-11 Thread Stephen Rothwell
Hi all,

Changes since 20150311:

New tree: extcon

The sound-asoc tree still had its build failure so I used the version from
next-20150306.

Non-merge commits (relative to Linus' tree): 3727
 3627 files changed, 144763 insertions(+), 78727 deletions(-)



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

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

Below is a summary of the state of the merge.

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

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

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

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

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (cca28a5fda5d Merge tag 'for-linus-20150310' of 
git://git.infradead.org/linux-mtd)
Merging fixes/master (b94d525e58dc Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging kbuild-current/rc-fixes (c517d838eb7d Linux 4.0-rc1)
Merging arc-current/for-curr (2ce7598c9a45 Linux 3.17-rc4)
Merging arm-current/fixes (6d021b724481 ARM: dump pgd, pmd and pte states on 
unhandled data abort faults)
Merging m68k-current/for-linus (4436820a98cd m68k/defconfig: Enable Ethernet 
bridging)
Merging metag-fixes/fixes (c2996cb29bfb metag: Fix KSTK_EIP() and KSTK_ESP() 
macros)
Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5)
Merging powerpc-merge/merge (c517d838eb7d Linux 4.0-rc1)
Merging powerpc-merge-mpe/fixes (4ad04e598711 powerpc/iommu: Remove IOMMU 
device references via bus notifier)
Merging sparc/master (53eb2516972b sparc: semtimedop() unreachable due to 
comparison error)
Merging net/master (d578e18ce93f tcp: restore 1.5x per RTT limit to CUBIC cwnd 
growth in congestion avoidance)
Merging ipsec/master (ac37e2515c1a xfrm: release dst_orig in case of error in 
xfrm_lookup())
Merging sound-current/for-linus (b71783a0857e ALSA: control: Add sanity checks 
for user ctl id name string)
Merging pci-current/for-linus (085a68d0010f PCI: xgene: Add register offset to 
config space base address)
Merging wireless-drivers/master (3f1615340ace brcmfmac: Perform bound checking 
on vendor command buffer)
Merging driver-core.current/driver-core-linus (c517d838eb7d Linux 4.0-rc1)
Merging tty.current/tty-linus (7fd6f640f2dd serial: 8250_dw: Fix deadlock in 
LCR workaround)
Merging usb.current/usb-linus (d0167ad2954e Revert "xhci: Clear the host side 
toggle manually when endpoint is 'soft reset'")
Merging usb-gadget-fixes/fixes (2c247804796b Revert "usb: gadget: zero: Add 
support for interrupt EP")
Merging usb-serial-fixes/usb-linus (9eccca084320 Linux 4.0-rc3)
Merging staging.current/staging-linus (1f51d5801859 vt6655: Fix late setting of 
byRFType.)
Merging char-misc.current/char-misc-linus (3d7a8278fdfd Revert "pcmcia: add a 
new resource manager for non ISA systems")
Merging input-current/for-linus (4eb8d6e7e5aa Input: psmouse - disable "palm 
detection" in the focaltech driver)
Merging crypto-current/master (001eabfd54c0 crypto: arm/aes update NEON AES 
module to latest OpenSSL version)
Merging ide/master (f96fe225677b Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging devicetree-current/devicetree/merge (6b1271de3723 of/unittest: Overlays 
with sub-devices tests)
Merging rr-fixes/fixes (f47689345931 lguest: update help text.)
Merging vfio-fixes/for-linus (7c2e211f3c95 vfio-pci: Fix the check on pci 
device type in vfio_pci_probe())
Merging kselftest-fixes/fixes (9eccca084320 Linux 4.0-rc3)
Merging drm-intel-fixes/for-linux-next-fixes (5e4f518959bd drm/i915: Prevent 
TLB error on first execution on SNB)
Merging asm-generic/master (643165c8bbc8 Merge tag 'uaccess_for_upstream' of 
git://git.kernel.org/pub/scm/linux

[Patch 3/3] dt: OF_UNITTEST make dependency broken, fix unittest.c after move

2015-03-11 Thread Frank Rowand
From: Frank Rowand 

Fix an of_unittest.c include path to account for the move of
unittest.c into unittest-data/.

Signed-off-by: Frank Rowand 

---
 drivers/of/unittest-data/unittest.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/of/unittest-data/unittest.c
===
--- a/drivers/of/unittest-data/unittest.c
+++ b/drivers/of/unittest-data/unittest.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 
-#include "of_private.h"
+#include "../of_private.h"
 
 static struct selftest_results {
int passed;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v1 1/2] x86: kconfig: remove X86_UP_IOAPIC

2015-03-11 Thread David Rientjes
On Wed, 11 Mar 2015, Luis R. Rodriguez wrote:

> From: "Luis R. Rodriguez" 
> 
> X86_UP_IOAPIC is a way so that 32-bit UP systems can enable
> X86_IOAPIC. X86_UP_IOAPIC is only as a visible user option if
> you are on a 32-bit system but have X86_UP_APIC enabled. X86_UP_APIC
> will be enabled by force if you have PCI_MSI on 32-bit systems
> now, X86_UP_APIC will now only be user selectable if you didn't
> have PCI_MSI enabled and are also not on a X86_32_NON_STANDARD
> system. Bryan's original patch (refactored commit log in commit
> 38a1dfda) [0] describes that Intel CE, Intel MID and Intel Quark
> are all 32-bit uniprocessor systems with IO-APICs, the code change
> however only *re-enabled* UP_IOAPIC as an *option* when PCI_MSI
> was enabled, but given that:
> 
> 1) enabling X86_IOAPIC is the real end goal here
> 2) enabling X86_IOAPIC only increases the kernel only by 12064 bytes (~12 KiB)
> 3) enabling X86_IOAPIC will in no way slow down your kernel
> 
> Let's make a compromise for 32-bit systems and always enable X86_IOAPIC
> when X86_UP_IOAPIC is enabled as 32-bit systems are not in a state
> of flux and the price for the size is small with no performance impact.
> 
> Using:
> 
> export ARCH=i386
> make allnoconfig
> --> Enabling PCI_MSI
> make localyesconfig
> 
> With X86_IO_APIC:
> mcgrof@ergon ~/linux-next (git::master)$ du -b arch/x86/boot/bzImage
> 734608  arch/x86/boot/bzImage
> 
> Without X86_IO_APIC:
> mcgrof@ergon ~/linux-next (git::master)$ du -b arch/x86/boot/bzImage
> 722544  arch/x86/boot/bzImage
> 

1.6% increase.

> [0] https://lkml.org/lkml/2015/1/22/718
> 
> Cc: David Rientjes 
> Cc: Bjorn Helgaas 
> Cc: Bryan O'Donoghue 
> Cc: Thomas Gleixner 
> Cc: Andy Shevchenko 
> Cc: Thomas Petazzoni 
> Cc: Ingo Molnar 
> Cc: Borislav Petkov 
> Cc: H. Peter Anvin 
> Cc: Jan Beulich 
> Cc: Juergen Gross 
> Cc: linux-...@vger.kernel.org
> Cc: x...@kernel.org
> Signed-off-by: Luis R. Rodriguez 
> ---
>  arch/x86/Kconfig | 15 ++-
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 110f6ae..b17a8ea 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -899,6 +899,7 @@ config X86_UP_APIC
>   bool "Local APIC support on uniprocessors" if !PCI_MSI
>   default PCI_MSI
>   depends on X86_32 && !SMP && !X86_32_NON_STANDARD
> + select X86_IO_APIC
>   ---help---
> A local APIC (Advanced Programmable Interrupt Controller) is an
> integrated interrupt controller in the CPU. If you have a single-CPU
> @@ -909,18 +910,6 @@ config X86_UP_APIC
> performance counters), and the NMI watchdog which detects hard
> lockups.
>  
> -config X86_UP_IOAPIC
> - bool "IO-APIC support on uniprocessors"
> - depends on X86_UP_APIC
> - ---help---
> -   An IO-APIC (I/O Advanced Programmable Interrupt Controller) is an
> -   SMP-capable replacement for PC-style interrupt controllers. Most
> -   SMP systems and many recent uniprocessor systems have one.
> -
> -   If you have a single-CPU system with an IO-APIC, you can say Y here
> -   to use it. If you say Y here even though your machine doesn't have
> -   an IO-APIC, then the kernel will still run with no slowdown at all.
> -
>  config X86_LOCAL_APIC
>   def_bool y
>   depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || 
> PCI_MSI
> @@ -928,7 +917,7 @@ config X86_LOCAL_APIC
>  
>  config X86_IO_APIC
>   def_bool y
> - depends on X86_LOCAL_APIC || X86_UP_IOAPIC
> + depends on X86_LOCAL_APIC
>   select IRQ_DOMAIN
>  
>  config X86_REROUTE_FOR_BROKEN_BOOT_IRQS

I think it would be best to remove the "select" so the "depends" for both 
config options won't diverge in the future.  This should be equivalent, 
right?

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -909,18 +909,6 @@ config X86_UP_APIC
  performance counters), and the NMI watchdog which detects hard
  lockups.
 
-config X86_UP_IOAPIC
-   bool "IO-APIC support on uniprocessors"
-   depends on X86_UP_APIC
-   ---help---
- An IO-APIC (I/O Advanced Programmable Interrupt Controller) is an
- SMP-capable replacement for PC-style interrupt controllers. Most
- SMP systems and many recent uniprocessor systems have one.
-
- If you have a single-CPU system with an IO-APIC, you can say Y here
- to use it. If you say Y here even though your machine doesn't have
- an IO-APIC, then the kernel will still run with no slowdown at all.
-
 config X86_LOCAL_APIC
def_bool y
depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || 
PCI_MSI
@@ -928,7 +916,7 @@ config X86_LOCAL_APIC
 
 config X86_IO_APIC
def_bool y
-   depends on X86_LOCAL_APIC || X86_UP_IOAPIC
+   depends on X86_LOCAL_APIC || X86_UP_APIC
select IRQ_DOMAIN
 
 config X86_REROUTE_FOR_BROKEN_BOOT_IRQS

And 

[Patch 2/3] dt: OF_UNITTEST make dependency broken, move unittest.c

2015-03-11 Thread Frank Rowand
From: Frank Rowand 

Move of_unittest.c into unittest-data/

This is based on v4.0-rc3.

All checkpatch errors are ignored, as this is just a file move.  At least
two of the checkpatch errors appear to be real bugs, to be addressed in
a future patch.

Signed-off-by: Frank Rowand 

---
 drivers/of/unittest-data/unittest.c | 1879 
 drivers/of/unittest.c   | 1879 
 2 files changed, 1879 insertions(+), 1879 deletions(-)

Index: b/drivers/of/unittest-data/unittest.c
===
--- /dev/null
+++ b/drivers/of/unittest-data/unittest.c
@@ -0,0 +1,1879 @@
+/*
+ * Self tests for device tree subsystem
+ */
+
+#define pr_fmt(fmt) "### dt-test ### " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "of_private.h"
+
+static struct selftest_results {
+   int passed;
+   int failed;
+} selftest_results;
+
+#define selftest(result, fmt, ...) ({ \
+   bool failed = !(result); \
+   if (failed) { \
+   selftest_results.failed++; \
+   pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); 
\
+   } else { \
+   selftest_results.passed++; \
+   pr_debug("pass %s():%i\n", __func__, __LINE__); \
+   } \
+   failed; \
+})
+
+static void __init of_selftest_find_node_by_name(void)
+{
+   struct device_node *np;
+   const char *options;
+
+   np = of_find_node_by_path("/testcase-data");
+   selftest(np && !strcmp("/testcase-data", np->full_name),
+   "find /testcase-data failed\n");
+   of_node_put(np);
+
+   /* Test if trailing '/' works */
+   np = of_find_node_by_path("/testcase-data/");
+   selftest(!np, "trailing '/' on /testcase-data/ should fail\n");
+
+   np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
+   selftest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", 
np->full_name),
+   "find /testcase-data/phandle-tests/consumer-a failed\n");
+   of_node_put(np);
+
+   np = of_find_node_by_path("testcase-alias");
+   selftest(np && !strcmp("/testcase-data", np->full_name),
+   "find testcase-alias failed\n");
+   of_node_put(np);
+
+   /* Test if trailing '/' works on aliases */
+   np = of_find_node_by_path("testcase-alias/");
+   selftest(!np, "trailing '/' on testcase-alias/ should fail\n");
+
+   np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
+   selftest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", 
np->full_name),
+   "find testcase-alias/phandle-tests/consumer-a failed\n");
+   of_node_put(np);
+
+   np = of_find_node_by_path("/testcase-data/missing-path");
+   selftest(!np, "non-existent path returned node %s\n", np->full_name);
+   of_node_put(np);
+
+   np = of_find_node_by_path("missing-alias");
+   selftest(!np, "non-existent alias returned node %s\n", np->full_name);
+   of_node_put(np);
+
+   np = of_find_node_by_path("testcase-alias/missing-path");
+   selftest(!np, "non-existent alias with relative path returned node 
%s\n", np->full_name);
+   of_node_put(np);
+
+   np = of_find_node_opts_by_path("/testcase-data:testoption", );
+   selftest(np && !strcmp("testoption", options),
+"option path test failed\n");
+   of_node_put(np);
+
+   np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
+   selftest(np, "NULL option path test failed\n");
+   of_node_put(np);
+
+   np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
+  );
+   selftest(np && !strcmp("testaliasoption", options),
+"option alias path test failed\n");
+   of_node_put(np);
+
+   np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
+   selftest(np, "NULL option alias path test failed\n");
+   of_node_put(np);
+
+   options = "testoption";
+   np = of_find_node_opts_by_path("testcase-alias", );
+   selftest(np && !options, "option clearing test failed\n");
+   of_node_put(np);
+
+   options = "testoption";
+   np = of_find_node_opts_by_path("/", );
+   selftest(np && !options, "option clearing root node test failed\n");
+   of_node_put(np);
+}
+
+static void __init of_selftest_dynamic(void)
+{
+   struct device_node *np;
+   struct property *prop;
+
+   np = of_find_node_by_path("/testcase-data");
+   if (!np) {
+   pr_err("missing testcase data\n");
+   return;
+   }
+
+   /* Array of 4 properties for the purpose of testing */
+   prop = kzalloc(sizeof(*prop) * 4, GFP_KERNEL);
+   if (!prop) {
+

[Patch 1/3] dt: OF_UNITTEST make dependency broken, framework fixes

2015-03-11 Thread Frank Rowand
From: Frank Rowand 

This 3 patch series is not bisectable.  If CONFIG_OF_UNITTEST=y then the kernel
will not build with just patch 1 or just patches 1 and 2 applied.

If CONFIG_OF_UNITTEST=y then a kernel image make will always cause .version to
be incremented, even if there are not source changes.  This is caused by
a lack of dependency tracking and checking for
drivers/of/unittest-data/testcases.dtb.o.  Fixing the problem was made more
complicated by the fact that testcases.dtb.o was linked into ../of_unittest.o.

Patch 1 modifies makefiles to move of_unittest.c into unittest-data/ and
creates missing dependency tracking for testcases.dtb.o.

Patch 2 will move of_unittest.c into unittest-data/

Patch 3 will fix an of_unittest.c include path to account for the move.

Signed-off-by: Frank Rowand 

---
 drivers/of/Makefile   |4 ++--
 drivers/of/unittest-data/Makefile |9 +
 scripts/Makefile.lib  |5 +++--
 3 files changed, 14 insertions(+), 4 deletions(-)

Index: b/drivers/of/Makefile
===
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -6,8 +6,6 @@ obj-$(CONFIG_OF_PROMTREE) += pdt.o
 obj-$(CONFIG_OF_ADDRESS)  += address.o
 obj-$(CONFIG_OF_IRQ)+= irq.o
 obj-$(CONFIG_OF_NET)   += of_net.o
-obj-$(CONFIG_OF_UNITTEST) += of_unittest.o
-of_unittest-objs := unittest.o unittest-data/testcases.dtb.o
 obj-$(CONFIG_OF_MDIO)  += of_mdio.o
 obj-$(CONFIG_OF_PCI)   += of_pci.o
 obj-$(CONFIG_OF_PCI_IRQ)  += of_pci_irq.o
@@ -16,5 +14,7 @@ obj-$(CONFIG_OF_RESERVED_MEM) += of_rese
 obj-$(CONFIG_OF_RESOLVE)  += resolver.o
 obj-$(CONFIG_OF_OVERLAY) += overlay.o
 
+obj-$(CONFIG_OF_UNITTEST) += unittest-data/
+
 CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
 CFLAGS_fdt_address.o = -I$(src)/../../scripts/dtc/libfdt
Index: b/scripts/Makefile.lib
===
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -276,10 +276,11 @@ cmd_dt_S_dtb= 
\
echo '__dtb_$(*F)_end:';\
echo '.global __dtb_$(*F)_end'; \
echo '.balign STRUCT_ALIGNMENT';\
-) > $@
+) > $@ ;\
+   touch $(depfile)
 
 $(obj)/%.dtb.S: $(obj)/%.dtb
-   $(call cmd,dt_S_dtb)
+   $(call if_changed_dep,dt_S_dtb)
 
 quiet_cmd_dtc = DTC $@
 cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
Index: b/drivers/of/unittest-data/Makefile
===
--- /dev/null
+++ b/drivers/of/unittest-data/Makefile
@@ -0,0 +1,9 @@
+
+obj-$(CONFIG_OF_UNITTEST) += of_unittest.o
+of_unittest-objs := unittest.o testcases.dtb.o
+
+targets += testcases.dtb testcases.dtb.S
+
+.SECONDARY: \
+   $(obj)/testcases.dtb.S \
+   $(obj)/testcases.dtb
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] phy: exynos-mipi-video: Fix unbalanced lock on non-regmap path

2015-03-11 Thread Kishon Vijay Abraham I



On Wednesday 11 March 2015 05:36 AM, Axel Lin wrote:

Remove the second lock on non-regmap path.

Fixes: 278270e39efa (phy: exynos-mipi-video: Use spin_lock to protct 
state->regmap rmw operations)
Reported-by: Julia Lawall 
Signed-off-by: Axel Lin 


merged after squashing it with the original patch.

Thanks
Kishon

---
  drivers/phy/phy-exynos-mipi-video.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/phy/phy-exynos-mipi-video.c 
b/drivers/phy/phy-exynos-mipi-video.c
index 8d6d117..df7519a 100644
--- a/drivers/phy/phy-exynos-mipi-video.c
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -75,7 +75,6 @@ static int __set_phy_state(struct exynos_mipi_video_phy 
*state,
} else {
addr = state->regs + EXYNOS_MIPI_PHY_CONTROL(id / 2);

-   spin_lock(>slock);
val = readl(addr);
if (on)
val |= reset;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 18/22] usb: gadget: serial: %pF is only for function pointers

2015-03-11 Thread Scott Wood
On Wed, 2015-03-11 at 23:45 -0500, Felipe Balbi wrote:
> On Wed, Mar 11, 2015 at 10:13:53PM -0500, Scott Wood wrote:
> > Use %pS for actual addresses, otherwise you'll get bad output
> > on arches like ppc64 where %pF expects a function descriptor.
> > 
> > Signed-off-by: Scott Wood 
> > Cc: linux-...@vger.kernel.org
> > Cc: Felipe Balbi 
> > ---
> >  drivers/usb/gadget/function/u_serial.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/gadget/function/u_serial.c 
> > b/drivers/usb/gadget/function/u_serial.c
> > index 491082a..89179ab 100644
> > --- a/drivers/usb/gadget/function/u_serial.c
> > +++ b/drivers/usb/gadget/function/u_serial.c
> > @@ -912,7 +912,7 @@ static int gs_put_char(struct tty_struct *tty, unsigned 
> > char ch)
> > unsigned long   flags;
> > int status;
> >  
> > -   pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %pf\n",
> > +   pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %ps\n",
>  ^
>S ??

%ps is the non-function-pointer version of %pf.  %pS is the
non-function-pointer version of %pF.  I didn't change the capitalization
of any of these -- if that's warranted in some places, it's outside the
scope of this treewide patchset.

-Scott


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/6] new zram statistics reporting scheme

2015-03-11 Thread Sergey Senozhatsky
On (03/12/15 14:11), Minchan Kim wrote:
> I think we don't need CONFIG_ZRAM_OLD_STATS.
> For example, for mem_used_max, we could add pr_warn_once in
> *mem_used_max_show* but not *mem_used_max_store*. so, old users will see
> deprecated message when they try to *read* the vaule old stat while they
> will write new value.
> One or two year later, we could remove mem_used_max_show then everyone
> should read the vaule /sys/block/zram0/mm_stat.
> 
> > 
> > > cat /sys/block/zram/mem_used_max
> > > cat /sys/block/zram/mm_stat | awk friend
> > > 
> > > How about changing only writeable, not readable for duplicated stats
> > > in /sys/block/zram? So, user will have writeable stat to set some
> > > options in /sys/block/zram and readable stat to get some data in
> > > /sys/block/zram/[io|mm]_stat if the stat is duplicated in both.
> > 
> > Sorry, I probably didn't drink enough coffee today, can you please
> > rephrase or give a trivial example?
> 
> Sorry, I was vague. I meant users can read the vaule for
> mem_used_max and mem_limit in two places(ie, /sys/block/zram/
> and /sys/block/zram/mm_stat). If we feel it's handy for user,
> i am not against that. But if there is no reason, I want to
> make /sys/block/zram/ stat write-only if it is possible stat
> like mem_used_max. I guess It's easier rule for user.

in a long term -- yes. duplication must go away. we provide [mm|io]_stat
nodes to do stats show.

so,
-- RW will be downgraded to WO
-- RO will be removed

(I'm talking about those attrs that are currently visible in two
places -- the original per-stat sysfs node and new [mm|io]_stat node).


and this is what CONFIG_ZRAM_OLD_STATS was doing: downgrade of RW to WO,
removal of some RO attrs. but I'd prefer to go with warn once plan and
do this downgrade/removal manually two years later.

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


[RFC PATCH] PCI: Disable MSI/MSI-X only if device is shutdown

2015-03-11 Thread Fam Zheng
If the device doesn't support shutdown, disabling interrupts may cause
trouble. For example, virtio-scsi-pci doesn't implement shutdown, and
after we disable MSI-X, futher notifications from device will be
delivered to IRQ, which is unexpected. This IRQ will not be cleared, and
may prevent us from making progress, by keep triggering interrupts.

Signed-off-by: Fam Zheng 
---
 drivers/pci/pci-driver.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 3cb2210..fb29c96 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -448,10 +448,11 @@ static void pci_device_shutdown(struct device *dev)
 
pm_runtime_resume(dev);
 
-   if (drv && drv->shutdown)
+   if (drv && drv->shutdown) {
drv->shutdown(pci_dev);
-   pci_msi_shutdown(pci_dev);
-   pci_msix_shutdown(pci_dev);
+   pci_msi_shutdown(pci_dev);
+   pci_msix_shutdown(pci_dev);
+   }
 
 #ifdef CONFIG_KEXEC
/*
-- 
1.9.3

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


Re: [PATCH v10 16/21] irqchip: Add GICv2 specific ACPI boot support

2015-03-11 Thread Jason Cooper
On Thu, Mar 12, 2015 at 09:46:39AM +0800, Hanjun Guo wrote:
> On 2015/3/12 7:11, Jason Cooper wrote:
> > Hey Grant,
> >
> > On Wed, Mar 11, 2015 at 06:04:50PM +, Grant Likely wrote:
> >> On 11 Mar 2015 12:42, "Hanjun Guo"  wrote:
> >>> From: Tomasz Nowicki 
> >>>
> >>> ACPI kernel uses MADT table for proper GIC initialization. It needs to
> >>> parse GIC related subtables, collect CPU interface and distributor
> >>> addresses and call driver initialization function (which is hardware
> >>> abstraction agnostic). In a similar way, FDT initialize GICv1/2.
> >>>
> >>> NOTE: This commit allow to initialize GICv1/2 basic functionality.
> >>> While now simple GICv2 init call is used, any further GIC features
> >>> require generic infrastructure for proper ACPI irqchip initialization.
> >>> That mechanism and stacked irqdomains to support GICv2 MSI/virtualization
> >>> extension, GICv3/4 and its ITS are considered as next steps.
> >>>
> >>> CC: Jason Cooper 
> >>> CC: Marc Zyngier 
> >>> CC: Thomas Gleixner 
> >> BTW, Thomas is taking a bit of a break, do he is unlikely to give an ack
> >> here in a timely manner. I've not heard from Jason. Personally, I think we
> >> can proceed without their ack if everything else is in order (heck, I used
> >> to help with the irq subsystem, use me as an ack of you want). The patch is
> >> low impact and only had effect for ARM ACPI builds.
> > I'm not talking much, but I am tracking and collecting everything for 
> > irqchip.
> > We do have some other changes in this driver this time around.  So it'd be 
> > nice
> > if I could take this.
> >
> > I had reached out to Olof for his thoughts on this and he hasn't had enough
> > cycles to look at it.  iirc, Marc reviewed a previous version and was happy 
> > with
> > the changes.  My only question I had for Olof I'll put below:
> 
> Please allow me to explain a little bit before Olof's confirmation, please 
> don't mind if
> any offended.

I'm not sure I parse this correctly, but fwiw, I'm not easily offended.  :-)

> >>> diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
> >>> index 0fe2f71..afd1af3 100644
> >>> --- a/drivers/irqchip/irqchip.c
> >>> +++ b/drivers/irqchip/irqchip.c
> >>> @@ -8,6 +8,7 @@
> >>>   * warranty of any kind, whether express or implied.
> >>>   */
> >>>
> >>> +#include 
> >>>  #include 
> >>>  #include 
> >>>  #include 
> >>> @@ -26,4 +27,6 @@ extern struct of_device_id __irqchip_of_table[];
> >>>  void __init irqchip_init(void)
> >>>  {
> >>> of_irq_init(__irqchip_of_table);
> >>> +
> >>> +   acpi_irq_init();
> >>>  }
> > Is this in line with Olof's idea that providing a dtb would override ACPI?
> 
> Yes, it will. Since ACPI is default OFF (disabled), if a dtb provided, and no 
> acpi=force
> passed in the early command line, dtb will be used as system configuration for
> boot (dtb is always the prior one for now) [1]. In acpi_gic_init() which 
> called by
> acpi_irq_init(), it will return immediately if acpi disabled, so it will not 
> parse
> any ACPI table for device configuration.

Ok, that matches my recollection.  Thanks for refreshing my memory.  I'll apply
this on a topic branch for irqchip/gic when I return from travel.  Most likely
Friday or over the weekend.

thx,

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


Re: [PATCH] mm/memory hotplog: postpone the reset of obsolete pgdat

2015-03-11 Thread David Rientjes
On Thu, 12 Mar 2015, Gu Zheng wrote:

> Qiu Xishi reported the following BUG when testing hot-add/hot-remove node 
> under
> stress condition.
> [ 1422.011064] BUG: unable to handle kernel paging request at 00025f60
> [ 1422.011086] IP: [] next_online_pgdat+0x1/0x50
> [ 1422.011178] PGD 0
> [ 1422.011180] Oops:  [#1] SMP
> [ 1422.011409] ACPI: Device does not support D3cold
> [ 1422.011961] Modules linked in: fuse nls_iso8859_1 nls_cp437 vfat fat loop 
> dm_mod coretemp mperf crc32c_intel ghash_clmulni_intel aesni_intel 
> ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 pcspkr microcode igb 
> dca i2c_algo_bit ipv6 megaraid_sas iTCO_wdt i2c_i801 i2c_core 
> iTCO_vendor_support tg3 sg hwmon ptp lpc_ich pps_core mfd_core acpi_pad 
> rtc_cmos button ext3 jbd mbcache sd_mod crc_t10dif scsi_dh_alua scsi_dh_rdac 
> scsi_dh_hp_sw scsi_dh_emc scsi_dh ahci libahci libata scsi_mod [last 
> unloaded: rasf]
> [ 1422.012006] CPU: 23 PID: 238 Comm: kworker/23:1 Tainted: G   O 
> 3.10.15-5885-euler0302 #1
> [ 1422.012024] Hardware name: HUAWEI TECHNOLOGIES CO.,LTD. Huawei N1/Huawei 
> N1, BIOS V100R001 03/02/2015
> [ 1422.012065] Workqueue: events vmstat_update
> [ 1422.012084] task: a800d32c ti: a800d32ae000 task.ti: 
> a800d32ae000
> [ 1422.012165] RIP: 0010:[]  [] 
> next_online_pgdat+0x1/0x50
> [ 1422.012205] RSP: 0018:a800d32afce8  EFLAGS: 00010286
> [ 1422.012225] RAX: 1440 RBX: 81da53b8 RCX: 
> 0082
> [ 1422.012226] RDX:  RSI: 0082 RDI: 
> 
> [ 1422.012254] RBP: a800d32afd28 R08: 81c93bfc R09: 
> 81cbdc96
> [ 1422.012272] R10: 40ec R11: 00a0 R12: 
> a800fffb3440
> [ 1422.012290] R13: a800d32afd38 R14: 0017 R15: 
> a800e6616800
> [ 1422.012292] FS:  () GS:a800e660() 
> knlGS:
> [ 1422.012314] CS:  0010 DS:  ES:  CR0: 80050033
> [ 1422.012328] CR2: 00025f60 CR3: 01a0b000 CR4: 
> 001407e0
> [ 1422.012328] DR0:  DR1:  DR2: 
> 
> [ 1422.012328] DR3:  DR6: fffe0ff0 DR7: 
> 0400
> [ 1422.012328] Stack:
> [ 1422.012328]  a800d32afd28 81126ca5 a800 
> 814b4314
> [ 1422.012328]  a800d32ae010  a800e6616180 
> a800fffb3440
> [ 1422.012328]  a800d32afde8 81128220 0013 
> 0038
> [ 1422.012328] Call Trace:
> [ 1422.012328]  [] ? next_zone+0xc5/0x150
> [ 1422.012328]  [] ? __schedule+0x544/0x780
> [ 1422.012328]  [] refresh_cpu_vm_stats+0xd0/0x140

So refresh_cpu_vm_stats() is doing for_each_populated_zone(), which calls 
next_zone(), and we've iterated over all zones for a particular node.  We 
call next_online_pgdat() with the pgdat of the previous zone's 
zone->zone_pgdat, and that explodes on dereference, right?

I have to ask because 3.10 is an ancient kernel, a more recent example for 
the changelog would be helpful if it's reproducible.

> [ 1422.012328]  [] vmstat_update+0x11/0x50
> [ 1422.012328]  [] process_one_work+0x194/0x3d0
> [ 1422.012328]  [] worker_thread+0x12b/0x410
> [ 1422.012328]  [] ? manage_workers+0x1a0/0x1a0
> [ 1422.012328]  [] kthread+0xc6/0xd0
> [ 1422.012328]  [] ? kthread_freezable_should_stop+0x70/0x70
> [ 1422.012328]  [] ret_from_fork+0x7c/0xb0
> [ 1422.012328]  [] ? kthread_freezable_should_stop+0x70/0x70
> 
> The cause is the "memset(pgdat, 0, sizeof(*pgdat))" at the end of 
> try_offline_node,
> which will reset the all content of pgdat to 0, as the pgdat is accessed 
> lock-lee,
> so that the users still using the pgdat will panic, such as the vmstat_update 
> routine.
> 

Correct me if I'm wrong, but it's not accessing pgdat at all, it's 
accessing zone->zone_pgdat->node_id and zone->zone_pgdat is invalid.  I 
don't _think_ there's anything different with 3.10, but I'd be happy to be 
shown wrong.

> So the solution here is postponing the reset of obsolete pgdat from 
> try_offline_node()
> to hotadd_new_pgdat(), and just resetting pgdat->nr_zones and 
> pgdat->classzone_idx to
> be 0 rather than the memset 0 to avoid breaking pointer information in pgdat.
> 

I don't see how memset(pgdat, 0, sizeof(*pgdat)) can cause the error 
above, can you be more specific?  

> Reported-by: Xishi Qiu 
> Suggested-by: KAMEZAWA Hiroyuki 
> Cc: 
> Signed-off-by: Gu Zheng 
> ---
>  mm/memory_hotplug.c |   13 -
>  1 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 9fab107..65842d6 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1092,6 +1092,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 
> start)
>   return NULL;
>  
>   arch_refresh_nodedata(nid, pgdat);
> + } else {
> + /* Reset the nr_zones and 

Re: [PATCH 0/6] new zram statistics reporting scheme

2015-03-11 Thread Minchan Kim
On Thu, Mar 12, 2015 at 11:16:09AM +0900, Sergey Senozhatsky wrote:
> On (03/12/15 10:55), Minchan Kim wrote:
> > I really appreciate you enhance stat functions, esp, working with iostat!
> 
> thanks! my pleasure.
> 
> > One thing I want to discuss is sometime we could remove RO fields
> > in /sys/block/zram/ but we couldn't remove RW fields because
> > io_stat/mm_stat doesn't have any writable option now so users will
> > have two options to read stat. For exmaple,
> 
> I played with CONFIG_ZRAM_OLD_STATS option, which turns RW attrs into
> WO attrs (where possible/needed). but it turned out to be a rather
> ugly patch and I eventually decided that I don't want to have these
> #ifdef-s in zram code for the next two years. so providing both RW/RO
> old stats (with a warning in the logs) and RO [mm|io]_stat sound like
> a better plan.

I think we don't need CONFIG_ZRAM_OLD_STATS.
For example, for mem_used_max, we could add pr_warn_once in
*mem_used_max_show* but not *mem_used_max_store*. so, old users will see
deprecated message when they try to *read* the vaule old stat while they
will write new value.
One or two year later, we could remove mem_used_max_show then everyone
should read the vaule /sys/block/zram0/mm_stat.

> 
> > cat /sys/block/zram/mem_used_max
> > cat /sys/block/zram/mm_stat | awk friend
> > 
> > How about changing only writeable, not readable for duplicated stats
> > in /sys/block/zram? So, user will have writeable stat to set some
> > options in /sys/block/zram and readable stat to get some data in
> > /sys/block/zram/[io|mm]_stat if the stat is duplicated in both.
> 
> Sorry, I probably didn't drink enough coffee today, can you please
> rephrase or give a trivial example?

Sorry, I was vague. I meant users can read the vaule for
mem_used_max and mem_limit in two places(ie, /sys/block/zram/
and /sys/block/zram/mm_stat). If we feel it's handy for user,
i am not against that. But if there is no reason, I want to
make /sys/block/zram/ stat write-only if it is possible stat
like mem_used_max. I guess It's easier rule for user.


> 
>   -ss

-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/6] new zram statistics reporting scheme

2015-03-11 Thread Sergey Senozhatsky
On (03/12/15 11:16), Sergey Senozhatsky wrote:
> > cat /sys/block/zram/mem_used_max
> > cat /sys/block/zram/mm_stat | awk friend
> > 
> > How about changing only writeable, not readable for duplicated stats
> > in /sys/block/zram? So, user will have writeable stat to set some
> > options in /sys/block/zram and readable stat to get some data in
> > /sys/block/zram/[io|mm]_stat if the stat is duplicated in both.
> 

did you mean:

-- attrs that are currently RW will eventually turn into WO. attr show()
   will be done by [mm|io]_stat file.

-- attrs that are currently RO will be removed. attr show() will be
   done by [mm|io]_stat file.

?

so, iow, rather than removing all duplicated attrs we remove only RO attrs
and keep previously RW attrs in write-only mode.

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


Re: [alsa-devel] [PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver

2015-03-11 Thread Inha Song
Hi, Chanwoo,

Thanks for your comments.

On Thu, 12 Mar 2015 13:33:49 +0900
Chanwoo Choi  wrote:

> Hi Inha,
> 
> On 03/12/2015 11:49 AM, Inha Song wrote:
> > Previously, When we use wm8994 codec, we should control its MCLK in machine 
> > driver.
> > But, It should be managed by wm8994 codec driver, not machine driver.
> > 
> > This patch add MCLK clock DT parsing logic and control own MCLK.
> > 
> > Signed-off-by: Inha Song 
> > ---
> >  sound/soc/codecs/wm8994.c | 27 ++-
> >  sound/soc/codecs/wm8994.h |  1 +
> >  2 files changed, 27 insertions(+), 1 deletion(-)
> > 
> > diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
> > index 247b390..d80dcc6 100644
> > --- a/sound/soc/codecs/wm8994.c
> > +++ b/sound/soc/codecs/wm8994.c
> > @@ -16,6 +16,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec 
> > *codec,
> >  {
> > struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
> > struct wm8994 *control = wm8994->wm8994;
> > +   int i;
> >  
> > wm_hubs_set_bias_level(codec, level);
> >  
> > @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct 
> > snd_soc_codec *codec,
> > break;
> > }
> >  
> > -   if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
> > +   if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
> > +   for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> > +   if (!IS_ERR(wm8994->clk_mclk[i]))
> > +   clk_prepare_enable(wm8994->clk_mclk[i]);
> 
> I think that you don't need to check error by using 'if' statement.
> clk_prepare_enable() function will check the NULL state of clk instance
> before preparing and enabling the clock. 

So that, I can handle it more concisely. Thanks, I will fix this.

> 
>   for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++)
>   clk_prepare_enable(wm8994->clk_mclk[i]);
> 
> But, wm8994_probe() have to initialize the NULL for wm8994->clk_mclk[i].
> I added the comment about this on below.
> 
> > +   }
> > active_reference(codec);
> > +   } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) {
> > +   for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> > +   if (!IS_ERR(wm8994->clk_mclk[i]))
> > +   clk_disable_unprepare(
> > +   wm8994->clk_mclk[i]);

ditto

> > +   }
> > +   }
> > break;
> >  
> > case SND_SOC_BIAS_STANDBY:
> > @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver 
> > soc_codec_dev_wm8994 = {
> >  static int wm8994_probe(struct platform_device *pdev)
> >  {
> > struct wm8994_priv *wm8994;
> > +   int i;
> >  
> > wm8994 = devm_kzalloc(>dev, sizeof(struct wm8994_priv),
> >   GFP_KERNEL);
> > @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev)
> >  
> > wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent);
> >  
> > +   for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> > +   char mclk_name[] = "MCLKx";
> > +
> > +   snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1);
> > +
> > +   wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name);
> > +   if (IS_ERR(wm8994->clk_mclk[i]))
> > +   if (PTR_ERR(wm8994->clk_mclk) == -EPROBE_DEFER)
> > +   return -EPROBE_DEFER;
> 
> I think you better to modify exception handling as following:
> 
>   if (IS_ERR(wm8994->clk_mclk[i])) {
>   wm8994->clk_mclk[i] = NULL;
>   return PTR_ERR(wm8994->clk_mclk);

I will fix. (MCLK is optional properties in wm8994)

if (IS_ERR(wm8994->clk_mclk[i]))
wm8994->clk_mclk[i] = NULL;

Best Regards,
Inha Song.

>   }
> 
> > +   }
> > +
> > pm_runtime_enable(>dev);
> > pm_runtime_idle(>dev);
> >  
> > diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h
> > index 6536f8d..8cf06a4 100644
> > --- a/sound/soc/codecs/wm8994.h
> > +++ b/sound/soc/codecs/wm8994.h
> > @@ -78,6 +78,7 @@ struct wm8994_priv {
> > int sysclk[2];
> > int sysclk_rate[2];
> > int mclk[2];
> > +   struct clk *clk_mclk[2];
> > int aifclk[2];
> > int aifdiv[2];
> > int channels[2];
> > 
> 
> Thanks,
> Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] workqueue: split apply_workqueue_attrs() into 3 stages

2015-03-11 Thread Lai Jiangshan
Current apply_workqueue_attrs() includes pwqs-allocation and pwqs-installation,
so when we batch multiple apply_workqueue_attrs()s as a transaction, we can't
ensure the transaction must succeed or fail as a complete unit.

To solve this, we split apply_workqueue_attrs() into three stages.
The first stage does the preparation: allocation memory, pwqs.
The second stage does the attrs-installaion and pwqs-installation.
The third stage frees the allocated memory and (old or unused) pwqs.

As the result, batching multiple apply_workqueue_attrs()s can
succeed or fail as a complete unit:
1) batch do all the first stage for all the workqueues
2) only commit all when all the above succeed.

This patch is a preparation for the next patch ("Allow modifying low level
unbound workqueue cpumask") which will do a multiple apply_workqueue_attrs().

The patch doesn't have functionality changed except two minor adjustment:
1) free_unbound_pwq() for the error path is removed, we use the
   heavier version put_pwq_unlocked() instead since the error path
   is rare. this adjustment simplifies the code.
2) the memory-allocation is also moved into wq_pool_mutex.
   this is needed to avoid to do the further splitting.

Cc: Christoph Lameter 
Cc: Kevin Hilman 
Cc: Lai Jiangshan 
Cc: Mike Galbraith 
Cc: Paul E. McKenney 
Cc: Tejun Heo 
Cc: Viresh Kumar 
Cc: Frederic Weisbecker 
Signed-off-by: Lai Jiangshan 
---
 kernel/workqueue.c | 199 +++--
 1 file changed, 115 insertions(+), 84 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c6845fa..957b244 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3424,17 +3424,6 @@ static struct pool_workqueue *alloc_unbound_pwq(struct 
workqueue_struct *wq,
return pwq;
 }
 
-/* undo alloc_unbound_pwq(), used only in the error path */
-static void free_unbound_pwq(struct pool_workqueue *pwq)
-{
-   lockdep_assert_held(_pool_mutex);
-
-   if (pwq) {
-   put_unbound_pool(pwq->pool);
-   kmem_cache_free(pwq_cache, pwq);
-   }
-}
-
 /**
  * wq_calc_node_mask - calculate a wq_attrs' cpumask for the specified node
  * @attrs: the wq_attrs of interest
@@ -3497,42 +3486,46 @@ static struct pool_workqueue 
*numa_pwq_tbl_install(struct workqueue_struct *wq,
return old_pwq;
 }
 
-/**
- * apply_workqueue_attrs - apply new workqueue_attrs to an unbound workqueue
- * @wq: the target workqueue
- * @attrs: the workqueue_attrs to apply, allocated with alloc_workqueue_attrs()
- *
- * Apply @attrs to an unbound workqueue @wq.  Unless disabled, on NUMA
- * machines, this function maps a separate pwq to each NUMA node with
- * possibles CPUs in @attrs->cpumask so that work items are affine to the
- * NUMA node it was issued on.  Older pwqs are released as in-flight work
- * items finish.  Note that a work item which repeatedly requeues itself
- * back-to-back will stay on its current pwq.
- *
- * Performs GFP_KERNEL allocations.
- *
- * Return: 0 on success and -errno on failure.
- */
-int apply_workqueue_attrs(struct workqueue_struct *wq,
- const struct workqueue_attrs *attrs)
+struct wq_unbound_install_ctx {
+   struct workqueue_struct *wq;/* target to be installed */
+   struct workqueue_attrs  *attrs; /* attrs for installing */
+   struct pool_workqueue   *dfl_pwq;
+   struct pool_workqueue   *pwq_tbl[];
+};
+
+static void wq_unbound_install_ctx_free(struct wq_unbound_install_ctx *ctx)
 {
+   int node;
+
+   if (ctx) {
+   /* put the pwqs */
+   for_each_node(node)
+   put_pwq_unlocked(ctx->pwq_tbl[node]);
+   put_pwq_unlocked(ctx->dfl_pwq);
+
+   free_workqueue_attrs(ctx->attrs);
+   }
+
+   kfree(ctx);
+}
+
+static struct wq_unbound_install_ctx *
+wq_unbound_install_ctx_prepare(struct workqueue_struct *wq,
+  const struct workqueue_attrs *attrs)
+{
+   struct wq_unbound_install_ctx *ctx;
struct workqueue_attrs *new_attrs, *tmp_attrs;
-   struct pool_workqueue **pwq_tbl, *dfl_pwq;
-   int node, ret;
+   int node;
 
-   /* only unbound workqueues can change attributes */
-   if (WARN_ON(!(wq->flags & WQ_UNBOUND)))
-   return -EINVAL;
+   lockdep_assert_held(_pool_mutex);
 
-   /* creating multiple pwqs breaks ordering guarantee */
-   if (WARN_ON((wq->flags & __WQ_ORDERED) && !list_empty(>pwqs)))
-   return -EINVAL;
+   ctx = kzalloc(sizeof(*ctx) + nr_node_ids * sizeof(ctx->pwq_tbl[0]),
+ GFP_KERNEL);
 
-   pwq_tbl = kzalloc(nr_node_ids * sizeof(pwq_tbl[0]), GFP_KERNEL);
new_attrs = alloc_workqueue_attrs(GFP_KERNEL);
tmp_attrs = alloc_workqueue_attrs(GFP_KERNEL);
-   if (!pwq_tbl || !new_attrs || !tmp_attrs)
-   goto enomem;
+   if (!ctx || 

[PATCH 3/4] workqueue: Create low-level unbound workqueues cpumask

2015-03-11 Thread Lai Jiangshan
From: Frederic Weisbecker 

Create a cpumask that limit the affinity of all unbound workqueues.
This cpumask is controlled though a file at the root of the workqueue
sysfs directory.

It works on a lower-level than the per WQ_SYSFS workqueues cpumask files
such that the effective cpumask applied for a given unbound workqueue is
the intersection of /sys/devices/virtual/workqueue/$WORKQUEUE/cpumask and
the new /sys/devices/virtual/workqueue/cpumask_unbounds file.

This patch implements the basic infrastructure and the read interface.
cpumask_unbounds is initially set to cpu_possible_mask.

Cc: Christoph Lameter 
Cc: Kevin Hilman 
Cc: Lai Jiangshan 
Cc: Mike Galbraith 
Cc: Paul E. McKenney 
Cc: Tejun Heo 
Cc: Viresh Kumar 
Signed-off-by: Frederic Weisbecker 
Signed-off-by: Lai Jiangshan 
---
 kernel/workqueue.c | 29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 957b244..61b5bfa 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -299,6 +299,8 @@ static DEFINE_SPINLOCK(wq_mayday_lock); /* protects 
wq->maydays list */
 static LIST_HEAD(workqueues);  /* PR: list of all workqueues */
 static bool workqueue_freezing;/* PL: have wqs started 
freezing? */
 
+static cpumask_var_t wq_unbound_cpumask;
+
 /* the per-cpu worker pools */
 static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS],
 cpu_worker_pools);
@@ -3529,7 +3531,7 @@ wq_unbound_install_ctx_prepare(struct workqueue_struct 
*wq,
 
/* make a copy of @attrs and sanitize it */
copy_workqueue_attrs(new_attrs, attrs);
-   cpumask_and(new_attrs->cpumask, new_attrs->cpumask, cpu_possible_mask);
+   cpumask_and(new_attrs->cpumask, new_attrs->cpumask, wq_unbound_cpumask);
 
/*
 * We may create multiple pwqs with differing cpumasks.  Make a
@@ -3959,9 +3961,29 @@ static struct bus_type wq_subsys = {
.dev_groups = wq_sysfs_groups,
 };
 
+static ssize_t unbounds_cpumask_show(struct device *dev,
+struct device_attribute *attr, char *buf)
+{
+   int written;
+
+   written = scnprintf(buf, PAGE_SIZE, "%*pb\n",
+   cpumask_pr_args(wq_unbound_cpumask));
+
+   return written;
+}
+
+static struct device_attribute wq_sysfs_cpumask_attr =
+   __ATTR(cpumask, 0444, unbounds_cpumask_show, NULL);
+
 static int __init wq_sysfs_init(void)
 {
-   return subsys_virtual_register(_subsys, NULL);
+   int err;
+
+   err = subsys_virtual_register(_subsys, NULL);
+   if (err)
+   return err;
+
+   return device_create_file(wq_subsys.dev_root, _sysfs_cpumask_attr);
 }
 core_initcall(wq_sysfs_init);
 
@@ -5094,6 +5116,9 @@ static int __init init_workqueues(void)
 
WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
 
+   BUG_ON(!alloc_cpumask_var(_unbound_cpumask, GFP_KERNEL));
+   cpumask_copy(wq_unbound_cpumask, cpu_possible_mask);
+
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
 
cpu_notifier(workqueue_cpu_up_callback, CPU_PRI_WORKQUEUE_UP);
-- 
2.1.0

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


[PATCH 4/4] workqueue: Allow modifying low level unbound workqueue cpumask

2015-03-11 Thread Lai Jiangshan
Allow to modify the low-level unbound workqueues cpumask through
sysfs. This is performed by traversing the entire workqueue list
and calling wq_unbound_install_ctx_prepare() on the unbound workqueues
with the low level mask passed in. Only after all the preparation are done,
we commit them all together.

The oreder-workquue is ignore from the low level unbound workqueue cpumask,
it will be handled in near future.

The per-nodes' pwqs are mandatorily controlled by the low level cpumask, while
the default pwq ignores the low level cpumask when (and ONLY when) the cpumask 
set
by the user doesn't overlap with the low level cpumask. In this case, we can't
apply the empty cpumask to the default pwq, so we use the user-set cpumask
directly.

Cc: Christoph Lameter 
Cc: Kevin Hilman 
Cc: Lai Jiangshan 
Cc: Mike Galbraith 
Cc: Paul E. McKenney 
Cc: Tejun Heo 
Cc: Viresh Kumar 
Cc: Frederic Weisbecker 
Original-patch-by: Frederic Weisbecker 
Signed-off-by: Lai Jiangshan 
---
 kernel/workqueue.c | 96 +-
 1 file changed, 88 insertions(+), 8 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 61b5bfa..facaaae 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -299,7 +299,7 @@ static DEFINE_SPINLOCK(wq_mayday_lock); /* protects 
wq->maydays list */
 static LIST_HEAD(workqueues);  /* PR: list of all workqueues */
 static bool workqueue_freezing;/* PL: have wqs started 
freezing? */
 
-static cpumask_var_t wq_unbound_cpumask;
+static cpumask_var_t wq_unbound_cpumask; /* PL: low level cpumask for all 
unbound wqs */
 
 /* the per-cpu worker pools */
 static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS],
@@ -3491,6 +3491,7 @@ static struct pool_workqueue *numa_pwq_tbl_install(struct 
workqueue_struct *wq,
 struct wq_unbound_install_ctx {
struct workqueue_struct *wq;/* target to be installed */
struct workqueue_attrs  *attrs; /* attrs for installing */
+   struct list_headlist;   /* queued for batching commit */
struct pool_workqueue   *dfl_pwq;
struct pool_workqueue   *pwq_tbl[];
 };
@@ -3513,10 +3514,11 @@ static void wq_unbound_install_ctx_free(struct 
wq_unbound_install_ctx *ctx)
 
 static struct wq_unbound_install_ctx *
 wq_unbound_install_ctx_prepare(struct workqueue_struct *wq,
-  const struct workqueue_attrs *attrs)
+  const struct workqueue_attrs *attrs,
+  cpumask_var_t unbound_cpumask)
 {
struct wq_unbound_install_ctx *ctx;
-   struct workqueue_attrs *new_attrs, *tmp_attrs;
+   struct workqueue_attrs *new_attrs, *pwq_attrs, *tmp_attrs;
int node;
 
lockdep_assert_held(_pool_mutex);
@@ -3525,13 +3527,16 @@ wq_unbound_install_ctx_prepare(struct workqueue_struct 
*wq,
  GFP_KERNEL);
 
new_attrs = alloc_workqueue_attrs(GFP_KERNEL);
+   pwq_attrs = alloc_workqueue_attrs(GFP_KERNEL);
tmp_attrs = alloc_workqueue_attrs(GFP_KERNEL);
if (!ctx || !new_attrs || !tmp_attrs)
goto out_free;
 
/* make a copy of @attrs and sanitize it */
copy_workqueue_attrs(new_attrs, attrs);
-   cpumask_and(new_attrs->cpumask, new_attrs->cpumask, wq_unbound_cpumask);
+   copy_workqueue_attrs(pwq_attrs, attrs);
+   cpumask_and(new_attrs->cpumask, new_attrs->cpumask, cpu_possible_mask);
+   cpumask_and(pwq_attrs->cpumask, pwq_attrs->cpumask, unbound_cpumask);
 
/*
 * We may create multiple pwqs with differing cpumasks.  Make a
@@ -3544,13 +3549,21 @@ wq_unbound_install_ctx_prepare(struct workqueue_struct 
*wq,
 * If something goes wrong during CPU up/down, we'll fall back to
 * the default pwq covering whole @attrs->cpumask.  Always create
 * it even if we don't use it immediately.
+*
+* If the cpumask set by the user doesn't overlap with the global
+* wq_unbound_cpumask, we ignore the wq_unbound_cpumask for this wq
+* which means all its nodes' pwqs are its default pwq and its default
+* pwq's workers' cpumask is totally equals to the user setting.
 */
-   ctx->dfl_pwq = alloc_unbound_pwq(wq, new_attrs);
+   if (cpumask_empty(pwq_attrs->cpumask))
+   ctx->dfl_pwq = alloc_unbound_pwq(wq, new_attrs);
+   else
+   ctx->dfl_pwq = alloc_unbound_pwq(wq, pwq_attrs);
if (!ctx->dfl_pwq)
goto out_free;
 
for_each_node(node) {
-   if (wq_calc_node_cpumask(attrs, node, -1, tmp_attrs->cpumask)) {
+   if (wq_calc_node_cpumask(pwq_attrs, node, -1, 
tmp_attrs->cpumask)) {
ctx->pwq_tbl[node] = alloc_unbound_pwq(wq, tmp_attrs);
if (!ctx->pwq_tbl[node])
goto out_free;
@@ -3564,6 +3577,7 @@ 

[PATCH 1/4] workqueue: Reorder sysfs code

2015-03-11 Thread Lai Jiangshan
From: Frederic Weisbecker 

The sysfs code usually belongs to the botom of the file since it deals
with high level objects. In the workqueue code it's misplaced and such
that we'll need to work around functions references to allow the sysfs
code to call APIs like apply_workqueue_attrs().

Lets move that block further in the file, right above alloc_workqueue_key()
which reference it.

Suggested-by: Tejun Heo 
Cc: Christoph Lameter 
Cc: Kevin Hilman 
Cc: Lai Jiangshan 
Cc: Mike Galbraith 
Cc: Paul E. McKenney 
Cc: Tejun Heo 
Cc: Viresh Kumar 
Signed-off-by: Frederic Weisbecker 
Signed-off-by: Lai Jiangshan 
---
 kernel/workqueue.c | 634 ++---
 1 file changed, 317 insertions(+), 317 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1ca0b1d..c6845fa 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3001,323 +3001,6 @@ int execute_in_process_context(work_func_t fn, struct 
execute_work *ew)
 }
 EXPORT_SYMBOL_GPL(execute_in_process_context);
 
-#ifdef CONFIG_SYSFS
-/*
- * Workqueues with WQ_SYSFS flag set is visible to userland via
- * /sys/bus/workqueue/devices/WQ_NAME.  All visible workqueues have the
- * following attributes.
- *
- *  per_cpuRO bool : whether the workqueue is per-cpu or unbound
- *  max_active RW int  : maximum number of in-flight work items
- *
- * Unbound workqueues have the following extra attributes.
- *
- *  id RO int  : the associated pool ID
- *  nice   RW int  : nice value of the workers
- *  cpumaskRW mask : bitmask of allowed CPUs for the workers
- */
-struct wq_device {
-   struct workqueue_struct *wq;
-   struct device   dev;
-};
-
-static struct workqueue_struct *dev_to_wq(struct device *dev)
-{
-   struct wq_device *wq_dev = container_of(dev, struct wq_device, dev);
-
-   return wq_dev->wq;
-}
-
-static ssize_t per_cpu_show(struct device *dev, struct device_attribute *attr,
-   char *buf)
-{
-   struct workqueue_struct *wq = dev_to_wq(dev);
-
-   return scnprintf(buf, PAGE_SIZE, "%d\n", (bool)!(wq->flags & 
WQ_UNBOUND));
-}
-static DEVICE_ATTR_RO(per_cpu);
-
-static ssize_t max_active_show(struct device *dev,
-  struct device_attribute *attr, char *buf)
-{
-   struct workqueue_struct *wq = dev_to_wq(dev);
-
-   return scnprintf(buf, PAGE_SIZE, "%d\n", wq->saved_max_active);
-}
-
-static ssize_t max_active_store(struct device *dev,
-   struct device_attribute *attr, const char *buf,
-   size_t count)
-{
-   struct workqueue_struct *wq = dev_to_wq(dev);
-   int val;
-
-   if (sscanf(buf, "%d", ) != 1 || val <= 0)
-   return -EINVAL;
-
-   workqueue_set_max_active(wq, val);
-   return count;
-}
-static DEVICE_ATTR_RW(max_active);
-
-static struct attribute *wq_sysfs_attrs[] = {
-   _attr_per_cpu.attr,
-   _attr_max_active.attr,
-   NULL,
-};
-ATTRIBUTE_GROUPS(wq_sysfs);
-
-static ssize_t wq_pool_ids_show(struct device *dev,
-   struct device_attribute *attr, char *buf)
-{
-   struct workqueue_struct *wq = dev_to_wq(dev);
-   const char *delim = "";
-   int node, written = 0;
-
-   rcu_read_lock_sched();
-   for_each_node(node) {
-   written += scnprintf(buf + written, PAGE_SIZE - written,
-"%s%d:%d", delim, node,
-unbound_pwq_by_node(wq, node)->pool->id);
-   delim = " ";
-   }
-   written += scnprintf(buf + written, PAGE_SIZE - written, "\n");
-   rcu_read_unlock_sched();
-
-   return written;
-}
-
-static ssize_t wq_nice_show(struct device *dev, struct device_attribute *attr,
-   char *buf)
-{
-   struct workqueue_struct *wq = dev_to_wq(dev);
-   int written;
-
-   mutex_lock(>mutex);
-   written = scnprintf(buf, PAGE_SIZE, "%d\n", wq->unbound_attrs->nice);
-   mutex_unlock(>mutex);
-
-   return written;
-}
-
-/* prepare workqueue_attrs for sysfs store operations */
-static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq)
-{
-   struct workqueue_attrs *attrs;
-
-   attrs = alloc_workqueue_attrs(GFP_KERNEL);
-   if (!attrs)
-   return NULL;
-
-   mutex_lock(>mutex);
-   copy_workqueue_attrs(attrs, wq->unbound_attrs);
-   mutex_unlock(>mutex);
-   return attrs;
-}
-
-static ssize_t wq_nice_store(struct device *dev, struct device_attribute *attr,
-const char *buf, size_t count)
-{
-   struct workqueue_struct *wq = dev_to_wq(dev);
-   struct workqueue_attrs *attrs;
-   int ret;
-
-   attrs = wq_sysfs_prep_attrs(wq);
-   if (!attrs)
-   return -ENOMEM;
-
-   if (sscanf(buf, "%d", >nice) == 1 &&
-   attrs->nice >= MIN_NICE && attrs->nice <= 

[PATCH 0/4] workqueue: Introduce low-level unbound wq sysfs cpumask v4

2015-03-11 Thread Lai Jiangshan
This patchset mostly copies from Frederic and split the apply_workqueue_attrs()
as TJ's suggest.

This patchset doesn't include the patch "workqueue: Allow changing attributions
of ordered workqueues", I hope to reduce the review processing. The handling
for the ordered workqueue will be repose after this patchset accepted.

Thanks,
Lai

Frederic Weisbecker (2):
  workqueue: Reorder sysfs code
  workqueue: Create low-level unbound workqueues cpumask

Lai Jiangshan (2):
  workqueue: split apply_workqueue_attrs() into 3 stages
  workqueue: Allow modifying low level unbound workqueue cpumask

Cc: Christoph Lameter 
Cc: Kevin Hilman 
Cc: Lai Jiangshan 
Cc: Mike Galbraith 
Cc: Paul E. McKenney 
Cc: Tejun Heo 
Cc: Viresh Kumar 
Cc: Frederic Weisbecker 

 kernel/workqueue.c | 942 ++---
 1 file changed, 539 insertions(+), 403 deletions(-)

-- 
2.1.0

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


[PATCH v4] x86: Fix sibling map with NumaChip

2015-03-11 Thread Daniel J Blueman
On NumaChip systems, the physical processor ID assignment wasn't accounting
for the number of nodes in AMD multi-module processors, giving an incorrect
sibling map:

$ cd /sys/devices/system/cpu/cpu29/topology
$ grep . *
core_id:5
core_siblings:,ff00
core_siblings_list:24-31
physical_package_id:3
thread_siblings:,3000
thread_siblings_list:28-29

After fixing:

core_id:5
core_siblings:,
core_siblings_list:16-31
physical_package_id:1
thread_siblings:,3000
thread_siblings_list:28-29

v2: Fix to check for MSR availability before use, as per Boris's feedback
v3: Test against boot cpu to correct behaviour on larger systems with global IO
v4: Use static_cpu_has_safe(), as Boris suggests

Candidate for stable.

Signed-off-by: Daniel J Blueman 
---
 arch/x86/kernel/apic/apic_numachip.c | 22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/apic/apic_numachip.c 
b/arch/x86/kernel/apic/apic_numachip.c
index c2fd21f..c1f4f36 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -37,10 +37,12 @@ static const struct apic apic_numachip;
 static unsigned int get_apic_id(unsigned long x)
 {
unsigned long value;
-   unsigned int id;
+   unsigned int id = (x >> 24) & 0xff;
 
-   rdmsrl(MSR_FAM10H_NODE_ID, value);
-   id = ((x >> 24) & 0xffU) | ((value << 2) & 0xff00U);
+   if (static_cpu_has_safe(X86_FEATURE_NODEID_MSR)) {
+   rdmsrl(MSR_FAM10H_NODE_ID, value);
+   id |= (value << 2) & 0xff00;
+   }
 
return id;
 }
@@ -155,10 +157,18 @@ static int __init numachip_probe(void)
 
 static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
 {
-   if (c->phys_proc_id != node) {
-   c->phys_proc_id = node;
-   per_cpu(cpu_llc_id, smp_processor_id()) = node;
+   u64 val;
+   u32 nodes = 1;
+
+   this_cpu_write(cpu_llc_id, node);
+
+   /* Account for nodes per socket in multi-core-module processors */
+   if (static_cpu_has_safe(X86_FEATURE_NODEID_MSR)) {
+   rdmsrl(MSR_FAM10H_NODE_ID, val);
+   nodes = ((val >> 3) & 7) + 1;
}
+
+   c->phys_proc_id = node / nodes;
 }
 
 static int __init numachip_system_init(void)
-- 
1.9.1

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


RE: [PATCH V2 2/3 net-next] Drivers: hv: vmbus: Fix a bug in the signalling logic with kick_q

2015-03-11 Thread KY Srinivasan


> -Original Message-
> From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On
> Behalf Of KY Srinivasan
> Sent: Wednesday, March 11, 2015 8:32 PM
> To: Jason Wang
> Cc: o...@aepfle.de; net...@vger.kernel.org; linux-kernel@vger.kernel.org;
> gre...@linuxfoundation.org; a...@canonical.com;
> de...@linuxdriverproject.org; da...@davemloft.net
> Subject: RE: [PATCH V2 2/3 net-next] Drivers: hv: vmbus: Fix a bug in the
> signalling logic with kick_q
> 
> 
> 
> > -Original Message-
> > From: Jason Wang [mailto:jasow...@redhat.com]
> > Sent: Wednesday, March 11, 2015 8:08 PM
> > To: KY Srinivasan
> > Cc: da...@davemloft.net; net...@vger.kernel.org; linux-
> > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> > a...@canonical.com; gre...@linuxfoundation.org; KY Srinivasan
> > Subject: Re: [PATCH V2 2/3 net-next] Drivers: hv: vmbus: Fix a bug in
> > the signalling logic with kick_q
> >
> >
> >
> > On Thu, Mar 12, 2015 at 3:04 AM, K. Y. Srinivasan 
> > wrote:
> > > When the caller specifies that signalling should be deferred, we
> > > need to address the case where we are not able to place the current
> > > packet because the buffer is full. In this case, we will signal the
> > > host as some packets may have been placed on the ring buffer.
> > > I would like to thank Jason Wang  for pointing
> > > out this issue.
> > >
> > > Signed-off-by: K. Y. Srinivasan 
> > > ---
> > >  drivers/hv/channel.c |   32 
> > >  1 files changed, 32 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index
> > > e58cdb7..ae06ba9 100644
> > > --- a/drivers/hv/channel.c
> > > +++ b/drivers/hv/channel.c
> > > @@ -614,8 +614,24 @@ int vmbus_sendpacket_ctl(struct
> vmbus_channel
> > > *channel, void *buffer,
> > >
> > >   ret = hv_ringbuffer_write(>outbound, bufferlist, 3,
> > > );
> > >
> > > + /*
> > > +  * Here is the logic for signalling the host:
> > > +  * 1. If the host is already draining the ringbuffer,
> > > +  *don't signal. This is indicated by the parameter
> > > +  *"signal".
> > > +  *
> > > +  * 2. If we are not able to write, signal if kick_q is false.
> > > +  *kick_q being false indicates that we may have placed zero or
> > > +  *more packets with more packets to come. We will signal in
> > > +  *this case even if potentially we may have not placed any
> > > +  *packet. This is a rare enough condition that it should not
> > > +  *matter.
> > > +  */
> > > +
> > >   if ((ret == 0) && kick_q && signal)
> > >   vmbus_setevent(channel);
> > > + else if ((ret != 0) && !kick_q)
> > > + vmbus_setevent(channel);
> > >
> > >   return ret;
> > >  }
> > > @@ -705,8 +721,24 @@ int vmbus_sendpacket_pagebuffer_ctl(struct
> > > vmbus_channel *channel,
> > >
> > >   ret = hv_ringbuffer_write(>outbound, bufferlist, 3,
> > > );
> > >
> > > + /*
> > > +  * Here is the logic for signalling the host:
> > > +  * 1. If the host is already draining the ringbuffer,
> > > +  *don't signal. This is indicated by the parameter
> > > +  *"signal".
> > > +  *
> > > +  * 2. If we are not able to write, signal if kick_q is false.
> > > +  *kick_q being false indicates that we may have placed zero or
> > > +  *more packets with more packets to come. We will signal in
> > > +  *this case even if potentially we may have not placed any
> > > +  *packet. This is a rare enough condition that it should not
> > > +  *matter.
> > > +  */
> > > +
> > >   if ((ret == 0) && kick_q && signal)
> > >   vmbus_setevent(channel);
> > > + else if ((ret != 0) && !kick_q)
> > > + vmbus_setevent(channel);
> > >
> > >   return ret;
> > >  }
> > > --
> >
> > Looks like we need to kick unconditionally here. Consider we may get -
> > EAGAIN when we want to send the last skb (kick_q is true) from the
> > list. We need kick host in this case.
> >
> > Btw, another method is let the driver to decide e.g exporting the
> > vmbus_setevent() and call it in netvsc_start_xmit().
> 
> There is other state that governs if the host needs to be signaled and I don't
> think we want to expose that to netvsc. In any case, netvsc will have to 
> signal
> the host when EGAIN is received.
> We might as well do it in the vmbus driver.
> 
> Thank you Jason, I will respin and resubmit the series.

Looks like there may be a way to make the signaling more precise even in this 
case.
I am going to experiment with it.

K. Y
> 
> K. Y
> >
> >
> >
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 18/22] usb: gadget: serial: %pF is only for function pointers

2015-03-11 Thread Felipe Balbi
On Wed, Mar 11, 2015 at 10:13:53PM -0500, Scott Wood wrote:
> Use %pS for actual addresses, otherwise you'll get bad output
> on arches like ppc64 where %pF expects a function descriptor.
> 
> Signed-off-by: Scott Wood 
> Cc: linux-...@vger.kernel.org
> Cc: Felipe Balbi 
> ---
>  drivers/usb/gadget/function/u_serial.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/u_serial.c 
> b/drivers/usb/gadget/function/u_serial.c
> index 491082a..89179ab 100644
> --- a/drivers/usb/gadget/function/u_serial.c
> +++ b/drivers/usb/gadget/function/u_serial.c
> @@ -912,7 +912,7 @@ static int gs_put_char(struct tty_struct *tty, unsigned 
> char ch)
>   unsigned long   flags;
>   int status;
>  
> - pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %pf\n",
> + pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %ps\n",
 ^
 S ??

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 0/3] btrfs: ENOMEM bugfixes

2015-03-11 Thread Omar Sandoval
On Tue, Feb 24, 2015 at 02:47:03AM -0800, Omar Sandoval wrote:
> Hi, everyone,
> 
> This patch series fixes a few bugs that occur under low memory conditions.
> These were exposed by a change in behavior of GFP_NOFS allocations in 
> 3.19-rc7,
> by commit 9879de7373fc ("mm: page_alloc: embed OOM killing naturally into
> allocation slowpath"). While the mm people sort that out, we can fix these
> issues, which are bugs no matter what the outcome there is.
> 
> Here's a quick script which reproduces these bugs. With the patches applied, 
> the
> filesystem will drop into read-only mode instead of blowing up.
> 
> 
> #!/bin/sh
> 
> cgcreate -g memory:enomem
> MEM=$((64 * 1024 * 1024))
> echo $MEM > /sys/fs/cgroup/memory/enomem/memory.limit_in_bytes
> 
> cgexec -g memory:enomem ~/xfstests/ltp/fsstress -p128 -n9 -d 
> /mnt/test &
> trap "killall fsstress; exit 0" SIGINT SIGTERM
> 
> while true; do
>   cgexec -g memory:enomem python -c '
> l = []
> while True:
> l.append(0)'
> done
> 
> 
> Version 2 rebases on top of 4.0-rc1, has a simpler fix for the
> alloc_extent_buffer race, expands the commit messages to mention changed
> comments, and adds Liu Bo's Reviewed-by.
> 
> Thanks!
> 
> Omar Sandoval (3):
>   btrfs: handle ENOMEM in btrfs_alloc_tree_block
>   btrfs: fix race on ENOMEM in alloc_extent_buffer
>   btrfs: check io_ctl_prepare_pages return in __btrfs_write_out_cache
> 
>  fs/btrfs/extent-tree.c  | 41 -
>  fs/btrfs/extent_io.c|  3 ++-
>  fs/btrfs/free-space-cache.c | 10 ++
>  3 files changed, 36 insertions(+), 18 deletions(-)
> -- 
> 2.3.0
> 

Ping. For anyone following along, it looks like commit cc87317726f8
("mm: page_alloc: revert inadvertent !__GFP_FS retry behavior change")
reverted the commit that exposed these bugs. Josef said he was okay with
taking these, will they make it to an upcoming -rc soon?

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


Re: [alsa-devel] [PATCH] ASoC: wm8994: Manage wm8994's MCLK in codec driver

2015-03-11 Thread Chanwoo Choi
Hi Inha,

On 03/12/2015 11:49 AM, Inha Song wrote:
> Previously, When we use wm8994 codec, we should control its MCLK in machine 
> driver.
> But, It should be managed by wm8994 codec driver, not machine driver.
> 
> This patch add MCLK clock DT parsing logic and control own MCLK.
> 
> Signed-off-by: Inha Song 
> ---
>  sound/soc/codecs/wm8994.c | 27 ++-
>  sound/soc/codecs/wm8994.h |  1 +
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
> index 247b390..d80dcc6 100644
> --- a/sound/soc/codecs/wm8994.c
> +++ b/sound/soc/codecs/wm8994.c
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -2470,6 +2471,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec 
> *codec,
>  {
>   struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
>   struct wm8994 *control = wm8994->wm8994;
> + int i;
>  
>   wm_hubs_set_bias_level(codec, level);
>  
> @@ -2491,8 +2493,19 @@ static int wm8994_set_bias_level(struct snd_soc_codec 
> *codec,
>   break;
>   }
>  
> - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
> + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
> + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> + if (!IS_ERR(wm8994->clk_mclk[i]))
> + clk_prepare_enable(wm8994->clk_mclk[i]);

I think that you don't need to check error by using 'if' statement.
clk_prepare_enable() function will check the NULL state of clk instance
before preparing and enabling the clock. 

for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++)
clk_prepare_enable(wm8994->clk_mclk[i]);

But, wm8994_probe() have to initialize the NULL for wm8994->clk_mclk[i].
I added the comment about this on below.

> + }
>   active_reference(codec);
> + } else if (codec->dapm.bias_level == SND_SOC_BIAS_ON) {
> + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> + if (!IS_ERR(wm8994->clk_mclk[i]))
> + clk_disable_unprepare(
> + wm8994->clk_mclk[i]);
> + }
> + }
>   break;
>  
>   case SND_SOC_BIAS_STANDBY:
> @@ -4451,6 +4464,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 
> = {
>  static int wm8994_probe(struct platform_device *pdev)
>  {
>   struct wm8994_priv *wm8994;
> + int i;
>  
>   wm8994 = devm_kzalloc(>dev, sizeof(struct wm8994_priv),
> GFP_KERNEL);
> @@ -4460,6 +4474,17 @@ static int wm8994_probe(struct platform_device *pdev)
>  
>   wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent);
>  
> + for (i = 0; i < ARRAY_SIZE(wm8994->clk_mclk); i++) {
> + char mclk_name[] = "MCLKx";
> +
> + snprintf(mclk_name, sizeof(mclk_name), "MCLK%d", i + 1);
> +
> + wm8994->clk_mclk[i] = devm_clk_get(pdev->dev.parent, mclk_name);
> + if (IS_ERR(wm8994->clk_mclk[i]))
> + if (PTR_ERR(wm8994->clk_mclk) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;

I think you better to modify exception handling as following:

if (IS_ERR(wm8994->clk_mclk[i])) {
wm8994->clk_mclk[i] = NULL;
return PTR_ERR(wm8994->clk_mclk);
}

> + }
> +
>   pm_runtime_enable(>dev);
>   pm_runtime_idle(>dev);
>  
> diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h
> index 6536f8d..8cf06a4 100644
> --- a/sound/soc/codecs/wm8994.h
> +++ b/sound/soc/codecs/wm8994.h
> @@ -78,6 +78,7 @@ struct wm8994_priv {
>   int sysclk[2];
>   int sysclk_rate[2];
>   int mclk[2];
> + struct clk *clk_mclk[2];
>   int aifclk[2];
>   int aifdiv[2];
>   int channels[2];
> 

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


Re: [PATCH v2] rds: avoid potential stack overflow

2015-03-11 Thread David Miller
From: Arnd Bergmann 
Date: Wed, 11 Mar 2015 22:46:59 +0100

> The rds_iw_update_cm_id function stores a large 'struct rds_sock' object
> on the stack in order to pass a pair of addresses. This happens to just
> fit withint the 1024 byte stack size warning limit on x86, but just
> exceed that limit on ARM, which gives us this warning:
> 
> net/rds/iw_rdma.c:200:1: warning: the frame size of 1056 bytes is larger than 
> 1024 bytes [-Wframe-larger-than=]
> 
> As the use of this large variable is basically bogus, we can rearrange
> the code to not do that. Instead of passing an rds socket into
> rds_iw_get_device, we now just pass the two addresses that we have
> available in rds_iw_update_cm_id, and we change rds_iw_get_mr accordingly,
> to create two address structures on the stack there.
> 
> Signed-off-by: Arnd Bergmann 
> ---
> v2: fix incorrect commit message

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


Re: [rhashtable] [ INFO: possible recursive locking detected ]

2015-03-11 Thread David Miller
From: Herbert Xu 
Date: Thu, 12 Mar 2015 14:47:13 +1100

> rhashtable: Add annotation to nested lock
> 
> Commit aa34a6cb0478842452bac58edb50d3ef9e178c92 ("rhashtable:
> Add arbitrary rehash function") killed the annotation on the
> nested lock which leads to bitching from lockdep.
> 
> Reported-by: Fengguang Wu 
> Signed-off-by: Herbert Xu 

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


[PATCH 00/12] Increased clocksource validation and cleanups (v4)

2015-03-11 Thread John Stultz
So here is another round of this series, which is the result of
earlier discussions with Linus and his suggestions around
improvements to clocksource validation in the hope we can more
easily catch bad hardware.

There's also a few cleanups Linus suggested as well as a few I've been
meaning to get to for awhile.

I tried in address all the feedback that had been given, adding
the checks behind CONFIG_DEBUG_TIMEKEEPING.  I also sorted out a
sane way to print rate-limited warnings if we see cycle deltas that
are too large, or if they look like small underflows.

I'd like to get this queued into -tip soon so it can get as much
testing in -next as possible.

If there are any objections or feedback, I'd love to hear it!

New in v4:
* Lots and lots of typo corrections and minor cleanups suggested
  by Ingo.
* Dropped "Remove clocksource_max_deferment()" patch
* Added "Rename __clocksource_updatefreq_*..." patch
* I realized one of the patches (Improve clocksource watchdog
  reporting) didn't have a proper cc list, so while it was on lkml
  folks may not have reviewed it before.

thanks
-john

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 

John Stultz (12):
  clocksource: Simplify clocks_calc_max_nsecs logic
  clocksource: Simplify logic around clocksource wrapping safety margins
  clocksource: Add max_cycles to clocksource structure
  time: Add debugging checks to warn if we see delays
  time: Add infrastructure to cap clocksource reads to the max_cycles
value
  time: Try to catch clocksource delta underflows
  time: Add warnings when overflows or underflows are observed
  clocksource: Improve clocksource watchdog reporting
  clocksource: Mostly kill clocksource_register()
  sparc: Convert to using clocksource_register_hz()
  clocksource: Add some debug info about clocksources being registered
  clocksource: Rename __clocksource_updatefreq_* to
__clocksource_update_freq_*

 arch/arm/plat-omap/counter_32k.c |   2 +-
 arch/s390/kernel/time.c  |   2 +-
 arch/sparc/kernel/time_32.c  |   6 +-
 drivers/clocksource/em_sti.c |   2 +-
 drivers/clocksource/sh_cmt.c |   2 +-
 drivers/clocksource/sh_tmu.c |   2 +-
 include/linux/clocksource.h  |  26 --
 kernel/time/clocksource.c| 171 ++-
 kernel/time/jiffies.c|   5 +-
 kernel/time/sched_clock.c|   6 +-
 kernel/time/timekeeping.c| 127 ++---
 lib/Kconfig.debug|  12 +++
 12 files changed, 235 insertions(+), 128 deletions(-)

-- 
1.9.1

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


[PATCH 05/12] time: Add infrastructure to cap clocksource reads to the max_cycles value

2015-03-11 Thread John Stultz
When calculating the current delta since the last tick, we
currently have no hard protections to prevent a multiplication
overflow from occurring.

This patch introduces infrastructure to allow a cap that
limits the read delta value to the max_cycles value, which is
where an overflow would occur.

Since this is in the hotpath, it adds the extra checking under
CONFIG_DEBUG_TIMEKEEPING.

There was some concern that capping time like this could cause
problems as we may stop expiring timers, which could go circular
if the timer that triggers time accumulation were mis-scheduled
too far in the future, which would cause time to stop.

However, since the mult overflow would result in a smaller time
value, we would effectively have the same problem there.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/timekeeping.c | 45 +
 1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 882ba5b..c06fe6e 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -135,11 +135,40 @@ static void timekeeping_check_update(struct timekeeper 
*tk, cycle_t offset)
}
}
 }
+
+static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
+{
+   cycle_t cycle_now, delta;
+
+   /* read clocksource */
+   cycle_now = tkr->read(tkr->clock);
+
+   /* calculate the delta since the last update_wall_time */
+   delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
+
+   /* Cap delta value to the max_cycles values to avoid mult overflows */
+   if (unlikely(delta > tkr->clock->max_cycles))
+   delta = tkr->clock->max_cycles;
+
+   return delta;
+}
 #else
 static inline
 void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
 {
 }
+static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
+{
+   cycle_t cycle_now, delta;
+
+   /* read clocksource */
+   cycle_now = tkr->read(tkr->clock);
+
+   /* calculate the delta since the last update_wall_time */
+   delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
+
+   return delta;
+}
 #endif
 
 /**
@@ -217,14 +246,10 @@ static inline u32 arch_gettimeoffset(void) { return 0; }
 
 static inline s64 timekeeping_get_ns(struct tk_read_base *tkr)
 {
-   cycle_t cycle_now, delta;
+   cycle_t delta;
s64 nsec;
 
-   /* read clocksource: */
-   cycle_now = tkr->read(tkr->clock);
-
-   /* calculate the delta since the last update_wall_time: */
-   delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
+   delta = timekeeping_get_delta(tkr);
 
nsec = delta * tkr->mult + tkr->xtime_nsec;
nsec >>= tkr->shift;
@@ -236,14 +261,10 @@ static inline s64 timekeeping_get_ns(struct tk_read_base 
*tkr)
 static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
 {
struct clocksource *clock = tk->tkr.clock;
-   cycle_t cycle_now, delta;
+   cycle_t delta;
s64 nsec;
 
-   /* read clocksource: */
-   cycle_now = tk->tkr.read(clock);
-
-   /* calculate the delta since the last update_wall_time: */
-   delta = clocksource_delta(cycle_now, tk->tkr.cycle_last, tk->tkr.mask);
+   delta = timekeeping_get_delta(>tkr);
 
/* convert delta to nanoseconds. */
nsec = clocksource_cyc2ns(delta, clock->mult, clock->shift);
-- 
1.9.1

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


[PATCH 07/12] time: Add warnings when overflows or underflows are observed

2015-03-11 Thread John Stultz
It was suggested that the underflow/overflow protection
should probably throw some sort of warning out, rather
then just silently fixing the issue.

So this patch adds some warnings here. The flag variables
used are not protected by locks, but since we can't print
from the reading functions, just being able to say we
saw an issue in the update interval is useful enough,
and can be slightly racy without real consequence.

The big complication is that we're only under a read
seqlock, so the data could shift under us during
our calculation to see if there was a problem. This
patch avoids this issue by nesting another seqlock
which allows us to snapshot the just required values
atomically. So we shouldn't see false positives.

I also added some basic rate-limiting here, since
on one build machine w/ skewed TSCs it was fairly
noisy at bootup.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/timekeeping.c | 62 +--
 1 file changed, 55 insertions(+), 7 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 2ba62fe..a7204ad 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -119,6 +119,20 @@ static inline void tk_update_sleep_time(struct timekeeper 
*tk, ktime_t delta)
 }
 
 #ifdef CONFIG_DEBUG_TIMEKEEPING
+#define WARNING_FREQ (HZ*300) /* 5 minute rate-limiting */
+/*
+ * These simple flag variables are managed
+ * without locks, which is racy, but ok since
+ * we don't really care about being super
+ * precise about how many events were seen,
+ * just that a problem was observed.
+ */
+static int timekeeping_underflow_seen;
+static int timekeeping_overflow_seen;
+
+/* last_warning is only modified under the timekeeping lock */
+static long timekeeping_last_warning;
+
 static void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
 {
 
@@ -134,28 +148,62 @@ static void timekeeping_check_update(struct timekeeper 
*tk, cycle_t offset)
offset, name, max_cycles>>1);
}
}
+
+   if (timekeeping_underflow_seen) {
+   if (jiffies - timekeeping_last_warning > WARNING_FREQ) {
+   printk_deferred("WARNING: Clocksource %s underflow 
observed. You should report\n", name);
+   printk_deferred(" this, consider using a 
different clocksource.\n");
+   timekeeping_last_warning = jiffies;
+   }
+   timekeeping_underflow_seen = 0;
+   }
+
+   if (timekeeping_overflow_seen) {
+   if (jiffies - timekeeping_last_warning > WARNING_FREQ) {
+   printk_deferred("WARNING: Clocksource %s overflow 
observed. You should report\n", name);
+   printk_deferred(" this, consider using a 
different clocksource.\n");
+   timekeeping_last_warning = jiffies;
+   }
+   timekeeping_overflow_seen = 0;
+   }
 }
 
 static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
 {
-   cycle_t cycle_now, delta;
+   cycle_t now, last, mask, max, delta;
+   unsigned int seq;
 
-   /* read clocksource */
-   cycle_now = tkr->read(tkr->clock);
+   /*
+* Since we're called holding a seqlock, the data may shift
+* under us while we're doing the calculation. This can cause
+* false positives, since we'd note a problem but throw the
+* results away. So nest another seqlock here to atomically
+* grab the points we are checking with.
+*/
+   do {
+   seq = read_seqcount_begin(_core.seq);
+   now = tkr->read(tkr->clock);
+   last = tkr->cycle_last;
+   mask = tkr->mask;
+   max = tkr->clock->max_cycles;
+   } while (read_seqcount_retry(_core.seq, seq));
 
-   /* calculate the delta since the last update_wall_time */
-   delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
+   delta = clocksource_delta(now, last, mask);
 
/*
 * Try to catch underflows by checking if we are seeing small
 * mask-relative negative values.
 */
-   if (unlikely((~delta & tkr->mask) < (tkr->mask >> 3)))
+   if (unlikely((~delta & mask) < (mask >> 3))) {
+   timekeeping_underflow_seen = 1;
delta = 0;
+   }
 
/* Cap delta value to the max_cycles values to avoid mult overflows */
-   if (unlikely(delta > tkr->clock->max_cycles))
+   if (unlikely(delta > max)) {
+   timekeeping_overflow_seen = 1;
delta = tkr->clock->max_cycles;
+   }
 
return delta;
 }
-- 
1.9.1

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

[PATCH 01/12] clocksource: Simplify clocks_calc_max_nsecs logic

2015-03-11 Thread John Stultz
The previous clocks_calc_max_nsecs had some unecessarily
complex bit logic to find the max interval that could cause
multiplication overflows. Since this is not in the hot
path, just do the divide to make it easier to read.

The previous implementation also had a subtle issue
that it avoided overflows into signed 64-bit values, where
as the intervals are always unsigned. This resulted in
overly conservative intervals, which other safety margins
were then added to, reducing the intended interval length.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 4892352..11323f4 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -476,19 +476,10 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 
maxadj, u64 mask)
 
/*
 * Calculate the maximum number of cycles that we can pass to the
-* cyc2ns function without overflowing a 64-bit signed result. The
-* maximum number of cycles is equal to ULLONG_MAX/(mult+maxadj)
-* which is equivalent to the below.
-* max_cycles < (2^63)/(mult + maxadj)
-* max_cycles < 2^(log2((2^63)/(mult + maxadj)))
-* max_cycles < 2^(log2(2^63) - log2(mult + maxadj))
-* max_cycles < 2^(63 - log2(mult + maxadj))
-* max_cycles < 1 << (63 - log2(mult + maxadj))
-* Please note that we add 1 to the result of the log2 to account for
-* any rounding errors, ensure the above inequality is satisfied and
-* no overflow will occur.
+* cyc2ns function without overflowing a 64-bit result.
 */
-   max_cycles = 1ULL << (63 - (ilog2(mult + maxadj) + 1));
+   max_cycles = ULLONG_MAX;
+   do_div(max_cycles, mult+maxadj);
 
/*
 * The actual maximum number of cycles we can defer the clocksource is
-- 
1.9.1

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


RE: [PATCH RFC] f2fs: add fast symlink

2015-03-11 Thread Chao Yu
Hi Wanpeng,

> -Original Message-
> From: Wanpeng Li [mailto:wanpeng...@linux.intel.com]
> Sent: Wednesday, March 11, 2015 7:52 PM
> To: Jaegeuk Kim
> Cc: Changman Lee; Chao Yu; linux-f2fs-de...@lists.sourceforge.net;
> linux-fsde...@vger.kernel.org; linux-kernel@vger.kernel.org; Wanpeng Li
> Subject: [PATCH RFC] f2fs: add fast symlink
> 
> This patch add fast symlink for f2fs, I'm not sure if inline
> interference with fast symlink, f2fs_follow_link can't be called
> in my patch, so my patch still can't work correctly, please help
> review and give comments to help me out.
> 
> Signed-off-by: Wanpeng Li 
> ---
>  fs/f2fs/f2fs.h  |  9 +
>  fs/f2fs/file.c  |  2 ++
>  fs/f2fs/inode.c | 15 +--
>  fs/f2fs/namei.c | 44 +---
>  4 files changed, 65 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 511d6cd..5938318 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1370,6 +1370,14 @@ static inline void f2fs_stop_checkpoint(struct 
> f2fs_sb_info *sbi)
>   sbi->sb->s_flags |= MS_RDONLY;
>  }
> 
> +/*
> + * Test whether an inode is a fast symlink.
> + */
> +static inline int f2fs_inode_is_fast_symlink(struct inode *inode)
> +{
> + return (S_ISLNK(inode->i_mode) && inode->i_blocks == 0);

How about introducing FI_FAST_SYMLINK & F2FS_FAST_SYMLINK to indicate whether
the inode is fast symlink or not?

So here could be:
return (S_ISLNK(inode->i_mode) &&
is_inode_flag_set(F2FS_I(inode), FI_FAST_SYMLINK));

> +}
> +
>  #define get_inode_mode(i) \
>   ((is_inode_flag_set(F2FS_I(i), FI_ACL_MODE)) ? \
>(F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
> @@ -1746,6 +1754,7 @@ extern const struct address_space_operations 
> f2fs_node_aops;
>  extern const struct address_space_operations f2fs_meta_aops;
>  extern const struct inode_operations f2fs_dir_inode_operations;
>  extern const struct inode_operations f2fs_symlink_inode_operations;
> +extern const struct inode_operations f2fs_fast_symlink_inode_operations;
>  extern const struct inode_operations f2fs_special_inode_operations;
>  extern struct kmem_cache *inode_entry_slab;
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index f1341c7..05a3d4f 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -546,6 +546,8 @@ void f2fs_truncate(struct inode *inode)
>   if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
>   S_ISLNK(inode->i_mode)))
>   return;
> + if (f2fs_inode_is_fast_symlink(inode))
> + return;
> 
>   trace_f2fs_truncate(inode);
> 
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index b508744..627fe6b 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include "f2fs.h"
>  #include "node.h"
> @@ -188,8 +189,18 @@ make_now:
>   inode->i_mapping->a_ops = _dblock_aops;
>   mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_HIGH_ZERO);
>   } else if (S_ISLNK(inode->i_mode)) {
> - inode->i_op = _symlink_inode_operations;
> - inode->i_mapping->a_ops = _dblock_aops;
> + if (f2fs_inode_is_fast_symlink(inode)) {
> + struct page *node_page;
> +
> + node_page = get_node_page(sbi, inode->i_ino);
> + inode->i_op = _fast_symlink_inode_operations;
> + nd_terminate_link(F2FS_INODE(node_page)->i_addr,
> + inode->i_size,
> + sizeof(F2FS_INODE(node_page)->i_addr) - 1);

I don't think nd_terminate_link() is necessary because we have already copied
terminate char '\0' when creating fast symlink.

> + } else {
> + inode->i_op = _symlink_inode_operations;
> + inode->i_mapping->a_ops = _dblock_aops;
> + }
>   } else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
>   S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
>   inode->i_op = _special_inode_operations;
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 1e2ae21..ffc0d52 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include "f2fs.h"
>  #include "node.h"
> @@ -247,6 +248,16 @@ fail:
>   return err;
>  }
> 
> +static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
> +{
> + struct page *node_page;
> +
> + node_page = get_node_page(F2FS_I_SB(dentry->d_inode),
> + dentry->d_inode->i_ino);

get_node_page can fail, we should handle this.

> + nd_set_link(nd, (char *)(F2FS_INODE(node_page)->i_addr));

f2fs_put_page(node_page, 1);

> + return NULL;
> +}
> +
>  static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
>   

[PATCH 10/12] sparc: Convert to using clocksource_register_hz()

2015-03-11 Thread John Stultz
While cleaning up some clocksource code, I noticed the
time_32 implementation uses the clocksource_hz2mult()
helper, but doesn't use the clocksource_register_hz()
method.

I don't believe the Sparc clocksource is a default
clocksource, so we shouldn't need to self-define
the mult/shift pair.

So convert the time_32.c implementation to use
clocksource_register_hz().

Untested.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: "David S. Miller" 
Acked-by: David S. Miller 
Signed-off-by: John Stultz 
---
 arch/sparc/kernel/time_32.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index a31c0c8..18147a5 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -181,17 +181,13 @@ static struct clocksource timer_cs = {
.rating = 100,
.read   = timer_cs_read,
.mask   = CLOCKSOURCE_MASK(64),
-   .shift  = 2,
.flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static __init int setup_timer_cs(void)
 {
timer_cs_enabled = 1;
-   timer_cs.mult = clocksource_hz2mult(sparc_config.clock_rate,
-   timer_cs.shift);
-
-   return __clocksource_register(_cs);
+   return clocksource_register_hz(_cs, sparc_config.clock_rate);
 }
 
 #ifdef CONFIG_SMP
-- 
1.9.1

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


[PATCH 08/12] clocksource: Improve clocksource watchdog reporting

2015-03-11 Thread John Stultz
The clocksource watchdog reporting has been less helpful
then desired, as it just printed the delta between
the two clocksources. This prevents any useful analysis
of why the skew occurred.

Thus this patch tries to improve the output when we
mark a clocksource as unstable, printing out the cycle
last and now values for both the current clocksource
and the watchdog clocksource. This will allow us to see
if the result was due to a false positive caused by
a problematic watchdog.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index a491803..340461e 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -142,13 +142,6 @@ static void __clocksource_unstable(struct clocksource *cs)
schedule_work(_work);
 }
 
-static void clocksource_unstable(struct clocksource *cs, int64_t delta)
-{
-   printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n",
-  cs->name, delta);
-   __clocksource_unstable(cs);
-}
-
 /**
  * clocksource_mark_unstable - mark clocksource unstable via watchdog
  * @cs:clocksource to be marked unstable
@@ -174,7 +167,7 @@ void clocksource_mark_unstable(struct clocksource *cs)
 static void clocksource_watchdog(unsigned long data)
 {
struct clocksource *cs;
-   cycle_t csnow, wdnow, delta;
+   cycle_t csnow, wdnow, cslast, wdlast, delta;
int64_t wd_nsec, cs_nsec;
int next_cpu, reset_pending;
 
@@ -213,6 +206,8 @@ static void clocksource_watchdog(unsigned long data)
 
delta = clocksource_delta(csnow, cs->cs_last, cs->mask);
cs_nsec = clocksource_cyc2ns(delta, cs->mult, cs->shift);
+   wdlast = cs->wd_last; /* save these in case we print them */
+   cslast = cs->cs_last;
cs->cs_last = csnow;
cs->wd_last = wdnow;
 
@@ -221,7 +216,12 @@ static void clocksource_watchdog(unsigned long data)
 
/* Check the deviation from the watchdog clocksource. */
if ((abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD)) {
-   clocksource_unstable(cs, cs_nsec - wd_nsec);
+   pr_warn("Watchdog: clocksource %s unstable\n", 
cs->name);
+   pr_warn("   %s wd_now: %llx wd_last: %llx mask: 
%llx\n",
+   watchdog->name, wdnow, wdlast, watchdog->mask);
+   pr_warn("   %s cs_now: %llx cs_last: %llx mask: 
%llx\n",
+   cs->name, csnow, cslast, cs->mask);
+   __clocksource_unstable(cs);
continue;
}
 
-- 
1.9.1

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


[PATCH 02/12] clocksource: Simplify logic around clocksource wrapping safety margins

2015-03-11 Thread John Stultz
The clocksource logic has a number of places where we try to
include a safety margin. Most of these are 12% safety margins,
but they are inconsistently applied and sometimes are applied
on top of each other.

Additionally, in the previous patch, we corrected an issue
where we unintentionally in effect created a 50% safety margin,
which these 12.5% margins where then added to.

So to simplify the logic here, this patch removes the various
12.5% margins, and consolidates adding the margin in one place:
clocks_calc_max_nsecs().

Additionally, Linus prefers a 50% safety margin, as it allows
bad clock values to be more easily caught. This should really
have no net effect, due to the corrected issue earlier which
caused greater then 50% margins to be used w/o issue.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Acked-by: Stephen Boyd  (for sched_clock.c bit)
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 26 --
 kernel/time/sched_clock.c |  4 ++--
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 11323f4..fe64c7f 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -469,6 +469,9 @@ static u32 clocksource_max_adjustment(struct clocksource 
*cs)
  * @shift: cycle to nanosecond divisor (power of two)
  * @maxadj:maximum adjustment value to mult (~11%)
  * @mask:  bitmask for two's complement subtraction of non 64 bit counters
+ *
+ * NOTE: This function includes a safety margin of 50%, so that bad clock 
values
+ * can be detected.
  */
 u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask)
 {
@@ -490,11 +493,14 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 
maxadj, u64 mask)
max_cycles = min(max_cycles, mask);
max_nsecs = clocksource_cyc2ns(max_cycles, mult - maxadj, shift);
 
+   /* Return 50% of the actual maximum, so we can detect bad values */
+   max_nsecs >>= 1;
+
return max_nsecs;
 }
 
 /**
- * clocksource_max_deferment - Returns max time the clocksource can be deferred
+ * clocksource_max_deferment - Returns max time the clocksource should be 
deferred
  * @cs: Pointer to clocksource
  *
  */
@@ -504,13 +510,7 @@ static u64 clocksource_max_deferment(struct clocksource 
*cs)
 
max_nsecs = clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj,
  cs->mask);
-   /*
-* To ensure that the clocksource does not wrap whilst we are idle,
-* limit the time the clocksource can be deferred by 12.5%. Please
-* note a margin of 12.5% is used because this can be computed with
-* a shift, versus say 10% which would require division.
-*/
-   return max_nsecs - (max_nsecs >> 3);
+   return max_nsecs;
 }
 
 #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
@@ -659,10 +659,9 @@ void __clocksource_updatefreq_scale(struct clocksource 
*cs, u32 scale, u32 freq)
 * conversion precision. 10 minutes is still a reasonable
 * amount. That results in a shift value of 24 for a
 * clocksource with mask >= 40bit and f >= 4GHz. That maps to
-* ~ 0.06ppm granularity for NTP. We apply the same 12.5%
-* margin as we do in clocksource_max_deferment()
+* ~ 0.06ppm granularity for NTP.
 */
-   sec = (cs->mask - (cs->mask >> 3));
+   sec = cs->mask;
do_div(sec, freq);
do_div(sec, scale);
if (!sec)
@@ -674,9 +673,8 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
   NSEC_PER_SEC / scale, sec * scale);
 
/*
-* for clocksources that have large mults, to avoid overflow.
-* Since mult may be adjusted by ntp, add an safety extra margin
-*
+* Ensure clocksources that have large mults don't overflow
+* when adjusted.
 */
cs->maxadj = clocksource_max_adjustment(cs);
while ((cs->mult + cs->maxadj < cs->mult)
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index 01d2d15..c794b84 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -125,9 +125,9 @@ void __init sched_clock_register(u64 (*read)(void), int 
bits,
 
new_mask = CLOCKSOURCE_MASK(bits);
 
-   /* calculate how many ns until we wrap */
+   /* calculate how many ns until we risk wrapping */
wrap = clocks_calc_max_nsecs(new_mult, new_shift, 0, new_mask);
-   new_wrap_kt = ns_to_ktime(wrap - (wrap >> 3));
+   new_wrap_kt = ns_to_ktime(wrap);
 
/* update epoch for new counter and update epoch_ns from old counter*/
new_epoch = read();
-- 
1.9.1

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

[PATCH 11/12] clocksource: Add some debug info about clocksources being registered

2015-03-11 Thread John Stultz
Print the mask, max_cycles, and max_idle_ns values for clocksources
being registered.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e31bd60..757d770 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -704,6 +704,9 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs->name);
 
clocksource_update_max_deferment(cs);
+
+   pr_info("clocksource %s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: 
%lld ns\n",
+   cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
-- 
1.9.1

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


[PATCH 06/12] time: Try to catch clocksource delta underflows

2015-03-11 Thread John Stultz
In the case where there is a broken clocksource
where there are multiple actual clocks that
aren't perfectly aligned, we may see small "negative"
deltas when we subtract 'now' from 'cycle_last'.

The values are actually negative with respect to the
clocksource mask value, not necessarily negative
if cast to a s64, but we can check by checking the
delta see if it is a small (relative to the mask)
negative value (again negative relative to the mask).

If so, we assume we jumped backwards somehow and
instead use zero for our delta.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/timekeeping.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index c06fe6e..2ba62fe 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -146,6 +146,13 @@ static inline cycle_t timekeeping_get_delta(struct 
tk_read_base *tkr)
/* calculate the delta since the last update_wall_time */
delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
 
+   /*
+* Try to catch underflows by checking if we are seeing small
+* mask-relative negative values.
+*/
+   if (unlikely((~delta & tkr->mask) < (tkr->mask >> 3)))
+   delta = 0;
+
/* Cap delta value to the max_cycles values to avoid mult overflows */
if (unlikely(delta > tkr->clock->max_cycles))
delta = tkr->clock->max_cycles;
-- 
1.9.1

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


[PATCH 09/12] clocksource: Mostly kill clocksource_register()

2015-03-11 Thread John Stultz
A long running project has been to cleanup remaining uses
of clocksource_register(), replacing it with the simpler
clocksource_register_khz/hz() functions.

However, there are a few cases where we need to self-define
our mult/shift values, so switch the function to a more
obviously internal __clocksource_register() name, and
consolidate much of the internal logic so we don't have
duplication.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: "David S. Miller" 
Cc: Martin Schwidefsky 
Signed-off-by: John Stultz 
---
 arch/s390/kernel/time.c |  2 +-
 arch/sparc/kernel/time_32.c |  2 +-
 include/linux/clocksource.h | 10 +-
 kernel/time/clocksource.c   | 81 +++--
 kernel/time/jiffies.c   |  4 +--
 5 files changed, 47 insertions(+), 52 deletions(-)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 20660dd..6c273cd 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -283,7 +283,7 @@ void __init time_init(void)
if (register_external_irq(EXT_IRQ_TIMING_ALERT, timing_alert_interrupt))
panic("Couldn't request external interrupt 0x1406");
 
-   if (clocksource_register(_tod) != 0)
+   if (__clocksource_register(_tod) != 0)
panic("Could not register TOD clock source");
 
/* Enable TOD clock interrupts on the boot cpu. */
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 2f80d23..a31c0c8 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -191,7 +191,7 @@ static __init int setup_timer_cs(void)
timer_cs.mult = clocksource_hz2mult(sparc_config.clock_rate,
timer_cs.shift);
 
-   return clocksource_register(_cs);
+   return __clocksource_register(_cs);
 }
 
 #ifdef CONFIG_SMP
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 63fe52f..c064349 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -179,7 +179,6 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 
mult, u32 shift)
 }
 
 
-extern int clocksource_register(struct clocksource*);
 extern int clocksource_unregister(struct clocksource*);
 extern void clocksource_touch_watchdog(void);
 extern struct clocksource* clocksource_get_next(void);
@@ -204,6 +203,15 @@ __clocksource_register_scale(struct clocksource *cs, u32 
scale, u32 freq);
 extern void
 __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq);
 
+/*
+ * Dont' call this unless you're a default clocksource
+ * (AKA: jiffies) and absolutely have to.
+ */
+static inline int __clocksource_register(struct clocksource *cs)
+{
+   return __clocksource_register_scale(cs, 1, 0);
+}
+
 static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
 {
return __clocksource_register_scale(cs, 1, hz);
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 340461e..e31bd60 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -657,38 +657,52 @@ static void clocksource_enqueue(struct clocksource *cs)
 void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 
freq)
 {
u64 sec;
+
/*
-* Calc the maximum number of seconds which we can run before
-* wrapping around. For clocksources which have a mask > 32bit
-* we need to limit the max sleep time to have a good
-* conversion precision. 10 minutes is still a reasonable
-* amount. That results in a shift value of 24 for a
-* clocksource with mask >= 40bit and f >= 4GHz. That maps to
-* ~ 0.06ppm granularity for NTP.
+* Default clocksources are *special* and self-define their mult/shift.
+* But, you're not special, so you should specify a freq value.
 */
-   sec = cs->mask;
-   do_div(sec, freq);
-   do_div(sec, scale);
-   if (!sec)
-   sec = 1;
-   else if (sec > 600 && cs->mask > UINT_MAX)
-   sec = 600;
-
-   clocks_calc_mult_shift(>mult, >shift, freq,
-  NSEC_PER_SEC / scale, sec * scale);
-
+   if (freq) {
+   /*
+* Calc the maximum number of seconds which we can run before
+* wrapping around. For clocksources which have a mask > 32-bit
+* we need to limit the max sleep time to have a good
+* conversion precision. 10 minutes is still a reasonable
+* amount. That results in a shift value of 24 for a
+* clocksource with mask >= 40-bit and f >= 4GHz. That maps to
+* ~ 0.06ppm granularity for NTP.
+*/
+   sec = cs->mask;
+   do_div(sec, freq);
+   do_div(sec, scale);
+   if (!sec)
+   

[PATCH 03/12] clocksource: Add max_cycles to clocksource structure

2015-03-11 Thread John Stultz
In order to facilitate some clocksource validation,
add a max_cycles entry to the structure which will
hold the maximum cycle value that can safely be
multiplied without potentially causing an overflow.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 include/linux/clocksource.h |  6 --
 kernel/time/clocksource.c   | 29 +
 kernel/time/sched_clock.c   |  2 +-
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 9c78d15..63fe52f 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -56,6 +56,7 @@ struct module;
  * @shift: cycle to nanosecond divisor (power of two)
  * @max_idle_ns:   max idle time permitted by the clocksource (nsecs)
  * @maxadj:maximum adjustment value to mult (~11%)
+ * @max_cycles:maximum safe cycle value which won't overflow 
on mult
  * @flags: flags describing special properties
  * @archdata:  arch-specific data
  * @suspend:   suspend function for the clocksource, if necessary
@@ -76,7 +77,7 @@ struct clocksource {
 #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
struct arch_clocksource_data archdata;
 #endif
-
+   u64 max_cycles;
const char *name;
struct list_head list;
int rating;
@@ -189,7 +190,8 @@ extern struct clocksource * __init 
clocksource_default_clock(void);
 extern void clocksource_mark_unstable(struct clocksource *cs);
 
 extern u64
-clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask);
+clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask,
+   u64 *max_cycles);
 extern void
 clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
 
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index fe64c7f..a491803 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -469,11 +469,14 @@ static u32 clocksource_max_adjustment(struct clocksource 
*cs)
  * @shift: cycle to nanosecond divisor (power of two)
  * @maxadj:maximum adjustment value to mult (~11%)
  * @mask:  bitmask for two's complement subtraction of non 64 bit counters
+ * @max_cyc:   maximum cycle value before potential overflow (does not include
+ * any safety margin)
  *
  * NOTE: This function includes a safety margin of 50%, so that bad clock 
values
  * can be detected.
  */
-u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask)
+u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask,
+   u64 *max_cyc)
 {
u64 max_nsecs, max_cycles;
 
@@ -493,6 +496,10 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, 
u64 mask)
max_cycles = min(max_cycles, mask);
max_nsecs = clocksource_cyc2ns(max_cycles, mult - maxadj, shift);
 
+   /* return the max_cycles value as well if requested */
+   if (max_cyc)
+   *max_cyc = max_cycles;
+
/* Return 50% of the actual maximum, so we can detect bad values */
max_nsecs >>= 1;
 
@@ -500,17 +507,15 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 
maxadj, u64 mask)
 }
 
 /**
- * clocksource_max_deferment - Returns max time the clocksource should be 
deferred
- * @cs: Pointer to clocksource
+ * clocksource_update_max_deferment - Updates the clocksource max_idle_ns & 
max_cycles
+ * @cs: Pointer to clocksource to be updated
  *
  */
-static u64 clocksource_max_deferment(struct clocksource *cs)
+static inline void clocksource_update_max_deferment(struct clocksource *cs)
 {
-   u64 max_nsecs;
-
-   max_nsecs = clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj,
- cs->mask);
-   return max_nsecs;
+   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
+   cs->maxadj, cs->mask,
+   >max_cycles);
 }
 
 #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
@@ -684,7 +689,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs->maxadj = clocksource_max_adjustment(cs);
}
 
-   cs->max_idle_ns = clocksource_max_deferment(cs);
+   clocksource_update_max_deferment(cs);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
@@ -730,8 +735,8 @@ int clocksource_register(struct clocksource *cs)
"Clocksource %s might overflow on 11%% adjustment\n",
cs->name);
 
-   /* calculate max idle time permitted for this clocksource */
-   cs->max_idle_ns = clocksource_max_deferment(cs);
+   /* Update max idle time permitted for this clocksource */
+   

[PATCH 12/12] clocksource: Rename __clocksource_updatefreq_* to __clocksource_update_freq_*

2015-03-11 Thread John Stultz
Ingo requested this function be renamed to improve readability, so
I've renamed __clocksource_updatefreq_scale() as well as the
__clocksource_updatefreq_hz/khz() functions to avoid
squishedtogethernames.

This touches some of the sh clocksources, which I've not tested.

The arch/arm/plat-omap change is just a comment change for
consistency.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Daniel Lezcano 
Signed-off-by: John Stultz 
---
 arch/arm/plat-omap/counter_32k.c |  2 +-
 drivers/clocksource/em_sti.c |  2 +-
 drivers/clocksource/sh_cmt.c |  2 +-
 drivers/clocksource/sh_tmu.c |  2 +-
 include/linux/clocksource.h  | 10 +-
 kernel/time/clocksource.c| 11 ++-
 6 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 61b4d70..43cf745 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -103,7 +103,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
 
/*
 * 12 rough estimate from the calculations in
-* __clocksource_updatefreq_scale.
+* __clocksource_update_freq_scale.
 */
clocks_calc_mult_shift(_mult, _shift,
32768, NSEC_PER_SEC, 12);
diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
index d0a7bd6..dc3c6ee 100644
--- a/drivers/clocksource/em_sti.c
+++ b/drivers/clocksource/em_sti.c
@@ -210,7 +210,7 @@ static int em_sti_clocksource_enable(struct clocksource *cs)
 
ret = em_sti_start(p, USER_CLOCKSOURCE);
if (!ret)
-   __clocksource_updatefreq_hz(cs, p->rate);
+   __clocksource_update_freq_hz(cs, p->rate);
return ret;
 }
 
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 2bd13b5..b8ff3c6 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -641,7 +641,7 @@ static int sh_cmt_clocksource_enable(struct clocksource *cs)
 
ret = sh_cmt_start(ch, FLAG_CLOCKSOURCE);
if (!ret) {
-   __clocksource_updatefreq_hz(cs, ch->rate);
+   __clocksource_update_freq_hz(cs, ch->rate);
ch->cs_enabled = true;
}
return ret;
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index f150ca82..b6b8fa3 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -272,7 +272,7 @@ static int sh_tmu_clocksource_enable(struct clocksource *cs)
 
ret = sh_tmu_enable(ch);
if (!ret) {
-   __clocksource_updatefreq_hz(cs, ch->rate);
+   __clocksource_update_freq_hz(cs, ch->rate);
ch->cs_enabled = true;
}
 
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c064349..68a8525 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -201,7 +201,7 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 
to, u32 minsec);
 extern int
 __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
 extern void
-__clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq);
+__clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq);
 
 /*
  * Dont' call this unless you're a default clocksource
@@ -222,14 +222,14 @@ static inline int clocksource_register_khz(struct 
clocksource *cs, u32 khz)
return __clocksource_register_scale(cs, 1000, khz);
 }
 
-static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz)
+static inline void __clocksource_update_freq_hz(struct clocksource *cs, u32 hz)
 {
-   __clocksource_updatefreq_scale(cs, 1, hz);
+   __clocksource_update_freq_scale(cs, 1, hz);
 }
 
-static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 
khz)
+static inline void __clocksource_update_freq_khz(struct clocksource *cs, u32 
khz)
 {
-   __clocksource_updatefreq_scale(cs, 1000, khz);
+   __clocksource_update_freq_scale(cs, 1000, khz);
 }
 
 
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 757d770..e5590c9 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -644,7 +644,7 @@ static void clocksource_enqueue(struct clocksource *cs)
 }
 
 /**
- * __clocksource_updatefreq_scale - Used update clocksource with new freq
+ * __clocksource_update_freq_scale - Used update clocksource with new freq
  * @cs:clocksource to be registered
  * @scale: Scale factor multiplied against freq to get clocksource hz
  * @freq:  clocksource frequency (cycles per second) divided by scale
@@ -652,9 +652,10 @@ static void clocksource_enqueue(struct clocksource *cs)
  * This should only be called from the clocksource->enable() method.
  *
  * This *SHOULD NOT* be called directly! Please use the
- * 

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

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

Thus, this patch adds some extra infrastructure to
add a check update_wall_time() to print warnings if we
see the call delayed beyond the max_cycles overflow
point, or beyond the clocksource max_idle_ns value
which is currently 50% of the overflow point.

This extra infrastructure is conditionalized
behind a new CONFIG_DEBUG_TIMEKEEPING option
also added in this patch.

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

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/jiffies.c |  1 +
 kernel/time/timekeeping.c | 27 +++
 lib/Kconfig.debug | 12 
 3 files changed, 40 insertions(+)

diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index a6a5bf5..7e41390 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -71,6 +71,7 @@ static struct clocksource clocksource_jiffies = {
.mask   = 0x, /*32bits*/
.mult   = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
.shift  = JIFFIES_SHIFT,
+   .max_cycles = 10,
 };
 
 __cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 91db941..882ba5b 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -118,6 +118,30 @@ static inline void tk_update_sleep_time(struct timekeeper 
*tk, ktime_t delta)
tk->offs_boot = ktime_add(tk->offs_boot, delta);
 }
 
+#ifdef CONFIG_DEBUG_TIMEKEEPING
+static void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
+{
+
+   cycle_t max_cycles = tk->tkr.clock->max_cycles;
+   const char *name = tk->tkr.clock->name;
+
+   if (offset > max_cycles) {
+   printk_deferred("ERROR: cycle offset (%lld) is larger than  
allowed %s max_cycles (%lld)\n",
+   offset, name, max_cycles);
+   } else {
+   if (offset > (max_cycles >> 1)) {
+   printk_deferred("WARNING: cycle offset (%lld) is past 
the %s 50%% safety margin (%lld)\n",
+   offset, name, max_cycles>>1);
+   }
+   }
+}
+#else
+static inline
+void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
+{
+}
+#endif
+
 /**
  * tk_setup_internals - Set up internals to use clocksource clock.
  *
@@ -1630,6 +1654,9 @@ void update_wall_time(void)
if (offset < real_tk->cycle_interval)
goto out;
 
+   /* Do some additional sanity checking */
+   timekeeping_check_update(real_tk, offset);
+
/*
 * With NO_HZ we may have to accumulate many cycle_intervals
 * (think "ticks") worth of time at once. To do this efficiently,
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c5cefb3..408d32e 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -865,6 +865,18 @@ config SCHED_STACK_END_CHECK
  data corruption or a sporadic crash at a later stage once the region
  is examined. The runtime overhead introduced is minimal.
 
+config DEBUG_TIMEKEEPING
+   bool "Enable extra timekeeping sanity checking"
+   help
+ This option will enable additional timekeeping sanity checks
+ which may be helpful when diagnosing issues where timekeeping
+ problems are suspected.
+
+ This may include checks in the timekeeping hotpaths, so this
+ option may have a performance impact to some workloads.
+
+ If unsure, say N.
+
 config TIMER_STATS
bool "Collect kernel timers statistics"
depends on DEBUG_KERNEL && PROC_FS
-- 
1.9.1

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


[PATCH] staging: fsl-mc: Corrected email addresses in TODO file

2015-03-11 Thread J. German Rivera
Signed-off-by: J. German Rivera 
---
 drivers/staging/fsl-mc/TODO | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-mc/TODO b/drivers/staging/fsl-mc/TODO
index 49ebfd9..d78288b 100644
--- a/drivers/staging/fsl-mc/TODO
+++ b/drivers/staging/fsl-mc/TODO
@@ -8,5 +8,6 @@
 * Add at least one device driver for a DPAA2 object (child device of the
   fsl-mc bus).
 
-Please send any patches to Greg Kroah-Hartman ,
-de...@driverdev.osuosl.org, linux-kernel@vger.kernel.org
+Please send any patches to Greg Kroah-Hartman ,
+german.riv...@freescale.com, de...@driverdev.osuosl.org,
+linux-kernel@vger.kernel.org
-- 
2.3.2

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


Re: [PATCH v4] HID: multitouch: Add support for button type usage

2015-03-11 Thread Jiri Kosina
On Wed, 11 Mar 2015, Benjamin Tissoires wrote:

> On Mar 11 2015 or thereabouts, Seth Forshee wrote:
> > According to [1], Windows Precision Touchpad devices must supply
> > a button type usage in the device capabilities feature report. A
> > value of 0 indicates that the device contains a depressible
> > button (i.e. it's a click-pad) whereas a value of 1 indicates
> > a non-depressible button. Add support for this usage and set
> > INPUT_PROP_BUTTONPAD on the touchpad input device whenever a
> > depressible button is present.
> > 
> > [1] 
> > https://msdn.microsoft.com/en-us/library/windows/hardware/dn467314(v=vs.85).aspx
> > 
> > Signed-off-by: Seth Forshee 
> > ---
> 
> Reviewed-by: Benjamin Tissoires 
> 
> Thanks for the quick re-spin

Applied to for-4.1/multitouch.

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


Re: [PATCH 3/15] net/mlx5_core: don't export static symbol

2015-03-11 Thread David Miller
From: Julia Lawall 
Date: Wed, 11 Mar 2015 17:56:25 +0100

> From: Julia Lawall 
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall 

Applied, thank you Julia.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kobject: WARN as tip when call kobject_get() to a kobject not initialized

2015-03-11 Thread Ethan Zhao
call kobject_get() to kojbect that is not initalized or released will only
leave following like call trace to us:

---[ cut here ]
[   54.545816] WARNING: CPU: 0 PID: 213 at include/linux/kref.h:47
kobject_get+0x41/0x50()
[   54.642595] Modules linked in: i2c_i801(+) mfd_core shpchp(+)
acpi_cpufreq(+) edac_core ioatdma(+) xfs libcrc32c ast syscopyarea ixgbe
sysfillrect sysimgblt sr_mod sd_mod drm_kms_helper igb mdio cdrom e1000e ahci
dca ttm libahci uas drm i2c_algo_bit ptp megaraid_sas libata usb_storage
i2c_core pps_core dm_mirror dm_region_hash dm_log dm_mod
[   55.007264] CPU: 0 PID: 213 Comm: kworker/0:2 Not tainted
3.18.5
[   55.099970] Hardware name: Oracle Corporation SUN FIRE X4170 M2 SERVER
   /ASSY,MOTHERBOARD,X4170, BIOS 08120104 05/08/2012
[   55.239736] Workqueue: kacpi_notify acpi_os_execute_deferred
[   55.308598]   bd730b61 88046742baf8
816b7edb
[   55.398305]    88046742bb38
81078ae1
[   55.488040]  88046742bbd8 8806706b3000 0292

[   55.56] Call Trace:
[   55.608228]  [] dump_stack+0x46/0x58
[   55.670895]  [] warn_slowpath_common+0x81/0xa0
[   55.743952]  [] warn_slowpath_null+0x1a/0x20
[   55.814929]  [] kobject_get+0x41/0x50
[   55.878654]  [] cpufreq_cpu_get+0x75/0xc0
[   55.946528]  [] cpufreq_update_policy+0x2e/0x1f0

The above issue was casued by a race condition, if there is a WARN in
kobject_get() of the kobject is not initialized, that would save us much
time to debug it.

Signed-off-by: Ethan Zhao 
---
 lib/kobject.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index 03d4ab3..3b841b9 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -576,8 +576,13 @@ void kobject_del(struct kobject *kobj)
  */
 struct kobject *kobject_get(struct kobject *kobj)
 {
-   if (kobj)
+   if (kobj) {
+   if (!kobj->state_initialized)
+   WARN(1, KERN_WARNING "kobject: '%s' (%p): is not "
+  "initialized, yet kobject_get() is being "
+  "called.\n", kobject_name(kobj), kobj);
kref_get(>kref);
+   }
return kobj;
 }
 
-- 
1.8.3.1

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


[ALSA] f2c5784f827: snd_hda_codec_hdmi hdaudioC1D0: Unable to sync register 0x4f0009. -5

2015-03-11 Thread Fengguang Wu
Hi Takashi,

We noticed the below dmesg errors on

git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/hda-regmap
commit f2c5784f82792221990f708dff42a71a4a51b721 ("ALSA: hda - Use regmap for 
amp accesses")

<6>[   17.709789] snd_hda_intel :02:00.1: Disabling MSI
<6>[   17.710115] snd_hda_intel :02:00.1: Handle VGA-switcheroo audio client
<6>[   17.748128] snd_hda_codec_realtek hdaudioC0D2: autoconfig for ALC898: 
line_outs=3 (0x14/0x15/0x16/0x0/0x0) type:line
<6>[   17.748729] snd_hda_codec_realtek hdaudioC0D2:speaker_outs=0 
(0x0/0x0/0x0/0x0/0x0)
<6>[   17.749253] snd_hda_codec_realtek hdaudioC0D2:hp_outs=1 
(0x1b/0x0/0x0/0x0/0x0)
<6>[   17.749735] snd_hda_codec_realtek hdaudioC0D2:mono: mono_out=0x0
<6>[   17.750102] snd_hda_codec_realtek hdaudioC0D2:dig-out=0x1e/0x0
<6>[   17.750456] snd_hda_codec_realtek hdaudioC0D2:inputs:
<6>[   17.750788] snd_hda_codec_realtek hdaudioC0D2:  Front Mic=0x19
<6>[   17.751140] snd_hda_codec_realtek hdaudioC0D2:  Rear Mic=0x18
<6>[   17.751494] snd_hda_codec_realtek hdaudioC0D2:  Line=0x1a
<6>[   17.765185] input: HDA Intel PCH Front Mic as 
/devices/pci:00/:00:1b.0/sound/card0/input2
<6>[   17.765787] input: HDA Intel PCH Rear Mic as 
/devices/pci:00/:00:1b.0/sound/card0/input3
<6>[   17.765845] input: HDA Intel PCH Line as 
/devices/pci:00/:00:1b.0/sound/card0/input4
<6>[   17.765895] input: HDA Intel PCH Line Out Front as 
/devices/pci:00/:00:1b.0/sound/card0/input5
<6>[   17.765958] input: HDA Intel PCH Line Out Surround as 
/devices/pci:00/:00:1b.0/sound/card0/input6
<6>[   17.765999] input: HDA Intel PCH Line Out CLFE as 
/devices/pci:00/:00:1b.0/sound/card0/input7
<6>[   17.766041] input: HDA Intel PCH Front Headphone as 
/devices/pci:00/:00:1b.0/sound/card0/input8
<6>[   17.896645] input: HDA NVidia HDMI/DP,pcm=3 as 
/devices/pci:00/:00:02.0/:02:00.1/sound/card1/input9
<6>[   17.897272] input: HDA NVidia HDMI/DP,pcm=7 as 
/devices/pci:00/:00:02.0/:02:00.1/sound/card1/input10
<6>[   17.897914] input: HDA NVidia HDMI/DP,pcm=8 as 
/devices/pci:00/:00:02.0/:02:00.1/sound/card1/input11
<6>[   17.898581] input: HDA NVidia HDMI/DP,pcm=9 as 
/devices/pci:00/:00:02.0/:02:00.1/sound/card1/input12
<3>[   17.919298] snd_hda_codec_hdmi hdaudioC1D0: Unable to sync register 
0x4f0009. -5
<3>[   17.929749] snd_hda_codec_realtek hdaudioC0D2: Unable to sync register 
0x2f000a. -5
<3>[   17.930271] snd_hda_codec_realtek hdaudioC0D2: Unable to sync register 
0x2f000a. -5

It's almost 100% reproducible:

testbox/testcase/testparams: lituya/will-it-scale/performance-writeseek3

74b67c48b10486f1  f2c5784f82792221990f708dff  
  --  
   fail:runs  %reproductionfail:runs
   | | |
   :10 100%  10:10
kmsg.snd_hda_codec_hdmi_hdaudioC1D0:Unable_to_sync_register
   :10 100%  10:10
kmsg.snd_hda_codec_realtek_hdaudioC0D2:Unable_to_sync_register

testbox/testcase/testparams: avoton3/netperf/performance-300s-200%-TCP_RR

74b67c48b10486f1  f2c5784f82792221990f708dff  
  --  
   :20  95%  19:20
kmsg.snd_hda_codec_hdmi_hdaudioC0D0:Unable_to_sync_register

Thanks,
Fengguang 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/


[PATCH 5/7] dm: add full blk-mq support to request-based DM

2015-03-11 Thread Mike Snitzer
Commit e5863d9ad ("dm: allocate requests in target when stacking on
blk-mq devices") served as the first step toward fully utilizing blk-mq
in request-based DM -- it enabled stacking a old-style (request_fn)
request_queue ontop of the underlying blk-mq device(s).  This first step
didn't improve performance of DM multipath ontop of fast blk-mq devices
(e.g. NVMe) because the top-level old-style request_queue was severely
limited by the queue_lock.

The second step offered here enables stacking a blk-mq request_queue
ontop of the underlying blk-mq device(s).  This unlocks significant
performance gains on fast blk-mq devices, Keith Busch tested on his NVMe
testbed and offered this really positive news:

 "Just providing a performance update. All my fio tests are getting
  roughly equal performance whether accessed through the raw block
  device or the multipath device mapper (~470k IOPS). I could only push
  ~20% of the raw iops through dm before this conversion, so this latest
  tree is looking really solid from a performance standpoint."

Tested-by: Keith Busch 
Signed-off-by: Mike Snitzer 
---
 drivers/md/dm-mpath.c |   4 +-
 drivers/md/dm-table.c |  11 +-
 drivers/md/dm.c   | 326 +++---
 3 files changed, 269 insertions(+), 72 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index add6391..2bb6599 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -428,9 +428,9 @@ static int __multipath_map(struct dm_target *ti, struct 
request *clone,
} else {
/* blk-mq request-based interface */
*__clone = blk_get_request(bdev_get_queue(bdev),
-  rq_data_dir(rq), GFP_KERNEL);
+  rq_data_dir(rq), GFP_ATOMIC);
if (IS_ERR(*__clone))
-   /* ENOMEM, requeue */
+   /* ENOMEM or EBUSY, requeue */
return r;
(*__clone)->bio = (*__clone)->biotail = NULL;
(*__clone)->rq_disk = bdev->bd_disk;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 0573120..66600ca 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DM_MSG_PREFIX "table"
 
@@ -1695,9 +1696,13 @@ void dm_table_run_md_queue_async(struct dm_table *t)
md = dm_table_get_md(t);
queue = dm_get_md_queue(md);
if (queue) {
-   spin_lock_irqsave(queue->queue_lock, flags);
-   blk_run_queue_async(queue);
-   spin_unlock_irqrestore(queue->queue_lock, flags);
+   if (queue->mq_ops)
+   blk_mq_run_hw_queues(queue, true);
+   else {
+   spin_lock_irqsave(queue->queue_lock, flags);
+   blk_run_queue_async(queue);
+   spin_unlock_irqrestore(queue->queue_lock, flags);
+   }
}
 }
 EXPORT_SYMBOL(dm_table_run_md_queue_async);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index b8cb2d5..b5409ac 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include  /* for rq_end_sector() */
+#include 
 
 #include 
 
@@ -224,6 +225,9 @@ struct mapped_device {
int last_rq_rw;
sector_t last_rq_pos;
ktime_t last_rq_start_time;
+
+   /* for blk-mq request-based DM support */
+   struct blk_mq_tag_set tag_set;
 };
 
 /*
@@ -1022,6 +1026,11 @@ static void end_clone_bio(struct bio *clone, int error)
blk_update_request(tio->orig, 0, nr_bytes);
 }
 
+static struct dm_rq_target_io *tio_from_request(struct request *rq)
+{
+   return (rq->q->mq_ops ? blk_mq_rq_to_pdu(rq) : rq->special);
+}
+
 /*
  * Don't touch any member of the md after calling this function because
  * the md may be freed in dm_put() at the end of this function.
@@ -1045,8 +1054,10 @@ static void rq_completed(struct mapped_device *md, int 
rw, bool run_queue)
 * queue lock again.
 */
if (run_queue) {
-   if (!nr_requests_pending ||
-   (nr_requests_pending >= md->queue->nr_congestion_on))
+   if (md->queue->mq_ops)
+   blk_mq_run_hw_queues(md->queue, true);
+   else if (!nr_requests_pending ||
+(nr_requests_pending >= md->queue->nr_congestion_on))
blk_run_queue_async(md->queue);
}
 
@@ -1059,13 +1070,17 @@ static void rq_completed(struct mapped_device *md, int 
rw, bool run_queue)
 static void free_rq_clone(struct request *clone)
 {
struct dm_rq_target_io *tio = clone->end_io_data;
+   struct mapped_device *md = tio->md;
 
blk_rq_unprep_clone(clone);
+
if (clone->q && clone->q->mq_ops)
tio->ti->type->release_clone_rq(clone);
else
-   free_clone_request(tio->md, 

[PATCH 0/7] dm: add full blk-mq support to request-based DM

2015-03-11 Thread Mike Snitzer
This patchset updates request-based DM (used exclussively by DM
multipath) to support blk-mq I/O path or the old ->request_fn I/O
path -- the default is still the old ->request_fn I/O path.

Like was done for SCSI, I've exposed a dm-mod.ko 'use_blk_mq' module
parameter and a CONFIG_DM_MQ_DEFAULT.  I've queued these patches in
linux-next via linux-dm.git's 'for-next' branch -- my goal is for
these changes to land upstream in 4.1.

I've tested all 4 supported permutations of rq-based queue stacking:
1) blk-mq mpath stacked on blk-mq device(s)
2) blk-mq mpath stacked on ->request_fn device(s)
3) old ->request_fn mpath stacked on blk-mq device(s)
4) old ->request_fn mpath stacked on old ->request_fn device(s)

There is definitely much more room for optimizing the blk-mq mpath
queue (via dm_mq_ops setup) to have more awareness about the
characteristics of the underlying blk-mq device(s) -- Jens offered
some suggestions that are worth pursuing.  Goal being to leverage the
ability to have multiple software submission queues that map to the
underlying paths' HW queue.  I expect Keith to be the most likely
person to pursue these follow-on optimizations given his immediate
access to NVMe devices, etc.

blk-mq allows for the removal of 2 of the 3 mempools and associated
allocations that were traditionally performed using old ->request_fn
I/O path.  The md->bs bioset still remains for cloning a request's
bios.

I'll be pursuing the possibility of removing the bio cloning that
happens when cloning a request (it was put in place for partial
completion of a request's bios but the prospect of avoiding those bio
clones warrants further review of how useful those partial completions
are, see: http://www.redhat.com/archives/dm-devel/2014-June/msg00030.html)

Jens and Keith, special thanks for your help answering more blk-mq
questions than I'd have hoped would be needed while at LSF/MM.

Keith Busch (1):
  blk-mq: don't wait in blk_mq_queue_enter() if __GFP_WAIT isn't set

Mike Snitzer (6):
  blk-mq: fix use of incorrect goto label in blk_mq_init_queue error path
  blk-mq: add blk_mq_init_allocated_queue and export blk_mq_register_disk
  blk-mq: export blk_mq_run_hw_queues
  dm: add full blk-mq support to request-based DM
  dm: optimize dm_mq_queue_rq to _not_ use kthread if using pure blk-mq
  dm: add 'use_blk_mq' module param and expose in per-device ro sysfs attr

 block/blk-mq-sysfs.c   |   1 +
 block/blk-mq.c |  47 --
 drivers/md/Kconfig |  11 ++
 drivers/md/dm-mpath.c  |   4 +-
 drivers/md/dm-sysfs.c  |   9 ++
 drivers/md/dm-table.c  |  17 +-
 drivers/md/dm.c| 414 +++--
 drivers/md/dm.h|   5 +-
 include/linux/blk-mq.h |   3 +
 9 files changed, 401 insertions(+), 110 deletions(-)

-- 
1.9.5 (Apple Git-50.3)

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


[PATCH 6/7] dm: optimize dm_mq_queue_rq to _not_ use kthread if using pure blk-mq

2015-03-11 Thread Mike Snitzer
dm_mq_queue_rq() is in atomic context so care must be taken to not
sleep -- as such GFP_ATOMIC is used for the md->bs bioset allocations
and dm-mpath's call to blk_get_request().  In the future the bioset
allocations will hopefully go away (by removing support for partial
completions of a request).

But the kthread will still be used to queue work if blk-mq is used ontop
of old-style request_fn device(s).  Also prepare for supporting DM
blk-mq ontop of old-style request_fn device(s) if a new dm-mod
'use_blk_mq' parameter is set.

Signed-off-by: Mike Snitzer 
---
 drivers/md/dm.c | 65 +++--
 1 file changed, 45 insertions(+), 20 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index b5409ac..b0c965a 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1074,9 +1074,10 @@ static void free_rq_clone(struct request *clone)
 
blk_rq_unprep_clone(clone);
 
-   if (clone->q && clone->q->mq_ops)
+   if (clone->q->mq_ops)
tio->ti->type->release_clone_rq(clone);
-   else
+   else if (!md->queue->mq_ops)
+   /* request_fn queue stacked on request_fn queue(s) */
free_clone_request(md, clone);
 
if (!md->queue->mq_ops)
@@ -1835,15 +1836,25 @@ static int setup_clone(struct request *clone, struct 
request *rq,
 static struct request *clone_rq(struct request *rq, struct mapped_device *md,
struct dm_rq_target_io *tio, gfp_t gfp_mask)
 {
-   struct request *clone = alloc_clone_request(md, gfp_mask);
+   /*
+* Do not allocate a clone if tio->clone was already set
+* (see: dm_mq_queue_rq).
+*/
+   bool alloc_clone = !tio->clone;
+   struct request *clone;
 
-   if (!clone)
-   return NULL;
+   if (alloc_clone) {
+   clone = alloc_clone_request(md, gfp_mask);
+   if (!clone)
+   return NULL;
+   } else
+   clone = tio->clone;
 
blk_rq_init(NULL, clone);
if (setup_clone(clone, rq, tio, gfp_mask)) {
/* -ENOMEM */
-   free_clone_request(md, clone);
+   if (alloc_clone)
+   free_clone_request(md, clone);
return NULL;
}
 
@@ -1861,7 +1872,8 @@ static void init_tio(struct dm_rq_target_io *tio, struct 
request *rq,
tio->orig = rq;
tio->error = 0;
memset(>info, 0, sizeof(tio->info));
-   init_kthread_work(>work, map_tio_request);
+   if (md->kworker_task)
+   init_kthread_work(>work, map_tio_request);
 }
 
 static struct dm_rq_target_io *prep_tio(struct request *rq,
@@ -1938,7 +1950,7 @@ static int map_request(struct dm_rq_target_io *tio, 
struct request *rq,
}
if (IS_ERR(clone))
return DM_MAPIO_REQUEUE;
-   if (setup_clone(clone, rq, tio, GFP_NOIO)) {
+   if (setup_clone(clone, rq, tio, GFP_ATOMIC)) {
/* -ENOMEM */
ti->type->release_clone_rq(clone);
return DM_MAPIO_REQUEUE;
@@ -2403,7 +2415,7 @@ static void __bind_mempools(struct mapped_device *md, 
struct dm_table *t)
p->bs = NULL;
 
 out:
-   /* mempool bind completed, now no need any mempools in the table */
+   /* mempool bind completed, no longer need any mempools in the table */
dm_table_free_md_mempools(t);
 }
 
@@ -2708,17 +2720,25 @@ static int dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
/* Init tio using md established in .init_request */
init_tio(tio, rq, md);
 
+   /*
+* Establish tio->ti before queuing work (map_tio_request)
+* or making direct call to map_request().
+*/
+   tio->ti = ti;
+
/* Clone the request if underlying devices aren't blk-mq */
if (dm_table_get_type(map) == DM_TYPE_REQUEST_BASED) {
-   // FIXME: make the memory for clone part of the pdu
+   /* clone request is allocated at the end of the pdu */
+   tio->clone = (void *)blk_mq_rq_to_pdu(rq) + sizeof(struct 
dm_rq_target_io);
if (!clone_rq(rq, md, tio, GFP_ATOMIC))
return BLK_MQ_RQ_QUEUE_BUSY;
+   queue_kthread_work(>kworker, >work);
+   } else {
+   /* Direct call is fine since .queue_rq allows allocations */
+   if (map_request(tio, rq, md) == DM_MAPIO_REQUEUE)
+   dm_requeue_unmapped_original_request(md, rq);
}
 
-   /* Establish tio->ti before queuing work (map_tio_request) */
-   tio->ti = ti;
-   queue_kthread_work(>kworker, >work);
-
return BLK_MQ_RQ_QUEUE_OK;
 }
 
@@ -2731,6 +2751,7 @@ static struct blk_mq_ops dm_mq_ops = {
 
 static int dm_init_request_based_blk_mq_queue(struct mapped_device *md)
 {
+   unsigned md_type = dm_get_md_type(md);
struct 

[PATCH 3/7] blk-mq: export blk_mq_run_hw_queues

2015-03-11 Thread Mike Snitzer
Rename blk_mq_run_queues to blk_mq_run_hw_queues, add async argument,
and export it.

DM's suspend support must be able to run the queue without starting
stopped hw queues.

Signed-off-by: Mike Snitzer 
---
 block/blk-mq.c | 8 
 include/linux/blk-mq.h | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index d576a78..5706dd9 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -33,7 +33,6 @@ static DEFINE_MUTEX(all_q_mutex);
 static LIST_HEAD(all_q_list);
 
 static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx);
-static void blk_mq_run_queues(struct request_queue *q);
 
 /*
  * Check if any of the ctx's have pending work in this hardware queue
@@ -118,7 +117,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q)
 
if (freeze) {
percpu_ref_kill(>mq_usage_counter);
-   blk_mq_run_queues(q);
+   blk_mq_run_hw_queues(q, false);
}
 }
 EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start);
@@ -904,7 +903,7 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool 
async)
>run_work, 0);
 }
 
-static void blk_mq_run_queues(struct request_queue *q)
+void blk_mq_run_hw_queues(struct request_queue *q, bool async)
 {
struct blk_mq_hw_ctx *hctx;
int i;
@@ -915,9 +914,10 @@ static void blk_mq_run_queues(struct request_queue *q)
test_bit(BLK_MQ_S_STOPPED, >state))
continue;
 
-   blk_mq_run_hw_queue(hctx, false);
+   blk_mq_run_hw_queue(hctx, async);
}
 }
+EXPORT_SYMBOL(blk_mq_run_hw_queues);
 
 void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx)
 {
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 9a75c88..ebfe707 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -220,6 +220,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
 void blk_mq_stop_hw_queues(struct request_queue *q);
 void blk_mq_start_hw_queues(struct request_queue *q);
 void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
+void blk_mq_run_hw_queues(struct request_queue *q, bool async);
 void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
 void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
void *priv);
-- 
1.9.5 (Apple Git-50.3)

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


[PATCH 4/7] blk-mq: don't wait in blk_mq_queue_enter() if __GFP_WAIT isn't set

2015-03-11 Thread Mike Snitzer
From: Keith Busch 

Return -EBUSY if we're unable to enter a queue immediately when
allocating a blk-mq request without __GFP_WAIT.

Signed-off-by: Keith Busch 
Signed-off-by: Mike Snitzer 
---
 block/blk-mq.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 5706dd9..01b2912 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -77,7 +77,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx 
*hctx,
clear_bit(CTX_TO_BIT(hctx, ctx), >word);
 }
 
-static int blk_mq_queue_enter(struct request_queue *q)
+static int blk_mq_queue_enter(struct request_queue *q, gfp_t gfp)
 {
while (true) {
int ret;
@@ -85,6 +85,9 @@ static int blk_mq_queue_enter(struct request_queue *q)
if (percpu_ref_tryget_live(>mq_usage_counter))
return 0;
 
+   if (!(gfp & __GFP_WAIT))
+   return -EBUSY;
+
ret = wait_event_interruptible(q->mq_freeze_wq,
!q->mq_freeze_depth || blk_queue_dying(q));
if (blk_queue_dying(q))
@@ -256,7 +259,7 @@ struct request *blk_mq_alloc_request(struct request_queue 
*q, int rw, gfp_t gfp,
struct blk_mq_alloc_data alloc_data;
int ret;
 
-   ret = blk_mq_queue_enter(q);
+   ret = blk_mq_queue_enter(q, gfp);
if (ret)
return ERR_PTR(ret);
 
@@ -1186,7 +1189,7 @@ static struct request *blk_mq_map_request(struct 
request_queue *q,
int rw = bio_data_dir(bio);
struct blk_mq_alloc_data alloc_data;
 
-   if (unlikely(blk_mq_queue_enter(q))) {
+   if (unlikely(blk_mq_queue_enter(q, GFP_KERNEL))) {
bio_endio(bio, -EIO);
return NULL;
}
-- 
1.9.5 (Apple Git-50.3)

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


[PATCH 7/7] dm: add 'use_blk_mq' module param and expose in per-device ro sysfs attr

2015-03-11 Thread Mike Snitzer
Request-based DM's blk-mq support defaults to off; but a user can easily
change the default using the dm_mod.use_blk_mq module/boot option.

Also, you can check what mode a given request-based DM device is using
with: cat /sys/block/dm-X/dm/use_blk_mq

This change enabled further cleanup and reduced work (e.g. the
md->io_pool and md->rq_pool isn't created if using blk-mq).

Signed-off-by: Mike Snitzer 
---
 drivers/md/Kconfig| 11 +++
 drivers/md/dm-sysfs.c |  9 +
 drivers/md/dm-table.c |  6 +++---
 drivers/md/dm.c   | 51 ---
 drivers/md/dm.h   |  5 -
 5 files changed, 67 insertions(+), 15 deletions(-)

diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 63e05e3..109f9dc 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -196,6 +196,17 @@ config BLK_DEV_DM
 
  If unsure, say N.
 
+config DM_MQ_DEFAULT
+   bool "request-based DM: use blk-mq I/O path by default"
+   depends on BLK_DEV_DM
+   ---help---
+ This option enables the blk-mq based I/O path for request-based
+ DM devices by default.  With the option the dm_mod.use_blk_mq
+ module/boot option defaults to Y, without it to N, but it can
+ still be overriden either way.
+
+ If unsure say N.
+
 config DM_DEBUG
bool "Device mapper debugging support"
depends on BLK_DEV_DM
diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c
index f5bb394..7e818f5 100644
--- a/drivers/md/dm-sysfs.c
+++ b/drivers/md/dm-sysfs.c
@@ -89,15 +89,24 @@ static ssize_t dm_attr_suspended_show(struct mapped_device 
*md, char *buf)
return strlen(buf);
 }
 
+static ssize_t dm_attr_use_blk_mq_show(struct mapped_device *md, char *buf)
+{
+   sprintf(buf, "%d\n", dm_use_blk_mq(md));
+
+   return strlen(buf);
+}
+
 static DM_ATTR_RO(name);
 static DM_ATTR_RO(uuid);
 static DM_ATTR_RO(suspended);
+static DM_ATTR_RO(use_blk_mq);
 static DM_ATTR_RW(rq_based_seq_io_merge_deadline);
 
 static struct attribute *dm_attrs[] = {
_attr_name.attr,
_attr_uuid.attr,
_attr_suspended.attr,
+   _attr_use_blk_mq.attr,
_attr_rq_based_seq_io_merge_deadline.attr,
NULL,
 };
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 66600ca..8d025f3 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -940,7 +940,7 @@ bool dm_table_mq_request_based(struct dm_table *t)
return dm_table_get_type(t) == DM_TYPE_MQ_REQUEST_BASED;
 }
 
-static int dm_table_alloc_md_mempools(struct dm_table *t)
+static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device 
*md)
 {
unsigned type = dm_table_get_type(t);
unsigned per_bio_data_size = 0;
@@ -958,7 +958,7 @@ static int dm_table_alloc_md_mempools(struct dm_table *t)
per_bio_data_size = max(per_bio_data_size, 
tgt->per_bio_data_size);
}
 
-   t->mempools = dm_alloc_md_mempools(type, t->integrity_supported, 
per_bio_data_size);
+   t->mempools = dm_alloc_md_mempools(md, type, t->integrity_supported, 
per_bio_data_size);
if (!t->mempools)
return -ENOMEM;
 
@@ -1128,7 +1128,7 @@ int dm_table_complete(struct dm_table *t)
return r;
}
 
-   r = dm_table_alloc_md_mempools(t);
+   r = dm_table_alloc_md_mempools(t, t->md);
if (r)
DMERR("unable to allocate mempools");
 
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index b0c965a..3165b94 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -228,8 +228,20 @@ struct mapped_device {
 
/* for blk-mq request-based DM support */
struct blk_mq_tag_set tag_set;
+   bool use_blk_mq;
 };
 
+#ifdef CONFIG_DM_MQ_DEFAULT
+static bool use_blk_mq = true;
+#else
+static bool use_blk_mq = false;
+#endif
+
+bool dm_use_blk_mq(struct mapped_device *md)
+{
+   return md->use_blk_mq;
+}
+
 /*
  * For mempools pre-allocation at the table loading time.
  */
@@ -2219,6 +2231,7 @@ static void dm_init_md_queue(struct mapped_device *md)
 
 static void dm_init_old_md_queue(struct mapped_device *md)
 {
+   md->use_blk_mq = false;
dm_init_md_queue(md);
 
/*
@@ -2260,6 +2273,7 @@ static struct mapped_device *alloc_dev(int minor)
if (r < 0)
goto bad_io_barrier;
 
+   md->use_blk_mq = use_blk_mq;
md->type = DM_TYPE_NONE;
mutex_init(>suspend_lock);
mutex_init(>type_lock);
@@ -2346,7 +2360,6 @@ static void unlock_fs(struct mapped_device *md);
 static void free_dev(struct mapped_device *md)
 {
int minor = MINOR(disk_devt(md->disk));
-   bool using_blk_mq = !!md->queue->mq_ops;
 
unlock_fs(md);
bdput(md->bdev);
@@ -2372,7 +2385,7 @@ static void free_dev(struct mapped_device *md)
 
put_disk(md->disk);
blk_cleanup_queue(md->queue);
-   if (using_blk_mq)
+   if (md->use_blk_mq)

[PATCH 2/7] blk-mq: add blk_mq_init_allocated_queue and export blk_mq_register_disk

2015-03-11 Thread Mike Snitzer
Add a variant of blk_mq_init_queue that allows a previously allocated
queue to be initialized.  blk_mq_init_allocated_queue models
blk_init_allocated_queue -- which was also created for DM's use.

DM's approach to device creation requires a placeholder request_queue be
allocated for use with alloc_dev() but the decision about what type of
request_queue will be ultimately created is deferred until all component
devices referenced in the DM table are processed to determine the table
type (request-based, blk-mq request-based, or bio-based).

Signed-off-by: Mike Snitzer 
---
 block/blk-mq-sysfs.c   |  1 +
 block/blk-mq.c | 28 +++-
 include/linux/blk-mq.h |  2 ++
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 1630a20..b79685e 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -436,6 +436,7 @@ int blk_mq_register_disk(struct gendisk *disk)
 
return 0;
 }
+EXPORT_SYMBOL_GPL(blk_mq_register_disk);
 
 void blk_mq_sysfs_unregister(struct request_queue *q)
 {
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 459840c..d576a78 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1891,9 +1891,25 @@ void blk_mq_release(struct request_queue *q)
 
 struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set)
 {
+   struct request_queue *uninit_q, *q;
+
+   uninit_q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node);
+   if (!uninit_q)
+   return ERR_PTR(-ENOMEM);
+
+   q = blk_mq_init_allocated_queue(set, uninit_q);
+   if (!q)
+   blk_cleanup_queue(uninit_q);
+
+   return q;
+}
+EXPORT_SYMBOL(blk_mq_init_queue);
+
+struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
+ struct request_queue *q)
+{
struct blk_mq_hw_ctx **hctxs;
struct blk_mq_ctx __percpu *ctx;
-   struct request_queue *q;
unsigned int *map;
int i;
 
@@ -1928,10 +1944,6 @@ struct request_queue *blk_mq_init_queue(struct 
blk_mq_tag_set *set)
hctxs[i]->queue_num = i;
}
 
-   q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node);
-   if (!q)
-   goto err_hctxs;
-
/*
 * Init percpu_ref in atomic mode so that it's faster to shutdown.
 * See blk_register_queue() for details.
@@ -1981,7 +1993,7 @@ struct request_queue *blk_mq_init_queue(struct 
blk_mq_tag_set *set)
blk_mq_init_cpu_queues(q, set->nr_hw_queues);
 
if (blk_mq_init_hw_queues(q, set))
-   goto err_hw;
+   goto err_hctxs;
 
mutex_lock(_q_mutex);
list_add_tail(>all_q_node, _q_list);
@@ -1993,8 +2005,6 @@ struct request_queue *blk_mq_init_queue(struct 
blk_mq_tag_set *set)
 
return q;
 
-err_hw:
-   blk_cleanup_queue(q);
 err_hctxs:
kfree(map);
for (i = 0; i < set->nr_hw_queues; i++) {
@@ -2009,7 +2019,7 @@ err_percpu:
free_percpu(ctx);
return ERR_PTR(-ENOMEM);
 }
-EXPORT_SYMBOL(blk_mq_init_queue);
+EXPORT_SYMBOL(blk_mq_init_allocated_queue);
 
 void blk_mq_free_queue(struct request_queue *q)
 {
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 7aec861..9a75c88 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -164,6 +164,8 @@ enum {
<< BLK_MQ_F_ALLOC_POLICY_START_BIT)
 
 struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
+struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
+ struct request_queue *q);
 void blk_mq_finish_init(struct request_queue *q);
 int blk_mq_register_disk(struct gendisk *);
 void blk_mq_unregister_disk(struct gendisk *);
-- 
1.9.5 (Apple Git-50.3)

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


[PATCH 1/7] blk-mq: fix use of incorrect goto label in blk_mq_init_queue error path

2015-03-11 Thread Mike Snitzer
If percpu_ref_init() fails the 'err_hctxs' label should be used instead
of 'err_map'.

Signed-off-by: Mike Snitzer 
---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4f4bea2..459840c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1938,7 +1938,7 @@ struct request_queue *blk_mq_init_queue(struct 
blk_mq_tag_set *set)
 */
if (percpu_ref_init(>mq_usage_counter, blk_mq_usage_counter_release,
PERCPU_REF_INIT_ATOMIC, GFP_KERNEL))
-   goto err_map;
+   goto err_hctxs;
 
setup_timer(>timeout, blk_mq_rq_timer, (unsigned long) q);
blk_queue_rq_timeout(q, 3);
-- 
1.9.5 (Apple Git-50.3)

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


[PATCH] mm/memory hotplog: postpone the reset of obsolete pgdat

2015-03-11 Thread Gu Zheng
Qiu Xishi reported the following BUG when testing hot-add/hot-remove node under
stress condition.
[ 1422.011064] BUG: unable to handle kernel paging request at 00025f60
[ 1422.011086] IP: [] next_online_pgdat+0x1/0x50
[ 1422.011178] PGD 0
[ 1422.011180] Oops:  [#1] SMP
[ 1422.011409] ACPI: Device does not support D3cold
[ 1422.011961] Modules linked in: fuse nls_iso8859_1 nls_cp437 vfat fat loop 
dm_mod coretemp mperf crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper 
cryptd lrw gf128mul glue_helper aes_x86_64 pcspkr microcode igb dca 
i2c_algo_bit ipv6 megaraid_sas iTCO_wdt i2c_i801 i2c_core iTCO_vendor_support 
tg3 sg hwmon ptp lpc_ich pps_core mfd_core acpi_pad rtc_cmos button ext3 jbd 
mbcache sd_mod crc_t10dif scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc 
scsi_dh ahci libahci libata scsi_mod [last unloaded: rasf]
[ 1422.012006] CPU: 23 PID: 238 Comm: kworker/23:1 Tainted: G   O 
3.10.15-5885-euler0302 #1
[ 1422.012024] Hardware name: HUAWEI TECHNOLOGIES CO.,LTD. Huawei N1/Huawei N1, 
BIOS V100R001 03/02/2015
[ 1422.012065] Workqueue: events vmstat_update
[ 1422.012084] task: a800d32c ti: a800d32ae000 task.ti: 
a800d32ae000
[ 1422.012165] RIP: 0010:[]  [] 
next_online_pgdat+0x1/0x50
[ 1422.012205] RSP: 0018:a800d32afce8  EFLAGS: 00010286
[ 1422.012225] RAX: 1440 RBX: 81da53b8 RCX: 0082
[ 1422.012226] RDX:  RSI: 0082 RDI: 
[ 1422.012254] RBP: a800d32afd28 R08: 81c93bfc R09: 81cbdc96
[ 1422.012272] R10: 40ec R11: 00a0 R12: a800fffb3440
[ 1422.012290] R13: a800d32afd38 R14: 0017 R15: a800e6616800
[ 1422.012292] FS:  () GS:a800e660() 
knlGS:
[ 1422.012314] CS:  0010 DS:  ES:  CR0: 80050033
[ 1422.012328] CR2: 00025f60 CR3: 01a0b000 CR4: 001407e0
[ 1422.012328] DR0:  DR1:  DR2: 
[ 1422.012328] DR3:  DR6: fffe0ff0 DR7: 0400
[ 1422.012328] Stack:
[ 1422.012328]  a800d32afd28 81126ca5 a800 
814b4314
[ 1422.012328]  a800d32ae010  a800e6616180 
a800fffb3440
[ 1422.012328]  a800d32afde8 81128220 0013 
0038
[ 1422.012328] Call Trace:
[ 1422.012328]  [] ? next_zone+0xc5/0x150
[ 1422.012328]  [] ? __schedule+0x544/0x780
[ 1422.012328]  [] refresh_cpu_vm_stats+0xd0/0x140
[ 1422.012328]  [] vmstat_update+0x11/0x50
[ 1422.012328]  [] process_one_work+0x194/0x3d0
[ 1422.012328]  [] worker_thread+0x12b/0x410
[ 1422.012328]  [] ? manage_workers+0x1a0/0x1a0
[ 1422.012328]  [] kthread+0xc6/0xd0
[ 1422.012328]  [] ? kthread_freezable_should_stop+0x70/0x70
[ 1422.012328]  [] ret_from_fork+0x7c/0xb0
[ 1422.012328]  [] ? kthread_freezable_should_stop+0x70/0x70

The cause is the "memset(pgdat, 0, sizeof(*pgdat))" at the end of 
try_offline_node,
which will reset the all content of pgdat to 0, as the pgdat is accessed 
lock-lee,
so that the users still using the pgdat will panic, such as the vmstat_update 
routine.

So the solution here is postponing the reset of obsolete pgdat from 
try_offline_node()
to hotadd_new_pgdat(), and just resetting pgdat->nr_zones and 
pgdat->classzone_idx to
be 0 rather than the memset 0 to avoid breaking pointer information in pgdat.

Reported-by: Xishi Qiu 
Suggested-by: KAMEZAWA Hiroyuki 
Cc: 
Signed-off-by: Gu Zheng 
---
 mm/memory_hotplug.c |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 9fab107..65842d6 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1092,6 +1092,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 
start)
return NULL;
 
arch_refresh_nodedata(nid, pgdat);
+   } else {
+   /* Reset the nr_zones and classzone_idx to 0 before reuse */
+   pgdat->nr_zones = 0;
+   pgdat->classzone_idx = 0;
}
 
/* we can use NODE_DATA(nid) from here */
@@ -1977,15 +1981,6 @@ void try_offline_node(int nid)
if (is_vmalloc_addr(zone->wait_table))
vfree(zone->wait_table);
}
-
-   /*
-* Since there is no way to guarentee the address of pgdat/zone is not
-* on stack of any kernel threads or used by other kernel objects
-* without reference counting or other symchronizing method, do not
-* reset node_data and free pgdat here. Just reset it to 0 and reuse
-* the memory when the node is online again.
-*/
-   memset(pgdat, 0, sizeof(*pgdat));
 }
 EXPORT_SYMBOL(try_offline_node);
 
-- 
1.7.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  

Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)

2015-03-11 Thread Herbert Xu
On Wed, Mar 11, 2015 at 08:51:32PM -0700, Guenter Roeck wrote:
>
> Yes, this helps.
> 
> Feel free to add
> 
> Tested-by: Guenter Roeck 

Thanks for testing and the quick feedback.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v6 09/30] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:06AM +0800, Yijing Wang wrote:
> This patch separate pci_host_bridge creation out
> of pci_create_root_bus(), and try to make a generic
> pci_host_bridge, then we could place generic PCI
> infos like domain number in it. Also Ripping out
> pci_host_bridge creation from pci_create_root_bus()
> make code more better readability. Further more,
> we could use the generic pci_host_bridge to hold
> host bridge specific operations like
> pcibios_root_bridge_prepare(). The changes are
> transparent to platform host bridge drivers.
> 
> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/pci/host-bridge.c |   55 ++
>  drivers/pci/pci.h |3 +
>  drivers/pci/probe.c   |  114 
> -
>  include/linux/pci.h   |1 +
>  4 files changed, 109 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
> index 39b2dbe..3bd45e7 100644
> --- a/drivers/pci/host-bridge.c
> +++ b/drivers/pci/host-bridge.c
> @@ -8,6 +8,61 @@
>  
>  #include "pci.h"
>  
> +static void pci_release_host_bridge_dev(struct device *dev)
> +{
> + struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
> +
> + if (bridge->release_fn)
> + bridge->release_fn(bridge);
> +
> + pci_free_resource_list(>windows);
> + kfree(bridge);
> +}
> +
> +struct pci_host_bridge *pci_create_host_bridge(
> + struct device *parent, u32 db, struct list_head *resources)
> +{
> + int error;
> + int bus = PCI_BUSNUM(db);
> + int domain = PCI_DOMAIN(db);
> + struct pci_host_bridge *host;
> + struct resource_entry *window, *n;
> +
> + host = kzalloc(sizeof(*host), GFP_KERNEL);
> + if (!host)
> + return NULL;
> +
> + host->busnum = bus;
> + host->domain = domain;
> + /* If support CONFIG_PCI_DOMAINS_GENERIC, use
> +  * pci_host_assign_domain_nr() to assign domain
> +  * number instead PCI_DOMAIN(db).
> +  */

Follow the normal Linux comment style:

host->domain = domain;

/*
 * If we support ...
 */

> + pci_host_assign_domain_nr(host);
> +
> + host->dev.parent = parent;
> + INIT_LIST_HEAD(>windows);
> + host->dev.release = pci_release_host_bridge_dev;
> + dev_set_name(>dev, "pci%04x:%02x", host->domain,
> + host->busnum);
> +
> + error = device_register(>dev);
> + if (error) {
> + put_device(>dev);
> + return NULL;
> + }
> +
> + resource_list_for_each_entry_safe(window, n, resources)
> + list_move_tail(>node, >windows);
> +
> + return host;
> +}
> +
> +void pci_free_host_bridge(struct pci_host_bridge *host)
> +{
> + device_unregister(>dev);
> +}
> +
>  static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
>  {
>   while (bus->parent)
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index eeacab9..3de5e51 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -323,4 +323,7 @@ static inline int pci_dev_specific_reset(struct pci_dev 
> *dev, int probe)
>  }
>  #endif
>  
> +struct pci_host_bridge *pci_create_host_bridge(
> + struct device *parent, u32 dombus, struct list_head *resources);
> +void pci_free_host_bridge(struct pci_host_bridge *host);

A later patch adds another declaration and a blank line here.  If you want
the blank line, add it here, when you're adding the first declarations in
this section.

>  #endif /* DRIVERS_PCI_H */
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 3d6befd..27ec612 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -503,31 +503,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus 
> *parent)
>   return b;
>  }
>  
> -static void pci_release_host_bridge_dev(struct device *dev)
> -{
> - struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
> -
> - if (bridge->release_fn)
> - bridge->release_fn(bridge);
> -
> - pci_free_resource_list(>windows);
> -
> - kfree(bridge);
> -}
> -
> -static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
> -{
> - struct pci_host_bridge *bridge;
> -
> - bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
> - if (!bridge)
> - return NULL;
> -
> - INIT_LIST_HEAD(>windows);
> - bridge->bus = b;
> - return bridge;
> -}
> -
>  static const unsigned char pcix_bus_speed[] = {
>   PCI_SPEED_UNKNOWN,  /* 0 */
>   PCI_SPEED_66MHz_PCIX,   /* 1 */
> @@ -1890,54 +1865,41 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
>  {
>  }
>  
> -struct pci_bus *pci_create_root_bus(struct device *parent, u32 db,
> - struct pci_ops *ops, void *sysdata, struct list_head *resources)
> +static struct pci_bus *__pci_create_root_bus(
> + struct pci_host_bridge *bridge, struct pci_ops *ops,
> + void *sysdata)
>  {

Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)

2015-03-11 Thread Guenter Roeck

On 03/11/2015 08:28 PM, Herbert Xu wrote:

On Wed, Mar 11, 2015 at 07:43:22PM -0700, Guenter Roeck wrote:


It looks like the perl scripts do run - I see the .S files, and I do see .o 
files created.
But I still get the error.

Looking into the object files, I see

$ nm vmx-crypto.o | grep aes_p8_cbc_encrypt
0680 t .aes_p8_cbc_encrypt
  U .aes_p8_cbc_encrypt
00a8 D aes_p8_cbc_encrypt


Ugh, does this patch help?

Thanks,

--8<--
crypto: vmx - Fix assembler perl to use _GLOBAL

Rather than doing things by hand for global symbols to deal with
different calling conventions we already have a macro _GLOBAL in
Linux to handle this.

Signed-off-by: Herbert Xu 


Yes, this helps.

Feel free to add

Tested-by: Guenter Roeck 

Thanks,
Guenter


diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
old mode 100755
new mode 100644
index 3ee8979..6c5c20c
--- a/drivers/crypto/vmx/aesp8-ppc.pl
+++ b/drivers/crypto/vmx/aesp8-ppc.pl
@@ -85,8 +85,6 @@ Lconsts:
  .asciz"AES for PowerISA 2.07, CRYPTOGAMS by "

  .globl.${prefix}_set_encrypt_key
-.align 5
-.${prefix}_set_encrypt_key:
  Lset_encrypt_key:
mflrr11
$PUSH   r11,$LRSAVE($sp)
@@ -348,8 +346,6 @@ Lenc_key_abort:
  .size .${prefix}_set_encrypt_key,.-.${prefix}_set_encrypt_key

  .globl.${prefix}_set_decrypt_key
-.align 5
-.${prefix}_set_decrypt_key:
$STU$sp,-$FRAME($sp)
mflrr10
$PUSH   r10,$FRAME+$LRSAVE($sp)
@@ -405,8 +401,6 @@ my ($inp,$out,$key,$rounds,$idx)=map("r$_",(3..7));

  $code.=<<___;
  .globl.${prefix}_${dir}crypt
-.align 5
-.${prefix}_${dir}crypt:
lwz $rounds,240($key)
lis r0,0xfc00
mfspr   $vrsave,256
@@ -484,8 +478,6 @@ my 
($ivec,$inptail,$inpperm,$outhead,$outperm,$outmask,$keyperm)=
map("v$_",(4..10));
  $code.=<<___;
  .globl.${prefix}_cbc_encrypt
-.align 5
-.${prefix}_cbc_encrypt:
${UCMP}i$len,16
bltlr-

@@ -1243,8 +1235,6 @@ my $dat=$tmp;

  $code.=<<___;
  .globl.${prefix}_ctr32_encrypt_blocks
-.align 5
-.${prefix}_ctr32_encrypt_blocks:
${UCMP}i$len,1
bltlr-

diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl 
b/drivers/crypto/vmx/ghashp8-ppc.pl
old mode 100755
new mode 100644
index e76a58c..0a6f899
--- a/drivers/crypto/vmx/ghashp8-ppc.pl
+++ b/drivers/crypto/vmx/ghashp8-ppc.pl
@@ -54,8 +54,6 @@ $code=<<___;
  .text

  .globl.gcm_init_p8
-.align 5
-.gcm_init_p8:
lis r0,0xfff0
li  r8,0x10
mfspr   $vrsave,256
@@ -98,8 +96,6 @@ $code=<<___;
  .size .gcm_init_p8,.-.gcm_init_p8

  .globl.gcm_gmult_p8
-.align 5
-.gcm_gmult_p8:
lis r0,0xfff8
li  r8,0x10
mfspr   $vrsave,256
@@ -148,8 +144,6 @@ $code=<<___;
  .size .gcm_gmult_p8,.-.gcm_gmult_p8

  .globl.gcm_ghash_p8
-.align 5
-.gcm_ghash_p8:
lis r0,0xfff8
li  r8,0x10
mfspr   $vrsave,256
diff --git a/drivers/crypto/vmx/ppc-xlate.pl b/drivers/crypto/vmx/ppc-xlate.pl
old mode 100755
new mode 100644
index f89e814..a591884
--- a/drivers/crypto/vmx/ppc-xlate.pl
+++ b/drivers/crypto/vmx/ppc-xlate.pl
@@ -27,25 +27,13 @@ my $globl = sub {
/osx/   && do { $name = "_$name";
last;
  };
-   /linux.*(32|64le)/
-   && do { $ret .= ".globl$name\n";
-   $ret .= ".type $name,\@function";
-   last;
- };
-   /linux.*64/ && do { $ret .= ".globl$name\n";
-   $ret .= ".type $name,\@function\n";
-   $ret .= ".section  \".opd\",\"aw\"\n";
-   $ret .= ".align3\n";
-   $ret .= "$name:\n";
-   $ret .= ".quad .$name,.TOC.\@tocbase,0\n";
-   $ret .= ".previous\n";
-
-   $name = ".$name";
+   /linux/
+   && do { $ret = "_GLOBAL($name)";
last;
  };
  }

-$ret = ".globl$name" if (!$ret);
+$ret = ".globl$name\nalign 5\n$name:" if (!$ret);
  $$global = $name;
  $ret;
  };
@@ -187,6 +175,8 @@ my $mtsle   = sub {
  ".long   ".sprintf "0x%X",(31<<26)|($arg<<21)|(147*2);
  };

+print "#include \n" if $flavour =~ /linux/;
+
  while($line=<>) {

  $line =~ s|[#!;].*$||;# get rid of asm-style comments...
@@ -200,15 +190,6 @@ while($line=<>) {
  }

  {
-   $line =~ s|(^[\.\w]+)\:\s*||;
-   my $label = $1;
-   if ($label) {
-   printf 

Re: [PATCH v6 30/30] PCI: Remove pci_bus_assign_domain_nr()

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:27AM +0800, Yijing Wang wrote:
> Now we save the domain number in pci_host_bridge,
> we could remove pci_bus_assign_domain_nr() and
> clean the domain member in pci_bus.
> 
> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/pci/pci.c   |5 -
>  drivers/pci/probe.c |   12 
>  include/linux/pci.h |3 ---
>  3 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 2cf942b..4d8dfe4 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4581,11 +4581,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge 
> *host)
>  {
>   host->domain = pci_assign_domain_nr(host->dev.parent);
>  }
> -
> -void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
> -{
> - bus->domain_nr = pci_assign_domain_nr(parent);
> -}

I think you forgot to remove the empty pci_bus_assign_domain_nr()
definition from include/linux/pci.h.

I'm not sure how much value is left in CONFIG_PCI_DOMAINS_GENERIC.  You're
removed *almost* everything that uses it.  I wonder how hard it would be to
get rid of that last little bit.

>  #endif
>  #endif
>  
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 196f08a..9cd3ca2 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -481,7 +481,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
>   }
>  }
>  
> -static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
> +static struct pci_bus *pci_alloc_bus(void)
>  {
>   struct pci_bus *b;
>  
> @@ -496,10 +496,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus 
> *parent)
>   INIT_LIST_HEAD(>resources);
>   b->max_bus_speed = PCI_SPEED_UNKNOWN;
>   b->cur_bus_speed = PCI_SPEED_UNKNOWN;
> -#ifdef CONFIG_PCI_DOMAINS_GENERIC
> - if (parent)
> - b->domain_nr = parent->domain_nr;
> -#endif
> +
>   return b;
>  }
>  
> @@ -646,7 +643,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus 
> *parent,
>   /*
>* Allocate a new bus, and inherit stuff from the parent..
>*/
> - child = pci_alloc_bus(parent);
> + child = pci_alloc_bus();
>   if (!child)
>   return NULL;
>  
> @@ -1866,14 +1863,13 @@ static struct pci_bus *pci_create_root_bus(
>   char *fmt;
>  
>   parent = bridge->dev.parent;
> - b = pci_alloc_bus(NULL);
> + b = pci_alloc_bus();
>   if (!b)
>   return NULL;
>  
>   b->sysdata = dev_get_drvdata(>dev);
>   b->ops = ops;
>   b->number = b->busn_res.start = bridge->busnum;
> - pci_bus_assign_domain_nr(b, parent);
>  
>   bridge->bus = b;
>   b->bridge = get_device(>dev);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index dc1c710..ebc70bb 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -467,9 +467,6 @@ struct pci_bus {
>   unsigned char   primary;/* number of primary bridge */
>   unsigned char   max_bus_speed;  /* enum pci_bus_speed */
>   unsigned char   cur_bus_speed;  /* enum pci_bus_speed */
> -#ifdef CONFIG_PCI_DOMAINS_GENERIC
> - int domain_nr;
> -#endif
>  
>   charname[48];
>  
> -- 
> 1.7.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [rhashtable] [ INFO: possible recursive locking detected ]

2015-03-11 Thread Herbert Xu
On Wed, Mar 11, 2015 at 11:41:56PM -0400, David Miller wrote:
> From: Herbert Xu 
> Date: Thu, 12 Mar 2015 14:37:45 +1100
> 
> > rhashtable: Add annotation to nested lock
> > 
> > Commit aa34a6cb0478842452bac58edb50d3ef9e178c92 ("rhashtable:
> > Add arbitrary rehash function") killed the annotation on the
> > nested lock which leads to bitching from lockdep.
> > 
> > Reported-by: Fengguang Wu 
> > Signed-off-by: Herbert Xu 
> 
> This doesn't apply to net-next, the second hunk gives a reject.

Sorry, I based on this on top of the cleanup patches sent earlier.
Here is a rebase on net-next.  I will resend the cleanups later.

--8<--
rhashtable: Add annotation to nested lock

Commit aa34a6cb0478842452bac58edb50d3ef9e178c92 ("rhashtable:
Add arbitrary rehash function") killed the annotation on the
nested lock which leads to bitching from lockdep.

Reported-by: Fengguang Wu 
Signed-off-by: Herbert Xu 

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index b1c19c5..d7f3db5 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -234,7 +234,7 @@ static int rhashtable_rehash_one(struct rhashtable *ht, 
unsigned old_hash)
 
new_bucket_lock = bucket_lock(new_tbl, new_hash);
 
-   spin_lock(new_bucket_lock);
+   spin_lock_nested(new_bucket_lock, RHT_LOCK_NESTED);
head = rht_dereference_bucket(new_tbl->buckets[new_hash],
  new_tbl, new_hash);
 
@@ -415,7 +415,7 @@ static bool __rhashtable_insert(struct rhashtable *ht, 
struct rhash_head *obj,
tbl = rht_dereference_rcu(ht->future_tbl, ht);
if (tbl != old_tbl) {
hash = obj_raw_hashfn(ht, tbl, rht_obj(ht, obj));
-   spin_lock(bucket_lock(tbl, hash));
+   spin_lock_nested(bucket_lock(tbl, hash), RHT_LOCK_NESTED);
}
 
if (compare &&

-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 2/2] cgroups: add a pids subsystem

2015-03-11 Thread Tejun Heo
On Wed, Mar 11, 2015 at 11:13:48AM -0400, Austin S Hemmelgarn wrote:
> I did not necessarily word this very clearly.  What I meant is that
> /proc/sys/kernel/pid_max is essentially an external limiting factor that
> caps the total number of pids that can be under the root cgroup and it's
> children, not that the cgroup in any way payed attention to it.  It might be
> useful to be able to just disable the sysctl option and set the value
> through the root cgroup, solely or consistency, although such usage isn't
> something I would consider essential in any way.

Unless there's a compelling reason to implement it, I don't think it's
a good idea to add it.  The reasons against it have been mentioned a
couple times in the thread and AFAICS none is being refuted.

Thanks.

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


[PATCH kernel] vfio-pci: Add missing break to enable VFIO_PCI_ERR_IRQ_INDEX

2015-03-11 Thread Alexey Kardashevskiy
This adds a missing break statement to VFIO_DEVICE_SET_IRQS handler
without which vfio_pci_set_err_trigger() would never be called.

While we are here, add another "break" to VFIO_PCI_REQ_IRQ_INDEX case
so if we add more indexes later, we won't miss it.

Signed-off-by: Alexey Kardashevskiy 
---
 drivers/vfio/pci/vfio_pci_intrs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_intrs.c 
b/drivers/vfio/pci/vfio_pci_intrs.c
index f88bfdf..2027a27 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -868,12 +868,14 @@ int vfio_pci_set_irqs_ioctl(struct vfio_pci_device *vdev, 
uint32_t flags,
func = vfio_pci_set_err_trigger;
break;
}
+   break;
case VFIO_PCI_REQ_IRQ_INDEX:
switch (flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) {
case VFIO_IRQ_SET_ACTION_TRIGGER:
func = vfio_pci_set_req_trigger;
break;
}
+   break;
}
 
if (!func)
-- 
2.0.0

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


Re: [PATCH v6 28/30] PCI: Export find_pci_host_bridge() and rename to pci_find_host_bridge()

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:25AM +0800, Yijing Wang wrote:
> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/pci/host-bridge.c |6 +++---
>  drivers/pci/pci.h |2 ++
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
> index bc1de59..51f0a82 100644
> --- a/drivers/pci/host-bridge.c
> +++ b/drivers/pci/host-bridge.c
> @@ -103,7 +103,7 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus 
> *bus)
>   return bus;
>  }
>  
> -static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus)
> +struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus)
>  {
>   struct pci_bus *root_bus = find_pci_root_bus(bus);
>  
> @@ -121,7 +121,7 @@ void pci_set_host_bridge_release(struct pci_host_bridge 
> *bridge,
>  void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region 
> *region,
>struct resource *res)
>  {
> - struct pci_host_bridge *bridge = find_pci_host_bridge(bus);
> + struct pci_host_bridge *bridge = pci_find_host_bridge(bus);
>   struct resource_entry *window;
>   resource_size_t offset = 0;
>  
> @@ -146,7 +146,7 @@ static bool region_contains(struct pci_bus_region 
> *region1,
>  void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
>struct pci_bus_region *region)
>  {
> - struct pci_host_bridge *bridge = find_pci_host_bridge(bus);
> + struct pci_host_bridge *bridge = pci_find_host_bridge(bus);
>   struct resource_entry *window;
>   resource_size_t offset = 0;
>  
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index a1dc9f2..45252dd 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -328,4 +328,6 @@ struct pci_host_bridge *pci_create_host_bridge(
>   void *sysdata, struct pci_host_bridge_ops *ops);
>  
>  void pci_free_host_bridge(struct pci_host_bridge *host);
> +struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus);

This is only used in drivers/pci/host-bridge.c and in drivers/pci/pci.c for
pci_domain_nr().  Can you drop this patch and put the generic
pci_domain_nr() implementation (next patch) in host-bridge.c instead of in
pci.c?

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


Re: [PATCH v2] clk: qcom: Properly change rates for ahbix clock

2015-03-11 Thread Kenneth Westfield
On Fri, Mar 06, 2015 at 03:41:53PM -0800, Stephen Boyd wrote:
> The ahbix clock can never be turned off in practice. To change the
> rates we need to switch the mux off the M/N counter to an always on
> source (XO), reprogram the M/N counter to get the rate we want and
> finally switch back to the M/N counter. Add a new ops structure
> for this type of clock so that we can set the rate properly.
> 
> Fixes: c99e515a92e9 "clk: qcom: Add IPQ806X LPASS clock controller (LCC) 
> driver"
> Cc: Kenneth Westfield 
> Signed-off-by: Stephen Boyd 
> ---
> 
> Changes from v1:
>  * Handle the case where clock feeding M/N counter is off
> 
>  drivers/clk/qcom/clk-rcg.c | 62 
> ++
>  drivers/clk/qcom/clk-rcg.h |  1 +
>  drivers/clk/qcom/lcc-ipq806x.c |  5 ++--
>  3 files changed, 65 insertions(+), 3 deletions(-)

Verified I2S audio functionality on the Storm board; with and without
firmware audio enabled.

Tested-by: Kenneth Westfield 

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [rhashtable] [ INFO: possible recursive locking detected ]

2015-03-11 Thread David Miller
From: Herbert Xu 
Date: Thu, 12 Mar 2015 14:37:45 +1100

> rhashtable: Add annotation to nested lock
> 
> Commit aa34a6cb0478842452bac58edb50d3ef9e178c92 ("rhashtable:
> Add arbitrary rehash function") killed the annotation on the
> nested lock which leads to bitching from lockdep.
> 
> Reported-by: Fengguang Wu 
> Signed-off-by: Herbert Xu 

This doesn't apply to net-next, the second hunk gives a reject.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [rhashtable] [ INFO: possible recursive locking detected ]

2015-03-11 Thread Herbert Xu
On Thu, Mar 12, 2015 at 11:29:24AM +0800, Fengguang Wu wrote:
> Greetings,
> 
> 0day kernel testing robot got the below dmesg and the first bad commit is
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next.git master
> 
> commit aa34a6cb0478842452bac58edb50d3ef9e178c92
> Author: Herbert Xu 
> AuthorDate: Wed Mar 11 09:43:48 2015 +1100
> Commit: David S. Miller 
> CommitDate: Wed Mar 11 16:36:21 2015 -0400

Thanks for the report.  This patch should fix it.

--8<--
rhashtable: Add annotation to nested lock

Commit aa34a6cb0478842452bac58edb50d3ef9e178c92 ("rhashtable:
Add arbitrary rehash function") killed the annotation on the
nested lock which leads to bitching from lockdep.

Reported-by: Fengguang Wu 
Signed-off-by: Herbert Xu 

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 5f9af45..6ffc793 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -225,7 +225,7 @@ static int rhashtable_rehash_one(struct rhashtable *ht, 
unsigned old_hash)
 
new_bucket_lock = bucket_lock(new_tbl, new_hash);
 
-   spin_lock(new_bucket_lock);
+   spin_lock_nested(new_bucket_lock, RHT_LOCK_NESTED);
head = rht_dereference_bucket(new_tbl->buckets[new_hash],
  new_tbl, new_hash);
 
@@ -406,7 +406,7 @@ static bool __rhashtable_insert(struct rhashtable *ht, 
struct rhash_head *obj,
tbl = rht_dereference_rcu(ht->future_tbl, ht);
if (tbl != old_tbl) {
hash = head_hashfn(ht, tbl, obj);
-   spin_lock(bucket_lock(tbl, hash));
+   spin_lock_nested(bucket_lock(tbl, hash), RHT_LOCK_NESTED);
}
 
if (compare &&
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v6 21/30] PCI: Introduce pci_bus_child_max_busnr()

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:18AM +0800, Yijing Wang wrote:
> Sometimes, we need to know the highest reserved
> busnr for children bus. Because parent's
> bus->busn_res could have padding in it.
> This function return the max child busnr as
> pci_scan_child_bus().
> 
> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> Signed-off-by: Fengguang Wu 

I must have screwed this up.  I don't know where the Signed-off-by from
Fengguang came from, but it shouldn't be there.  And I also screwed up by
adding my own Signed-off-by to the branch while we're still iterating on
this series.  The patches you post should not have my Signed-off-by in
them; I should add that.  But that's my fault because put them in the
branch, and I asked you to pull that branch and modify and repost it.

> ---
>  drivers/pci/hotplug/acpiphp_glue.c |   29 +
>  drivers/pci/pci.c  |   27 +--
>  include/linux/pci.h|2 +-
>  3 files changed, 27 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c 
> b/drivers/pci/hotplug/acpiphp_glue.c
> index bcb90e4..84f2584 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
>   acpi_unlock_hp_context();
>  }
>  
> -/**
> - * acpiphp_max_busnr - return the highest reserved bus number under the 
> given bus.
> - * @bus: bus to start search with
> - */
> -static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
> -{
> - struct pci_bus *tmp;
> - unsigned char max, n;
> -
> - /*
> -  * pci_bus_max_busnr will return the highest
> -  * reserved busnr for all these children.
> -  * that is equivalent to the bus->subordinate
> -  * value.  We don't want to use the parent's
> -  * bus->subordinate value because it could have
> -  * padding in it.
> -  */
> - max = bus->busn_res.start;
> -
> - list_for_each_entry(tmp, >children, node) {
> - n = pci_bus_max_busnr(tmp);
> - if (n > max)
> - max = n;
> - }
> - return max;
> -}
> -
>  static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
>  {
>   struct acpiphp_func *func;
> @@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
>   LIST_HEAD(add_list);
>  
>   acpiphp_rescan_slot(slot);
> - max = acpiphp_max_busnr(bus);
> + max = pci_bus_child_max_busnr(bus);
>   for (pass = 0; pass < 2; pass++) {
>   list_for_each_entry(dev, >devices, bus_list) {
>   if (PCI_SLOT(dev->devfn) != slot->device)
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index c49eec1..0001896 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -108,7 +108,7 @@ static bool pcie_ari_disabled;
>   * Given a PCI bus, returns the highest PCI bus number present in the set
>   * including the given PCI bus and its list of child PCI buses.
>   */
> -unsigned char pci_bus_max_busnr(struct pci_bus *bus)
> +static unsigned char pci_bus_max_busnr(struct pci_bus *bus)
>  {
>   struct pci_bus *tmp;
>   unsigned char max, n;
> @@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
>   }
>   return max;
>  }
> -EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
> +
> +unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
> +{
> + struct pci_bus *tmp;
> + unsigned char max, n;
> +
> + /*
> +  * pci_bus_max_busnr will return the highest
> +  * reserved busnr for all these children.
> +  * that is equivalent to the bus->subordinate
> +  * value.  We don't want to use the parent's
> +  * bus->subordinate value because it could have
> +  * padding in it.
> +  */
> + max = bus->busn_res.start;
> +
> + list_for_each_entry(tmp, >children, node) {
> + n = pci_bus_max_busnr(tmp);
> + if (n > max)
> + max = n;
> + }
> + return max;
> +}
> +EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
>  
>  #ifdef CONFIG_HAS_IOMEM
>  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index cfaf217..261b8de 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1181,7 +1181,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
> *dev, int max,
>  void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
> void *userdata);
>  int pci_cfg_space_size(struct pci_dev *dev);
> -unsigned char pci_bus_max_busnr(struct pci_bus *bus);
> +unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
>  void pci_setup_bridge(struct pci_bus *bus);
>  resource_size_t pcibios_window_alignment(struct pci_bus *bus,
>unsigned long type);
> -- 
> 1.7.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" 

RE: [PATCH V2 3/3 net-next] hyperv: Support batched notification

2015-03-11 Thread KY Srinivasan


> -Original Message-
> From: Jason Wang [mailto:jasow...@redhat.com]
> Sent: Wednesday, March 11, 2015 8:09 PM
> To: KY Srinivasan
> Cc: da...@davemloft.net; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; gre...@linuxfoundation.org; KY Srinivasan
> Subject: Re: [PATCH V2 3/3 net-next] hyperv: Support batched notification
> 
> 
> 
> On Thu, Mar 12, 2015 at 3:04 AM, K. Y. Srinivasan 
> wrote:
> > Optimize notifying the host by deferring notification until there are
> > no more packets to be sent. This will help in batching the requests on
> > the host.
> >
> > Signed-off-by: K. Y. Srinivasan 
> > ---
> >  drivers/net/hyperv/hyperv_net.h   |2 +-
> >  drivers/net/hyperv/netvsc.c   |   14 +-
> >  drivers/net/hyperv/netvsc_drv.c   |3 ++-
> >  drivers/net/hyperv/rndis_filter.c |2 +-
> >  4 files changed, 13 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/hyperv/hyperv_net.h
> > b/drivers/net/hyperv/hyperv_net.h index 4815843..3fd9896 100644
> > --- a/drivers/net/hyperv/hyperv_net.h
> > +++ b/drivers/net/hyperv/hyperv_net.h
> > @@ -184,7 +184,7 @@ struct rndis_device {  int
> > netvsc_device_add(struct hv_device *device, void *additional_info);
> > int netvsc_device_remove(struct hv_device *device);  int
> > netvsc_send(struct hv_device *device,
> > -   struct hv_netvsc_packet *packet);
> > +   struct hv_netvsc_packet *packet, bool kick_q);
> >  void netvsc_linkstatus_callback(struct hv_device *device_obj,
> > struct rndis_message *resp);
> >  int netvsc_recv_callback(struct hv_device *device_obj, diff --git
> > a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index
> > 208eb05..9003b94 100644
> > --- a/drivers/net/hyperv/netvsc.c
> > +++ b/drivers/net/hyperv/netvsc.c
> > @@ -707,7 +707,7 @@ static u32 netvsc_copy_to_send_buf(struct
> > netvsc_device *net_device,  }
> >
> >  int netvsc_send(struct hv_device *device,
> > -   struct hv_netvsc_packet *packet)
> > +   struct hv_netvsc_packet *packet, bool kick_q)
> >  {
> > struct netvsc_device *net_device;
> > int ret = 0;
> > @@ -719,6 +719,7 @@ int netvsc_send(struct hv_device *device,
> > u32 msg_size = 0;
> > struct sk_buff *skb = NULL;
> > u16 q_idx = packet->q_idx;
> > +   u32 vmbus_flags =
> VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
> >
> >
> > net_device = get_outbound_net_device(device); @@ -768,18
> +769,21 @@
> > int netvsc_send(struct hv_device *device,
> > return -ENODEV;
> >
> > if (packet->page_buf_cnt) {
> > -   ret = vmbus_sendpacket_pagebuffer(out_channel,
> > +   ret = vmbus_sendpacket_pagebuffer_ctl(out_channel,
> >   packet->page_buf,
> >   packet->page_buf_cnt,
> >   ,
> >   sizeof(struct
> nvsp_message),
> > - req_id);
> > + req_id,
> > + vmbus_flags,
> > + kick_q);
> > } else {
> > -   ret = vmbus_sendpacket(out_channel, ,
> > +   ret = vmbus_sendpacket_ctl(out_channel, ,
> > sizeof(struct nvsp_message),
> > req_id,
> > VM_PKT_DATA_INBAND,
> > -
>   VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
> > +   vmbus_flags,
> > +   kick_q);
> > }
> >
> > if (ret == 0) {
> > diff --git a/drivers/net/hyperv/netvsc_drv.c
> > b/drivers/net/hyperv/netvsc_drv.c index a06bd66..80b4b29 100644
> > --- a/drivers/net/hyperv/netvsc_drv.c
> > +++ b/drivers/net/hyperv/netvsc_drv.c
> > @@ -384,6 +384,7 @@ static int netvsc_start_xmit(struct sk_buff *skb,
> > struct net_device *net)
> > u32 net_trans_info;
> > u32 hash;
> > u32 skb_length = skb->len;
> > +   bool kick_q = !skb->xmit_more;
> >
> >
> > /* We will atmost need two pages to describe the rndis @@ -556,7
> > +557,7 @@ do_send:
> > packet->page_buf_cnt = init_page_array(rndis_msg,
> rndis_msg_size,
> > skb, >page_buf[0]);
> >
> > -   ret = netvsc_send(net_device_ctx->device_ctx, packet);
> > +   ret = netvsc_send(net_device_ctx->device_ctx, packet, kick_q);
> 
> Maybe just a !skb->xmit_more here to save a local variable.

Will fix it.

K. Y


[PATCH 15/22] drm: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: dri-de...@lists.freedesktop.org
---
 drivers/gpu/drm/drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index d512134..48f7359 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -70,7 +70,7 @@ void drm_err(const char *format, ...)
vaf.fmt = format;
vaf.va = 
 
-   printk(KERN_ERR "[" DRM_NAME ":%pf] *ERROR* %pV",
+   printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV",
   __builtin_return_address(0), );
 
va_end(args);
-- 
2.1.0

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


RE: [PATCH V2 2/3 net-next] Drivers: hv: vmbus: Fix a bug in the signalling logic with kick_q

2015-03-11 Thread KY Srinivasan


> -Original Message-
> From: Jason Wang [mailto:jasow...@redhat.com]
> Sent: Wednesday, March 11, 2015 8:08 PM
> To: KY Srinivasan
> Cc: da...@davemloft.net; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; gre...@linuxfoundation.org; KY Srinivasan
> Subject: Re: [PATCH V2 2/3 net-next] Drivers: hv: vmbus: Fix a bug in the
> signalling logic with kick_q
> 
> 
> 
> On Thu, Mar 12, 2015 at 3:04 AM, K. Y. Srinivasan 
> wrote:
> > When the caller specifies that signalling should be deferred, we need
> > to address the case where we are not able to place the current packet
> > because the buffer is full. In this case, we will signal the host as
> > some packets may have been placed on the ring buffer.
> > I would like to thank Jason Wang  for pointing
> > out this issue.
> >
> > Signed-off-by: K. Y. Srinivasan 
> > ---
> >  drivers/hv/channel.c |   32 
> >  1 files changed, 32 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index
> > e58cdb7..ae06ba9 100644
> > --- a/drivers/hv/channel.c
> > +++ b/drivers/hv/channel.c
> > @@ -614,8 +614,24 @@ int vmbus_sendpacket_ctl(struct vmbus_channel
> > *channel, void *buffer,
> >
> > ret = hv_ringbuffer_write(>outbound, bufferlist, 3,
> > );
> >
> > +   /*
> > +* Here is the logic for signalling the host:
> > +* 1. If the host is already draining the ringbuffer,
> > +*don't signal. This is indicated by the parameter
> > +*"signal".
> > +*
> > +* 2. If we are not able to write, signal if kick_q is false.
> > +*kick_q being false indicates that we may have placed zero or
> > +*more packets with more packets to come. We will signal in
> > +*this case even if potentially we may have not placed any
> > +*packet. This is a rare enough condition that it should not
> > +*matter.
> > +*/
> > +
> > if ((ret == 0) && kick_q && signal)
> > vmbus_setevent(channel);
> > +   else if ((ret != 0) && !kick_q)
> > +   vmbus_setevent(channel);
> >
> > return ret;
> >  }
> > @@ -705,8 +721,24 @@ int vmbus_sendpacket_pagebuffer_ctl(struct
> > vmbus_channel *channel,
> >
> > ret = hv_ringbuffer_write(>outbound, bufferlist, 3,
> > );
> >
> > +   /*
> > +* Here is the logic for signalling the host:
> > +* 1. If the host is already draining the ringbuffer,
> > +*don't signal. This is indicated by the parameter
> > +*"signal".
> > +*
> > +* 2. If we are not able to write, signal if kick_q is false.
> > +*kick_q being false indicates that we may have placed zero or
> > +*more packets with more packets to come. We will signal in
> > +*this case even if potentially we may have not placed any
> > +*packet. This is a rare enough condition that it should not
> > +*matter.
> > +*/
> > +
> > if ((ret == 0) && kick_q && signal)
> > vmbus_setevent(channel);
> > +   else if ((ret != 0) && !kick_q)
> > +   vmbus_setevent(channel);
> >
> > return ret;
> >  }
> > --
> 
> Looks like we need to kick unconditionally here. Consider we may get -
> EAGAIN when we want to send the last skb (kick_q is true) from the list. We
> need kick host in this case.
> 
> Btw, another method is let the driver to decide e.g exporting the
> vmbus_setevent() and call it in netvsc_start_xmit().

There is other state that governs if the host needs to be signaled and I don't 
think we want to 
expose that to netvsc. In any case, netvsc will have to signal the host when 
EGAIN is received.
We might as well do it in the vmbus driver.

Thank you Jason, I will respin and resubmit the series.

K. Y
> 
> 
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH 01/22] mm/memblock.c: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: linux...@kvack.org
---
 mm/memblock.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 252b77b..a7d4ff3 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -685,7 +685,7 @@ int __init_memblock memblock_remove(phys_addr_t base, 
phys_addr_t size)
 
 int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
 {
-   memblock_dbg("   memblock_free: [%#016llx-%#016llx] %pF\n",
+   memblock_dbg("   memblock_free: [%#016llx-%#016llx] %pS\n",
 (unsigned long long)base,
 (unsigned long long)base + size - 1,
 (void *)_RET_IP_);
@@ -701,7 +701,7 @@ static int __init_memblock 
memblock_reserve_region(phys_addr_t base,
 {
struct memblock_type *_rgn = 
 
-   memblock_dbg("memblock_reserve: [%#016llx-%#016llx] flags %#02lx %pF\n",
+   memblock_dbg("memblock_reserve: [%#016llx-%#016llx] flags %#02lx %pS\n",
 (unsigned long long)base,
 (unsigned long long)base + size - 1,
 flags, (void *)_RET_IP_);
@@ -1218,7 +1218,7 @@ void * __init memblock_virt_alloc_try_nid_nopanic(
phys_addr_t min_addr, phys_addr_t max_addr,
int nid)
 {
-   memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx 
max_addr=0x%llx %pF\n",
+   memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx 
max_addr=0x%llx %pS\n",
 __func__, (u64)size, (u64)align, nid, (u64)min_addr,
 (u64)max_addr, (void *)_RET_IP_);
return memblock_virt_alloc_internal(size, align, min_addr,
@@ -1250,7 +1250,7 @@ void * __init memblock_virt_alloc_try_nid(
 {
void *ptr;
 
-   memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx 
max_addr=0x%llx %pF\n",
+   memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx 
max_addr=0x%llx %pS\n",
 __func__, (u64)size, (u64)align, nid, (u64)min_addr,
 (u64)max_addr, (void *)_RET_IP_);
ptr = memblock_virt_alloc_internal(size, align,
@@ -1274,7 +1274,7 @@ void * __init memblock_virt_alloc_try_nid(
  */
 void __init __memblock_free_early(phys_addr_t base, phys_addr_t size)
 {
-   memblock_dbg("%s: [%#016llx-%#016llx] %pF\n",
+   memblock_dbg("%s: [%#016llx-%#016llx] %pS\n",
 __func__, (u64)base, (u64)base + size - 1,
 (void *)_RET_IP_);
kmemleak_free_part(__va(base), size);
@@ -1294,7 +1294,7 @@ void __init __memblock_free_late(phys_addr_t base, 
phys_addr_t size)
 {
u64 cursor, end;
 
-   memblock_dbg("%s: [%#016llx-%#016llx] %pF\n",
+   memblock_dbg("%s: [%#016llx-%#016llx] %pS\n",
 __func__, (u64)base, (u64)base + size - 1,
 (void *)_RET_IP_);
kmemleak_free_part(__va(base), size);
-- 
2.1.0

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


Re: [PATCH v6 21/30] PCI: Introduce pci_bus_child_max_busnr()

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:18AM +0800, Yijing Wang wrote:
> Sometimes, we need to know the highest reserved
> busnr for children bus. Because parent's
> bus->busn_res could have padding in it.
> This function return the max child busnr as
> pci_scan_child_bus().

I'm not convinced about this one.  The fact that it's only used by parisc
lba_pci.c and acpiphp makes me suspicious that either they're doing
something funny, or other drivers *should* be using it, too.

> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> Signed-off-by: Fengguang Wu 
> ---
>  drivers/pci/hotplug/acpiphp_glue.c |   29 +
>  drivers/pci/pci.c  |   27 +--
>  include/linux/pci.h|2 +-
>  3 files changed, 27 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c 
> b/drivers/pci/hotplug/acpiphp_glue.c
> index bcb90e4..84f2584 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
>   acpi_unlock_hp_context();
>  }
>  
> -/**
> - * acpiphp_max_busnr - return the highest reserved bus number under the 
> given bus.
> - * @bus: bus to start search with
> - */
> -static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
> -{
> - struct pci_bus *tmp;
> - unsigned char max, n;
> -
> - /*
> -  * pci_bus_max_busnr will return the highest
> -  * reserved busnr for all these children.
> -  * that is equivalent to the bus->subordinate
> -  * value.  We don't want to use the parent's
> -  * bus->subordinate value because it could have
> -  * padding in it.
> -  */
> - max = bus->busn_res.start;
> -
> - list_for_each_entry(tmp, >children, node) {
> - n = pci_bus_max_busnr(tmp);
> - if (n > max)
> - max = n;
> - }
> - return max;
> -}
> -
>  static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
>  {
>   struct acpiphp_func *func;
> @@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
>   LIST_HEAD(add_list);
>  
>   acpiphp_rescan_slot(slot);
> - max = acpiphp_max_busnr(bus);
> + max = pci_bus_child_max_busnr(bus);
>   for (pass = 0; pass < 2; pass++) {
>   list_for_each_entry(dev, >devices, bus_list) {
>   if (PCI_SLOT(dev->devfn) != slot->device)
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index c49eec1..0001896 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -108,7 +108,7 @@ static bool pcie_ari_disabled;
>   * Given a PCI bus, returns the highest PCI bus number present in the set
>   * including the given PCI bus and its list of child PCI buses.
>   */
> -unsigned char pci_bus_max_busnr(struct pci_bus *bus)
> +static unsigned char pci_bus_max_busnr(struct pci_bus *bus)
>  {
>   struct pci_bus *tmp;
>   unsigned char max, n;
> @@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
>   }
>   return max;
>  }
> -EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
> +
> +unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
> +{
> + struct pci_bus *tmp;
> + unsigned char max, n;
> +
> + /*
> +  * pci_bus_max_busnr will return the highest
> +  * reserved busnr for all these children.
> +  * that is equivalent to the bus->subordinate
> +  * value.  We don't want to use the parent's
> +  * bus->subordinate value because it could have
> +  * padding in it.
> +  */
> + max = bus->busn_res.start;
> +
> + list_for_each_entry(tmp, >children, node) {
> + n = pci_bus_max_busnr(tmp);
> + if (n > max)
> + max = n;
> + }
> + return max;
> +}
> +EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
>  
>  #ifdef CONFIG_HAS_IOMEM
>  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index cfaf217..261b8de 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1181,7 +1181,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
> *dev, int max,
>  void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
> void *userdata);
>  int pci_cfg_space_size(struct pci_dev *dev);
> -unsigned char pci_bus_max_busnr(struct pci_bus *bus);
> +unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
>  void pci_setup_bridge(struct pci_bus *bus);
>  resource_size_t pcibios_window_alignment(struct pci_bus *bus,
>unsigned long type);
> -- 
> 1.7.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/22] mfd: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: Samuel Ortiz 
Cc: Lee Jones 
---
 drivers/mfd/mc13xxx-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 64dde5d..25fd711 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -51,19 +51,19 @@
 void mc13xxx_lock(struct mc13xxx *mc13xxx)
 {
if (!mutex_trylock(>lock)) {
-   dev_dbg(mc13xxx->dev, "wait for %s from %pf\n",
+   dev_dbg(mc13xxx->dev, "wait for %s from %ps\n",
__func__, __builtin_return_address(0));
 
mutex_lock(>lock);
}
-   dev_dbg(mc13xxx->dev, "%s from %pf\n",
+   dev_dbg(mc13xxx->dev, "%s from %ps\n",
__func__, __builtin_return_address(0));
 }
 EXPORT_SYMBOL(mc13xxx_lock);
 
 void mc13xxx_unlock(struct mc13xxx *mc13xxx)
 {
-   dev_dbg(mc13xxx->dev, "%s from %pf\n",
+   dev_dbg(mc13xxx->dev, "%s from %ps\n",
__func__, __builtin_return_address(0));
mutex_unlock(>lock);
 }
-- 
2.1.0

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


[BUG] perf report: ordered events and flushing bug

2015-03-11 Thread Stephane Eranian
Hi,

I am working on the JIT support to improve the flow and have
perf record inject the MMAPs at the end of the collection. For
that I piggyback on the buildid pass. To avoid rewriting the entire perf.data
file, I simply append the the MMAP records at the end of the file. And that
puts them out-of-order in time systematically. But I thought it would be okay
because perf report would sort them by timestamps again.

Well, it does not in all cases! Why?

Because of the round flushing. Based on how far out-of-order an event is,
it may not be processed correctly because of round flushing. I believe this
may only impact MMAP records.  This is a serious issue because
mmaps drive symbolization of samples. If samples are processed without the
proper dso mapping, then samples may not be symbolized or may be wrongly
symbolized.

So far, the workaround I found was to set the oe->next_flush = 0 for
the ROUND mode.
In other words, do not flush anything until FINAL. To me, this is the
only sensible
way of avoiding this kind of problems. I am not sure I understand the
point of flushing
anyway, except to minimize memory footprint, maybe. But it does not
work with vastly
out-of-order mmaps.

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


[PATCH 14/22] parisc: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: linux-par...@vger.kernel.org
---
 drivers/parisc/superio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 8be2096..38c5440 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -348,7 +348,7 @@ int superio_fixup_irq(struct pci_dev *pcidev)
BUG();
return -1;
}
-   printk("superio_fixup_irq(%s) ven 0x%x dev 0x%x from %pf\n",
+   printk("superio_fixup_irq(%s) ven 0x%x dev 0x%x from %ps\n",
pci_name(pcidev),
pcidev->vendor, pcidev->device,
__builtin_return_address(0));
-- 
2.1.0

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


[PATCH 11/22] powerpc/32: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/mm/pgtable_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 03b1a3b..24f304a 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -221,7 +221,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, 
unsigned long flags,
 */
if (mem_init_done && (p < virt_to_phys(high_memory)) &&
!(__allow_ioremap_reserved && memblock_is_region_reserved(p, 
size))) {
-   printk("__ioremap(): phys addr 0x%llx is RAM lr %pf\n",
+   printk("__ioremap(): phys addr 0x%llx is RAM lr %ps\n",
   (unsigned long long)p, __builtin_return_address(0));
return NULL;
}
-- 
2.1.0

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


[PATCH 22/22] tracing: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: Steven Rostedt 
Cc: Ingo Molnar 
---
 include/trace/events/btrfs.h   |  4 ++--
 include/trace/events/ext3.h|  2 +-
 include/trace/events/ext4.h|  6 +++---
 include/trace/events/module.h  |  4 ++--
 include/trace/events/random.h  | 10 +-
 kernel/trace/trace_entries.h   |  6 +++---
 tools/lib/traceevent/event-parse.c |  2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 1faecea..572e650 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -962,7 +962,7 @@ TRACE_EVENT(alloc_extent_state,
__entry->ip = IP
),
 
-   TP_printk("state=%p; mask = %s; caller = %pF", __entry->state,
+   TP_printk("state=%p; mask = %s; caller = %pS", __entry->state,
  show_gfp_flags(__entry->mask), (void *)__entry->ip)
 );
 
@@ -982,7 +982,7 @@ TRACE_EVENT(free_extent_state,
__entry->ip = IP
),
 
-   TP_printk(" state=%p; caller = %pF", __entry->state,
+   TP_printk(" state=%p; caller = %pS", __entry->state,
  (void *)__entry->ip)
 );
 
diff --git a/include/trace/events/ext3.h b/include/trace/events/ext3.h
index 6797b9d..7f20707 100644
--- a/include/trace/events/ext3.h
+++ b/include/trace/events/ext3.h
@@ -144,7 +144,7 @@ TRACE_EVENT(ext3_mark_inode_dirty,
__entry->ip = IP;
),
 
-   TP_printk("dev %d,%d ino %lu caller %pF",
+   TP_printk("dev %d,%d ino %lu caller %pS",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  (unsigned long) __entry->ino, (void *)__entry->ip)
 );
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 6e5abd6d..47fca36 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -240,7 +240,7 @@ TRACE_EVENT(ext4_mark_inode_dirty,
__entry->ip = IP;
),
 
-   TP_printk("dev %d,%d ino %lu caller %pF",
+   TP_printk("dev %d,%d ino %lu caller %pS",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  (unsigned long) __entry->ino, (void *)__entry->ip)
 );
@@ -1762,7 +1762,7 @@ TRACE_EVENT(ext4_journal_start,
__entry->rsv_blocks  = rsv_blocks;
),
 
-   TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pF",
+   TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pS",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip)
 );
@@ -1784,7 +1784,7 @@ TRACE_EVENT(ext4_journal_start_reserved,
__entry->blocks  = blocks;
),
 
-   TP_printk("dev %d,%d blocks, %d caller %pF",
+   TP_printk("dev %d,%d blocks, %d caller %pS",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->blocks, (void *)__entry->ip)
 );
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 81c4c18..28c4599 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -84,7 +84,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
__assign_str(name, mod->name);
),
 
-   TP_printk("%s call_site=%pf refcnt=%d",
+   TP_printk("%s call_site=%ps refcnt=%d",
  __get_str(name), (void *)__entry->ip, __entry->refcnt)
 );
 
@@ -121,7 +121,7 @@ TRACE_EVENT(module_request,
__assign_str(name, name);
),
 
-   TP_printk("%s wait=%d call_site=%pf",
+   TP_printk("%s wait=%d call_site=%ps",
  __get_str(name), (int)__entry->wait, (void *)__entry->ip)
 );
 
diff --git a/include/trace/events/random.h b/include/trace/events/random.h
index 805af6d..4684de3 100644
--- a/include/trace/events/random.h
+++ b/include/trace/events/random.h
@@ -22,7 +22,7 @@ TRACE_EVENT(add_device_randomness,
__entry->IP = IP;
),
 
-   TP_printk("bytes %d caller %pF",
+   TP_printk("bytes %d caller %pS",
__entry->bytes, (void *)__entry->IP)
 );
 
@@ -43,7 +43,7 @@ DECLARE_EVENT_CLASS(random__mix_pool_bytes,
__entry->IP = IP;
),
 
-   TP_printk("%s pool: bytes %d caller %pF",
+   TP_printk("%s pool: bytes %d caller %pS",
  __entry->pool_name, __entry->bytes, (void *)__entry->IP)
 );
 
@@ -82,7 +82,7 @@ TRACE_EVENT(credit_entropy_bits,
),
 
TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
- "caller %pF", __entry->pool_name, __entry->bits,
+ "caller %pS", __entry->pool_name, __entry->bits,
  __entry->entropy_count, __entry->entropy_total,
  (void *)__entry->IP)
 );
@@ -207,7 +207,7 @@ 

Re: [PATCH v6 20/30] sparc/PCI: Use pci_scan_host_bridge() for simplicity

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:17AM +0800, Yijing Wang wrote:
> Now we could use pci_scan_host_bridge() to scan
> pci buses, provide sparc specific pci_host_bridge_ops.
> 
> Signed-off-by: Yijing Wang 
> CC: "David S. Miller" 
> CC: sparcli...@vger.kernel.org
> Signed-off-by: Bjorn Helgaas 
> ---
>  arch/sparc/kernel/pci.c |   32 ++--
>  1 files changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
> index 21f804a..7e28f74 100644
> --- a/arch/sparc/kernel/pci.c
> +++ b/arch/sparc/kernel/pci.c
> @@ -650,12 +650,25 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
>   pci_claim_bus_resources(child_bus);
>  }
>  
> +static void pci_host_bridge_of_scan_bus(
> + struct pci_host_bridge *host)
> +{
> + struct pci_pbm_info *pbm = dev_get_drvdata(>dev);
> + struct device_node *node = pbm->op->dev.of_node;
> +
> + pci_of_scan_bus(pbm, node, host->bus);
> +}
> +
> +static struct pci_host_bridge_ops phb_ops = {
> + .scan_bus = pci_host_bridge_of_scan_bus,
> +};
> +
>  struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
>struct device *parent)
>  {
>   LIST_HEAD(resources);
>   struct device_node *node = pbm->op->dev.of_node;
> - struct pci_bus *bus;
> + struct pci_host_bridge *host;
>  
>   printk("PCI: Scanning PBM %s\n", node->full_name);
>  
> @@ -667,22 +680,21 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info 
> *pbm,
>   pbm->busn.end   = pbm->pci_last_busno;
>   pbm->busn.flags = IORESOURCE_BUS;
>   pci_add_resource(, >busn);
> - bus = pci_create_root_bus(parent,
> + host = pci_scan_host_bridge(parent,
>   PCI_DOMBUS(pbm->index, pbm->pci_first_busno),
> - pbm->pci_ops, pbm, );
> - if (!bus) {
> - printk(KERN_ERR "Failed to create bus for %s\n",
> + pbm->pci_ops, pbm, , _ops);
> + if (!host) {
> + printk(KERN_ERR "Failed to create host bridge for %s\n",
>  node->full_name);
>   pci_free_resource_list();
>   return NULL;
>   }
>  

I would keep "bus" and set it here:

bus = host->bus;

That would remove some lines from your patch that really didn't change,
which makes it easier to see what actually *is* changing, namely, you're
removing the pci_of_scan_bus() call because it is now done inside
pci_scan_host_bridge().

> - pci_of_scan_bus(pbm, node, bus);
> - pci_bus_register_of_sysfs(bus);
> + pci_bus_register_of_sysfs(host->bus);
>  
> - pci_claim_bus_resources(bus);
> - pci_bus_add_devices(bus);
> - return bus;
> + pci_claim_bus_resources(host->bus);
> + pci_bus_add_devices(host->bus);
> + return host->bus;
>  }
>  
>  void pcibios_fixup_bus(struct pci_bus *pbus)
> -- 
> 1.7.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 19/22] jfs: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: jfs-discuss...@lists.sourceforge.net
---
 fs/jfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 5d30c56..4cd9798 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -102,7 +102,7 @@ void jfs_error(struct super_block *sb, const char *fmt, ...)
vaf.fmt = fmt;
vaf.va = 
 
-   pr_err("ERROR: (device %s): %pf: %pV\n",
+   pr_err("ERROR: (device %s): %ps: %pV\n",
   sb->s_id, __builtin_return_address(0), );
 
va_end(args);
-- 
2.1.0

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


[PATCH 12/22] sparc: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: sparcli...@vger.kernel.org
---
 arch/sparc/kernel/ds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index f87a55d..4ff835f 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -875,7 +875,7 @@ void ldom_power_off(void)
 
 static void ds_conn_reset(struct ds_info *dp)
 {
-   printk(KERN_ERR "ds-%llu: ds_conn_reset() from %pf\n",
+   printk(KERN_ERR "ds-%llu: ds_conn_reset() from %ps\n",
   dp->id, __builtin_return_address(0));
 }
 
-- 
2.1.0

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


[PATCH 09/22] blackfin: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: adi-buildroot-de...@lists.sourceforge.net
Cc: Steven Miao 
---
 arch/blackfin/kernel/setup.c| 8 
 arch/blackfin/mach-common/smp.c | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 4f424ae..bfb3d85 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1022,15 +1022,15 @@ void __init setup_arch(char **cmdline_p)
printk(KERN_EMERG "Recovering from DOUBLE FAULT event\n");
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
/* We assume the crashing kernel, and the current symbol table 
match */
-   printk(KERN_EMERG " While handling exception (EXCAUSE = %#x) at 
%pF\n",
+   printk(KERN_EMERG " While handling exception (EXCAUSE = %#x) at 
%pS\n",
initial_pda.seqstat_doublefault & SEQSTAT_EXCAUSE,
initial_pda.retx_doublefault);
-   printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pF\n",
+   printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pS\n",
initial_pda.dcplb_doublefault_addr);
-   printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pF\n",
+   printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pS\n",
initial_pda.icplb_doublefault_addr);
 #endif
-   printk(KERN_NOTICE " The instruction at %pF caused a double 
exception\n",
+   printk(KERN_NOTICE " The instruction at %pS caused a double 
exception\n",
initial_pda.retx);
} else if (_bfin_swrst & RESET_WDOG)
printk(KERN_INFO "Recovering from Watchdog event\n");
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 8ad3e90..375262d 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -285,15 +285,15 @@ void secondary_start_kernel(void)
if (_bfin_swrst & SWRST_DBL_FAULT_B) {
printk(KERN_EMERG "CoreB Recovering from DOUBLE FAULT event\n");
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
-   printk(KERN_EMERG " While handling exception (EXCAUSE = %#x) at 
%pF\n",
+   printk(KERN_EMERG " While handling exception (EXCAUSE = %#x) at 
%pS\n",
initial_pda_coreb.seqstat_doublefault & SEQSTAT_EXCAUSE,
initial_pda_coreb.retx_doublefault);
-   printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pF\n",
+   printk(KERN_NOTICE "   DCPLB_FAULT_ADDR: %pS\n",
initial_pda_coreb.dcplb_doublefault_addr);
-   printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pF\n",
+   printk(KERN_NOTICE "   ICPLB_FAULT_ADDR: %pS\n",
initial_pda_coreb.icplb_doublefault_addr);
 #endif
-   printk(KERN_NOTICE " The instruction at %pF caused a double 
exception\n",
+   printk(KERN_NOTICE " The instruction at %pS caused a double 
exception\n",
initial_pda_coreb.retx);
}
 
-- 
2.1.0

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


[PATCH 13/22] x86: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: x...@kernel.org
Cc: xen-de...@lists.xenproject.org
---
 arch/x86/include/asm/trace/exceptions.h | 2 +-
 arch/x86/xen/multicalls.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/trace/exceptions.h 
b/arch/x86/include/asm/trace/exceptions.h
index 2fbc66c..e04d75b 100644
--- a/arch/x86/include/asm/trace/exceptions.h
+++ b/arch/x86/include/asm/trace/exceptions.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(x86_exceptions,
__entry->error_code = error_code;
),
 
-   TP_printk("address=%pf ip=%pf error_code=0x%lx",
+   TP_printk("address=%ps ip=%ps error_code=0x%lx",
  (void *)__entry->address, (void *)__entry->ip,
  __entry->error_code) );
 
diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
index ea54a08..13598f9 100644
--- a/arch/x86/xen/multicalls.c
+++ b/arch/x86/xen/multicalls.c
@@ -103,7 +103,7 @@ void xen_mc_flush(void)
   ret, smp_processor_id());
dump_stack();
for (i = 0; i < b->mcidx; i++) {
-   printk(KERN_DEBUG "  call %2d/%d: op=%lu 
arg=[%lx] result=%ld\t%pF\n",
+   printk(KERN_DEBUG "  call %2d/%d: op=%lu 
arg=[%lx] result=%ld\t%pS\n",
   i+1, b->mcidx,
   b->debug[i].op,
   b->debug[i].args[0],
-- 
2.1.0

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


[PATCH 21/22] xfs: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: x...@oss.sgi.com
---
 fs/xfs/xfs_error.c |  2 +-
 fs/xfs/xfs_trace.h | 20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 3ee186a..338e50b 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -131,7 +131,7 @@ xfs_error_report(
 {
if (level <= xfs_error_level) {
xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
-   "Internal error %s at line %d of file %s.  Caller %pF",
+   "Internal error %s at line %d of file %s.  Caller %pS",
tag, linenum, filename, ra);
 
xfs_stack_trace();
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 51372e3..b5ac81e 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -115,7 +115,7 @@ DECLARE_EVENT_CLASS(xfs_perag_class,
__entry->refcount = refcount;
__entry->caller_ip = caller_ip;
),
-   TP_printk("dev %d:%d agno %u refcount %d caller %pf",
+   TP_printk("dev %d:%d agno %u refcount %d caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->agno,
  __entry->refcount,
@@ -239,7 +239,7 @@ TRACE_EVENT(xfs_iext_insert,
__entry->caller_ip = caller_ip;
),
TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
- "offset %lld block %lld count %lld flag %d caller %pf",
+ "offset %lld block %lld count %lld flag %d caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->ino,
  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
@@ -283,7 +283,7 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
__entry->caller_ip = caller_ip;
),
TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
- "offset %lld block %lld count %lld flag %d caller %pf",
+ "offset %lld block %lld count %lld flag %d caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->ino,
  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
@@ -329,7 +329,7 @@ DECLARE_EVENT_CLASS(xfs_buf_class,
__entry->caller_ip = caller_ip;
),
TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
- "lock %d flags %s caller %pf",
+ "lock %d flags %s caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  (unsigned long long)__entry->bno,
  __entry->nblks,
@@ -402,7 +402,7 @@ DECLARE_EVENT_CLASS(xfs_buf_flags_class,
__entry->caller_ip = caller_ip;
),
TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
- "lock %d flags %s caller %pf",
+ "lock %d flags %s caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  (unsigned long long)__entry->bno,
  __entry->buffer_length,
@@ -447,7 +447,7 @@ TRACE_EVENT(xfs_buf_ioerror,
__entry->caller_ip = caller_ip;
),
TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
- "lock %d error %d flags %s caller %pf",
+ "lock %d error %d flags %s caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  (unsigned long long)__entry->bno,
  __entry->buffer_length,
@@ -613,7 +613,7 @@ DECLARE_EVENT_CLASS(xfs_lock_class,
__entry->lock_flags = lock_flags;
__entry->caller_ip = caller_ip;
),
-   TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
+   TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->ino,
  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
@@ -702,7 +702,7 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
__entry->pincount = atomic_read(>i_pincount);
__entry->caller_ip = caller_ip;
),
-   TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
+   TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->ino,
  __entry->count,
@@ -1333,7 +1333,7 @@ TRACE_EVENT(xfs_bunmap,
__entry->flags = flags;
),
TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
- "flags %s caller %pf",
+ "flags %s caller %ps",
  MAJOR(__entry->dev), MINOR(__entry->dev),
  __entry->ino,
  __entry->size,
@@ -1466,7 +1466,7 @@ TRACE_EVENT(xfs_agf,

[PATCH 20/22] pstore: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: Anton Vorontsov 
Cc: Colin Cross 
Cc: Kees Cook 
Cc: Tony Luck 
---
 fs/pstore/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index b32ce53..f8a5bfe 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -107,7 +107,7 @@ static int pstore_ftrace_seq_show(struct seq_file *s, void 
*v)
struct pstore_ftrace_seq_data *data = v;
struct pstore_ftrace_record *rec = (void *)(ps->data + data->off);
 
-   seq_printf(s, "%d %08lx  %08lx  %pf <- %pF\n",
+   seq_printf(s, "%d %08lx  %08lx  %ps <- %pS\n",
pstore_ftrace_decode_cpu(rec), rec->ip, rec->parent_ip,
(void *)rec->ip, (void *)rec->parent_ip);
 
-- 
2.1.0

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


[PATCH 10/22] microblaze: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: Michal Simek 
---
 arch/microblaze/mm/pgtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c
index 4f4520e..8a8f1cd 100644
--- a/arch/microblaze/mm/pgtable.c
+++ b/arch/microblaze/mm/pgtable.c
@@ -74,7 +74,7 @@ static void __iomem *__ioremap(phys_addr_t addr, unsigned 
long size,
p >= memory_start && p < virt_to_phys(high_memory) &&
!(p >= __virt_to_phys((phys_addr_t)__bss_stop) &&
p < __virt_to_phys((phys_addr_t)__bss_stop))) {
-   pr_warn("__ioremap(): phys addr "PTE_FMT" is RAM lr %pf\n",
+   pr_warn("__ioremap(): phys addr "PTE_FMT" is RAM lr %ps\n",
(unsigned long)p, __builtin_return_address(0));
return NULL;
}
-- 
2.1.0

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


[PATCH 04/22] md/bcache: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: linux-bca...@vger.kernel.org
Cc: Kent Overstreet 
---
 drivers/md/bcache/closure.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bcache/closure.c b/drivers/md/bcache/closure.c
index 7a228de..87abf53 100644
--- a/drivers/md/bcache/closure.c
+++ b/drivers/md/bcache/closure.c
@@ -177,7 +177,7 @@ static int debug_seq_show(struct seq_file *f, void *data)
list_for_each_entry(cl, _list, all) {
int r = atomic_read(>remaining);
 
-   seq_printf(f, "%p: %pF -> %pf p %p r %i ",
+   seq_printf(f, "%p: %pS -> %pf p %p r %i ",
   cl, (void *) cl->ip, cl->fn, cl->parent,
   r & CLOSURE_REMAINING_MASK);
 
@@ -189,7 +189,7 @@ static int debug_seq_show(struct seq_file *f, void *data)
   r & CLOSURE_SLEEPING ? "Sl" : "");
 
if (r & CLOSURE_WAITING)
-   seq_printf(f, " W %pF\n",
+   seq_printf(f, " W %pS\n",
   (void *) cl->waiting_on);
 
seq_printf(f, "\n");
-- 
2.1.0

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


Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)

2015-03-11 Thread Herbert Xu
On Wed, Mar 11, 2015 at 07:43:22PM -0700, Guenter Roeck wrote:
>
> It looks like the perl scripts do run - I see the .S files, and I do see .o 
> files created.
> But I still get the error.
> 
> Looking into the object files, I see
> 
> $ nm vmx-crypto.o | grep aes_p8_cbc_encrypt
> 0680 t .aes_p8_cbc_encrypt
>  U .aes_p8_cbc_encrypt
> 00a8 D aes_p8_cbc_encrypt

Ugh, does this patch help?

Thanks,

--8<--
crypto: vmx - Fix assembler perl to use _GLOBAL

Rather than doing things by hand for global symbols to deal with
different calling conventions we already have a macro _GLOBAL in
Linux to handle this.

Signed-off-by: Herbert Xu 

diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
old mode 100755
new mode 100644
index 3ee8979..6c5c20c
--- a/drivers/crypto/vmx/aesp8-ppc.pl
+++ b/drivers/crypto/vmx/aesp8-ppc.pl
@@ -85,8 +85,6 @@ Lconsts:
 .asciz "AES for PowerISA 2.07, CRYPTOGAMS by "
 
 .globl .${prefix}_set_encrypt_key
-.align 5
-.${prefix}_set_encrypt_key:
 Lset_encrypt_key:
mflrr11
$PUSH   r11,$LRSAVE($sp)
@@ -348,8 +346,6 @@ Lenc_key_abort:
 .size  .${prefix}_set_encrypt_key,.-.${prefix}_set_encrypt_key
 
 .globl .${prefix}_set_decrypt_key
-.align 5
-.${prefix}_set_decrypt_key:
$STU$sp,-$FRAME($sp)
mflrr10
$PUSH   r10,$FRAME+$LRSAVE($sp)
@@ -405,8 +401,6 @@ my ($inp,$out,$key,$rounds,$idx)=map("r$_",(3..7));
 
 $code.=<<___;
 .globl .${prefix}_${dir}crypt
-.align 5
-.${prefix}_${dir}crypt:
lwz $rounds,240($key)
lis r0,0xfc00
mfspr   $vrsave,256
@@ -484,8 +478,6 @@ my 
($ivec,$inptail,$inpperm,$outhead,$outperm,$outmask,$keyperm)=
map("v$_",(4..10));
 $code.=<<___;
 .globl .${prefix}_cbc_encrypt
-.align 5
-.${prefix}_cbc_encrypt:
${UCMP}i$len,16
bltlr-
 
@@ -1243,8 +1235,6 @@ my $dat=$tmp;
 
 $code.=<<___;
 .globl .${prefix}_ctr32_encrypt_blocks
-.align 5
-.${prefix}_ctr32_encrypt_blocks:
${UCMP}i$len,1
bltlr-
 
diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl 
b/drivers/crypto/vmx/ghashp8-ppc.pl
old mode 100755
new mode 100644
index e76a58c..0a6f899
--- a/drivers/crypto/vmx/ghashp8-ppc.pl
+++ b/drivers/crypto/vmx/ghashp8-ppc.pl
@@ -54,8 +54,6 @@ $code=<<___;
 .text
 
 .globl .gcm_init_p8
-.align 5
-.gcm_init_p8:
lis r0,0xfff0
li  r8,0x10
mfspr   $vrsave,256
@@ -98,8 +96,6 @@ $code=<<___;
 .size  .gcm_init_p8,.-.gcm_init_p8
 
 .globl .gcm_gmult_p8
-.align 5
-.gcm_gmult_p8:
lis r0,0xfff8
li  r8,0x10
mfspr   $vrsave,256
@@ -148,8 +144,6 @@ $code=<<___;
 .size  .gcm_gmult_p8,.-.gcm_gmult_p8
 
 .globl .gcm_ghash_p8
-.align 5
-.gcm_ghash_p8:
lis r0,0xfff8
li  r8,0x10
mfspr   $vrsave,256
diff --git a/drivers/crypto/vmx/ppc-xlate.pl b/drivers/crypto/vmx/ppc-xlate.pl
old mode 100755
new mode 100644
index f89e814..a591884
--- a/drivers/crypto/vmx/ppc-xlate.pl
+++ b/drivers/crypto/vmx/ppc-xlate.pl
@@ -27,25 +27,13 @@ my $globl = sub {
/osx/   && do { $name = "_$name";
last;
  };
-   /linux.*(32|64le)/
-   && do { $ret .= ".globl $name\n";
-   $ret .= ".type  $name,\@function";
-   last;
- };
-   /linux.*64/ && do { $ret .= ".globl $name\n";
-   $ret .= ".type  $name,\@function\n";
-   $ret .= ".section   \".opd\",\"aw\"\n";
-   $ret .= ".align 3\n";
-   $ret .= "$name:\n";
-   $ret .= ".quad  .$name,.TOC.\@tocbase,0\n";
-   $ret .= ".previous\n";
-
-   $name = ".$name";
+   /linux/
+   && do { $ret = "_GLOBAL($name)";
last;
  };
 }
 
-$ret = ".globl $name" if (!$ret);
+$ret = ".globl $name\nalign 5\n$name:" if (!$ret);
 $$global = $name;
 $ret;
 };
@@ -187,6 +175,8 @@ my $mtsle   = sub {
 "  .long   ".sprintf "0x%X",(31<<26)|($arg<<21)|(147*2);
 };
 
+print "#include \n" if $flavour =~ /linux/;
+
 while($line=<>) {
 
 $line =~ s|[#!;].*$||; # get rid of asm-style comments...
@@ -200,15 +190,6 @@ while($line=<>) {
 }
 
 {
-   $line =~ s|(^[\.\w]+)\:\s*||;
-   my $label = $1;
-   if ($label) {
-   printf "%s:",($GLOBALS{$label} or $label);
-   printf "\n.localentry\t$GLOBALS{$label},0"  if ($GLOBALS{$label} && 
$flavour =~ /linux.*64le/);
-   }
-}
-
-{
$line =~ 

[PATCH 03/22] sound: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: alsa-de...@alsa-project.org
---
 sound/core/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/device.c b/sound/core/device.c
index 41bec30..4879711 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -127,7 +127,7 @@ void snd_device_free(struct snd_card *card, void 
*device_data)
if (dev)
__snd_device_free(dev);
else
-   dev_dbg(card->dev, "device free %p (from %pF), not found\n",
+   dev_dbg(card->dev, "device free %p (from %pS), not found\n",
device_data, __builtin_return_address(0));
 }
 EXPORT_SYMBOL(snd_device_free);
-- 
2.1.0

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


Re: [PATCH v2] ipv6: expose RFC4191 route preference via rtnetlink

2015-03-11 Thread David Miller
From: Lubomir Rintel 
Date: Wed, 11 Mar 2015 15:39:21 +0100

> This makes it possible to retain the route preference when RAs are handled in
> userspace.
> 
> Signed-off-by: Lubomir Rintel 
> ---
> Changes since v1:
>   - In case an invalid value is specified treat it as 
> ICMPV6_ROUTER_PREF_MEDIUM

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


Re: [PATCH v6 13/30] PCI: Introduce new scan function pci_scan_host_bridge()

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:10AM +0800, Yijing Wang wrote:
> Introduce new scan function pci_scan_host_bridge() to
> support host bridge drivers that need to provide platform
> own pci_host_bridge_ops.
> 
> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/pci/probe.c |   22 ++
>  include/linux/pci.h |4 
>  2 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 59d9be3..99f17e3 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2064,6 +2064,28 @@ static struct pci_bus *__pci_scan_root_bus(
>   return b;
>  }
>  
> +struct pci_host_bridge *pci_scan_host_bridge(struct device *parent,
> + u32 db, struct pci_ops *ops, void *sysdata,
> + struct list_head *resources,
> + struct pci_host_bridge_ops *phb_ops)

Drop the "phb_" prefix.

> +{
> + struct pci_host_bridge *host;
> + struct pci_bus *bus;
> +
> + host = pci_create_host_bridge(parent, db, resources,
> + sysdata, phb_ops);
> + if (!host)
> + return NULL;
> +
> + bus = __pci_scan_root_bus(host, ops);
> + if (!bus)
> + pci_free_host_bridge(host);
> +
> + return host;
> +}
> +EXPORT_SYMBOL(pci_scan_host_bridge);
> +
> +
>  struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db,
>   struct pci_ops *ops, void *sysdata, struct list_head *resources)
>  {
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index e9922b1..28eafb5 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -790,6 +790,10 @@ void pci_bus_release_busn_res(struct pci_bus *b);
>  struct pci_bus *pci_scan_root_bus(struct device *parent, u32 dombus,
>struct pci_ops *ops, void *sysdata,
>struct list_head *resources);
> +struct pci_host_bridge *pci_scan_host_bridge(struct device *parent,
> + u32 dombus, struct pci_ops *ops, void *sysdata,
> + struct list_head *resources,
> + struct pci_host_bridge_ops *phb_ops);
>  struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
>   int busnr);
>  void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v6 12/30] PCI: Introduce pci_host_bridge_ops to support host specific operations

2015-03-11 Thread Bjorn Helgaas
On Mon, Mar 09, 2015 at 10:34:09AM +0800, Yijing Wang wrote:
> Now we have weak functions like pcibios_root_bridge_prepare()
> to setup pci host bridge, We could introduce pci_host_bridge_ops
> which contain host bridge specific ops to setup pci_host_bridge.
> Then host bridge driver could add pci_host_bridge_ops hooks
> intead of weak function to setup pci_host_bridge.
> This patch add following pci_host_bridge_ops hooks:
> 
> pci_host_bridge_ops {
>   /* set root bus speed, some platform need this like powerpc */
>   void (*set_root_bus_speed)(struct pci_host_bridge *host);
>   /* setup pci_host_bridge before pci_host_bridge be added to driver core 
> */
>   int (*prepare)(struct pci_host_bridge *host);
>   /* platform specific of scan hook to scan pci device */
>   void (*scan_bus)(struct pci_host_bridge *);
> }
> We could easily extend it to support different host bridge
> specific operations.
> 
> Signed-off-by: Yijing Wang 
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/pci/host-bridge.c |   12 ++--
>  drivers/pci/pci.h |4 ++--
>  drivers/pci/probe.c   |   17 +++--
>  include/linux/pci.h   |8 
>  4 files changed, 31 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
> index 3c34c49..bc1de59 100644
> --- a/drivers/pci/host-bridge.c
> +++ b/drivers/pci/host-bridge.c
> @@ -23,8 +23,8 @@ static void pci_release_host_bridge_dev(struct device *dev)
>  }
>  
>  struct pci_host_bridge *pci_create_host_bridge(
> - struct device *parent, u32 db,
> - struct list_head *resources, void *sysdata)
> + struct device *parent, u32 db, struct list_head *resources,
> + void *sysdata, struct pci_host_bridge_ops *ops)
>  {
>   int error;
>   int bus = PCI_BUSNUM(db);
> @@ -56,6 +56,7 @@ struct pci_host_bridge *pci_create_host_bridge(
>   }
>   mutex_unlock(_mutex);
>  
> + host->ops = ops;
>   host->dev.parent = parent;
>   INIT_LIST_HEAD(>windows);
>   host->dev.release = pci_release_host_bridge_dev;
> @@ -63,6 +64,13 @@ struct pci_host_bridge *pci_create_host_bridge(
>   dev_set_name(>dev, "pci%04x:%02x", host->domain,
>   host->busnum);
>  
> + if (host->ops && host->ops->prepare) {
> + error = host->ops->prepare(host);
> + if (error) {
> + kfree(host);
> + return NULL;
> + }
> + }
>   error = device_register(>dev);
>   if (error) {
>   put_device(>dev);
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 79a8894..a1dc9f2 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -324,8 +324,8 @@ static inline int pci_dev_specific_reset(struct pci_dev 
> *dev, int probe)
>  #endif
>  
>  struct pci_host_bridge *pci_create_host_bridge(
> - struct device *parent, u32 dombus,
> - struct list_head *resources, void *sysdata);
> + struct device *parent, u32 dombus, struct list_head *resources,
> + void *sysdata, struct pci_host_bridge_ops *ops);
>  
>  void pci_free_host_bridge(struct pci_host_bridge *host);
>  #endif /* DRIVERS_PCI_H */
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index c8e074d..59d9be3 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1889,6 +1889,8 @@ static struct pci_bus *__pci_create_root_bus(
>  
>   bridge->bus = b;
>   b->bridge = get_device(>dev);
> + if (bridge->ops && bridge->ops->set_root_bus_speed)
> + bridge->ops->set_root_bus_speed(bridge);

Before this patch, can you do this:

  - Rename the powerpc pcibios_root_bridge_prepare() to
pcibios_set_root_bus_speed() and add a call to it here

  - Move the pcibios_root_bridge_prepare() call to pci_create_host_bridge()

Then this patch will make a lot more sense because it will look like this,
with the host bridge ops call right next to the matching pcibios call:

  + if (host->ops && host->ops->prepare) {
  + error = host->ops->prepare(host);
  + ...
  + }
pcibios_root_bridge_prepare(...);

  + if (bridge->ops && bridge->ops->set_root_bus_speed)
  + bridge->ops->set_root_bus_speed(bridge);
pcibios_set_root_bus_speed(...);

>   error = pcibios_root_bridge_prepare(bridge);
>   if (error)
>   goto err_out;
> @@ -1954,7 +1956,7 @@ struct pci_bus *pci_create_root_bus(struct device 
> *parent, u32 db,
>  {
>   struct pci_host_bridge *host;
>  
> - host = pci_create_host_bridge(parent, db, resources, sysdata);
> + host = pci_create_host_bridge(parent, db, resources, sysdata, NULL);
>   if (!host)
>   return NULL;
>  
> @@ -2051,10 +2053,13 @@ static struct pci_bus *__pci_scan_root_bus(
>   pci_bus_insert_busn_res(b, b->number, 255);
>   }
>  
> - max = 

Re: [PATCH 12/12] clocksource: Add some debug info about clocksources being registered

2015-03-11 Thread John Stultz
On Sat, Mar 7, 2015 at 1:50 AM, Ingo Molnar  wrote:
>
> * John Stultz  wrote:
>
>> Print the mask, max_cycles, and max_idle_ns values for clocksources
>> being registered.
>>
>> Cc: Dave Jones 
>> Cc: Linus Torvalds 
>> Cc: Thomas Gleixner 
>> Cc: Richard Cochran 
>> Cc: Prarit Bhargava 
>> Cc: Stephen Boyd 
>> Cc: Ingo Molnar 
>> Cc: Peter Zijlstra 
>> Signed-off-by: John Stultz 
>> ---
>>  kernel/time/clocksource.c | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
>> index 3f24bb3..9b75316 100644
>> --- a/kernel/time/clocksource.c
>> +++ b/kernel/time/clocksource.c
>> @@ -697,6 +697,10 @@ void __clocksource_updatefreq_scale(struct clocksource 
>> *cs, u32 scale, u32 freq)
>
> So that name should really be something like 
> __clocksource_update_freq_scale(),
> right?

Sure, I can add an extra patch to address that...


>>   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
>>cs->maxadj, cs->mask,
>>>max_cycles);
>> +
>> + pr_info("clocksource %s: mask: 0x%llx max_cycles: 0x%llx, max_idle_ns: 
>> %lld ns\n",
>> + cs->name, cs->mask, cs->max_cycles, cs->max_idle_ns);
>> +
>
> Also, why is this function exported? No in-tree module uses it.

So, its mostly due to the fact that the inline function
__clocksource_updatefreq_hz() in clocksource.h uses it, which may be
used by some clocksources in their enable() hooks. And those
clocksources may be compiled as a module.


> Also, when I read the code, I noticed:
>
> /**
>  * __clocksource_updatefreq_scale - Used update clocksource with new freq
>  * @cs: clocksource to be registered
>  * @scale:  Scale factor multiplied against freq to get clocksource hz
>  * @freq:   clocksource frequency (cycles per second) divided by scale
>  *
>  * This should only be called from the clocksource->enable() method.
>  *
>  * This *SHOULD NOT* be called directly! Please use the
>  * clocksource_updatefreq_hz() or clocksource_updatefreq_khz helper functions.
>
> One more reason to not export it?
>
> Also, typo in the description.
>
> Plus, one helper function is marked with '()', the other not ...

I'll address that in the new patch as well.

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


Re: [PATCH v4 4/9] selftests: Add install target

2015-03-11 Thread Michael Ellerman
On Wed, 2015-03-11 at 07:18 -0600, Shuah Khan wrote:
> On 03/10/2015 10:06 PM, Michael Ellerman wrote:
> > This adds make install support to selftests. The basic usage is:
> > 
> > $ cd tools/testing/selftests
> > $ make install
> > 
> > That installs into tools/testing/selftests/install, which can then be
> > copied where ever necessary.
> > 
> > The install destination is also configurable using eg:
> > 
> > $ INSTALL_PATH=/mnt/selftests make install
> > 
> > The implementation uses two targets in the child makefiles. The first
> > "install" is expected to install all files into $(INSTALL_PATH).
> > 
> > The second, "emit_tests", is expected to emit the test instructions (ie.
> > bash script) on stdout. Separating this from install means the child
> > makefiles need no knowledge of the location of the test script.
> > 
> > Signed-off-by: Michael Ellerman 
> > ---
> > 
> > v3: Rebase onto 4.0-rc2.
> > Rename all.sh to run_kselftest.sh.
> > Add --no-print-directory to emit_tests invocation.
> > v4: Rebase onto 4.0-rc3, add TEST_FILES to efivars and vm tests, remove
> > newlines from echoes.
> 
> I don't see my comments addressed. If you want me to take
> this work, please address the following comments:
> 
> - Name install directory kselftest. It should work with the
>   the use-case.
> 
>   make INSTALL_PATH=/tmp make install
>   The install directory should be /tmp/kselftest
> 
> - Flatten the directory with all tests under /tmp/kselftest
> 
> I am wasting lot of time because you don't fully address my
> comments and send patches that dont' work correctly. Please
> make sure your patches don't generate work for me.

You're wasting a lot of time? You have got to be kidding me. You are wasting a
lot of *my* time.

You have my patches, they're signed off, you can do what you wish with them.
Good luck.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/22] ARM: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood 
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm/mm/alignment.c   | 2 +-
 arch/arm/nwfpe/fpmodule.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 2c0c541..3419550 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -132,7 +132,7 @@ static const char *usermode_action[] = {
 static int alignment_proc_show(struct seq_file *m, void *v)
 {
seq_printf(m, "User:\t\t%lu\n", ai_user);
-   seq_printf(m, "System:\t\t%lu (%pF)\n", ai_sys, ai_sys_last_pc);
+   seq_printf(m, "System:\t\t%lu (%pS)\n", ai_sys, ai_sys_last_pc);
seq_printf(m, "Skipped:\t%lu\n", ai_skipped);
seq_printf(m, "Half:\t\t%lu\n", ai_half);
seq_printf(m, "Word:\t\t%lu\n", ai_word);
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index ec717c1..2d2bfe2 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -147,7 +147,7 @@ void float_raise(signed char flags)
 #ifdef CONFIG_DEBUG_USER
if (flags & debug)
printk(KERN_DEBUG
-  "NWFPE: %s[%d] takes exception %08x at %pf from %08lx\n",
+  "NWFPE: %s[%d] takes exception %08x at %ps from %08lx\n",
   current->comm, current->pid, flags,
   __builtin_return_address(0), GET_USERREG()->ARM_pc);
 #endif
-- 
2.1.0

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


[PATCH 05/22] PM / AVS: SmartReflex: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: linux...@vger.kernel.org
Cc: Kevin Hilman 
Cc: Nishanth Menon 
---
 drivers/power/avs/smartreflex.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index db9973b..76d6a12 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -356,7 +356,7 @@ int sr_configure_errgen(struct omap_sr *sr)
u8 senp_shift, senn_shift;
 
if (!sr) {
-   pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+   pr_warn("%s: NULL omap_sr from %pS\n", __func__,
(void *)_RET_IP_);
return -EINVAL;
}
@@ -423,7 +423,7 @@ int sr_disable_errgen(struct omap_sr *sr)
u32 vpboundint_en, vpboundint_st;
 
if (!sr) {
-   pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+   pr_warn("%s: NULL omap_sr from %pS\n", __func__,
(void *)_RET_IP_);
return -EINVAL;
}
@@ -478,7 +478,7 @@ int sr_configure_minmax(struct omap_sr *sr)
u8 senp_shift, senn_shift;
 
if (!sr) {
-   pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+   pr_warn("%s: NULL omap_sr from %pS\n", __func__,
(void *)_RET_IP_);
return -EINVAL;
}
@@ -563,7 +563,7 @@ int sr_enable(struct omap_sr *sr, unsigned long volt)
int ret;
 
if (!sr) {
-   pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+   pr_warn("%s: NULL omap_sr from %pS\n", __func__,
(void *)_RET_IP_);
return -EINVAL;
}
@@ -615,7 +615,7 @@ int sr_enable(struct omap_sr *sr, unsigned long volt)
 void sr_disable(struct omap_sr *sr)
 {
if (!sr) {
-   pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+   pr_warn("%s: NULL omap_sr from %pS\n", __func__,
(void *)_RET_IP_);
return;
}
-- 
2.1.0

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


[PATCH 17/22] esp_scsi: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: linux-s...@vger.kernel.org
Cc: Hannes Reinecke 
---
 drivers/scsi/esp_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 065b25d..dba5f10 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -1034,7 +1034,7 @@ static int esp_check_spur_intr(struct esp *esp)
 
 static void esp_schedule_reset(struct esp *esp)
 {
-   esp_log_reset("esp_schedule_reset() from %pf\n",
+   esp_log_reset("esp_schedule_reset() from %ps\n",
  __builtin_return_address(0));
esp->flags |= ESP_FLAG_RESETTING;
esp_event(esp, ESP_EVENT_RESET);
-- 
2.1.0

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


[PATCH 18/22] usb: gadget: serial: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: linux-...@vger.kernel.org
Cc: Felipe Balbi 
---
 drivers/usb/gadget/function/u_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/u_serial.c 
b/drivers/usb/gadget/function/u_serial.c
index 491082a..89179ab 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -912,7 +912,7 @@ static int gs_put_char(struct tty_struct *tty, unsigned 
char ch)
unsigned long   flags;
int status;
 
-   pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %pf\n",
+   pr_vdebug("gs_put_char: (%d,%p) char=0x%x, called from %ps\n",
port->port_num, tty, ch, __builtin_return_address(0));
 
spin_lock_irqsave(>port_lock, flags);
-- 
2.1.0

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


[PATCH 06/22] random: %pF is only for function pointers

2015-03-11 Thread Scott Wood
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood 
Cc: "Theodore Ts'o" 
---
 drivers/char/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 9cd6968..9072db1 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1234,7 +1234,7 @@ void get_random_bytes(void *buf, int nbytes)
 {
 #if DEBUG_RANDOM_BOOT > 0
if (unlikely(nonblocking_pool.initialized == 0))
-   printk(KERN_NOTICE "random: %pF get_random_bytes called "
+   printk(KERN_NOTICE "random: %pS get_random_bytes called "
   "with %d bits of entropy available\n",
   (void *) _RET_IP_,
   nonblocking_pool.entropy_total);
-- 
2.1.0

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


  1   2   3   4   5   6   7   8   9   10   >