Re: [PATCH] Fixing style warnings.

2015-03-02 Thread Sebastian Andrzej Siewior
On 03/03/2015 06:19 AM, cfredric wrote:
> Signed-off-by: cfredric 

You could use your full name here.

> ---
>  drivers/usb/core/buffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
> index 506b969..89f2e77 100644
> --- a/drivers/usb/core/buffer.c
> +++ b/drivers/usb/core/buffer.c
> @@ -70,7 +70,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
>   size = pool_max[i];
>   if (!size)
>   continue;
> - snprintf(name, sizeof name, "buffer-%d", size);
> + snprintf(name, sizeof(name), "buffer-%d", size);

This looks like checkpactch warning you fixed. You could add something
to the patch description that says so.

>   hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
>   size, size, 0);
>   if (!hcd->pool[i]) {
> @@ -95,6 +95,7 @@ void hcd_buffer_destroy(struct usb_hcd *hcd)
>  
>   for (i = 0; i < HCD_BUFFER_POOLS; i++) {
>   struct dma_pool *pool = hcd->pool[i];
> +

This looks unrelated.

>   if (pool) {
>   dma_pool_destroy(pool);
>   hcd->pool[i] = NULL;
> 

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] checkkconfigsymbols.py: filter reports for tools/

2015-03-02 Thread Valentin Rothberg
Hi Paul,

thanks for your answer.

On Tue, Mar 3, 2015 at 1:57 AM, Paul Bolle  wrote:
> On Wed, 2015-02-25 at 15:15 +0100, Valentin Rothberg wrote:
>> @@ -46,8 +46,9 @@ def main():
>>  stdout = stdout[:-1]
>>
>>  for gitfile in stdout.rsplit("\n"):
>> -if ".git" in gitfile or "ChangeLog" in gitfile or \
>> -".log" in gitfile or os.path.isdir(gitfile):
>> +if ".git" in gitfile or "ChangeLog" in gitfile or  \
>> +".log" in gitfile or os.path.isdir(gitfile) or \
>> +gitfile.startswith("tools/"):
>
> Perhaps just
> gitfile == "tools/perf/config/Makefile"
>
> (but I'm unsure if that's valid python)?
>
>>  continue
>>  if REGEX_FILE_KCONFIG.match(gitfile):
>>  kconfig_files.append(gitfile)
>
> This patch was triggered by perf changes that hit next-20150225, wasn't
> it? If so, we might want to find out why the perf people need to use

Yes, it was in next-20150225.  However, more recent changes have the
same problem.  I fear it get's worse for us : )

> their
> "$(call detected,CONFIG_EXAMPLE)"
>
> hack. Especially because that hack is also used on existing Kconfig
> symbols (I spotted X86, X86_64, AUDIT, and NUMA). And the usage of both
> valid Kconfig macros and faux Kconfig macros in that hack looks odd to
> me.

AFAIU it's independent from Kconfig / Kbuild.  The usage of Kconfig
symbols seems completely random to me.

Ignoring tools entirely also seems a little too much, since some tools
are still Kconfig sensitive.Hence, I vote to ignore only perf:

+gitfile.startswith("tools/perf"):
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 for-3.20-fixes] workqueue: fix hang involving racing cancel[_delayed]_work_sync()'s for PREEMPT_NONE

2015-03-02 Thread Jesper Nilsson
On Mon, Mar 02, 2015 at 11:21:44AM -0500, Tejun Heo wrote:
> On Mon, Mar 02, 2015 at 01:26:15PM +0100, Jesper Nilsson wrote:
> > On Mon, Feb 09, 2015 at 05:15:27PM +0100, Tejun Heo wrote:
> > > Hello,
> > 
> > Hi!
> > 
> > > This patch removes the possible hang by updating __cancel_work_timer()
> > > to explicitly wait for clearing of CANCELING rather than invoking
> > > flush_work() after try_to_grab_pending() fails with -ENOENT.  The
> > > explicit wait uses the matching bit waitqueue for the CANCELING bit.
> > > 
> > > Link: http://lkml.kernel.org/g/20150206171156.ga8...@axis.com
> > > 
> > > Signed-off-by: Tejun Heo 
> > > Reported-by: Rabin Vincent 
> > > Cc: sta...@vger.kernel.org
> > 
> > What's the status on this patch, it's not in 4.0-rc1 at least?
> > Is it queued for the 3.18 stable branch?
> 
> Sorry about the delay.  Applied to wq/for-4.0-fixes.  Will push out in
> a week or so.

Thanks, that works great. Just wanted to know. :-)

> Thanks.
> 
> -- 
> tejun

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


Re: [PATCH 0/3] Add ktd2692 Flash LED driver

2015-03-02 Thread Jacek Anaszewski

On 03/02/2015 09:07 PM, Bryan Wu wrote:

On Mon, Mar 2, 2015 at 1:15 AM, Sakari Ailus  wrote:

H Ingi,

On Mon, Mar 02, 2015 at 04:14:39PM +0900, Ingi Kim wrote:

Hi Jacek

On 2015년 02월 27일 17:42, Jacek Anaszewski wrote:

Hi Ingi,

On 02/27/2015 02:01 AM, Ingi Kim wrote:

This patch supports KTD2692 flash LED driver

Ingi Kim (3):
of: Add vendor prefix for Kinetic technologies
leds: ktd2692: add device tree bindings for ktd2692
leds: Add ktd2692 flash LED driver

   .../devicetree/bindings/leds/leds-ktd2692.txt  |   19 ++
   .../devicetree/bindings/vendor-prefixes.txt|1 +
   drivers/leds/Kconfig   |8 +
   drivers/leds/Makefile  |1 +
   drivers/leds/leds-ktd2692.c|  245 

   5 files changed, 274 insertions(+)
   create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd2692.txt
   create mode 100644 drivers/leds/leds-ktd2692.c



In your device tree binding documentation there is torch-gpio mentioned,
but you seem not to use it in the driver.

We have already LED Flash class (/drivers/leds/led-class-flash.c) for
this type of devices, which handles both torch and flash modes
(flash_strobe sysfs attribute is provided for strobing the flash).

The reference drivers using LED Flash class are still pending [1], but I
think that at least leds-aat1290 driver is almost ready for merging.
It controls very similar device to yours.

Another advantage of using LED Flash class is that it has been designed
to be compatible with Video for Linux 2 subsystem, which will allow for 
registering LED Flash class devices as a V4L2 sub-devices.

Adding Sakari.



Ok, I'll check LED Flash class, and add torch-gpio


Many LED flash chips include a hardware pin for torch control but few really
need it. If you don't, i.e. you can implement the torch using the control bus
instead, I think I'd probably drop it from the chip's DT bindings.



Ingi, please follow Jacek's advice to use LED Flash class interface.
I'm reviewing those leds flash drivers and probably merge them soon.


Bryan please hold on with merging them as I am about to send new patch
set, as we've agreed that synchronized strobe feature should be removed
from the LED Flash class. There will be also some tweaking around
aat1290 DT bindings.

--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] udc: gadget: atmel_usba_udc: depend on COMMON_CLK_AT91

2015-03-02 Thread Alexandre Belloni
Since the addition of the errata handling for at91sam9rl and at91sam9g45, the
atmel_usba_udc depends on the pmc driver being present. Explicitly set that
dependency.

Signed-off-by: Alexandre Belloni 
---
 drivers/usb/gadget/udc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 9a3a6b00391a..b04206fdba11 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -55,7 +55,7 @@ config USB_LPC32XX
 
 config USB_ATMEL_USBA
tristate "Atmel USBA"
-   depends on AVR32 || ARCH_AT91
+   depends on AVR32 || ARCH_AT91 && COMMON_CLK_AT91
help
  USBA is the integrated high-speed USB Device controller on
  the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.
-- 
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 v11 0/6] Add Skyworks SKY81452 device drivers

2015-03-02 Thread Lee Jones
On Tue, 03 Mar 2015, Gyungoh Yoo wrote:

> On Fri, Feb 27, 2015 at 08:39:38PM +, Lee Jones wrote:
> > On Fri, 27 Feb 2015, gyun...@gmail.com wrote:
> > 
> > > From: Gyungoh Yoo 
> > > 
> > > This patch set includes regulator and backlight driver for SKY81452.
> > > Also it includes documents for device tree and module.
> > > sky81452-regulator was already applied. So this series doesn't
> > > include it.
> > > 
> > > v11:
> > > Renamed 'skyworks,en-channels' property to led-sources.
> > > Removed unused property 'skyworks,ovp-level'.
> > > 
> > > v10:
> > > Removed trivial get_brightness implementations for sky81452-backlight
> > > 
> > > v9:
> > > Removed the change to remove MODULE_VERSION() for sky81452-regulator
> > > 
> > > v8:
> > > Renamed property names for backlight with vendor prefix
> > > Modified gpio-enable property to generic property for GPIO
> > > Made up the example for backlight DT
> > > Changed the DT parsing of regulator using regulator_node and of_match
> > > 
> > > v7:
> > > Modified licensing text to GPLv2
> > > Split Kconfig renaming from DT patch
> > > 
> > > v6:
> > > Added new line character at the end of line of dev_err()
> > > 
> > > v5:
> > > Changed DT for regulator : 'lout' node should be defined under 'regulator'
> > > Removed compatible string from sky81452-regulator driver
> > > Modified sky81452-regulator to return EINVAL when of_node is NULL
> > > Move sky81452-backlight.h to include/linux/platform_data
> > > 
> > > v4:
> > > Removed MODULE_VERSION()
> > > Modified license to GPLv2
> > > Removed calling to backlight_device_unregister() in sky81452-backlight
> > > 
> > > v3:
> > > Cleaned-up DBG messages
> > > Cleaned-up DT
> > > Fixed the backlight name from 'sky81452-bl' to 'sky81452-backlight'
> > > Assigned mfd_cell.of_compatible for binding device node
> > > Modified error messages
> > > Modified sky81452-regulator to return ENODATA when of_node is NULL
> > > 
> > > v2:
> > > Split the patches for each sub-system
> > > Added 'reg' attribute for I2C address in device tree documents
> > > Added 'compatible' attribute in child drivers
> > > Renamed CONFIG_SKY81452 to CONFIG_MFD_SKY81452
> > > Changed the dependency from I2C=y to I2C, for CONFIG_MFD_SKY81452
> > > Added message for exception or errors.
> > > Added vendor prefix for Skyworks Solutions, Inc.
> > > Add SKY81452 to the Trivial Devices list
> > > 
> > > Gyungoh Yoo (6):
> > >   mfd: Add support for Skyworks SKY81452 driver
> > >   backlight: Add support Skyworks SKY81452 backlight driver
> > >   devicetree: Add new SKY81452 mfd binding
> > >   devicetree: Add new SKY81452 backlight binding
> > >   devicetree: Add vendor prefix for Skyworks Solutions, Inc.
> > >   devicetree: Add SKY81452 to the Trivial Devices list
> > > 
> > >  .../devicetree/bindings/i2c/trivial-devices.txt|   1 +
> > >  Documentation/devicetree/bindings/mfd/sky81452.txt |  35 ++
> > >  .../devicetree/bindings/vendor-prefixes.txt|   1 +
> > >  .../video/backlight/sky81452-backlight.txt |  29 ++
> > >  drivers/mfd/Kconfig|  12 +
> > >  drivers/mfd/Makefile   |   1 +
> > >  drivers/mfd/sky81452.c | 108 +++
> > >  drivers/video/backlight/Kconfig|  10 +
> > >  drivers/video/backlight/Makefile   |   1 +
> > >  drivers/video/backlight/sky81452-backlight.c   | 353 
> > > +
> > >  include/linux/mfd/sky81452.h   |  31 ++
> > >  include/linux/platform_data/sky81452-backlight.h   |  46 +++
> > >  12 files changed, 628 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/mfd/sky81452.txt
> > >  create mode 100644 
> > > Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
> > >  create mode 100644 drivers/mfd/sky81452.c
> > >  create mode 100644 drivers/video/backlight/sky81452-backlight.c
> > >  create mode 100644 include/linux/mfd/sky81452.h
> > >  create mode 100644 include/linux/platform_data/sky81452-backlight.h
> > 
> > Correct me if I'm wrong, but I believe you have all of the relevant
> > Acks now.  If so, I plan to pick this up next week and take it
> > through the MFD tree.
> 
> I had got all Acks except DT on v10.
> Rob from DT reviewed, and v11 includes what he asked.

Let's wait to see if he cares to re-review.  If after a few more days
he has chosen not to, I'll pick up the set.

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


[PATCH] staging/lustre/llite: Fix obd name after c error

2015-03-02 Thread green
From: Oleg Drokin 

commit 95745e9b1de2 ("staging: lustre: Use kasprintf.") introduced
a copy and paste error causing two different obd types to be assigned
same content causing lustre to fail on mount with a warning from procfs
followed by a bizzare error about OST not having enough MDS
capabilities.

This patch unbreaks Lustre client again.

Signed-off-by: Oleg Drokin 
CC: Navya Sri Nizamkari 
CC: Julia Lawall 
---
This really came from nowhere and I do not see this patch in any archives
of mailinglists I am subscribed to.
In fact Google cannot find it either.

 drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index ee4bd89..bf1ec27 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -983,7 +983,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount 
*mnt)
goto out_free;
}
 
-   md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_dt, cfg->cfg_instance);
+   md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_md, cfg->cfg_instance);
if (!md) {
err = -ENOMEM;
goto out_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/


[PATCH v2] ARM: at91: pm: fix SRAM allocation

2015-03-02 Thread Alexandre Belloni
On some platforms, there are multiple SRAM nodes defined in the device tree but
some of them are disabled, leading to allocation failure. Try to find the first
enabled SRAM node and allocate from it.

Signed-off-by: Alexandre Belloni 
Tested-by: Wenyou Yang 
---
Changes in v2:
 - initialize pdev to NULL

 arch/arm/mach-at91/pm.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 5e34fb143309..aa4116e9452f 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -270,37 +270,35 @@ static void __init at91_pm_sram_init(void)
phys_addr_t sram_pbase;
unsigned long sram_base;
struct device_node *node;
-   struct platform_device *pdev;
+   struct platform_device *pdev = NULL;
 
-   node = of_find_compatible_node(NULL, NULL, "mmio-sram");
-   if (!node) {
-   pr_warn("%s: failed to find sram node!\n", __func__);
-   return;
+   for_each_compatible_node(node, NULL, "mmio-sram") {
+   pdev = of_find_device_by_node(node);
+   if (pdev) {
+   of_node_put(node);
+   break;
+   }
}
 
-   pdev = of_find_device_by_node(node);
if (!pdev) {
pr_warn("%s: failed to find sram device!\n", __func__);
-   goto put_node;
+   return;
}
 
sram_pool = dev_get_gen_pool(>dev);
if (!sram_pool) {
pr_warn("%s: sram pool unavailable!\n", __func__);
-   goto put_node;
+   return;
}
 
sram_base = gen_pool_alloc(sram_pool, at91_slow_clock_sz);
if (!sram_base) {
pr_warn("%s: unable to alloc ocram!\n", __func__);
-   goto put_node;
+   return;
}
 
sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base);
slow_clock = __arm_ioremap_exec(sram_pbase, at91_slow_clock_sz, false);
-
-put_node:
-   of_node_put(node);
 }
 #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/


Re: [PATCH] i2c: tegra: match return type of wait_for_completion_timeout

2015-03-02 Thread Alexandre Courbot
On Sun, Mar 1, 2015 at 11:17 PM, Nicholas Mc Guire  wrote:
> return type of wait_for_completion_timeout is unsigned long not int. As ret
> was only used for wait_for_completion_timeout here it is renamed to time_left
> the type changed to unsigned long and references fixed up.
>
> Signed-off-by: Nicholas Mc Guire 

Looks good!

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


Re: [PATCH v2 0/5] split ET_DYN ASLR from mmap ASLR

2015-03-02 Thread Ingo Molnar

* Kees Cook  wrote:

> To address the "offset2lib" ASLR weakness[1], this separates ET_DYN
> ASLR from mmap ASLR, as already done on s390. The architectures
> that are already randomizing mmap (arm, arm64, mips, powerpc, s390,
> and x86), have their various forms of arch_mmap_rnd() made available
> via the new CONFIG_ARCH_HAS_ELF_RANDOMIZE. For these architectures,
> arch_randomize_brk() is collapsed as well.
> 
> This is an alternative to the solutions in:
> https://lkml.org/lkml/2015/2/23/442

Looks good so far:

Reviewed-by: Ingo Molnar 

While reviewing this series I also noticed that the following code 
could be factored out from architecture mmap code as well:

  - arch_pick_mmap_layout() uses very similar patterns across the 
platforms, with only few variations. Many architectures use 
the same duplicated mmap_is_legacy() helper as well. There's 
usually just trivial differences between mmap_legacy_base() 
approaches as well.

  - arch_mmap_rnd(): the PF_RANDOMIZE checks are needlessly
exposed to the arch routine - the arch routine should only 
concentrate on arch details, not generic flags like
PF_RANDOMIZE.

In theory the mmap layout could be fully parametrized as well: i.e. no 
callback functions to architectures by default at all: just 
declarations of bits of randomization desired (or, available address 
space bits), and perhaps an arch helper to allow 32-bit vs. 64-bit 
address space distinctions.

'Weird' architectures could provide special routines, but only by 
overriding the default behavior, which should be generic, safe and 
robust.

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/


[PATCH 1/2] tracing: remove ftrace:function TRACE_EVENT_FL_USE_CALL_FILTER flag

2015-03-02 Thread He Kuang
TRACE_EVENT_FL_USE_CALL_FILTER flag in ftrace:functon event can be
removed. This flag was first introduced in commit
f306cc82a93d ("tracing: Update event filters for multibuffer").

Now, the only place uses this flag is ftrace:function, but the filter of
ftrace:function has a different code path with events/syscalls and
events/tracepoints. It uses ftrace_filter_write() and perf's
ftrace_profile_set_filter() to set the filter, the functionality of file
'tracing/events/ftrace/function/filter' is bypassed in function
init_pred(), in which case, neither call->filter nor file->filter is
used.

So we can safely remove TRACE_EVENT_FL_USE_CALL_FILTER flag from
ftrace:function events.

Signed-off-by: He Kuang 
---
 kernel/trace/trace_export.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 12e2b99..174a6a7 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -177,7 +177,7 @@ struct ftrace_event_call __used event_##call = {
\
},  \
.event.type = etype,\
.print_fmt  = print,\
-   .flags  = TRACE_EVENT_FL_IGNORE_ENABLE | 
TRACE_EVENT_FL_USE_CALL_FILTER, \
+   .flags  = TRACE_EVENT_FL_IGNORE_ENABLE, \
 }; \
 struct ftrace_event_call __used
\
 __attribute__((section("_ftrace_events"))) *__event_##call = _##call;
-- 
2.2.0.33.gc18b867

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/2] tracing: remove macro TRACE_EVENT_FL_USE_CALL_FILTER and related codes

2015-03-02 Thread He Kuang
After applying the previous patch, TRACE_EVENT_FL_USE_CALL_FILTER and
the codes relate to it can be removed.

Signed-off-by: He Kuang 
---
 include/linux/ftrace_event.h   |  2 --
 kernel/trace/trace_events_filter.c | 68 ++
 2 files changed, 11 insertions(+), 59 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c674ee8..fd6bf18 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -250,7 +250,6 @@ enum {
TRACE_EVENT_FL_NO_SET_FILTER_BIT,
TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
TRACE_EVENT_FL_WAS_ENABLED_BIT,
-   TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
TRACE_EVENT_FL_TRACEPOINT_BIT,
 };
 
@@ -272,7 +271,6 @@ enum {
TRACE_EVENT_FL_NO_SET_FILTER= (1 << 
TRACE_EVENT_FL_NO_SET_FILTER_BIT),
TRACE_EVENT_FL_IGNORE_ENABLE= (1 << 
TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
TRACE_EVENT_FL_WAS_ENABLED  = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
-   TRACE_EVENT_FL_USE_CALL_FILTER  = (1 << 
TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
TRACE_EVENT_FL_TRACEPOINT   = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
 };
 
diff --git a/kernel/trace/trace_events_filter.c 
b/kernel/trace/trace_events_filter.c
index ced69da..cc61e0b 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -645,10 +645,7 @@ static void append_filter_err(struct filter_parse_state 
*ps,
 
 static inline struct event_filter *event_filter(struct ftrace_event_file *file)
 {
-   if (file->event_call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   return file->event_call->filter;
-   else
-   return file->filter;
+   return file->filter;
 }
 
 /* caller must hold event_mutex */
@@ -782,12 +779,7 @@ static void __free_preds(struct event_filter *filter)
 
 static void filter_disable(struct ftrace_event_file *file)
 {
-   struct ftrace_event_call *call = file->event_call;
-
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   call->flags &= ~TRACE_EVENT_FL_FILTERED;
-   else
-   file->flags &= ~FTRACE_EVENT_FL_FILTERED;
+   file->flags &= ~FTRACE_EVENT_FL_FILTERED;
 }
 
 static void __free_filter(struct event_filter *filter)
@@ -839,13 +831,8 @@ static int __alloc_preds(struct event_filter *filter, int 
n_preds)
 
 static inline void __remove_filter(struct ftrace_event_file *file)
 {
-   struct ftrace_event_call *call = file->event_call;
-
filter_disable(file);
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   remove_filter_string(call->filter);
-   else
-   remove_filter_string(file->filter);
+   remove_filter_string(file->filter);
 }
 
 static void filter_free_subsystem_preds(struct ftrace_subsystem_dir *dir,
@@ -862,15 +849,8 @@ static void filter_free_subsystem_preds(struct 
ftrace_subsystem_dir *dir,
 
 static inline void __free_subsystem_filter(struct ftrace_event_file *file)
 {
-   struct ftrace_event_call *call = file->event_call;
-
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER) {
-   __free_filter(call->filter);
-   call->filter = NULL;
-   } else {
-   __free_filter(file->filter);
-   file->filter = NULL;
-   }
+   __free_filter(file->filter);
+   file->filter = NULL;
 }
 
 static void filter_free_subsystem_filters(struct ftrace_subsystem_dir *dir,
@@ -1664,55 +1644,30 @@ fail:
 
 static inline void event_set_filtered_flag(struct ftrace_event_file *file)
 {
-   struct ftrace_event_call *call = file->event_call;
-
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   call->flags |= TRACE_EVENT_FL_FILTERED;
-   else
-   file->flags |= FTRACE_EVENT_FL_FILTERED;
+   file->flags |= FTRACE_EVENT_FL_FILTERED;
 }
 
 static inline void event_set_filter(struct ftrace_event_file *file,
struct event_filter *filter)
 {
-   struct ftrace_event_call *call = file->event_call;
-
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   rcu_assign_pointer(call->filter, filter);
-   else
-   rcu_assign_pointer(file->filter, filter);
+   rcu_assign_pointer(file->filter, filter);
 }
 
 static inline void event_clear_filter(struct ftrace_event_file *file)
 {
-   struct ftrace_event_call *call = file->event_call;
-
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   RCU_INIT_POINTER(call->filter, NULL);
-   else
-   RCU_INIT_POINTER(file->filter, NULL);
+   RCU_INIT_POINTER(file->filter, NULL);
 }
 
 static inline void
 event_set_no_set_filter_flag(struct ftrace_event_file *file)
 {
-   struct ftrace_event_call *call = file->event_call;
-
-   if (call->flags & TRACE_EVENT_FL_USE_CALL_FILTER)
-   call->flags |= TRACE_EVENT_FL_NO_SET_FILTER;
-   else
-   file->flags |= 

Re: [PATCH] dmaengine: virt-dma: fix completion list manipulation

2015-03-02 Thread Lars-Peter Clausen

On 03/02/2015 11:03 PM, Robert Jarzmik wrote:

Lars-Peter Clausen  writes:


On 03/02/2015 10:19 PM, Robert Jarzmik wrote:

diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h
index 3772032..2a3da22 100644
--- a/drivers/dma/virt-dma.h
+++ b/drivers/dma/virt-dma.h
@@ -91,7 +91,7 @@ static inline void vchan_cookie_complete(struct virt_dma_desc 
*vd)
dma_cookie_complete(>tx);
dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
 vd, cookie);
-   list_add_tail(>node, >desc_completed);
+   list_move_tail(>node, >desc_completed);


That will break all drivers which handle this currently correctly and remove the
descriptor from any list before calling vchan_cookie_complete.

Ah, well well I don't agree.

First, let's split the drivers which remove the descriptors and these which
don't :

These which remove the descriptor:
dma-jz4740.c
fsl-edma.c

These which don't remove the descriptor:
amba-pl08x.c
edma.c
img-mdc-dma.c
k3dma.c
moxart-dma.c
omap-dma.c
qcom_bam_dma.c
s3c24xx-dma.c
sa11x0-dma.c
sun6i-dma.c


All of those remove the descriptor from the list when they start the transfer.



That settles the correctness I think, the correct behavior is to not remove the
descriptor and let it be done by vchan_cookie_complete().

Now for the remaining 2 drivers, we'll have :
  - list_del(>node) => vd becomes a singleton
  - list_move_tail(>node, &...desc_completed)
=> list_del(>node) : nothing changes, it's a nop
=> list_add_tail(>node, &...desc_completed)

And the behavior remains correct after the patch, only one "list_del()" is done
twice for nothing. Where do you see any breakage ?


Calling list_del() on a list item that is not on a list causes undefined 
behavior, which can result in memory corruption, segfaults, etc...


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


Re: [PATCHv2 01/10] fbdev: ssd1307fb: fix memory address smem_start.

2015-03-02 Thread Maxime Ripard
On Sun, Mar 01, 2015 at 11:27:54PM +0100, Thomas Niederprüm wrote:
> the smem_start pointer of the framebuffer info struct needs to hold the
> physical address rather than the virtual address. This patch fixes a
> driver crash on mmaping the framebuffer memory due to an access to the
> memory address.
> 
> Note however that the memory allocated by kzalloc is not page aligned,
> while the address presented on a mmap call is aligned to the next page
> boudary.
> 
> Signed-off-by: Thomas Niederprüm 

Acked-by: Maxime Ripard 

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH] MTD: m25p80: fix inconsistency in m25p_ids for Micron devices

2015-03-02 Thread Brian Norris
On Mon, Mar 02, 2015 at 10:26:51AM +0100, Mike Looijmans wrote:
> As stated in a5b7616c5, "mtd: m25p80,spi-nor: Fix module aliases for
> m25p80", m25p_ids[] in m25p80.c needs to be kept in sync with
> spi_nor_ids[] in spi-nor.c.
> 
> This patch fixes the mismatches for the Micron devices, the
> "n25q256a" and "n25q512a" do not exist in the spi_nor_ids, so

Huh?

$ git grep -n 'n25q512a' drivers/mtd
drivers/mtd/devices/m25p80.c:269:   {"n25q512a"},   {"n25q512ax3"}, 
{"n25q00"},
drivers/mtd/spi-nor/spi-nor.c:569:  { "n25q512a",INFO(0x20bb20, 0, 64 * 
1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
drivers/mtd/spi-nor/spi-nor.c:570:  { "n25q512ax3",  INFO(0x20ba20, 0, 64 * 
1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
$ git grep -n 'n25q256a' drivers/mtd
drivers/mtd/devices/m25p80.c:268:   {"n25q064"},{"n25q128a11"}, 
{"n25q128a13"}, {"n25q256a"},
drivers/mtd/spi-nor/spi-nor.c:568:  { "n25q256a",INFO(0x20ba19, 0, 64 * 
1024,  512, SECT_4K | SPI_NOR_QUAD_READ) },

> replace them with the correct names for these chips.
> 
> This repairs the disappearance of NOR flash on the Miami boards since 3.18.

$ git grep -n 'n25q256a' v3.18 -- drivers/mtd
v3.18:drivers/mtd/devices/m25p80.c:283: {"n25q064"},{"n25q128a11"}, 
{"n25q128a13"}, {"n25q256a"},
v3.18:drivers/mtd/spi-nor/spi-nor.c:538:{ "n25q256a",INFO(0x20ba19, 
0, 64 * 1024,  512, SECT_4K) },
$ git grep -n 'n25q512a' v3.18 -- drivers/mtd
v3.18:drivers/mtd/devices/m25p80.c:284: {"n25q512a"},   {"n25q512ax3"}, 
{"n25q00"},
v3.18:drivers/mtd/spi-nor/spi-nor.c:539:{ "n25q512a",INFO(0x20bb20, 
0, 64 * 1024, 1024, SECT_4K) },
v3.18:drivers/mtd/spi-nor/spi-nor.c:540:{ "n25q512ax3",  INFO(0x20ba20, 
0, 64 * 1024, 1024, USE_FSR) },

Perhaps you're looking at a modified 3.18 kernel from your vendor?

> Signed-off-by: Mike Looijmans 
> ---
>  drivers/mtd/devices/m25p80.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index b2b33e4..402172c 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -280,8 +280,11 @@ static const struct spi_device_id m25p_ids[] = {
>   {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"},
>   {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"},
>   {"mx66l1g55g"},
> - {"n25q064"},{"n25q128a11"}, {"n25q128a13"}, {"n25q256a"},
> - {"n25q512a"},   {"n25q512ax3"}, {"n25q00"},
> + {"n25q064"},
> + {"n25q128a11"}, {"n25q128a13"},
> + {"n25q256a11"}, {"n25q256a13"},
> + {"n25q512a11"}, {"n25q512a13"}, {"n25q512ax3"},
> + {"n25q00"},

Even if I were to take your change (which I will not), please don't make
arbitrary whitespace changes.

>   {"pm25lv512"},  {"pm25lv010"},  {"pm25lq032"},
>   {"s25sl032p"},  {"s25sl064p"},  {"s25fl256s0"}, {"s25fl256s1"},
>   {"s25fl512s"},  {"s70fl01gs"},  {"s25sl12800"}, {"s25sl12801"},

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


Re: [PATCH net-next 10/14] bluetooth: Use eth__addr instead of memset

2015-03-02 Thread Marcel Holtmann
Hi Joe,

> Use the built-in function instead of memset.
> 
> Signed-off-by: Joe Perches 
> ---
> net/bluetooth/bnep/netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c
> index 4b488ec..6ceb5d3 100644
> --- a/net/bluetooth/bnep/netdev.c
> +++ b/net/bluetooth/bnep/netdev.c
> @@ -218,7 +218,7 @@ static const struct net_device_ops bnep_netdev_ops = {
> void bnep_net_setup(struct net_device *dev)
> {
> 
> - memset(dev->broadcast, 0xff, ETH_ALEN);
> + eth_broadcast_addr(dev->broadcast);
>   dev->addr_len = ETH_ALEN;

Acked-by: Marcel Holtmann 

Regards

Marcel

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


Re: [PATCH 1/1] ARM: exynos_defconfig: Disable IOMMU support

2015-03-02 Thread Javier Martinez Canillas
Hello Kukjin,

On 03/02/2015 08:43 PM, Kukjin Kim wrote:
> On 02/27/15 15:20, Javier Martinez Canillas wrote:
>> Hello Kukjin,
>> 
> Hi,
> 
>> On 02/17/2015 12:38 PM, Javier Martinez Canillas wrote:
>> 
>> Can you please pick this patch? linux-next is still broken for many Exynos
>> boards after commit 8dcc14f82f06 ("drm/exynos: IOMMU support should not be
>> selectable by user") so we need to disable IOMMU support on Exynos to make
>> them boot again.
>> 
>> Here are boot logs of some boards that are affected by this issue:
>> 
>> http://storage.kernelci.org/samsung/v4.0-rc1-44-g6a05e2a77140/arm-exynos_defconfig/lab-tbaker/boot-exynos5250-arndale.html
>> http://storage.kernelci.org/samsung/v4.0-rc1-28-g55a4c031ed15/arm-exynos_defconfig/lab-collabora/boot-exynos5800-peach-pi.html
>> http://storage.kernelci.org/samsung/v4.0-rc1-28-g55a4c031ed15/arm-exynos_defconfig/lab-collabora/boot-exynos5250-snow.html
>> 
> Thanks, applied.
>

Thanks a lot, please keep in mind that this patch is 4.0 rc material since
the offending commit landed in 4.0-rc1 so Exynos DRM driver breaks the boot.
 
>> Also there are other exynos_defconfig patches that have been in the list:
>> 
>> * [PATCH 1/1] ARM: exynos_defconfig: Enable HDMI support
>> https://lkml.org/lkml/2015/2/6/531
>> 
>> * [PATCH] ARM: exynos_defconfig: Enable Marvell WiFi-Ex support
>> https://lkml.org/lkml/2015/2/15/59
>> 
> Will have a look soon ;)
>

Great, thanks.

> - Kukjin
>

Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] mtd: atmel_nand: fix typo in dev_err error message

2015-03-02 Thread Brian Norris
On Sat, Feb 28, 2015 at 08:27:56PM +, Colin King wrote:
> From: Colin Ian King 
> 
> Fix typo, "Unkown" -> "Unknown"
> 
> Signed-off-by: Colin Ian King 

Pushed to l2-mtd.git

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] mtd: nand: MTD_NAND_HISI504 should depend on HAS_DMA

2015-03-02 Thread Brian Norris
On Sun, Mar 01, 2015 at 10:35:52AM +0100, Geert Uytterhoeven wrote:
> If NO_DMA=y:
> 
> drivers/built-in.o: In function `hisi_nfc_probe':
> hisi504_nand.c:(.text+0x23e646): undefined reference to 
> `dmam_alloc_coherent'
> 
> Signed-off-by: Geert Uytterhoeven 

Looks good. Pushed to linux-mtd.git. Thanks!

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/4] crypto: caamhash: add two missed dma_mapping_error

2015-03-02 Thread yjin


On 2015年03月02日 19:53, Horia Geantă wrote:

On 2/28/2015 8:00 AM, yanjiang@windriver.com wrote:

From: Yanjiang Jin 

Add two missed dma_mapping_error() after dma_map_single().

Signed-off-by: Yanjiang Jin 
---
  drivers/crypto/caam/caamhash.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index f347ab7..f6ad322 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -160,6 +160,10 @@ static inline dma_addr_t map_seq_out_ptr_result(u32 *desc, 
struct device *jrdev,
dma_addr_t dst_dma;
  
  	dst_dma = dma_map_single(jrdev, result, digestsize, DMA_FROM_DEVICE);

+   if (dma_mapping_error(jrdev, dst_dma)) {
+   dev_err(jrdev, "unable to map dst dma\n");
+   return -ENOMEM;
+   }
append_seq_out_ptr(desc, dst_dma, digestsize, 0);
  
  	return dst_dma;

Value returned by map_seq_out_ptr_result() - dst_dma - is always fed to
dma_mapping_error().
Note that using an invalid dst_dma in append_seq_out_ptr() doesn't break
anything, so it's ok to check dst_dma later.


@@ -173,6 +177,10 @@ static inline dma_addr_t buf_map_to_sec4_sg(struct device 
*jrdev,
dma_addr_t buf_dma;
  
  	buf_dma = dma_map_single(jrdev, buf, buflen, DMA_TO_DEVICE);

+   if (dma_mapping_error(jrdev, buf_dma)) {
+   dev_err(jrdev, "unable to map buf dma\n");
+   return 0;
+   }
dma_to_sec4_sg_one(sec4_sg, buf_dma, buflen, 0);
  
  	return buf_dma;



These functions are expected to return dma_addr_t, not an error code.
If dma_mapping_error() is needed within their scope, the return type
will have to change. And return value will need to be checked by their
callers.

System run well without the above changes, so abandoned this patch in 
V2. Will do more test in the future.


Thanks!
Yanjiang





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


Re: [regression v4.0-rc1] mm: IPIs from TLB flushes causing significant performance degradation.

2015-03-02 Thread Linus Torvalds
On Mon, Mar 2, 2015 at 9:20 PM, Dave Chinner  wrote:
>>
>> But are those migrate-page calls really common enough to make these
>> things happen often enough on the same pages for this all to matter?
>
> It's looking like that's a possibility.

Hmm. Looking closer, commit 10c1045f28e8 already should have
re-introduced the "pte was already NUMA" case.

So that's not it either, afaik. Plus your numbers seem to say that
it's really "migrate_pages()" that is done more. So it feels like the
numa balancing isn't working right.

But I'm not seeing what would cause that in that commit. It really all
looks the same to me. The few special-cases it drops get re-introduced
later (although in a different form).

Mel, do you see what I'm missing?

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


Re: [PATCH] workqueue: update numa affinity when node hotplug

2015-03-02 Thread Kamezawa Hiroyuki

On 2015/03/03 1:28, Tejun Heo wrote:

Hello,

On Mon, Mar 02, 2015 at 05:41:05PM +0900, Kamezawa Hiroyuki wrote:

Let me start from explaining current behavior.

- cpu-id is determined when a new processor(lapicid/x2apicid) is founded.
   cpu-id<->nodeid relationship is _not_ recorded.


Is this something from the firmware side or is it just that we aren't
maintaining the association right now?



I think it's not just maintained.


- node-id is determined when a new pxm(firmware info) is founded.
   pxm<->nodeid relationship is recorded.

By this, there are 2 cases of cpu<->nodeid change.

Case A) In x86, cpus on memory-less nodes are all tied to existing nodes(round 
robin).
At memory-hotadd happens and a new node comes, cpus are moved to a newly added 
node
based on pxm.


Ah, okay, so the firmware doesn't provide proximity information at all
for memory-less nodes so we end up putting all of them somewhere
random and when memory is added to one of the memory-less nodes, the
mapping information changes?



With memory-less node, proximity domain for processors are given but ignored.
When memory(node) hotplug happens, the information revisited and cpuid<->nodeid
relationship is updated.


Am I understanding it correctly?  If so, it's super weird tho.  Why
wouldn't there be proximity information for a memless node?  Not
having memory doesn't mean it's at the same distance from all existing
nodes.


Firmware gives pxm for memory-less node but it's ignored.
I'm not sure why the current implemetaion is.


Case B) Adding a node after removing another node, if pxm of them were 
different from
each other, cpu<->node relatiionship changes.


I don't get this either.  Does proximity relationship actually change?
Or is it that we're assigning different IDs to the same thing?Isn't
proximity pretty much hardwired to how the system is architected to
begin with?



relationship between proximity domain and lapic id doesn't change.
relationship between lapic-id and cpu-id changes.

pxm <-> memory address  : no change
pxm <-> lapicid : no change
pxm <-> node id : no change
lapicid <-> cpu id  : change.


I personally thinks proper fix is building persistent cpu-id <-> lapicid 
relationship as
pxm does rather than creating band-aid.


Oh if this is possible, I agree that's the right direction too.



Implementation is a bit complicated now :(.

Thanks,
-Kame


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 4/4] crypto: caamhash: replace kmalloc with kzalloc

2015-03-02 Thread yjin


On 2015年03月02日 19:03, Horia Geantă wrote:

On 2/28/2015 8:00 AM, yanjiang@windriver.com wrote:

From: Yanjiang Jin 

This can make sure we get a clean memory, else system would report
the below warning:

I'd avoid using kzalloc, it's an overhead on the hot path. kmalloc can
be used with a bit of attention to detail, i.e. what params to
explicitly initialize.

Got it. Just zeroing edesc->sec4_sg_bytes in V2.

Thanks!
Yanjiang


I see that the stack trace reports using WR Linux and a modified caam
driver - it uses NAPI (net_rx_action) instead of tasklet.

Have you actually reproduced the problem on upstream linux?
There are some fixes that already address similar (if not exact) problem:
76b99080ccc9 "crypto: caam - fix uninitialized edesc->dst_dma fiel"
45e9af78b1ab "crypto: caam - fix uninitialized S/G table size in
ahash_digest"

Thanks,
Horia


caam_jr ffe301000.jr: DMA-API: device driver tries to free DMA memory it has 
not allocated [device address=0xdeadbeefdeadbeef] [size=18446744073150512879 
bytes]
[ cut here ]
WARNING: at lib/dma-debug.c:877
Modules linked in:
CPU: 1 PID: 98 Comm: cryptomgr_test Not tainted 3.10.62-ltsi-WR6.0.0.0_standard 
#175
task: c000f74bc400 ti: c000fffd task.ti: c000f775c000
NIP: c04f5ed8 LR: c04f5ed4 CTR: c055a160
REGS: c000fffd3650 TRAP: 0700   Not tainted  
(3.10.62-ltsi-WR6.0.0.0_standard)
MSR: 80029000   CR: 24a48e84  XER: 
SOFTE: 1

004f5ed4 c000fffd38d0 c12af348 00a0
24a48e84  c125f1c8 01eb
0060 0001 10187373 0020
01eb c1fff780 c11ac928 c0007f003028
0097 0098 0098 c000f7758800
f7098c00 0001 0001 003f
f7098c00 0014 c0007f003000 c11b0e98
 c1565b80 c000fffd39e0 c000f72f2410
NIP [c04f5ed8] .check_unmap+0x848/0x9c0
LR [c04f5ed4] .check_unmap+0x844/0x9c0
Call Trace:
[c000fffd38d0] [c04f5ed4] .check_unmap+0x844/0x9c0 (unreliable)
[c000fffd3970] [c04f60d4] .debug_dma_unmap_page+0x84/0xb0
[c000fffd3aa0] [c08295cc] .ahash_done+0x1dc/0x360
[c000fffd3ca0] [c081b7ec] .caam_jr_dequeue+0x26c/0x3a0
[c000fffd3da0] [c08be50c] .net_rx_action+0x1cc/0x330
[c000fffd3e80] [c007276c] .__do_softirq+0x19c/0x3d0
[c000fffd3f90] [c0017054] .call_do_softirq+0x14/0x24
[c000f775ef10] [c0005fe8] .do_softirq+0x118/0x150
  sda: sda1 sda2 sda3
[c000f775efa0] [c0072c54] .irq_exit+0x124/0x140
[c000f775f020] [c0005ac4] .do_IRQ+0x184/0x370
[c000f775f0d0] [c001b93c] exc_0x500_common+0xfc/0x100
--- Exception: 501 at .rcu_note_context_switch+0x0/0x370
edule+0xbc/0x7f0
[c000f775f3c0] [c0a29944] .__schedule+0xa4/0x7f0 (unreliable)
[c000f775f620] [c0a277f4] .schedule_timeout+0x1b4/0x2e0
[c000f775f700] [c0a29428] .wait_for_common+0xf8/0x1d0
[c000f775f7c0] [c0a295ac] 
.wait_for_completion_interruptible+0x2c/0x50
[c000f775f840] [c0494b64] 
.do_one_async_hash_op.isra.1.part.2+0x24/0x50
[c000f775f8c0] [c04951a8] .test_hash+0x618/0x7d0
[c000f775fb30] [c0495424] .alg_test_hash+0xc4/0xf0
[c000f775fbc0] [c0494928] .alg_test+0xa8/0x2c0
[c000f775fcb0] [c0491164] .cryptomgr_test+0x64/0x80
[c000f775fd30] [c009a8d0] .kthread+0xf0/0x100
[c000f775fe30] [ca08] .ret_from_kernel_thread+0x5c/0xd4
Instruction dump:
7c641b78 419e0160 e8a90050 2fa5 409e0008 e8a90010 e8de0028 e8fe0030
3c62ff90 38638320 48546b69 6000 <0fe0> 4b34 e87e0010 2fa3
---[ end trace 52825d316d569f00 ]---

Signed-off-by: Yanjiang Jin 
---






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


[PATCH 3/3] crypto: caamhash: - fix uninitialized edesc->sec4_sg_bytes field

2015-03-02 Thread yanjiang.jin
From: Yanjiang Jin 

sec4_sg_bytes not being properly initialized causes ahash_done
to try to free unallocated DMA memory:

caam_jr ffe301000.jr: DMA-API: device driver tries to free DMA memory it has 
not allocated [device address=0xdeadbeefdeadbeef] [size=3735928559 bytes]
[ cut here ]
WARNING: at lib/dma-debug.c:1093
Modules linked in:
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.0.0-rc1-WR6.0.0.0_standard+ #6
task: e9598c00 ti: effca000 task.ti: e95a2000
NIP: c04ef24c LR: c04ef24c CTR: c0549730
REGS: effcbd40 TRAP: 0700   Not tainted  (4.0.0-rc1-WR6.0.0.0_standard+)
MSR: 00029002   CR: 22008084  XER: 2000

GPR00: c04ef24c effcbdf0 e9598c00 0096 c08f7424 c00ab2b0  0001
GPR08: c0fe7510 effca000  01c3 22008082  c1048e77 c105
GPR16: c0c36700 493c0040 002c e690e4a0 c1054fb4 c18bac40 00029002 c18b0788
GPR24: 0014 e690e480 effcbe48  c0fde128 e6ffac10 deadbeef deadbeef
NIP [c04ef24c] check_unmap+0x93c/0xb40
LR [c04ef24c] check_unmap+0x93c/0xb40
Call Trace:
[effcbdf0] [c04ef24c] check_unmap+0x93c/0xb40 (unreliable)
[effcbe40] [c04ef4f4] debug_dma_unmap_page+0xa4/0xc0
[effcbec0] [c070cda8] ahash_done+0x128/0x1a0
[effcbef0] [c0700070] caam_jr_dequeue+0x1d0/0x290
[effcbf40] [c0045f40] tasklet_action+0x110/0x1f0
[effcbf80] [c0044bc8] __do_softirq+0x188/0x700
[effcbfe0] [c00455d8] irq_exit+0x108/0x120
[effcbff0] [c000f520] call_do_irq+0x24/0x3c
[e95a3e20] [c00059b8] do_IRQ+0xc8/0x170
[e95a3e50] [c0011bc8] ret_from_except+0x0/0x18
--- interrupt: 501 at arch_cpu_idle+0x30/0xa0
LR = arch_cpu_idle+0x30/0xa0
[e95a3f10] [c009a5c8] trace_hardirqs_off_caller+0xf8/0x1d0 (unreliable)
[e95a3f20] [c0094810] cpu_startup_entry+0x220/0x4b0
[e95a3f90] [c00140f8] start_secondary+0x3a8/0x4e0
[e95a3ff0] [c0001c88] __secondary_start+0x7c/0xc8
Instruction dump:
41de01c8 80a9002c 2f85 40fe0008 80a90008 80fa0018 3c60c0ae 811a001c
38637b8c 813a0020 815a0024 4840ef15 <0fe0> 8134004c 2f89 40feff48
---[ end trace 52fb050c6682b55a ]---

Signed-off-by: Yanjiang Jin 
---

Change log:
v2:

Abandon the v1 patch 0004-crypto-caamhash-replace-kmalloc-with-kzalloc.patch.
Just zeroing edesc->sec4_sg_bytes.

 drivers/crypto/caam/caamhash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index f347ab7..ba0532e 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -1172,6 +1172,7 @@ static int ahash_final_no_ctx(struct ahash_request *req)
return -ENOMEM;
}
 
+   edesc->sec4_sg_bytes = 0;
sh_len = desc_len(sh_desc);
desc = edesc->hw_desc;
init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | HDR_REVERSE);
-- 
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 1/3] crypto: caam: fix some compile warnings

2015-03-02 Thread yanjiang.jin
From: Yanjiang Jin 

This commit is to avoid the below warnings:

drivers/crypto/caam/sg_sw_sec4.h:88:12: warning:
'dma_map_sg_chained' defined but not used [-Wunused-function]
 static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg,
^
drivers/crypto/caam/sg_sw_sec4.h:104:12: warning:
'dma_unmap_sg_chained' defined but not used [-Wunused-function]
 static int dma_unmap_sg_chained(struct device *dev,
^

Signed-off-by: Yanjiang Jin 
---

V2: no change.

 drivers/crypto/caam/sg_sw_sec4.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index 3b91821..a6276eb 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -85,7 +85,7 @@ static inline int sg_count(struct scatterlist *sg_list, int 
nbytes,
return sg_nents;
 }
 
-static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg,
+static inline int dma_map_sg_chained(struct device *dev, struct scatterlist 
*sg,
  unsigned int nents, enum dma_data_direction dir,
  bool chained)
 {
@@ -101,9 +101,9 @@ static int dma_map_sg_chained(struct device *dev, struct 
scatterlist *sg,
return nents;
 }
 
-static int dma_unmap_sg_chained(struct device *dev, struct scatterlist *sg,
-   unsigned int nents, enum dma_data_direction dir,
-   bool chained)
+static inline int dma_unmap_sg_chained(struct device *dev,
+   struct scatterlist *sg, unsigned int nents,
+   enum dma_data_direction dir, bool chained)
 {
if (unlikely(chained)) {
int i;
-- 
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 2/3] crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem

2015-03-02 Thread yanjiang.jin
From: Yanjiang Jin 

Fix rng_unmap_ctx's DMA_UNMAP size problem for caam_rng, else system would
report the below calltrace during kexec boot:

caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different 
size [device address=0x7f080010] [map size=16 bytes] [unmap size=40 
bytes]
[ cut here ]
WARNING: at lib/dma-debug.c:887
Modules linked in:
CPU: 1 PID: 730 Comm: kexec Not tainted 3.10.62-ltsi-WR6.0.0.0_standard #188
task: c000f7cdaa80 ti: c000e534 task.ti: c000e534
NIP: c04f5bc8 LR: c04f5bc4 CTR: c05f69b0
REGS: c000e53433c0 TRAP: 0700   Not tainted  
(3.10.62-ltsi-WR6.0.0.0_standard)
MSR: 80029000   CR: 24088482  XER: 
SOFTE: 0

GPR00: c04f5bc4 c000e5343640 c12af360 009f
GPR04:  00a0 c0d02070 c00015980660
GPR08: c0cff360   c12da018
GPR12: 01e3 c1fff780 100f 0001
GPR16: 0002   
GPR20:    0001
GPR24: 0001 0001  0001
GPR28: c1556b90 c1565b80 c000e5343750 c000f9427480
NIP [c04f5bc8] .check_unmap+0x538/0x9c0
LR [c04f5bc4] .check_unmap+0x534/0x9c0
Call Trace:
[c000e5343640] [c04f5bc4] .check_unmap+0x534/0x9c0 (unreliable)
[c000e53436e0] [c04f60d4] .debug_dma_unmap_page+0x84/0xb0
[c000e5343810] [c082f9d4] .caam_cleanup+0x1d4/0x240
[c000e53438a0] [c056cc88] .hwrng_unregister+0xd8/0x1c0
[c000e5343930] [c082fa74] .caam_rng_shutdown+0x34/0x60
[c000e53439a0] [c0817354] .caam_remove+0x54/0x420
[c000e5343a70] [c05791ac] .platform_drv_shutdown+0x3c/0x60
[c000e5343af0] [c0573728] .device_shutdown+0x128/0x240
[c000e5343b90] [c00880b4] .kernel_restart_prepare+0x54/0x70
[c000e5343c10] [c00e5cac] .kernel_kexec+0x9c/0xd0
[c000e5343c90] [c0088404] .SyS_reboot+0x244/0x2d0
[c000e5343e30] [c718] syscall_exit+0x0/0x8c
Instruction dump:
7c641b78 41de0410 e8a90050 2fa5 419e0484 e8de0028 e8ff0030 3c62ff90
e91e0030 38638388 48546ed9 6000 <0fe0> 3c62ff8f 38637fc8 48546ec5
---[ end trace e43fd1734d6600df ]---

Signed-off-by: Yanjiang Jin 
---

V2: no change.

 drivers/crypto/caam/caamrng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index ae31e55..314f73d 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -90,8 +90,8 @@ static inline void rng_unmap_ctx(struct caam_rng_ctx *ctx)
struct device *jrdev = ctx->jrdev;
 
if (ctx->sh_desc_dma)
-   dma_unmap_single(jrdev, ctx->sh_desc_dma, DESC_RNG_LEN,
-DMA_TO_DEVICE);
+   dma_unmap_single(jrdev, ctx->sh_desc_dma,
+   desc_bytes(ctx->sh_desc), DMA_TO_DEVICE);
rng_unmap_buf(jrdev, >bufs[0]);
rng_unmap_buf(jrdev, >bufs[1]);
 }
-- 
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: [PATCHv2 0/7] introduce dynamic device creation/removal

2015-03-02 Thread Sergey Senozhatsky
On (03/01/15 17:42), Sergey Senozhatsky wrote:
> v2:
> switch to sysfs class, rather than using /dev/zram-control node and
> doing IOCTL on it. we lose some features, though. like automatic
> device_id generation.
> 

Hello,

will submit v3 later today:
-- add missing add/remove documentation
-- fix kernel version typo in class documentation
-- add new trivial cleanup patch

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


[PATCH 0/3] fix some CAAM warnings.

2015-03-02 Thread yanjiang.jin
From: Yanjiang Jin 

Hi,

This patch series  fix some CAAM compile and runtime warnings.
The patches 0001 and 0002 are same as V1.

I have tested this on fsl-p5020ds board using upstream 4.0.0-rc1+ with the 
below configs:

CONFIG_DMA_API_DEBUG=y
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set

Change log:
v2:

Abandon the v1 patch 
0003-crypto-caamhash-add-two-missed-dma_mapping_error.patch.
Replace the v1 patch 0004-crypto-caamhash-replace-kmalloc-with-kzalloc.patch 
with the new
patch 0003-crypto-caamhash-fix-uninitialized-edesc-sec4_sg_byte.patch.

Yanjiang Jin (3):
  crypto: caam: fix some compile warnings
  crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem
  crypto: caamhash: - fix uninitialized edesc->sec4_sg_bytes field

 drivers/crypto/caam/caamhash.c   | 1 +
 drivers/crypto/caam/caamrng.c| 4 ++--
 drivers/crypto/caam/sg_sw_sec4.h | 8 
 3 files changed, 7 insertions(+), 6 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] efi: Clean up the efi_call_phys_[prolog|epilog]() save/restore interaction

2015-03-02 Thread Ingo Molnar

Also clean up the save_pgd global variable while at it.

untested as well.

Thanks,

Ingo

==>
>From 166625ceaef68fcbeee63adc63c02d75abcaf0db Mon Sep 17 00:00:00 2001
From: Ingo Molnar 
Date: Tue, 3 Mar 2015 07:42:48 +0100
Subject: [PATCH] efi: Clean up the efi_call_phys_[prolog|epilog]() save/restore 
interaction

Currently x86-64 efi_call_phys_prolog() saves into a global variable (save_pgd),
and efi_call_phys_epilog() restores the kernel pagetables from that global
variable.

Change this to a cleaner save/restore pattern where the saving function returns
the saved object and the restore function restores that.

Apply the same concept to the 32-bit code as well.

Plus this approach, as an added bonus, allows us to express the
!efi_enabled(EFI_OLD_MEMMAP) situation in a clean fashion as well,
via a 'NULL' return value.

Cc: Tapasweni Pathak 
Signed-off-by: Ingo Molnar 
---
 arch/x86/include/asm/efi.h |  6 --
 arch/x86/platform/efi/efi.c|  5 +++--
 arch/x86/platform/efi/efi_32.c | 11 ---
 arch/x86/platform/efi/efi_64.c | 26 --
 4 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 25bce45c6fc4..3738b138b843 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -2,6 +2,8 @@
 #define _ASM_X86_EFI_H
 
 #include 
+#include 
+
 /*
  * We map the EFI regions needed for runtime services non-contiguously,
  * with preserved alignment on virtual addresses starting from -4G down
@@ -89,8 +91,8 @@ extern void __iomem *__init efi_ioremap(unsigned long addr, 
unsigned long size,
 extern struct efi_scratch efi_scratch;
 extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable);
 extern int __init efi_memblock_x86_reserve_range(void);
-extern void __init efi_call_phys_prolog(void);
-extern void __init efi_call_phys_epilog(void);
+extern pgd_t * __init efi_call_phys_prolog(void);
+extern void __init efi_call_phys_epilog(pgd_t *save_pgd);
 extern void __init efi_unmap_memmap(void);
 extern void __init efi_memory_uc(u64 addr, unsigned long size);
 extern void __init efi_map_region(efi_memory_desc_t *md);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 2490a15d18f1..aa5bd2b986c2 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -86,8 +86,9 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
 {
efi_status_t status;
unsigned long flags;
+   pgd_t *save_pgd;
 
-   efi_call_phys_prolog();
+   save_pgd = efi_call_phys_prolog();
 
/* Disable interrupts around EFI calls: */
local_irq_save(flags);
@@ -96,7 +97,7 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
   descriptor_version, virtual_map);
local_irq_restore(flags);
 
-   efi_call_phys_epilog();
+   efi_call_phys_epilog(save_pgd);
 
return status;
 }
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index abecc6e1dc90..ed5b67338294 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -56,19 +56,24 @@ void __init efi_map_region(efi_memory_desc_t *md)
 void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
 void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
 
-void __init efi_call_phys_prolog(void)
+pgd_t * __init efi_call_phys_prolog(void)
 {
struct desc_ptr gdt_descr;
+   pgd_t *save_pgd;
 
+   /* Current pgd is swapper_pg_dir, we'll restore it later: */
+   save_pgd = swapper_pg_dir;
load_cr3(initial_page_table);
__flush_tlb_all();
 
gdt_descr.address = __pa(get_cpu_gdt_table(0));
gdt_descr.size = GDT_SIZE - 1;
load_gdt(_descr);
+
+   return save_pgd;
 }
 
-void __init efi_call_phys_epilog(void)
+void __init efi_call_phys_epilog(pgd_t *save_pgd)
 {
struct desc_ptr gdt_descr;
 
@@ -76,7 +81,7 @@ void __init efi_call_phys_epilog(void)
gdt_descr.size = GDT_SIZE - 1;
load_gdt(_descr);
 
-   load_cr3(swapper_pg_dir);
+   load_cr3(save_pgd);
__flush_tlb_all();
 }
 
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 427eb3540e5f..a0ac0f9c307f 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -41,8 +41,6 @@
 #include 
 #include 
 
-static pgd_t *save_pgd __initdata;
-
 /*
  * We allocate runtime services regions bottom-up, starting from -4G, i.e.
  * 0x___ and limit EFI VA mapping space to 64G.
@@ -77,14 +75,16 @@ static void __init early_code_mapping_set_exec(int 
executable)
}
 }
 
-void __init efi_call_phys_prolog(void)
+pgd_t * __init efi_call_phys_prolog(void)
 {
unsigned long vaddress;
+   pgd_t *save_pgd;
+
int pgd;
int n_pgds;
 
if (!efi_enabled(EFI_OLD_MEMMAP))
-   return;
+   return NULL;
 

RE: [RFC V3] mm: change mm_advise_free to clear page dirty

2015-03-02 Thread Wang, Yalin
> -Original Message-
> From: Minchan Kim [mailto:minchan@gmail.com] On Behalf Of Minchan Kim
> Sent: Tuesday, March 03, 2015 12:15 PM
> To: Wang, Yalin
> Cc: 'Michal Hocko'; 'Andrew Morton'; 'linux-kernel@vger.kernel.org';
> 'linux...@kvack.org'; 'Rik van Riel'; 'Johannes Weiner'; 'Mel Gorman';
> 'Shaohua Li'; Hugh Dickins; Cyrill Gorcunov
> Subject: Re: [RFC V3] mm: change mm_advise_free to clear page dirty
> 
> On Tue, Mar 03, 2015 at 11:59:17AM +0800, Wang, Yalin wrote:
> > > -Original Message-
> > > From: Minchan Kim [mailto:minchan@gmail.com] On Behalf Of Minchan
> Kim
> > > Sent: Tuesday, March 03, 2015 11:26 AM
> > > To: Wang, Yalin
> > > Cc: 'Michal Hocko'; 'Andrew Morton'; 'linux-kernel@vger.kernel.org';
> > > 'linux...@kvack.org'; 'Rik van Riel'; 'Johannes Weiner'; 'Mel Gorman';
> > > 'Shaohua Li'; Hugh Dickins; Cyrill Gorcunov
> > > Subject: Re: [RFC V3] mm: change mm_advise_free to clear page dirty
> > >
> > > Could you separte this patch in this patchset thread?
> > > It's tackling differnt problem.
> > >
> > > As well, I had a question to previous thread about why shared page
> > > has a problem now but you didn't answer and send a new patchset.
> > > It makes reviewers/maintainer time waste/confuse. Please, don't
> > > hurry to send a code. Before that, resolve reviewers's comments.
> > >
> > > On Tue, Mar 03, 2015 at 10:06:40AM +0800, Wang, Yalin wrote:
> > > > This patch add ClearPageDirty() to clear AnonPage dirty flag,
> > > > if not clear page dirty for this anon page, the page will never be
> > > > treated as freeable. We also make sure the shared AnonPage is not
> > > > freeable, we implement it by dirty all copyed AnonPage pte,
> > > > so that make sure the Anonpage will not become freeable, unless
> > > > all process which shared this page call madvise_free syscall.
> > >
> > > Please, spend more time to make description clear. I really doubt
> > > who understand this description without code inspection. :(
> > > Of course, I'm not a person to write description clear like native
> > > , either but just I'm sure I spend a more time to write description
> > > rather than coding, at least. :)
> > >
> > I see, I will send another mail for file private map pages.
> > Sorry for my English expressions.
> > I think your solution is ok,
> > Your patch will make sure the anonpage pte will always be dirty.
> > I add some comments for your patch:
> >
> > > ---
> > >  mm/madvise.c | 1 -
> > >  mm/memory.c  | 9 +++--
> > >  mm/rmap.c| 2 +-
> > >  mm/vmscan.c  | 3 +--
> > >  4 files changed, 9 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/mm/madvise.c b/mm/madvise.c
> > > index 6d0fcb8..d64200e 100644
> > > --- a/mm/madvise.c
> > > +++ b/mm/madvise.c
> > > @@ -309,7 +309,6 @@ static int madvise_free_pte_range(pmd_t *pmd,
> unsigned
> > > long addr,
> > >   continue;
> > >   }
> > >
> > > - ClearPageDirty(page);
> > >   unlock_page(page);
> > >   }
> > >
> > > diff --git a/mm/memory.c b/mm/memory.c
> > > index 8ae52c9..2f45e77 100644
> > > --- a/mm/memory.c
> > > +++ b/mm/memory.c
> > > @@ -2460,9 +2460,14 @@ static int do_swap_page(struct mm_struct *mm,
> struct
> > > vm_area_struct *vma,
> > >
> > >   inc_mm_counter_fast(mm, MM_ANONPAGES);
> > >   dec_mm_counter_fast(mm, MM_SWAPENTS);
> > > - pte = mk_pte(page, vma->vm_page_prot);
> > > +
> > > + /*
> > > +  * Every page swapped-out was pte_dirty so we makes pte dirty again.
> > > +  * MADV_FREE relys on it.
> > > +  */
> > > + pte = mk_pte(pte_mkdirty(page), vma->vm_page_prot);
> > pte_mkdirty() usage seems wrong here.
> 
> Argh, it reveals I didn't test even build. My shame.
> But RFC tag might mitigate my shame. :)
> I will fix it if I send a formal version.
> Thanks for the review.
> 
> >
> > >   if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) {
> > > - pte = maybe_mkwrite(pte_mkdirty(pte), vma);
> > > + pte = maybe_mkwrite(pte, vma);
> > >   flags &= ~FAULT_FLAG_WRITE;
> > >   ret |= VM_FAULT_WRITE;
> > >   exclusive = 1;
> > > diff --git a/mm/rmap.c b/mm/rmap.c
> > > index 47b3ba8..34c1d66 100644
> > > --- a/mm/rmap.c
> > > +++ b/mm/rmap.c
> > > @@ -1268,7 +1268,7 @@ static int try_to_unmap_one(struct page *page,
> struct
> > > vm_area_struct *vma,
> > >
> > >   if (flags & TTU_FREE) {
> > >   VM_BUG_ON_PAGE(PageSwapCache(page), page);
> > > - if (!dirty && !PageDirty(page)) {
> > > + if (!dirty) {
> > >   /* It's a freeable page by MADV_FREE */
> > >   dec_mm_counter(mm, MM_ANONPAGES);
> > >   goto discard;
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > index 671e47e..7f520c9 100644
> > > --- a/mm/vmscan.c
> > > +++ b/mm/vmscan.c
> > > @@ -805,8 +805,7 @@ static enum page_references
> > > page_check_references(struct page *page,
> > > 

Re: [PATCH] ath:Release resources for structure pointer, ar if error pointing device in the function, ath10k_core_register_work

2015-03-02 Thread Michal Kazior
On 3 March 2015 at 03:36, Nicholas Krause  wrote:
> Releases resources and deregisters the stucture pointer ar passed by the 
> caller to the function, ath10k_core_register_work
> if unable to probe the structure pointer successfully with a call to 
> ath10k_core_probe_fw. Further more if this happerns
> we must first jump to the label err for the goto statement required to jump 
> to handle this particular error in the function,
> ath10k_core_register_work.  After we are in the correct error section we must 
> free the resources for the structure pointer,ar
> with a call to the function,  ath10k_core_unregister to free resources 
> allocated for the structure pointer,ar.
>
> Signed-off-by: Nicholas Krause 
> ---
>  drivers/net/wireless/ath/ath10k/core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c 
> b/drivers/net/wireless/ath/ath10k/core.c
> index 310e12b..8b2ca25 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -1307,9 +1307,7 @@ err_unregister_mac:
>  err_release_fw:
> ath10k_core_free_firmware_files(ar);
>  err:
> -   /* TODO: It's probably a good idea to release device from the driver
> -* but calling device_release_driver() here will cause a deadlock.
> -*/
> +   ath10k_core_unregister(ar);
> return;
>  }

Did you test this? This will deadlock. ath10k_core_unregister() tries
to cancel ar->register_work. This won't work if you call it from the
worker itself. Moreover if I ignore the deadlock
ath10k_core_unregister() would do nothing else in this context because
ATH10K_FLAG_CORE_REGISTERED wouldn't be even set.

If you're interested in dealing with this TODO I suggest you read
through the original thread which led to the current state of affairs:

  http://www.spinics.net/lists/linux-wireless/msg124004.html


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


Re: [PATCH] kernel: Unlock after locking

2015-03-02 Thread Al Viro
On Tue, Mar 03, 2015 at 08:49:10AM +0530, Tapasweni Pathak wrote:
> Release lock before returning.
> 
> Signed-off-by: Tapasweni Pathak 
> ---
> I'm not sure if this is a bug, it seems like it is intentional, but
> there is no comment or anything like that which confirms this.

Er...  How about looking at the callers?  That's in acct_get() and the
only caller is nearby - it's
static void slow_acct_process(struct pid_namespace *ns)
{
for ( ; ns; ns = ns->parent) {
struct bsd_acct_struct *acct = acct_get(ns);
if (acct) {
do_acct_process(acct);
mutex_unlock(>lock);
acct_put(acct);
}
}
}

which obviously expects that acct_get() returns either NULL or
a pointer to an instance of struct bsd_acct_struct *and* expects
.lock of that instance to be locked in the latter case...

IOW, NAK.  Out of curiosity, what's the point of that patch, seeing that
you suspected that current behaviour was intentional, in which case the
patch would obviously break things?  As it does, in fact...  What's more, 
either we are leaking a lock every time we hit that codepath (i.e. every
time we get around to call of do_acct_process()), or you are introducing
double unlocks - if this lock is not leaked, it has to be dropped somewhere.

I'm not saying that you'll never run into really dumb bugs, but it's
generally useful to reason a bit about the observable consequences such
a bug might have - if nothing else, that might yield a test you could
use to verify that the bug was, indeed, fixed by your patch.  In this
case it would be "deadlock on the second exit() after having the
process accounting enabled", which would be very easy to observe if it
happened.  What's more, trying to do that _after_ applying your patch
would have lockdep yelling at you about mutex_unlock() on a mutex that
is not locked, which would indicate that something has gone wrong...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kprobes: x86: cleanup __recover_probed_insn().

2015-03-02 Thread Wang Nan
Since kernel kconfig forbids turning off KPROBES_ON_FTRACE for x86, we
don't need to consider the situation that a kprobe probing on a ftrace
location. The only exception should be early kprobe with
KPROBES_ON_FTRACE enabled. However, it is still impossible for it to get
a tainted by ftrace if it is registered before ftrace is ready.

Thus this patch removes unneed logic to make code simpler.

Signed-off-by: Wang Nan 
---
 arch/x86/kernel/kprobes/core.c | 62 --
 1 file changed, 12 insertions(+), 50 deletions(-)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 4e3d5a9..88a99c0 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -219,55 +219,6 @@ retry:
}
 }
 
-static unsigned long
-__recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr)
-{
-   struct kprobe *kp;
-   unsigned long faddr;
-
-   kp = get_kprobe((void *)addr);
-   faddr = ftrace_location(addr);
-   /*
-* Addresses inside the ftrace location are refused by
-* arch_check_ftrace_location(). Something went terribly wrong
-* if such an address is checked here.
-*/
-   if (WARN_ON(faddr && faddr != addr))
-   return 0UL;
-   /*
-* Use the current code if it is not modified by Kprobe
-* and it cannot be modified by ftrace.
-*/
-   if (!kp && !faddr)
-   return addr;
-
-   /*
-* Basically, kp->ainsn.insn has an original instruction.
-* However, RIP-relative instruction can not do single-stepping
-* at different place, __copy_instruction() tweaks the displacement of
-* that instruction. In that case, we can't recover the instruction
-* from the kp->ainsn.insn.
-*
-* On the other hand, in case on normal Kprobe, kp->opcode has a copy
-* of the first byte of the probed instruction, which is overwritten
-* by int3. And the instruction at kp->addr is not modified by kprobes
-* except for the first byte, we can recover the original instruction
-* from it and kp->opcode.
-*
-* In case of Kprobes using ftrace, we do not have a copy of
-* the original instruction. In fact, the ftrace location might
-* be modified at anytime and even could be in an inconsistent state.
-* Fortunately, we know that the original code is the ideal 5-byte
-* long NOP.
-*/
-   memcpy(buf, (void *)addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
-   if (faddr)
-   memcpy(buf, ideal_nops[NOP_ATOMIC5], 5);
-   else
-   buf[0] = kp->opcode;
-   return (unsigned long)buf;
-}
-
 /*
  * Recover the probed instruction at addr for further analysis.
  * Caller must lock kprobes by kprobe_mutex, or disable preemption
@@ -282,7 +233,18 @@ unsigned long recover_probed_instruction(kprobe_opcode_t 
*buf, unsigned long add
if (__addr != addr)
return __addr;
 
-   return __recover_probed_insn(buf, addr);
+   /*
+* If KPROBES_ON_FTRACE is off, we are not allowed probing at
+* ftrace location. If it is on, we should use
+* arm_kprobe_ftrace() and never get here.  As a result, there
+* is no need to care about confliction between kprobe and
+* ftrace. The only exception should be early kprobes. However,
+* for such kprobes registered before ftrace is ready, it is
+* impossible to get a tainted instruction; for such kprobes
+* registered after ftrace ready, it will use
+* arm_kprobe_ftrace() and won't get here.
+*/
+   return addr;
 }
 
 /* Check if paddr is at an instruction boundary */
-- 
1.8.4

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


Re: [PATCH] clkdev: clk_add_alias don't put origin clock

2015-03-02 Thread Yoshinori Sato
At Sun, 1 Mar 2015 14:51:57 +,
Russell King - ARM Linux wrote:
> 
> On Sun, Mar 01, 2015 at 04:43:35PM +0900, Yoshinori Sato wrote:
> > Refer to 'r' later.
> > So don't put in clk_add_alias.
> > 
> > Signed-off-by: Yoshinori Sato 
> 
> This isn't how I want to solve this.  I'd much rather we converted clkdev
> to use struct clk_hw internally instead.  This is something I'm looking
> into at the moment.
> 

OK.
It's checked a little more.

Thanks.

> -- 
> FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
> according to speedtest.net.

-- 
Yoshinori Sato

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


Re: [PATCH] Staging: fbtft: fb_pcd8544: Fixed coding style errors and warnings

2015-03-02 Thread Dan Carpenter
On Tue, Mar 03, 2015 at 03:36:17AM +, Cláudio Maia wrote:
> The following errors were fixed:
> 
> ERROR: code indent should use tabs where possible
> WARNING: line over 80 characters
> 
> Signed-off-by: Cláudio Maia 

Don't indent this.

> @@ -52,60 +52,63 @@ static int init_display(struct fbtft_par *par)
>   par->fbtftops.reset(par);
>  
>   /* Function set */
> - write_reg(par, 0x21); /* 5:1  1
> -  2:0  PD - Powerdown control: chip is active
> -  1:0  V  - Entry mode: 
> horizontal addressing
> -  0:1  H  - Extended 
> instruction set control: extended
> -   */
> + write_reg(par, 0x21); /*
> + 5:1  1
> + 2:0  PD - Powerdown control: chip is active
> + 1:0  V  - Entry mode: horizontal addressing
> + 0:1  H  - Extended instruction set control: extended
> + */

This looks kind of weird and this is not kernel style for commenting.
Read Documentation/CodingStyle.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls

2015-03-02 Thread Ingo Molnar

* Tapasweni Pathak  wrote:

> Disabling interrupts around kmalloc() is less than ideal. Move it
> after the kmalloc().
> 
> Found using Coccinelle.
> 
> Signed-off-by: Tapasweni Pathak 
> Suggested-by: Matt Fleming 
> ---
>  arch/x86/platform/efi/efi_64.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index 17e80d8..5d6af59 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -88,10 +88,10 @@ void __init efi_call_phys_prolog(void)
>   return;
> 
>   early_code_mapping_set_exec(1);
> - local_irq_save(efi_flags);
> 
>   n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
>   save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
> + local_irq_save(efi_flags);
> 
>   for (pgd = 0; pgd < n_pgds; pgd++) {
>   save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);

So why are interrupts disabled around page table operations to begin 
with? It's not like any of this can execute on two CPUs at once, nor 
can this be executed from interrupt context.

So, shouldn't we only protect the EFI calls themselves? If we did that 
we could save the efi_flags global variable ugliness as well.

I.e. something like the attached patch. (not tested and all that)

Thanks,

Ingo

===>
>From 160eef628f9e803ba62707ec7f610ea9f0f13984 Mon Sep 17 00:00:00 2001
From: Ingo Molnar 
Date: Tue, 3 Mar 2015 07:31:56 +0100
Subject: [PATCH] efi: Disable interrupts around EFI calls, not in the 
epilog/prolog calls

Tapasweni Pathak reported that we do a kmalloc() in efi_call_phys_prolog()
on x86-64 while having interrupts disabled, which is a big no-no, as
kmalloc() can sleep.

Solve this by removing the irq disabling from the prolog/epilog calls
around EFI calls: it's unnecessary, as in this stage we are single
threaded in the boot thread, and we don't ever execute this from
interrupt contexts.

Reported-by: Tapasweni Pathak 
Signed-off-by: Ingo Molnar 
---
 arch/x86/platform/efi/efi.c|  7 +++
 arch/x86/platform/efi/efi_32.c | 11 +++
 arch/x86/platform/efi/efi_64.c |  3 ---
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index dbc8627a5cdf..2490a15d18f1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -85,12 +85,19 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
efi_memory_desc_t *virtual_map)
 {
efi_status_t status;
+   unsigned long flags;
 
efi_call_phys_prolog();
+
+   /* Disable interrupts around EFI calls: */
+   local_irq_save(flags);
status = efi_call_phys(efi_phys.set_virtual_address_map,
   memory_map_size, descriptor_size,
   descriptor_version, virtual_map);
+   local_irq_restore(flags);
+
efi_call_phys_epilog();
+
return status;
 }
 
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 40e7cda52936..abecc6e1dc90 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -33,11 +33,10 @@
 
 /*
  * To make EFI call EFI runtime service in physical addressing mode we need
- * prolog/epilog before/after the invocation to disable interrupt, to
- * claim EFI runtime service handler exclusively and to duplicate a memory in
- * low memory space say 0 - 3G.
+ * prolog/epilog before/after the invocation to claim the EFI runtime service
+ * handler exclusively and to duplicate a memory mapping in low memory space,
+ * say 0 - 3G.
  */
-static unsigned long efi_rt_eflags;
 
 void efi_sync_low_kernel_mappings(void) {}
 void __init efi_dump_pagetable(void) {}
@@ -61,8 +60,6 @@ void __init efi_call_phys_prolog(void)
 {
struct desc_ptr gdt_descr;
 
-   local_irq_save(efi_rt_eflags);
-
load_cr3(initial_page_table);
__flush_tlb_all();
 
@@ -81,8 +78,6 @@ void __init efi_call_phys_epilog(void)
 
load_cr3(swapper_pg_dir);
__flush_tlb_all();
-
-   local_irq_restore(efi_rt_eflags);
 }
 
 void __init efi_runtime_mkexec(void)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 17e80d829df0..427eb3540e5f 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -42,7 +42,6 @@
 #include 
 
 static pgd_t *save_pgd __initdata;
-static unsigned long efi_flags __initdata;
 
 /*
  * We allocate runtime services regions bottom-up, starting from -4G, i.e.
@@ -88,7 +87,6 @@ void __init efi_call_phys_prolog(void)
return;
 
early_code_mapping_set_exec(1);
-   local_irq_save(efi_flags);
 
n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
@@ -116,7 +114,6 @@ void __init efi_call_phys_epilog(void)
set_pgd(pgd_offset_k(pgd * 

[tip:perf/core] perf tools: Reference count struct thread

2015-03-02 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  f3b623b8490af7a9b819cbcf2d99ab4597ece94b
Gitweb: http://git.kernel.org/tip/f3b623b8490af7a9b819cbcf2d99ab4597ece94b
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 2 Mar 2015 22:21:35 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 3 Mar 2015 00:17:08 -0300

perf tools: Reference count struct thread

We need to do that to stop accumulating entries in the dead_threads
linked list, i.e. we were keeping references to threads in struct hists
that continue to exist even after a thread exited and was removed from
the machine threads rbtree.

We still keep the dead_threads list, but just for debugging, allowing us
to iterate at any given point over the threads that still are referenced
by things like struct hist_entry.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Don Zickus 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-3ejvfyed0r7ue61dkurzj...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c |  2 +-
 tools/perf/builtin-trace.c |  7 ++-
 tools/perf/ui/browsers/hists.c |  6 +++---
 tools/perf/util/build-id.c |  5 +++--
 tools/perf/util/hist.c |  2 ++
 tools/perf/util/hist.h |  2 +-
 tools/perf/util/machine.c  | 44 ++
 tools/perf/util/machine.h  |  1 -
 tools/perf/util/session.c  |  6 --
 tools/perf/util/thread.c   | 14 ++
 tools/perf/util/thread.h   | 13 +
 11 files changed, 66 insertions(+), 36 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 7ce2966..e00e2ea 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -831,7 +831,7 @@ static int thread_atoms_insert(struct perf_sched *sched, 
struct thread *thread)
return -1;
}
 
-   atoms->thread = thread;
+   atoms->thread = thread__get(thread);
INIT_LIST_HEAD(>work_list);
__thread_latency_insert(>atom_root, atoms, >cmp_pid);
return 0;
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index d95a8f4..211614f 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1741,7 +1741,10 @@ static int trace__sys_enter(struct trace *trace, struct 
perf_evsel *evsel,
} else
ttrace->entry_pending = true;
 
-   trace->current = thread;
+   if (trace->current != thread) {
+   thread__put(trace->current);
+   trace->current = thread__get(thread);
+   }
 
return 0;
 }
@@ -2274,6 +2277,8 @@ next_event:
}
 
 out_disable:
+   thread__zput(trace->current);
+
perf_evlist__disable(evlist);
 
if (!err) {
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 788506e..ad312d9 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1467,7 +1467,7 @@ static int perf_evsel__hists_browse(struct perf_evsel 
*evsel, int nr_events,
perf_hpp__set_user_width(symbol_conf.col_width_list_str);
 
while (1) {
-   const struct thread *thread = NULL;
+   struct thread *thread = NULL;
const struct dso *dso = NULL;
int choice = 0,
annotate = -2, zoom_dso = -2, zoom_thread = -2,
@@ -1754,13 +1754,13 @@ zoom_thread:
pstack__remove(fstack, 
>hists->thread_filter);
 zoom_out_thread:
ui_helpline__pop();
-   browser->hists->thread_filter = NULL;
+   thread__zput(browser->hists->thread_filter);
perf_hpp__set_elide(HISTC_THREAD, false);
} else {
ui_helpline__fpush("To zoom out press <- or -> 
+ \"Zoom out of %s(%d) thread\"",
   thread->comm_set ? 
thread__comm_str(thread) : "",
   thread->tid);
-   browser->hists->thread_filter = thread;
+   browser->hists->thread_filter = 
thread__get(thread);
perf_hpp__set_elide(HISTC_THREAD, false);
pstack__push(fstack, 
>hists->thread_filter);
}
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index ffdc338..a196746 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -61,8 +61,9 @@ static int perf_event__exit_del_thread(struct perf_tool *tool 
__maybe_unused,
 
if (thread) {
rb_erase(>rb_node, >threads);
-   machine->last_match = NULL;
-   thread__delete(thread);
+   if (machine->last_match == thread)
+   thread__zput(machine->last_match);

[tip:perf/core] perf sched: No need to keep the session around

2015-03-02 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  ae536acfacb65a4a9858c32b12361e09f84f4157
Gitweb: http://git.kernel.org/tip/ae536acfacb65a4a9858c32b12361e09f84f4157
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 2 Mar 2015 22:28:41 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 3 Mar 2015 00:17:12 -0300

perf sched: No need to keep the session around

We were keeping the session around just because we kept pointers to
struct thread instances, but now we reference count them, so no need
for deferring the perf_session__delete call to after we traverse the
work_list entries.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Don Zickus 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-9agtck6jdr3rebdp39z1l...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index e00e2ea..a3ebf1d 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1439,8 +1439,7 @@ static int perf_sched__process_tracepoint_sample(struct 
perf_tool *tool __maybe_
return err;
 }
 
-static int perf_sched__read_events(struct perf_sched *sched,
-  struct perf_session **psession)
+static int perf_sched__read_events(struct perf_sched *sched)
 {
const struct perf_evsel_str_handler handlers[] = {
{ "sched:sched_switch",   process_sched_switch_event, },
@@ -1454,6 +1453,7 @@ static int perf_sched__read_events(struct perf_sched 
*sched,
.path = input_name,
.mode = PERF_DATA_MODE_READ,
};
+   int rc = -1;
 
session = perf_session__new(, false, >tool);
if (session == NULL) {
@@ -1478,16 +1478,10 @@ static int perf_sched__read_events(struct perf_sched 
*sched,
sched->nr_lost_chunks = 
session->evlist->stats.nr_events[PERF_RECORD_LOST];
}
 
-   if (psession)
-   *psession = session;
-   else
-   perf_session__delete(session);
-
-   return 0;
-
+   rc = 0;
 out_delete:
perf_session__delete(session);
-   return -1;
+   return rc;
 }
 
 static void print_bad_events(struct perf_sched *sched)
@@ -1515,12 +1509,10 @@ static void print_bad_events(struct perf_sched *sched)
 static int perf_sched__lat(struct perf_sched *sched)
 {
struct rb_node *next;
-   struct perf_session *session;
 
setup_pager();
 
-   /* save session -- references to threads are held in work_list */
-   if (perf_sched__read_events(sched, ))
+   if (perf_sched__read_events(sched))
return -1;
 
perf_sched__sort_lat(sched);
@@ -1537,6 +1529,7 @@ static int perf_sched__lat(struct perf_sched *sched)
work_list = rb_entry(next, struct work_atoms, node);
output_lat_thread(sched, work_list);
next = rb_next(next);
+   thread__zput(work_list->thread);
}
 
printf(" 
-\n");
@@ -1548,7 +1541,6 @@ static int perf_sched__lat(struct perf_sched *sched)
print_bad_events(sched);
printf("\n");
 
-   perf_session__delete(session);
return 0;
 }
 
@@ -1557,7 +1549,7 @@ static int perf_sched__map(struct perf_sched *sched)
sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF);
 
setup_pager();
-   if (perf_sched__read_events(sched, NULL))
+   if (perf_sched__read_events(sched))
return -1;
print_bad_events(sched);
return 0;
@@ -1572,7 +1564,7 @@ static int perf_sched__replay(struct perf_sched *sched)
 
test_calibrations(sched);
 
-   if (perf_sched__read_events(sched, NULL))
+   if (perf_sched__read_events(sched))
return -1;
 
printf("nr_run_events:%ld\n", sched->nr_run_events);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf probe: Remove bias offset to find probe point by address

2015-03-02 Thread tip-bot for Masami Hiramatsu
Commit-ID:  0104fe69e0287cf3635657b4c6b26a18e0091697
Gitweb: http://git.kernel.org/tip/0104fe69e0287cf3635657b4c6b26a18e0091697
Author: Masami Hiramatsu 
AuthorDate: Mon, 2 Mar 2015 21:49:46 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:34:38 -0300

perf probe: Remove bias offset to find probe point by address

Remove bias offset to find probe point by address.

Without this patch, probe points on kernel and executables are shown
correctly, but do not work with libraries:

  # ./perf probe -l
probe:do_fork(on do_fork@kernel/fork.c)
probe_libc:malloc(on malloc in /usr/lib64/libc-2.17.so)
probe_perf:strlist__new (on strlist__new@util/strlist.c in 
/home/mhiramat/ksrc/linux-3/tools/perf/perf)

Removing bias allows it to show it as real place:

  # ./perf probe -l
probe:do_fork(on do_fork@kernel/fork.c)
probe_libc:malloc(on __libc_malloc@malloc/malloc.c in 
/usr/lib64/libc-2.17.so)
probe_perf:strlist__new (on strlist__new@util/strlist.c in 
/home/mhiramat/ksrc/linux-3/tools/perf/perf)

Signed-off-by: Masami Hiramatsu 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Naohiro Aota 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/20150302124946.9191.64085.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/probe-finder.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index d141935..46f009a 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1345,11 +1345,8 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, 
unsigned long addr,
const char *fname = NULL, *func = NULL, *basefunc = NULL, *tmp;
int baseline = 0, lineno = 0, ret = 0;
 
-   /* Adjust address with bias */
-   addr += dbg->bias;
-
/* Find cu die */
-   if (!dwarf_addrdie(dbg->dbg, (Dwarf_Addr)addr - dbg->bias, )) {
+   if (!dwarf_addrdie(dbg->dbg, (Dwarf_Addr)addr, )) {
pr_warning("Failed to find debug information for address %lx\n",
   addr);
ret = -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] Revert "perf: Remove the extra validity check on nr_pages"

2015-03-02 Thread tip-bot for Kan Liang
Commit-ID:  2ed11312eb19506c027e7cac039994ad42a9cb2c
Gitweb: http://git.kernel.org/tip/2ed11312eb19506c027e7cac039994ad42a9cb2c
Author: Kan Liang 
AuthorDate: Mon, 2 Mar 2015 02:14:26 -0500
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 18:25:38 -0300

Revert "perf: Remove the extra validity check on nr_pages"

This reverts commit 74390aa55678 ("perf: Remove the extra validity check
on nr_pages")

nr_pages equals to number of pages - 1 in perf_mmap. So nr_pages = 0 is
valid.

So the nr_pages != 0 && !is_power_of_2(nr_pages) are all
needed for checking. Otherwise, for example, perf test 6 failed.

 # perf test 6
  6: x86 rdpmc test :Error:
 mmap() syscall returned with (Invalid argument)
 FAILED!

Signed-off-by: Kan Liang 
Cc: Andi Kleen 
Cc: Kaixu Xia 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1425280466-7830-1-git-send-email-kan.li...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index af924bc..8bb20cc 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4446,7 +4446,7 @@ static int perf_mmap(struct file *file, struct 
vm_area_struct *vma)
 * If we have rb pages ensure they're a power-of-two number, so we
 * can do bitmasks instead of modulo.
 */
-   if (!is_power_of_2(nr_pages))
+   if (nr_pages != 0 && !is_power_of_2(nr_pages))
return -EINVAL;
 
if (vma_size != PAGE_SIZE * (1 + nr_pages))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf probe: Warn if given uprobe event accesses memory on older kernel

2015-03-02 Thread tip-bot for Masami Hiramatsu
Commit-ID:  79702f614187f652a814061e8f5875ddcc9e732d
Gitweb: http://git.kernel.org/tip/79702f614187f652a814061e8f5875ddcc9e732d
Author: Masami Hiramatsu 
AuthorDate: Sat, 28 Feb 2015 11:53:29 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:27:43 -0300

perf probe: Warn if given uprobe event accesses memory on older kernel

Warn if given uprobe event accesses memory on older kernel.

Until 3.14, uprobe event only supports accessing registers so this warns
to upgrade kernel if uprobe-event returns -EINVAL and an argument of the
event accesses memory ($stack, @+offset, and +|-offs() symtax).

With this patch (on 3.10.0-123.13.2.el7.x86_64);
  -
  # ./perf probe -x ./perf warn_uprobe_event_compat stack=-0\(%sp\)
  Added new event:
  Failed to write event: Invalid argument
  Please upgrade your kernel to at least 3.14 to have access to feature -0(%sp)
Error: Failed to add events.
  -

Suggested-by: Arnaldo Carvalho de Melo 
Signed-off-by: Masami Hiramatsu 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/20150228025329.32106.70581.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/probe-event.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 7c0e765..1c570c2 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2199,6 +2199,27 @@ static int get_new_event_name(char *buf, size_t len, 
const char *base,
return ret;
 }
 
+/* Warn if the current kernel's uprobe implementation is old */
+static void warn_uprobe_event_compat(struct probe_trace_event *tev)
+{
+   int i;
+   char *buf = synthesize_probe_trace_command(tev);
+
+   /* Old uprobe event doesn't support memory dereference */
+   if (!tev->uprobes || tev->nargs == 0 || !buf)
+   goto out;
+
+   for (i = 0; i < tev->nargs; i++)
+   if (strglobmatch(tev->args[i].value, "[$@+-]*")) {
+   pr_warning("Please upgrade your kernel to at least "
+  "3.14 to have access to feature %s\n",
+  tev->args[i].value);
+   break;
+   }
+out:
+   free(buf);
+}
+
 static int __add_probe_trace_events(struct perf_probe_event *pev,
 struct probe_trace_event *tevs,
 int ntevs, bool allow_suffix)
@@ -2295,6 +2316,8 @@ static int __add_probe_trace_events(struct 
perf_probe_event *pev,
 */
allow_suffix = true;
}
+   if (ret == -EINVAL && pev->uprobes)
+   warn_uprobe_event_compat(tev);
 
/* Note that it is possible to skip all events because of blacklist */
if (ret >= 0 && tev->event) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test

2015-03-02 Thread tip-bot for Adrian Hunter
Commit-ID:  543d976fa2ebf5543bd07b5d487bf3a6144c0886
Gitweb: http://git.kernel.org/tip/543d976fa2ebf5543bd07b5d487bf3a6144c0886
Author: Adrian Hunter 
AuthorDate: Mon, 2 Mar 2015 09:59:05 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:48:16 -0300

perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test

Feature tests are compiled but not executed, however it might avoid a
future uninitialized variable warning, so initialize the cpu set.

Reported-by: Ingo Molnar 
Signed-off-by: Adrian Hunter 
Cc: H. Peter Anvin 
Cc: Ingo Molnar 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: linux-tip-comm...@vger.kernel.org
Link: http://lkml.kernel.org/r/54f41849.1010...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c 
b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
index 2b81b72..fdada5e 100644
--- a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
+++ b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 
 int main(void)
 {
@@ -8,7 +9,8 @@ int main(void)
cpu_set_t cs;
 
pthread_attr_init(_attr);
-   /* don't care abt exact args, just the API itself in libpthread */
+   CPU_ZERO();
+
ret = pthread_attr_setaffinity_np(_attr, sizeof(cs), );
 
return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Improve libbfd detection message

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  0189d7c45acd9fc9a7e6876dc55bc44ae8dc9a37
Gitweb: http://git.kernel.org/tip/0189d7c45acd9fc9a7e6876dc55bc44ae8dc9a37
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 09:46:42 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:16:35 -0300

perf tools: Improve libbfd detection message

Before:

  No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol 
demangling

After:

  No bfd.h/libbfd found, please install 
binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling

Change the message to the standard 'please install' language and also
add libiberty-dev suggestion for Ubuntu systems.

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228084610.ge31...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index aa2f0aa..e2350ad 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -635,7 +635,7 @@ else
 EXTLIBS += -liberty
 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
   else
-msg := $(warning No bfd.h/libbfd found, install 
binutils-dev[el]/zlib-static to gain symbol demangling)
+msg := $(warning No bfd.h/libbfd found, please install 
binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
 CFLAGS += -DNO_DEMANGLE
   endif
 endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Improve feature test debuggability

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  b49f1a4be701c2386ccc7496dc8442cf26424d5c
Gitweb: http://git.kernel.org/tip/b49f1a4be701c2386ccc7496dc8442cf26424d5c
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 10:16:27 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:17:44 -0300

perf tools: Improve feature test debuggability

Certain feature tests fail with link errors:

  triton:~/tip/tools/perf/config/feature-checks> make test-libbabeltrace.bin
  gcc -MD  -o test-libbabeltrace.bin test-libbabeltrace.c # -lbabeltrace 
provided by
  /tmp/cc6dRSqd.o: In function `main':
  test-libbabeltrace.c:(.text+0xf): undefined reference to 
`bt_ctf_stream_class_get_packet_context_type'

although they should already fail with a build error due to lack of a
proper prototype for the function. Due to this I first tried to find
which library was missing - while it was the whole feature that was
missing from the .h file already.

To solve this, propagate -Wall -Werror to all testcases and remove them
from testcase Makefile rules that used them explicitly.

A missing feature now outputs:

  triton:~/tip/tools/perf/config/feature-checks> make test-libbabeltrace.bin
  gcc -MD  -Wall -Werror -o test-libbabeltrace.bin test-libbabeltrace.c  # 
-lbabeltrace provided by
  test-libbabeltrace.c: In function ‘main’:
  test-libbabeltrace.c:6:2: error: implicit declaration of function 
‘bt_ctf_stream_class_get_packet_context_type’ 
[-Werror=implicit-function-declaration]

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228091627.gf31...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/feature-checks/Makefile | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index 70c9aeb..8fe0678 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -39,24 +39,24 @@ PKG_CONFIG := $(CROSS_COMPILE)pkg-config
 
 all: $(FILES)
 
-BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
+BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) 
$(LDFLAGS)
 
 ###
 
 test-all.bin:
-   $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 
-ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell 
$(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) 
$(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -lbabeltrace
+   $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf 
-lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs 
--cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) 
-DPACKAGE='"perf"' -lbfd -ldl -lz -lbabeltrace
 
 test-hello.bin:
$(BUILD)
 
 test-pthread-attr-setaffinity-np.bin:
-   $(BUILD) -D_GNU_SOURCE -Werror -lpthread
+   $(BUILD) -D_GNU_SOURCE -lpthread
 
 test-stackprotector-all.bin:
-   $(BUILD) -Werror -fstack-protector-all
+   $(BUILD) -fstack-protector-all
 
 test-fortify-source.bin:
-   $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
+   $(BUILD) -O2 -D_FORTIFY_SOURCE=2
 
 test-bionic.bin:
$(BUILD)
@@ -119,10 +119,10 @@ test-libbfd.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
 
 test-liberty.bin:
-   $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl 
-liberty
+   $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' 
-lbfd -ldl -liberty
 
 test-liberty-z.bin:
-   $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl 
-liberty -lz
+   $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' 
-lbfd -ldl -liberty -lz
 
 test-cplus-demangle.bin:
$(BUILD) -liberty
@@ -140,7 +140,7 @@ test-libbabeltrace.bin:
$(BUILD) # -lbabeltrace provided by 
$(FEATURE_CHECK_LDFLAGS-libbabeltrace)
 
 test-sync-compare-and-swap.bin:
-   $(BUILD) -Werror
+   $(BUILD)
 
 test-compile-32.bin:
$(CC) -m32 -o $(OUTPUT)$@ test-compile.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Improve 'libbabel' feature check failure message

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  de5349fa439dd32d432cd401eb2decfae20b9f74
Gitweb: http://git.kernel.org/tip/de5349fa439dd32d432cd401eb2decfae20b9f74
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 10:18:49 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:21:41 -0300

perf tools: Improve 'libbabel' feature check failure message

On Debian-ish systems libbabeltrace-dev should be suggested as a package
install as well.

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228091849.ga28...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index e2350ad..d44c64d 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -706,7 +706,7 @@ endif
 
 ifndef NO_LIBBABELTRACE
   ifeq ($(feature-libbabeltrace), 0)
-msg := $(warning No libbabeltrace found, disables 'perf data' CTF format 
support, please install libbabeltrace-devel/libbabeltrace-ctf-dev);
+msg := $(warning No libbabeltrace found, disables 'perf data' CTF format 
support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
 NO_LIBBABELTRACE := 1
   else
 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Improve libperl detection message

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  a954e68402f9cac000ad7ea57df6040fe5ef455a
Gitweb: http://git.kernel.org/tip/a954e68402f9cac000ad7ea57df6040fe5ef455a
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 09:39:09 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:15:55 -0300

perf tools: Improve libperl detection message

Before:

  Missing perl devel files. Disabling perl scripting support, consider 
installing perl-ExtUtils-Embed

After:

  Missing perl devel files. Disabling perl scripting support, please install 
perl-ExtUtils-Embed/libperl-dev

Change the message to the standard 'please install' language and
adds Debian-ish package suggestion.

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228083909.gc31...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index d3efeef..aa2f0aa 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -531,7 +531,7 @@ else
   ifneq ($(feature-libperl), 1)
 CFLAGS += -DNO_LIBPERL
 NO_LIBPERL := 1
-msg := $(warning Missing perl devel files. Disabling perl scripting 
support, consider installing perl-ExtUtils-Embed);
+msg := $(warning Missing perl devel files. Disabling perl scripting 
support, please install perl-ExtUtils-Embed/libperl-dev);
   else
 LDFLAGS += $(PERL_EMBED_LDFLAGS)
 EXTLIBS += $(PERL_EMBED_LIBADD)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Improve Python feature detection messages

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  6c5aa23704e2786eb1a2a733165eef95c4375f41
Gitweb: http://git.kernel.org/tip/6c5aa23704e2786eb1a2a733165eef95c4375f41
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 09:33:45 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:13:51 -0300

perf tools: Improve Python feature detection messages

Change the Python detection message from:

  config/Makefile:566: No python-config tool was found
  config/Makefile:566: Python support will not be built

  config/Makefile:565: No 'python-config' tool was found: disables Python 
support - please install python-devel/python-dev

It's now a standard one-line message with a package install suggestion,
and it also uses the standard language used by other feature detection
messages.

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228083345.gb31...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/Makefile | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c3570b5..d3efeef 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -548,22 +548,21 @@ endif
 disable-python = $(eval $(disable-python_code))
 define disable-python_code
   CFLAGS += -DNO_LIBPYTHON
-  $(if $(1),$(warning No $(1) was found))
-  $(warning Python support will not be built)
+  $(warning $1)
   NO_LIBPYTHON := 1
 endef
 
 ifdef NO_LIBPYTHON
-  $(call disable-python)
+  $(call disable-python,Python support disabled by user)
 else
 
   ifndef PYTHON
-$(call disable-python,python interpreter)
+$(call disable-python,No python interpreter was found: disables Python 
support - please install python-devel/python-dev)
   else
 PYTHON_WORD := $(call shell-wordify,$(PYTHON))
 
 ifndef PYTHON_CONFIG
-  $(call disable-python,python-config tool)
+  $(call disable-python,No 'python-config' tool was found: disables Python 
support - please install python-devel/python-dev)
 else
 
   PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
@@ -575,7 +574,7 @@ else
   FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
 
   ifneq ($(feature-libpython), 1)
-$(call disable-python,Python.h (for Python 2.x))
+$(call disable-python,No 'Python.h' (for Python 2.x support) was 
found: disables Python support - please install python-devel/python-dev)
   else
 
 ifneq ($(feature-libpython-version), 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/


[tip:perf/core] perf tools: Add PERF-FEATURES to the .gitignore file

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  97fe9253592241572711d3c1818c0b586d2f34b2
Gitweb: http://git.kernel.org/tip/97fe9253592241572711d3c1818c0b586d2f34b2
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 09:12:48 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:06:20 -0300

perf tools: Add PERF-FEATURES to the .gitignore file

It's an auto-generated file.

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228081248.ga31...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 40399c3..68328f5 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -1,6 +1,7 @@
 PERF-CFLAGS
 PERF-GUI-VARS
 PERF-VERSION-FILE
+PERF-FEATURES
 perf
 perf-read-vdso32
 perf-read-vdsox32
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Remove annoying extra message from the features build

2015-03-02 Thread tip-bot for Ingo Molnar
Commit-ID:  a6a76ba9ea03fe22eb28a6a19482d547b8773001
Gitweb: http://git.kernel.org/tip/a6a76ba9ea03fe22eb28a6a19482d547b8773001
Author: Ingo Molnar 
AuthorDate: Sat, 28 Feb 2015 09:17:50 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:07:35 -0300

perf tools: Remove annoying extra message from the features build

This message:

  Makefile:153: The path 'python-config' is not executable.

Appears on every perf build that does not have a sufficient python
environment installed. It's really just an internal detail of python
configuration pass and users should not see it - and it's pretty
meaningless to them in any case because the message is not very helpful.
(So it's not executable. Why does that matter? What can the user do
about it?)

Remove the warning, the missing python feature warning is sufficient:

  config/Makefile:566: No python-config tool was found
  config/Makefile:566: Python support will not be built

although even that one isn't very helpful to users: so no Python support
will be built, what can the user do to fix that? Most other such
warnings give package install suggestions.

Signed-off-by: Ingo Molnar 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150228081750.ga31...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/utilities.mak | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak
index 7076a62..c16ce83 100644
--- a/tools/perf/config/utilities.mak
+++ b/tools/perf/config/utilities.mak
@@ -175,6 +175,5 @@ _ge-abspath = $(if $(is-executable),$(1))
 define get-executable-or-default
 $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2)))
 endef
-_ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call 
_gea_err,$(2)))
-_gea_warn = $(warning The path '$(1)' is not executable.)
+_ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err,$(2)))
 _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf record: Get rid of -l option from Documentation

2015-03-02 Thread tip-bot for Namhyung Kim
Commit-ID:  08b23f4e635fa42a1d3ebdf31b8bb720f17d6c14
Gitweb: http://git.kernel.org/tip/08b23f4e635fa42a1d3ebdf31b8bb720f17d6c14
Author: Namhyung Kim 
AuthorDate: Mon, 2 Mar 2015 13:53:58 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:04:07 -0300

perf record: Get rid of -l option from Documentation

The perf record does not support -l option anymore, so nuke it.

Signed-off-by: Namhyung Kim 
Cc: Jiri Olsa 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1425272038-10406-1-git-send-email-namhy...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-record.txt | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index cae75c1..4d66894 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -62,9 +62,6 @@ OPTIONS
 --all-cpus::
 System-wide collection from all CPUs.
 
--l::
-Scale counter values.
-
 -p::
 --pid=::
Record events on existing process ID (comma separated list).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Fix build error on ARCH=i386/x86_64/ sparc64

2015-03-02 Thread tip-bot for Namhyung Kim
Commit-ID:  b11db6581beaccef8ae9a388ae96074aa5cc144f
Gitweb: http://git.kernel.org/tip/b11db6581beaccef8ae9a388ae96074aa5cc144f
Author: Namhyung Kim 
AuthorDate: Mon, 2 Mar 2015 13:31:03 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:01:42 -0300

perf tools: Fix build error on ARCH=i386/x86_64/sparc64

He Kuang reported that current perf tools failed to build when ARCH
variable was given like above.

It was because the name is different that internal directory name.  I
can see that David's sparc64 build has same problem.

So fix it by applying the sed conversion script to the command line ARCH
variable also, and fixing the converted name there (i.e. i386/x86_64 ->
x86, sparc64 -> sparc).

Reported-by: He Kuang 
Signed-off-by: Namhyung Kim 
Tested-by: He Kuang 
Acked: Jiri Olsa 
Cc: David Ahern 
Cc: He Kuang 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1425270663-10215-1-git-send-email-namhy...@kernel.org
[ Resolved conflict with 4861f87cd3d1 "Make sparc64 arch point to sparc" ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/Makefile.arch | 27 +--
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
index ac8721f..e972057 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/perf/config/Makefile.arch
@@ -1,32 +1,15 @@
+ifndef ARCH
+ARCH := $(shell uname -m 2>/dev/null || echo not)
+endif
 
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-
-RAW_ARCH := $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+  -e s/sun4u/sparc/ -e s/sparc64/sparc/ \
   -e s/arm.*/arm/ -e s/sa110/arm/ \
   -e s/s390x/s390/ -e s/parisc64/parisc/ \
   -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
   -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
   -e s/tile.*/tile/ )
 
-# Additional ARCH settings for x86
-ifeq ($(RAW_ARCH),i386)
-  ARCH ?= x86
-endif
-
-ifeq ($(RAW_ARCH),x86_64)
-  ARCH ?= x86
-
-  ifneq (, $(findstring m32,$(CFLAGS)))
-RAW_ARCH := x86_32
-  endif
-endif
-
-ifeq ($(RAW_ARCH),sparc64)
-  ARCH ?= sparc
-endif
-
-ARCH ?= $(RAW_ARCH)
-
 LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
 ifeq ($(LP64), 1)
   IS_64_BIT := 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/


[tip:perf/core] perf record: Document --group option

2015-03-02 Thread tip-bot for Namhyung Kim
Commit-ID:  9a75606ca06d94aab1ed0dbe96935e3f89dfb81c
Gitweb: http://git.kernel.org/tip/9a75606ca06d94aab1ed0dbe96935e3f89dfb81c
Author: Namhyung Kim 
AuthorDate: Mon, 2 Mar 2015 12:13:33 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 12:04:45 -0300

perf record: Document --group option

The 'perf record --group' option lacks documentation and confuses users.
As -e/--event option already supports group spec, it should not be used
anymore.

Also add a short description of event group itself.

Reported-by: Stephane Eranian 
Signed-off-by: Namhyung Kim 
Cc: Jiri Olsa 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Link: 
http://lkml.kernel.org/r/1425266013-5034-1-git-send-email-namhy...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-record.txt | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index 4d66894..355c4f5 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -55,6 +55,11 @@ OPTIONS
   If you want to profile write accesses in [0x1000~1008), just set
   'mem:0x1000/8:w'.
 
+   - a group of events surrounded by a pair of brace 
("{event1,event2,...}").
+ Each event is separated by commas and the group should be quoted to
+ prevent the shell interpretation.  You also need to use --group on
+ "perf report" to view group events together.
+
 --filter=::
 Event filter.
 
@@ -104,6 +109,10 @@ OPTIONS
specification with appended unit character - B/K/M/G. The
size is rounded up to have nearest pages power of two value.
 
+--group::
+   Put all events in a single event group.  This precedes the --event
+   option and remains only for backward compatibility.  See --event.
+
 -g::
Enables call-graph (stack chain/backtrace) recording.
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Fix FORK after COMM when synthesizing records for pre-existing threads

2015-03-02 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  4aa5f4f7bb8bc41cba15bcd0d80c4fb085027d6b
Gitweb: http://git.kernel.org/tip/4aa5f4f7bb8bc41cba15bcd0d80c4fb085027d6b
Author: Arnaldo Carvalho de Melo 
AuthorDate: Fri, 27 Feb 2015 19:52:10 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 11:51:30 -0300

perf tools: Fix FORK after COMM when synthesizing records for pre-existing 
threads

In this commit:

  commit 363b785f3805a2632eb09a8b430842461c21a640
  Author: Don Zickus 
  Date:   Fri Mar 14 10:43:44 2014 -0400

  perf tools: Speed up thread map generation

We ended up emitting PERF_RECORD_FORK events after their corresponding
PERF_RECORD_COMM, so the code below will remove the "existing thread"
and then recreates it, unnecessarily:

  [root@ssdandy ~]# perf probe -x ~/bin/perf -L machine__process_fork_event
  
  0  int machine__process_fork_event(struct machine *machine, union 
perf_event *event,
struct perf_sample *sample)
  2  {
  3 struct thread *thread = machine__find_thread(machine,
 event->fork.pid,
 event->fork.tid);
  6 struct thread *parent = machine__findnew_thread(machine,

event->fork.ppid,

event->fork.ptid);

/* if a thread currently exists for the thread id remove it */
if (thread != NULL)
 12 machine__remove_thread(machine, thread);

 14 thread = machine__findnew_thread(machine, event->fork.pid,
 event->fork.tid);
 16 if (dump_trace)
 17 perf_event__fprintf_task(event, stdout);

 19 if (thread == NULL || parent == NULL ||
 20 thread__fork(thread, parent, sample->time) < 0) {
 21 dump_printf("problem processing PERF_RECORD_FORK, 
skipping event.\n");
 22 return -1;
}

 25 return 0;
 26  }

  [root@ssdandy ~]# perf probe -x ~/bin/perf 
fork_after_comm=machine__process_fork_event:12
  Added new event:
probe_perf:fork_after_comm (on machine__process_fork_event:12 in 
/home/acme/bin/perf)

  You can now use it in all perf tools, such as:

perf record -e probe_perf:fork_after_comm -aR sleep 1

  [root@ssdandy ~]#

  [root@ssdandy ~]# perf record -g -e probe_perf:* trace -o /tmp/bla
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.021 MB perf.data (30 samples) ]
  Terminated
  [root@ssdandy ~]#

  [root@ssdandy ~]# perf report --no-children --show-total-period --stdio
  # To display the perf.data header info, please use --header/--header-only 
options.
  #
  # Samples: 30  of event 'probe_perf:fork_after_comm'
  # Event count (approx.): 30
  #
  # OverheadPeriod  Command  Shared Object  Symbol
  #     ...  .  
...
  #
 100.00%30  tracetrace  [.] 
machine__process_fork_event
|
---machine__process_fork_event
   __event__synthesize_thread.part.2
   perf_event__synthesize_threads
   cmd_trace
   main
   __libc_start_main

  [root@ssdandy ~]#

  And Looking at 'perf report -D' output we see it:

  0 0 0x8698 [0x30]: PERF_RECORD_COMM: auditd:703/707
  0 0 0x86c8 [0x38]: PERF_RECORD_FORK(703:707):(703:703)

Fix it by more closely mimicking how the kernel generates those records
when a new fork happens, i.e. first a PERF_RECORD_FORK, then a
PERF_RECORD_COMM.

Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Don Zickus 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-h0emvymi2t3mw8dlqd6d6...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/event.c | 34 --
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 9e806d8..d5efa50 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -95,9 +95,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, 
size_t len)
return tgid;
 }
 
-static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
-union perf_event *event, pid_t pid,
-perf_event__handler_t process,
+static pid_t perf_event__prepare_comm(union perf_event *event, pid_t pid,
 struct machine *machine)
 {
size_t size;
@@ -124,6 +122,19 @@ static pid_t perf_event__synthesize_comm(struct perf_tool 
*tool,
   

[tip:perf/core] perf stat: Report unsupported events properly

2015-03-02 Thread tip-bot for Suzuki K. Poulose
Commit-ID:  3b4331d9a4f2d99603c38bfcac79943b7c6c5439
Gitweb: http://git.kernel.org/tip/3b4331d9a4f2d99603c38bfcac79943b7c6c5439
Author: Suzuki K. Poulose 
AuthorDate: Fri, 13 Feb 2015 18:40:58 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 11:51:17 -0300

perf stat: Report unsupported events properly

Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
broke the perf stat output for unsupported counters.

 $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
 Warning:
 CCI_400/config=24/ event is not supported by the kernel.

  Performance counter stats for 'system wide':

  0  CCI_400/config=24/

1.080265400 seconds time elapsed

Where it used to be :

$ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
 Warning:
 CCI_400/config=24/ event is not supported by the kernel.

  Performance counter stats for 'system wide':

  CCI_400/config=24/

1.083840675 seconds time elapsed

This patch fixes the issues by checking if the counter is supported,
before reading and logging the counter value.

Signed-off-by: Suzuki K. Poulose 
Acked-by: David Ahern 
Tested-by: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1423852858-8455-1-git-send-email-suzuki.poul...@arm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-stat.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e598e4e..d28949d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
int ncpus = perf_evsel__nr_cpus(counter);
int cpu, thread;
 
+   if (!counter->supported)
+   return -ENOENT;
+
if (counter->system_wide)
nthreads = 1;
 
@@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel 
*counter, char *prefix)
if (prefix)
fprintf(output, "%s", prefix);
 
-   if (scaled == -1) {
+   if (scaled == -1 || !counter->supported) {
fprintf(output, "%*s%s",
csv_output ? 0 : 18,
counter->supported ? CNTR_NOT_COUNTED : 
CNTR_NOT_SUPPORTED,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Compare JOBS to 0 after grep

2015-03-02 Thread tip-bot for David Ahern
Commit-ID:  c65568c5456e5216e5467e81d1e04c1f5bdd453f
Gitweb: http://git.kernel.org/tip/c65568c5456e5216e5467e81d1e04c1f5bdd453f
Author: David Ahern 
AuthorDate: Wed, 18 Feb 2015 18:59:31 -0500
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 11:51:00 -0300

perf tools: Compare JOBS to 0 after grep

If JOBS is not by user perf tries to autodetect the number by grepping
the number of CPUs from /proc/cpuinfo. 'grep -c' will always return an
integer so after this command JOBS should be compared to 0, not "".

Signed-off-by: David Ahern 
Link: 
http://lkml.kernel.org/r/1424303971-91904-1-git-send-email-david.ah...@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index cb2e586..d5020ae 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -25,7 +25,7 @@ unexport MAKEFLAGS
 #
 ifeq ($(JOBS),)
   JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
-  ifeq ($(JOBS),)
+  ifeq ($(JOBS),0)
 JOBS := 1
   endif
 endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Only include tsc file for x86

2015-03-02 Thread tip-bot for David Ahern
Commit-ID:  ecefde629fadd3fcca2ea4c6a799d6e6aab8781f
Gitweb: http://git.kernel.org/tip/ecefde629fadd3fcca2ea4c6a799d6e6aab8781f
Author: David Ahern 
AuthorDate: Thu, 19 Feb 2015 13:22:33 -0500
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 2 Mar 2015 11:50:08 -0300

perf tools: Only include tsc file for x86

The perf_time_to_tsc and tsc_to_perf_time functions are only used for x86.

Make inclusion of tsc.c dependent on x86 as well.

Signed-off-by: David Ahern 
Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1424370153-128274-1-git-send-email-david.ah...@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/Build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index a2c8047..972a6e0 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -71,7 +71,7 @@ libperf-y += stat.o
 libperf-y += record.o
 libperf-y += srcline.o
 libperf-y += data.o
-libperf-y += tsc.o
+libperf-$(CONFIG_X86) += tsc.o
 libperf-y += cloexec.o
 libperf-y += thread-stack.o
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL 00/20] perf/core improvements and fixes

2015-03-02 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Hi Ingo,
> 
>   This one has the thread reference counting, that I tested using 'perf 
> probe':
> 
>   perf probe -x ~/bin/perf 'thread__delete:4 thread refcnt=thread->refcnt 
> tid=thread->tid'
>   perf probe -x ~/bin/perf 'thread__get:1 thread refcnt=thread->refcnt 
> tid=thread->tid'
>   perf probe -x ~/bin/perf 'thread__put:6 thread refcnt=thread->refcnt 
> tid=thread->tid'
>   perf record -o thread_refcnt.data -g -e 
> probe_perf:thread__put,probe_perf:thread__get_1,probe_perf:thread__delete 
> perf top
> 
>   with that I checked and in the end the refcount reaches zero and
> thread__delete is called, as expected, using 'perf script', looking at the
> callchains, etc, did the same for 'perf sched lat' and 'trace' also seems to
> work.
> 
>   David, Namhyung, please holler if you find something fishy with this
> thread refcnt stuff, as it is something that is related to previous/current
> work by you guys,
> 
>   Ah, I also merged perf/urgent so that it is buildable in more systems.o
> 
>   There is also the revert for that is_power_of_2 "simplification" in 
> perf_mmap,
> that hasn't made it to perf/urgent nor upstream, its something only in 
> perf/core, sorry
> about that one, should have caught that :-\
> 
>   Please consider pulling,
> 
> - Arnaldo
> The following changes since commit 33be4ef116511f1079c4c3bf4b5547faf7439301:
> 
>   Merge 'tip/perf/urgent' into perf/core to pick fixes (2015-03-02 11:45:49 
> -0300)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git 
> tags/perf-core-for-mingo
> 
> for you to fetch changes up to ae536acfacb65a4a9858c32b12361e09f84f4157:
> 
>   perf sched: No need to keep the session around (2015-03-03 00:17:12 -0300)
> 
> 
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Warn if given uprobe event accesses memory on older kernel (Masami 
> Hiramatsu)
> 
> - 'perf record' Documentation fixes (Namhyung Kim)
> 
> - Report unsupported events properly in 'perf stat' (Suzuki K. Poulose)
> 
> Infrastructure:
> 
> - Avoid FORK after COMM when synthesizing records for pre-existing threads 
> (Arnaldo Carvalho de Melo)
> 
> - Reference count struct thread (Arnaldo Carvalho de Melo)
> 
> - No need to keep the session around in 'perf sched', thread refcounting 
> removes that need (Arnaldo Carvalho de Melo)
> 
> - Initialize cpu set in pthread_attr_setaffinity_np feature test (Adrian 
> Hunter)
> 
> - Only include tsc file for x86 (David Ahern)
> 
> - Compare JOBS to 0 after grep (David Ahern)
> 
> - Improve feature detection messages (Ingo Molnar)
> 
> - Revert "perf: Remove the extra validity check on nr_pages" (Kan Liang)
> 
> - Remove bias offset to find probe point by address (Masami Hiramatsu)
> 
> - Fix build error on ARCH=i386/x86_64/sparc64 )Namhyung Kim)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> Adrian Hunter (1):
>   perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature 
> test
> 
> Arnaldo Carvalho de Melo (3):
>   perf tools: Fix FORK after COMM when synthesizing records for 
> pre-existing threads
>   perf tools: Reference count struct thread
>   perf sched: No need to keep the session around
> 
> David Ahern (2):
>   perf tools: Only include tsc file for x86
>   perf tools: Compare JOBS to 0 after grep
> 
> Ingo Molnar (7):
>   perf tools: Add PERF-FEATURES to the .gitignore file
>   perf tools: Remove annoying extra message from the features build
>   perf tools: Improve Python feature detection messages
>   perf tools: Improve libperl detection message
>   perf tools: Improve libbfd detection message
>   perf tools: Improve feature test debuggability
>   perf tools: Improve 'libbabel' feature check failure message
> 
> Kan Liang (1):
>   Revert "perf: Remove the extra validity check on nr_pages"
> 
> Masami Hiramatsu (2):
>   perf probe: Warn if given uprobe event accesses memory on older kernel
>   perf probe: Remove bias offset to find probe point by address
> 
> Namhyung Kim (3):
>   perf tools: Fix build error on ARCH=i386/x86_64/sparc64
>   perf record: Get rid of -l option from Documentation
>   perf record: Document --group option
> 
> Suzuki K. Poulose (1):
>   perf stat: Report unsupported events properly
> 
>  kernel/events/core.c   |  2 +-
>  tools/perf/.gitignore  |  1 +
>  tools/perf/Documentation/perf-record.txt   | 12 --
>  tools/perf/Makefile|  2 +-
>  tools/perf/builtin-sched.c | 26 +
>  tools/perf/builtin-stat.c  |  5 ++-
>  tools/perf/builtin-trace.c |  7 +++-
>  tools/perf/config/Makefile 

Re: [PATCH] ARM: dts: imx: Add dr_mode host setting to all host-only usb instances

2015-03-02 Thread Peter Chen
On Tue, Mar 03, 2015 at 11:41:35AM +0800, Shawn Guo wrote:
> 
> On Fri, Feb 27, 2015 at 09:06:00AM -0500, Matt Porter wrote:
> > The chipidea driver adds an extra line of spam to the log when a
> > host-only chipidea instance is left set to the default of a dual role
> > controller.
> > 
> > [2.010873] ci_hdrc ci_hdrc.1: doesn't support gadget
> > 
> > Set the dr_mode property to host on all the host-only nodes
> > to avoid this warning.

It is not an warning, it is dev_info.

In fact, imx28, imx6sl and imx6sx's second controller is dual-role
controller, we only set dr_mode at board's dts according to design
unless the controller's capability register is incorrect.

So, sorry, I don't think this change is necessary.

> > 
> > Signed-off-by: Matt Porter 
> > ---
> >  arch/arm/boot/dts/imx27.dtsi   | 2 ++
> >  arch/arm/boot/dts/imx28.dtsi   | 1 +
> >  arch/arm/boot/dts/imx35.dtsi   | 1 +
> >  arch/arm/boot/dts/imx50.dtsi   | 3 +++
> >  arch/arm/boot/dts/imx51.dtsi   | 3 +++
> >  arch/arm/boot/dts/imx53.dtsi   | 3 +++
> >  arch/arm/boot/dts/imx6qdl.dtsi | 3 +++
> >  arch/arm/boot/dts/imx6sl.dtsi  | 1 +
> >  arch/arm/boot/dts/imx6sx.dtsi  | 1 +
> >  9 files changed, 18 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
> > index 4b063b6..6951b66 100644
> > --- a/arch/arm/boot/dts/imx27.dtsi
> > +++ b/arch/arm/boot/dts/imx27.dtsi
> > @@ -488,6 +488,7 @@
> > interrupts = <54>;
> > clocks = < IMX27_CLK_USB_IPG_GATE>;
> > fsl,usbmisc = < 1>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > @@ -497,6 +498,7 @@
> > interrupts = <55>;
> > clocks = < IMX27_CLK_USB_IPG_GATE>;
> > fsl,usbmisc = < 2>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
> > index 47f68ac..02330f4 100644
> > --- a/arch/arm/boot/dts/imx28.dtsi
> > +++ b/arch/arm/boot/dts/imx28.dtsi
> > @@ -1197,6 +1197,7 @@
> > interrupts = <92>;
> > clocks = < 61>;
> > fsl,usbphy = <>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
> > index 6932928..b6478e9 100644
> > --- a/arch/arm/boot/dts/imx35.dtsi
> > +++ b/arch/arm/boot/dts/imx35.dtsi
> > @@ -318,6 +318,7 @@
> > clocks = < 73>;
> > fsl,usbmisc = < 1>;
> > fsl,usbphy = <>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > diff --git a/arch/arm/boot/dts/imx50.dtsi b/arch/arm/boot/dts/imx50.dtsi
> > index 620b0f0..e245713 100644
> > --- a/arch/arm/boot/dts/imx50.dtsi
> > +++ b/arch/arm/boot/dts/imx50.dtsi
> > @@ -197,6 +197,7 @@
> > reg = <0x53f80200 0x0200>;
> > interrupts = <14>;
> > clocks = < IMX5_CLK_USB_PHY2_GATE>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > @@ -205,6 +206,7 @@
> > reg = <0x53f80400 0x0200>;
> > interrupts = <16>;
> > clocks = < IMX5_CLK_USBOH3_GATE>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > @@ -213,6 +215,7 @@
> > reg = <0x53f80600 0x0200>;
> > interrupts = <17>;
> > clocks = < IMX5_CLK_USBOH3_GATE>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
> > index c0116cf..f46fe9b 100644
> > --- a/arch/arm/boot/dts/imx51.dtsi
> > +++ b/arch/arm/boot/dts/imx51.dtsi
> > @@ -265,6 +265,7 @@
> > interrupts = <14>;
> > clocks = < IMX5_CLK_USBOH3_GATE>;
> > fsl,usbmisc = < 1>;
> > +   dr_mode = "host";
> > status = "disabled";
> > };
> >  
> > @@ -274,6 +275,7 @@
> > interrupts = <16>;
> > clocks = < IMX5_CLK_USBOH3_GATE>;
> > fsl,usbmisc = < 2>;
> > +   dr_mode = "host";
> > 

linux-next: Tree for Mar 3

2015-03-02 Thread Stephen Rothwell
Hi all,

Changes since 20150302:

The md tree still had its build failure so I applied a fix patch.

The clk tree still had its build failure so I again used the version
from next-20150225.

Non-merge commits (relative to Linus' tree): 2134
  files changed, 64110 insertions(+), 50104 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 207 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 (023a6007a08d Merge tag 'gpio-v4.0-2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio)
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 (23be7fdafa50 ARM: 8305/1: DMA: Fix kzalloc flags in 
__iommu_alloc_buffer())
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 (6262fc474431 powerpc/iommu: Remove IOMMU 
device references via bus notifier)
Merging sparc/master (a38ecbbd0be0 Merge branch 'x86-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging net/master (eee617a1c35d Merge branch 'mlx4')
Merging ipsec/master (ac37e2515c1a xfrm: release dst_orig in case of error in 
xfrm_lookup())
Merging sound-current/for-linus (8cdebf71098c ALSA: dice: fix wrong offsets for 
Dice interface)
Merging pci-current/for-linus (4efe874aace5 PCI: Don't read past the end of 
sysfs "driver_override" buffer)
Merging wireless-drivers/master (aeb2d2a4c0ae rtlwifi: Remove logging statement 
that is no longer needed)
Merging driver-core.current/driver-core-linus (c517d838eb7d Linux 4.0-rc1)
Merging tty.current/tty-linus (c517d838eb7d Linux 4.0-rc1)
Merging usb.current/usb-linus (b20b1618b8fc cdc-acm: Add support for Denso 
cradle CU-321)
Merging usb-gadget-fixes/fixes (a0456399fb07 usb: gadget: configfs: don't 
NUL-terminate (sub)compatible ids)
Merging usb-serial-fixes/usb-linus (aa91def41a7b USB: ch341: set tty baud speed 
according to tty struct)
Merging staging.current/staging-linus (abe46b8932dd staging: comedi: 
adv_pci1710: fix AI INSN_READ for non-zero channel)
Merging char-misc.current/char-misc-linus (6c15a8516b81 mei: make device 
disabled on stop unconditionally)
Merging input-current/for-linus (2523caab3ce9 Input: cyapa - remove superfluous 
type check in cyapa_gen5_read_idac_data())
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 (f5db310d77ef selftests/vm: fix link error for 
transhuge-stress test)
Merging drm-intel-fixes/for-linux-next-fixes (a6ddea78fa94 drm/i915: Check for 
driver readyness before handling an underrun interrupt)
Merging asm-generic/master (643165c8bbc8 M

Re: [PATCH] ath9k_htc: avoid memcpy when downloading firmware

2015-03-02 Thread Eric Dumazet
On Tue, 2015-03-03 at 12:24 +0800, Fred Chou wrote:
> From: Fred Chou 
> 
> The temporary buffer to hold firmware data is not really needed,
> and memcpy can be avoided by using data pointer instead.
> 
> Signed-off-by: Fred Chou 
> ---
>  drivers/net/wireless/ath/ath9k/hif_usb.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
> b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 10c02f5..0bc35a8 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -986,30 +986,22 @@ static int ath9k_hif_usb_download_fw(struct 
> hif_device_usb *hif_dev)
>   const void *data = hif_dev->fw_data;

Here data can be vmalloc() backed.

>   size_t len = hif_dev->fw_size;
>   u32 addr = AR9271_FIRMWARE;
> - u8 *buf = kzalloc(4096, GFP_KERNEL);

Here buf is kmalloc() backed.

>   u32 firm_offset;
>  
> - if (!buf)
> - return -ENOMEM;
> -
>   while (len) {
>   transfer = min_t(size_t, len, 4096);
> - memcpy(buf, data, transfer);
>  
>   err = usb_control_msg(hif_dev->udev,
> usb_sndctrlpipe(hif_dev->udev, 0),
> FIRMWARE_DOWNLOAD, 0x40 | USB_DIR_OUT,
> -   addr >> 8, 0, buf, transfer, HZ);


Are you sure usb_control_msg() accepts vmalloc()ed buffers ?

My guess is the answer is no.


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


Re: [PATCH 2/2] ARM: rockchip: disable watchdog during suspend

2015-03-02 Thread Chris Zhong


On 03/03/2015 04:50 AM, Heiko Stuebner wrote:

Hi Chris,

Am Montag, 9. Februar 2015, 21:12:23 schrieb Chris Zhong:

The watchdog clock should be disable in dw_wdt_suspend, but we set a
dummy clock to watchdog for rk3288. So the watchdog will continue to
work during suspend. And we switch the system clock to 32khz from 24Mhz,
during suspend, so the watchdog timer over count will increase to
755 times, about 12.5 hours, the original value is 60 seconds. So
watchdog will reset the system over a night,  but voltage are all
incorrect, then it hang on reset.

Signed-off-by: Chris Zhong 
Signed-off-by: Daniel Kurtz 

The SGRF is not writeable in all bootmodes (I've talked with Doug about this
to verify I remembered this correctly), so handling the sgrf gate for the
watchdog is not safe for all possible boards.

Why not simply turn off the watchdog in the driver during suspend?
I think SGRF is writeable, since we would set this RK3288_SGRF_SOC_CON0 
register when suspend.

and this SGRF_PCLK_WDT_GATE is one bit of RK3288_SGRF_SOC_CON0.

I tried to set wdt_en(WDT_CR[bit 0]) to 0 in watchdog driver, but that 
would cause system reboot.


Heiko


---

  arch/arm/mach-rockchip/pm.c | 11 ---
  arch/arm/mach-rockchip/pm.h |  2 ++
  2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c
index a3ab397..b07d886 100644
--- a/arch/arm/mach-rockchip/pm.c
+++ b/arch/arm/mach-rockchip/pm.c
@@ -75,9 +75,13 @@ static void rk3288_slp_mode_set(int level)
regmap_read(pmu_regmap, RK3288_PMU_PWRMODE_CON,
_pmu_pwr_mode_con);

-   /* set bit 8 so that system will resume to FAST_BOOT_ADDR */
+   /*
+* SGRF_FAST_BOOT_EN - system to boot from FAST_BOOT_ADDR
+* PCLK_WDT_GATE - disable WDT during suspend.
+*/
regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0,
-SGRF_FAST_BOOT_EN | SGRF_FAST_BOOT_EN_WRITE);
+SGRF_PCLK_WDT_GATE | SGRF_FAST_BOOT_EN
+| SGRF_PCLK_WDT_GATE_WRITE | SGRF_FAST_BOOT_EN_WRITE);

/* booting address of resuming system is from this register value */
regmap_write(sgrf_regmap, RK3288_SGRF_FAST_BOOT_ADDR,
@@ -122,7 +126,8 @@ static void rk3288_slp_mode_set_resume(void)
 rk3288_pmu_pwr_mode_con);

regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0,
-rk3288_sgrf_soc_con0 | SGRF_FAST_BOOT_EN_WRITE);
+rk3288_sgrf_soc_con0 | SGRF_PCLK_WDT_GATE_WRITE
+| SGRF_FAST_BOOT_EN_WRITE);
  }

  static int rockchip_lpmode_enter(unsigned long arg)
diff --git a/arch/arm/mach-rockchip/pm.h b/arch/arm/mach-rockchip/pm.h
index 96beaa0..d463978 100644
--- a/arch/arm/mach-rockchip/pm.h
+++ b/arch/arm/mach-rockchip/pm.h
@@ -44,6 +44,8 @@ void __init rockchip_suspend_init(void);

  #define RK3288_SGRF_SOC_CON0  (0x)
  #define RK3288_SGRF_FAST_BOOT_ADDR(0x0120)
+#define SGRF_PCLK_WDT_GATE BIT(6)
+#define SGRF_PCLK_WDT_GATE_WRITE   BIT(22)
  #define SGRF_FAST_BOOT_EN BIT(8)
  #define SGRF_FAST_BOOT_EN_WRITE   BIT(24)







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


RE: Re: [PATCH v2 3/3] efi: Capsule update with user helper interface

2015-03-02 Thread Kweh, Hock Leong
> -Original Message-
> From: Matt Fleming [mailto:m...@console-pimps.org]
> Sent: Monday, March 02, 2015 8:30 PM
> 
> On Mon, 02 Mar, at 10:59:00AM, Kweh Hock Leong wrote:
> > > -Original Message-
> > > From: Borislav Petkov [mailto:b...@alien8.de]
> > > Sent: Wednesday, February 25, 2015 8:49 PM
> > >
> > > On Wed, Feb 25, 2015 at 12:38:20PM +, Kweh, Hock Leong wrote:
> > > > The reason we use this interface for efi capsule is that efi capsule
> > > > support multi binaries to be uploaded and each binary file name
> > > > can be different.
> > >
> > > So you can write the file path to a second file and reload then, once
> > > per file.
> >
> > Thanks for the suggestion. Did some exploration on this approach and
> > would like to continue the discussion together with this suggested design.
> >
> > Ideal condition:
> > - one file note is enough for load binary and status return (capsule_load)
> > - load steps would be as simple as just:
> >echo [binary file name] > capsule_load
> > - status return in the same command action. If failed, the echo will fail
> >with the failing status code.
> >
> > Trade off:
> > - does not have the run time flexibility to load any firmware binaries at
> >different different path as firmware class  only support one custom
> >path inputted during boot time/load time. Unless to add new export
> >function for firmware class.
> 
> Could you elaborate here? I don't understand this point.

Just to call out that using firmware class auto locate binary feature is limited
to locations:
- "/lib/firmware/updates/" UTS_RELEASE,
- "/lib/firmware/updates",
- "/lib/firmware/" UTS_RELEASE,
- "/lib/firmware"
and one custom path which inputted during firmware_class module load
time or kernel boot up time.

It is just not like the user helper interface which allow load the binary at
any path/location.

This really is not a big deal. User should cope with it.

> 
> > - if any typo on user level or file path not found, firmware class falls 
> > back
> >to user helper interface. User is required to open another terminal to
> >performs:
> >-> echo 1 > loading
> >-> cat capsule.bin > data
> >-> echo 0 > loading
> >Or wait for timeout.
> 
> Not if you use request_firmware_direct(), right?
> request_firmware_direct() explicitly does not invoke the user helper.
> 
> > - User has the capability to configure the firmware_class time out value.
> >If the infinite value is set, the only method to break the infinite 
> > waiting
> >by manually perform "echo -1 > loading" on the other terminal.
> 
> I'm not sure this is a problem if we use request_firmware_direct().

Oops... I miss out this function. Will rework using this function.

> 
> > Are you guys okay with these trade off?
> > Or you guys still okay with the previous 2 design idea?
> 
> I quite like the design that Borislav is proposing. Things become a lot
> simpler when we stop using request_firmware_nowait().
> 
> The next question is whether we want to batch passing capsules to the
> firmware. The UpdateCapsule() EFI runtime service allows you to chain
> capsule blobs together and pass a scatter-gather list.
> 
> If we do want to batch uploading then we need the equivalent of the
> 'reload' file from the microcode loader to signal to the kernel that the
> userland process has finished uploading capsules, and the kernel can now
> send them to the firmware as one chunk.
> 
> Also, Andy previously raised the point about multiple userland processes
> passing capsules to the firmware simultaneously and the races that
> occur, so we'd need a way to make that atomic.
> 
> I'd much prefer to send one capsule at a time to the firmware, because
> it just makes this whole thing simpler.
> 
> Wilson, I'm really looking for your input here with how capsule
> uploading works on Quark. If we can just repeatedly call UpdateCapsule()
> with one capsule file at a time, that's fine. If we absolutely must
> bundle multiple capsule files together then we probably need to provide
> some atomicity.
> 
> Thoughts?

Quark does not need batch uploading. Even I tested multiple capsules on
Quark by doing repeatedly calling UpdateCapsule() is still working for Quark.
So, Quark does not require this bundling.

> 
> > > Alternatively, you can combine all the files into a cpio archive like
> > > we do with the microcode loader too, and let the kernel parse the cpio
> > > archive.
> >
> > I believe this will make the implementation complicated compare to above.
> 
> Agreed. The capsule files we're sending to the firmware (via this
> interface) already contain all the information we need to stitch
> multiple binaries together - there's really no reason to bundle things
> any further.
> 
> --
> Matt Fleming, Intel Open Source Technology Center

Hi Greg, Ming Lei, Sam & Andy,

Do you guys have any others concern on Borislav proposed approach?
Thanks.


Regards,
Wilson

--
To unsubscribe from this list: send the 

Re: [PATCH v2] ARM: dts: warp: Add initial WaRP Board support

2015-03-02 Thread Shawn Guo
On Tue, Mar 03, 2015 at 12:41:45AM -0300, Otavio Salvador wrote:
> The WaRP Board is a Wearable Reference Plaform. The board features:
> 
>  - Freescale i.MX6 SoloLite processor with 512MB of RAM
>  - Freescale FXOS8700CQ 6-axis Xtrinsic sensor
>  - Freescale Kinetis KL16 MCU
>  - Freescale Xtrinsic MMA955xL intelligent motion sensing platform
> 
> The board implements a hybrid architecture to address the evolving
> needs of the wearables market. The platform consists of a main board
> and an example daughtercard with the ability to add additional
> daughtercards for different usage models.
> 
> For more information about the project, visit:
> 
>  http://www.warpboard.org/
> 
> Signed-off-by: Otavio Salvador 

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]: rtc: ds1685: Fix sparse warnings

2015-03-02 Thread Joshua Kinard
From: Joshua Kinard 

Fix two minor sparse warnings:

  CHECK   drivers/rtc/rtc-ds1685.c
drivers/rtc/rtc-ds1685.c:2178:1: warning: function 'ds1685_rtc_poweroff'
with external linkage has definition
drivers/rtc/rtc-ds1685.c:802:23: warning: Using plain integer as NULL
pointer

Signed-off-by: Joshua Kinard 
Fixes: aaaf5fbf56f1: "rtc: add driver for DS1685 family of real time clocks"
---
 drivers/rtc/rtc-ds1685.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 7a7c8de..7020209 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -799,7 +799,7 @@ ds1685_rtc_proc(struct device *dev, struct seq_file *seq)
struct platform_device *pdev = to_platform_device(dev);
struct ds1685_priv *rtc = platform_get_drvdata(pdev);
u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8];
-   char *model = '\0';
+   char *model;
 #ifdef CONFIG_RTC_DS1685_PROC_REGS
char bits[NUM_REGS][(NUM_BITS * NUM_SPACES) + NUM_BITS + 1];
 #endif
@@ -2174,7 +2174,7 @@ module_exit(ds1685_rtc_exit);
  * ds1685_rtc_poweroff - uses the RTC chip to power the system off.
  * @pdev: pointer to platform_device structure.
  */
-extern void __noreturn
+void __noreturn
 ds1685_rtc_poweroff(struct platform_device *pdev)
 {
u8 ctrla, ctrl4a, ctrl4b;

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


Re: [PATCH 4/4] pinctrl: tegra: add a driver for Tegra210

2015-03-02 Thread Alexandre Courbot
On Wed, Feb 25, 2015 at 6:00 AM, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Tegra210's pinmux supports a different set of pins/options than earlier
> SoCs, so requires its own driver (well, table of pin-specific data).
>
> Cc: devicet...@vger.kernel.org
> Signed-off-by: Stephen Warren 

The series, and this patch in particular,

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


Re: [PATCH 1/2] ARM: rockchip: decrease the wait time for resume

2015-03-02 Thread Chris Zhong


On 03/03/2015 04:47 AM, Heiko Stuebner wrote:

Am Montag, 9. Februar 2015, 21:12:22 schrieb Chris Zhong:

The delay time for wait the 24MHz OSC stabilization is 750ms, and the
delay time for wait the external PMU stabilization is 750ms too, let's
decrease them to 30ms.

just to understand whats happening here:

The default delay time for wait the 24MHz OSC and PMU stabilization is 750ms,
= reset value in the register and your patch is decreasing this to 30ms.

Are the new 30ms for each of the two long enough in all cases?

Yes, the 30ms are safe for wait them to stabilization.



Heiko



Signed-off-by: Chris Zhong 
---

  arch/arm/mach-rockchip/pm.c | 3 +++
  arch/arm/mach-rockchip/pm.h | 4 
  2 files changed, 7 insertions(+)

diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c
index 50cb781..a3ab397 100644
--- a/arch/arm/mach-rockchip/pm.c
+++ b/arch/arm/mach-rockchip/pm.c
@@ -209,6 +209,9 @@ static int rk3288_suspend_init(struct device_node *np)
memcpy(rk3288_bootram_base, rockchip_slp_cpu_resume,
   rk3288_bootram_sz);

+   regmap_write(pmu_regmap, RK3288_PMU_OSC_CNT, OSC_STABL_CNT_THRESH);
+   regmap_write(pmu_regmap, RK3288_PMU_STABL_CNT, PMU_STABL_CNT_THRESH);
+
return 0;
  }

diff --git a/arch/arm/mach-rockchip/pm.h b/arch/arm/mach-rockchip/pm.h
index 7d752ff..96beaa0 100644
--- a/arch/arm/mach-rockchip/pm.h
+++ b/arch/arm/mach-rockchip/pm.h
@@ -57,6 +57,10 @@ void __init rockchip_suspend_init(void);
  /* PMU_WAKEUP_CFG1 bits */
  #define PMU_ARMINT_WAKEUP_EN  BIT(0)

+/* wait 30ms for OSC stable and 30ms for pmic stable */
+#define OSC_STABL_CNT_THRESH   (32 * 30)
+#define PMU_STABL_CNT_THRESH   (32 * 30)
+
  enum rk3288_pwr_mode_con {
PMU_PWR_MODE_EN = 0,
PMU_CLK_CORE_SRC_GATE_EN,







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


Re: [GIT PULL] Samsung Thermal fixes for v4.0-rc2

2015-03-02 Thread Eduardo Valentin
On Mon, Mar 02, 2015 at 11:43:47AM +0100, Lukasz Majewski wrote:
> Dear Eduardo,
> 
> Please find my first pull request for Samsung Thermal fixes targeting
> v4.0-rc2.
> 

Pulled. Thanks. 

Couple of minor comments though (check next on your pull)

> Changes:
> - Exynos7 power down detection mode fix
> - Fix for cpufreq cooling device regression
> - Updating MAINTAINER's entry for Samsung Exynos Thermal 
> 
> 
> 
> The following changes since commit
> 5912e264d9eec512598d8faf33440630a3aee989:
> 
>   Merge branch 'tmon-fixes' of .git into next (2015-02-28 14:07:03
>   +0800)
> 
> are available in the git repository at:
> 
> 
>   g...@github.com:lmajewski/linux-samsung-thermal.git
>   github_linux-samusng-thermal/fixes

This branch does not really exist. But I figure you want to mention
'fixes' branch.

> 
> for you to fetch changes up to 93c537affd5d2a7b2fcea4a1d608b011841d3c04:
> 
>   MAINTAINERS: Add entry for SAMSUNG THERMAL DRIVER (2015-03-02
>   10:06:09 +0100)
> 
> 
> Chanwoo Choi (1):
>   thermal: exynos: Fix wrong control of power down detection mode
> for Exynos7
> 
> Lukasz Majewski (2):
>   cpufreq: exynos: Use simple approach to asses if cpu cooling can
> be used MAINTAINERS: Add entry for SAMSUNG THERMAL DRIVER
> 
>  MAINTAINERS  |  8 
>  drivers/cpufreq/exynos-cpufreq.c | 21 ++---

As this one was a left over and was acked by cpufreq maintainer, I am
picking this time. But even in the case of an ack, I would really prefer
to have each change going via their respective tree whenever possible.

>  drivers/thermal/samsung/exynos_tmu.c |  3 ++-
>  3 files changed, 16 insertions(+), 16 deletions(-)
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung R Institute Poland (SRPOL) | Linux Platform Group
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH] x86/xen: Initialize cr4 shadow for 64-bit PV(H) guests

2015-03-02 Thread Luis R. Rodriguez
On Mon, Feb 23, 2015 at 9:09 AM, David Vrabel  wrote:
> On 23/02/15 16:01, Boris Ostrovsky wrote:
>> Commit 1e02ce4cccdc ("x86: Store a per-cpu shadow copy of CR4")
>> introduced CR4 shadows.
>>
>> These shadows are initialized in early boot code. The commit missed
>> initialization for 64-bit PV(H) guests that this patch adds.
>
> Applied to stable/for-linus-4.0, thanks.
>
> Boris, can you kick of a set of tests on this branch, please?

Do we know worst case what should blow up without this commit ?

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


Re: [regression v4.0-rc1] mm: IPIs from TLB flushes causing significant performance degradation.

2015-03-02 Thread Dave Chinner
On Mon, Mar 02, 2015 at 06:37:47PM -0800, Linus Torvalds wrote:
> On Mon, Mar 2, 2015 at 6:22 PM, Linus Torvalds
>  wrote:
> >
> > There might be some other case where the new "just change the
> > protection" doesn't do the "oh, but it the protection didn't change,
> > don't bother flushing". I don't see it.
> 
> Hmm. I wonder.. In change_pte_range(), we just unconditionally change
> the protection bits.
> 
> But the old numa code used to do
> 
> if (!pte_numa(oldpte)) {
> ptep_set_numa(mm, addr, pte);
> 
> so it would actually avoid the pte update if a numa-prot page was
> marked numa-prot again.
> 
> But are those migrate-page calls really common enough to make these
> things happen often enough on the same pages for this all to matter?

It's looking like that's a possibility.  I am running a fake-numa=4
config on this test VM so it's got 4 nodes of 4p/4GB RAM each.
both kernels are running through the same page fault path and that
is straight through migrate_pages().

3.19:

   13.70% 0.01%  [kernel][k] native_flush_tlb_others
   - native_flush_tlb_others
  - 98.58% flush_tlb_page
   ptep_clear_flush
   try_to_unmap_one
   rmap_walk
   try_to_unmap
   migrate_pages
   migrate_misplaced_page
 - handle_mm_fault
- 96.88% __do_page_fault
 trace_do_page_fault
 do_async_page_fault
   + async_page_fault
+ 3.12% __get_user_pages
  + 1.40% flush_tlb_mm_range

4.0-rc1:

-   67.12% 0.04%  [kernel][k] native_flush_tlb_others
   - native_flush_tlb_others
  - 99.80% flush_tlb_page
   ptep_clear_flush
   try_to_unmap_one
   rmap_walk
   try_to_unmap
   migrate_pages
   migrate_misplaced_page
 - handle_mm_fault
- 99.50% __do_page_fault
 trace_do_page_fault
 do_async_page_fault
   - async_page_fault

Same call chain, just a lot more CPU used further down the stack.

> Odd.
> 
> So it would be good if your profiles just show "there's suddenly a
> *lot* more calls to flush_tlb_page() from XYZ" and the culprit is
> obvious that way..

Ok, I did a simple 'perf stat -e tlb:tlb_flush -a -r 6 sleep 10' to
count all the tlb flush events from the kernel. I then pulled the
full events for a 30s period to get a sampling of the reason
associated with each flush event.

4.0-rc1:

 Performance counter stats for 'system wide' (6 runs):

 2,190,503  tlb:tlb_flush  ( +-  8.30% )

  10.001970663 seconds time elapsed( +-  0.00% )

The reason breakdown:

81% TLB_REMOTE_SHOOTDOWN
19% TLB_FLUSH_ON_TASK_SWITCH

3.19:

 Performance counter stats for 'system wide' (6 runs):

   467,151  tlb:tlb_flush  ( +- 25.50% )

  10.002021491 seconds time elapsed( +-  0.00% )

The reason breakdown:

  6% TLB_REMOTE_SHOOTDOWN
 94% TLB_FLUSH_ON_TASK_SWITCH

The difference would appear to be the number of remote TLB
shootdowns that are occurring from otherwise identical page fault
paths.

Cheers,

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


[PATCH] Fixing style warnings.

2015-03-02 Thread cfredric
Signed-off-by: cfredric 
---
 drivers/usb/core/buffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 506b969..89f2e77 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -70,7 +70,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
size = pool_max[i];
if (!size)
continue;
-   snprintf(name, sizeof name, "buffer-%d", size);
+   snprintf(name, sizeof(name), "buffer-%d", size);
hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
size, size, 0);
if (!hcd->pool[i]) {
@@ -95,6 +95,7 @@ void hcd_buffer_destroy(struct usb_hcd *hcd)
 
for (i = 0; i < HCD_BUFFER_POOLS; i++) {
struct dma_pool *pool = hcd->pool[i];
+
if (pool) {
dma_pool_destroy(pool);
hcd->pool[i] = NULL;
-- 
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 1/3] early kprobes: make kprobes_on_ftrace_initialized public available.

2015-03-02 Thread Wang Nan
That var is useful for x86 recover_probed_instruction() for recovering
ftraced instructions, to make it possible to determine whether the
instruction has been converted to nop by ftrace.

I will merge this patch into next version of early kprobe series.

Signed-off-by: Wang Nan 
---
 include/linux/kprobes.h | 3 +++
 kernel/kprobes.c| 4 +---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 2d78bbb..24eac73 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -288,6 +288,8 @@ extern const unsigned char 
*arch_kprobe_on_ftrace_get_old_insn(struct kprobe *kp
const unsigned char *ftrace_nop, unsigned char *dest, size_t 
insn_size);
 
 extern void init_kprobes_on_ftrace(void);
+extern bool kprobes_on_ftrace_initialized __read_mostly;
+
 extern bool kprobe_fix_ftrace_make_nop(struct dyn_ftrace *rec);
 extern const unsigned char *kprobe_on_ftrace_get_old_insn(struct dyn_ftrace 
*rec,
const unsigned char *ftrace_nop, unsigned char *dest, size_t 
insn_size);
@@ -295,6 +297,7 @@ extern const unsigned char 
*kprobe_on_ftrace_get_old_insn(struct dyn_ftrace *rec
 static inline void init_kprobes_on_ftrace(void)
 {
 }
+#define kprobes_on_ftrace_initialized  true
 
 static inline bool kprobe_fix_ftrace_make_nop(struct dyn_ftrace *_unused)
 {
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1ec8e6e..2d4e671 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -70,9 +70,7 @@
 static int kprobes_initialized;
 static int kprobes_blacklist_initialized;
 #if defined(CONFIG_KPROBES_ON_FTRACE) && defined(CONFIG_EARLY_KPROBES)
-static bool kprobes_on_ftrace_initialized __read_mostly = false;
-#else
-# define kprobes_on_ftrace_initialized false
+bool kprobes_on_ftrace_initialized __read_mostly = false;
 #endif
 
 bool kprobes_is_early(void)
-- 
1.8.4

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


[PATCH 2/3] ftrace/x86: don't return error if other makes a same code change.

2015-03-02 Thread Wang Nan
In ftrace_modify_code_direct(), if the target instruction has already
been modified by other to the desire instruction, don't return error.

This patch is for early kprobe. If an early kprobe is unregistered
before ftrace is ready, the instruction may have already been restored
to NOP.

Signed-off-by: Wang Nan 
---
 arch/x86/kernel/ftrace.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 0a86c7c..fba1779 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -121,8 +121,13 @@ ftrace_modify_code_direct(unsigned long ip, unsigned const 
char *old_code,
return -EFAULT;
 
/* Make sure it is what we expect it to be */
-   if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
-   return -EINVAL;
+   if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) {
+   /* Check if someone else has already done it */
+   if (memcmp(replaced, new_code, MCOUNT_INSN_SIZE) != 0)
+   return -EINVAL;
+   else
+   return 0;
+   }
 
ip = text_ip_addr(ip);
 
-- 
1.8.4

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


[PATCH 3/3] early kprobes: x86: don't try to recover ftraced instruction before ftrace get ready.

2015-03-02 Thread Wang Nan
Before ftrace convertin instruction to nop, if an early kprobe is
registered then unregistered, without this patch its first bytes will
be replaced by head of NOP, which may confuse ftrace.

Actually, since we have a patch which convert ftrace entry to nop
when probing, this problem should never be triggered. Provide it for
safety.

Signed-off-by: Wang Nan 
---
 arch/x86/kernel/kprobes/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 87beb64..c7d304d 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -225,6 +225,9 @@ __recover_probed_insn(kprobe_opcode_t *buf, unsigned long 
addr)
struct kprobe *kp;
unsigned long faddr;
 
+   if (!kprobes_on_ftrace_initialized)
+   return addr;
+
kp = get_kprobe((void *)addr);
faddr = ftrace_location(addr);
/*
-- 
1.8.4

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


[PATCH 0/3] early kprobes: Fix bug in unregistering early kprobe before kprobe is ready.

2015-03-02 Thread Wang Nan
In my RFC patch series of early kprobes, unregistering early kprobe on
ftrace triggers ftrace_bug(). This series of patch provides a fix.
I'll merge them in next version of early kprobe patch series.

-- 
1.8.4

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


[PATCH] NFC: st21nfca: fix st21nfca_get_iso14443_3_uid data copy

2015-03-02 Thread Nicolas Iooss
st21nfca_get_iso14443_3_uid() does not correctly copy the uid from
uid_skb->data to its gate parameter.  "gate = uid_skb->data;" only puts
a pointer to uid_skb->data to the local variable gate.  This means that
in st21nfca_hci_target_from_gate() the content of "u8
uid[NFC_NFCID1_MAXSIZE]" local variable is never initialized before
being used in memcpy(target->nfcid1, uid, len).

Fix this by replacing the local variable assignment with a memcpy.

This was found by compiling Linux with "gcc -Wunused-but-set-parameter".

Signed-off-by: Nicolas Iooss 
---

As I did not get any reply from https://lkml.org/lkml/2015/2/28/25 and
got confirmation by other people that this may be a real bug, I am now
sending a patch to fix it.

 drivers/nfc/st21nfca/st21nfca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c
index 24d3d240d5f4..ff70d2838b29 100644
--- a/drivers/nfc/st21nfca/st21nfca.c
+++ b/drivers/nfc/st21nfca/st21nfca.c
@@ -588,7 +588,7 @@ static int st21nfca_get_iso14443_3_uid(struct nfc_hci_dev 
*hdev, u8 *gate,
goto exit;
}
 
-   gate = uid_skb->data;
+   memcpy(gate, uid_skb->data, uid_skb->len);
*len = uid_skb->len;
 exit:
kfree_skb(uid_skb);
-- 
2.3.1

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


Re: [Debug 0/2] Fix regressions caused by commit 593669c2ac0f

2015-03-02 Thread Jiang Liu


On 2015/3/3 12:34, Dave Airlie wrote:
> On 3 March 2015 at 14:25, Jiang Liu  wrote:
>> Commit 593669c2ac0f (x86/PCI/ACPI: Use common ACPI resource interfaces
>> to simplify implementation) causes regression to several platforms,
>> which is caused by stricter checks in new ACPI resource parsing code
>> and BIOSes report incorrect ACPI resource descriptors.  So try to relax
>> the check to avoid regressions.
>>
>> Jiang Liu (2):
>>   x86/PCI/ACPI: Ignore resources consumed by host bridge itself
>>   x86/PCI/ACPI: Relax ACPI resource descriptor checks to work around
>> BIOS bugs
> 
> I've booted my machine with that lost its r8169 and it appears to be
> working now.
> 
> So from the regression POV:
> Tested-by: Dave Airlie 
Thanks for testing, Dave:)
> 
> Dave.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/9] selftests/timers: Use implicit rules

2015-03-02 Thread Michael Ellerman
There's no need to open-code the build rules, use the implicit ones.

This has the nice side effect of enabling cross compilation.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/timers/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 149cee3b7b8a..87340405e4b3 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,9 +1,9 @@
-all:
-   gcc posix_timers.c -o posix_timers -lrt
-
 TEST_PROGS := posix_timers
+LDLIBS += -lrt
+
+all: $(TEST_PROGS)
 
 include ../lib.mk
 
 clean:
-   rm -f ./posix_timers
+   rm -f $(TEST_PROGS)
-- 
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 3/9] selftests: Add install support for the powerpc tests

2015-03-02 Thread Michael Ellerman
The bulk of the selftests are actually below the powerpc sub directory.

This adds support for installing them, when on a powerpc machine, or if
ARCH and CROSS_COMPILE are set appropriately.

This is a little more complicated because of the sub directory structure
under powerpc, but much of the common logic in lib.mk is still used. The
net effect of the patch is still a reduction in code.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/powerpc/Makefile   | 19 -
 tools/testing/selftests/powerpc/copyloops/Makefile | 15 +++
 tools/testing/selftests/powerpc/mm/Makefile| 15 +++
 tools/testing/selftests/powerpc/pmu/Makefile   | 48 --
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   | 13 +++---
 .../testing/selftests/powerpc/primitives/Makefile  | 15 +++
 .../testing/selftests/powerpc/stringloops/Makefile | 15 +++
 tools/testing/selftests/powerpc/tm/Makefile| 15 +++
 8 files changed, 73 insertions(+), 82 deletions(-)

diff --git a/tools/testing/selftests/powerpc/Makefile 
b/tools/testing/selftests/powerpc/Makefile
index 1d5e7ad2c460..22c4f8ffa422 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -22,10 +22,25 @@ all: $(TARGETS)
 $(TARGETS):
$(MAKE) -k -C $@ all
 
-run_tests: all
+include ../lib.mk
+
+override define RUN_TESTS
@for TARGET in $(TARGETS); do \
$(MAKE) -C $$TARGET run_tests; \
done;
+endef
+
+override define INSTALL_RULE
+   @for TARGET in $(TARGETS); do \
+   $(MAKE) -C $$TARGET install; \
+   done;
+endef
+
+override define EMIT_TESTS
+   @for TARGET in $(TARGETS); do \
+   $(MAKE) -s -C $$TARGET emit_tests; \
+   done;
+endef
 
 clean:
@for TARGET in $(TARGETS); do \
@@ -36,4 +51,4 @@ clean:
 tags:
find . -name '*.c' -o -name '*.h' | xargs ctags
 
-.PHONY: all run_tests clean tags $(TARGETS)
+.PHONY: tags $(TARGETS)
diff --git a/tools/testing/selftests/powerpc/copyloops/Makefile 
b/tools/testing/selftests/powerpc/copyloops/Makefile
index 6f2d3be227f9..c05023514ce8 100644
--- a/tools/testing/selftests/powerpc/copyloops/Makefile
+++ b/tools/testing/selftests/powerpc/copyloops/Makefile
@@ -6,24 +6,19 @@ CFLAGS += -D SELFTEST
 # Use our CFLAGS for the implicit .S rule
 ASFLAGS = $(CFLAGS)
 
-PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
+TEST_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
 EXTRA_SOURCES := validate.c ../harness.c
 
-all: $(PROGS)
+all: $(TEST_PROGS)
 
 copyuser_64: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
 copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
 memcpy_64:   CPPFLAGS += -D COPY_LOOP=test_memcpy
 memcpy_power7:   CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
 
-$(PROGS): $(EXTRA_SOURCES)
+$(TEST_PROGS): $(EXTRA_SOURCES)
 
-run_tests: all
-   @-for PROG in $(PROGS); do \
-   ./$$PROG; \
-   done;
+include ../../lib.mk
 
 clean:
-   rm -f $(PROGS) *.o
-
-.PHONY: all run_tests clean
+   rm -f $(TEST_PROGS) *.o
diff --git a/tools/testing/selftests/powerpc/mm/Makefile 
b/tools/testing/selftests/powerpc/mm/Makefile
index a14c538dd7f8..41cc3ed66818 100644
--- a/tools/testing/selftests/powerpc/mm/Makefile
+++ b/tools/testing/selftests/powerpc/mm/Makefile
@@ -1,21 +1,16 @@
 noarg:
$(MAKE) -C ../
 
-PROGS := hugetlb_vs_thp_test subpage_prot
+TEST_PROGS := hugetlb_vs_thp_test subpage_prot
 
-all: $(PROGS) tempfile
+all: $(TEST_PROGS) tempfile
 
-$(PROGS): ../harness.c
+$(TEST_PROGS): ../harness.c
 
-run_tests: all
-   @-for PROG in $(PROGS); do \
-   ./$$PROG; \
-   done;
+include ../../lib.mk
 
 tempfile:
dd if=/dev/zero of=tempfile bs=64k count=1
 
 clean:
-   rm -f $(PROGS) tempfile
-
-.PHONY: all run_tests clean
+   rm -f $(TEST_PROGS) tempfile
diff --git a/tools/testing/selftests/powerpc/pmu/Makefile 
b/tools/testing/selftests/powerpc/pmu/Makefile
index c9f4263906a5..5a161175bbd4 100644
--- a/tools/testing/selftests/powerpc/pmu/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/Makefile
@@ -1,38 +1,42 @@
 noarg:
$(MAKE) -C ../
 
-PROGS := count_instructions l3_bank_test per_event_excludes
+TEST_PROGS := count_instructions l3_bank_test per_event_excludes
 EXTRA_SOURCES := ../harness.c event.c lib.c
 
-SUB_TARGETS = ebb
+all: $(TEST_PROGS) ebb
 
-all: $(PROGS) $(SUB_TARGETS)
-
-$(PROGS): $(EXTRA_SOURCES)
+$(TEST_PROGS): $(EXTRA_SOURCES)
 
 # loop.S can only be built 64-bit
 count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
$(CC) $(CFLAGS) -m64 -o $@ $^
 
-run_tests: all sub_run_tests
-   @-for PROG in $(PROGS); do \
-   ./$$PROG; \
-   done;
+include ../../lib.mk
 
-clean: sub_clean
-   rm -f $(PROGS) loop.o
+DEFAULT_RUN_TESTS := $(RUN_TESTS)
+override define RUN_TESTS
+   $(DEFAULT_RUN_TESTS)
+   $(MAKE) -C ebb run_tests
+endef
 

[PATCH 6/9] selftests: Set CC using CROSS_COMPILE once in lib.mk

2015-03-02 Thread Michael Ellerman
This avoids repeating the logic in every Makefile. We mimic the
top-level Makefile and use $(CROSS_COMPILE)gcc.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/efivarfs/Makefile | 1 -
 tools/testing/selftests/exec/Makefile | 1 -
 tools/testing/selftests/kcmp/Makefile | 1 -
 tools/testing/selftests/lib.mk| 4 
 tools/testing/selftests/net/Makefile  | 1 -
 tools/testing/selftests/powerpc/Makefile  | 3 +--
 tools/testing/selftests/size/Makefile | 2 --
 tools/testing/selftests/vm/Makefile   | 1 -
 8 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/efivarfs/Makefile 
b/tools/testing/selftests/efivarfs/Makefile
index 3052d0bda24b..d683486a859b 100644
--- a/tools/testing/selftests/efivarfs/Makefile
+++ b/tools/testing/selftests/efivarfs/Makefile
@@ -1,4 +1,3 @@
-CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall
 
 test_objs = open-unlink create-read
diff --git a/tools/testing/selftests/exec/Makefile 
b/tools/testing/selftests/exec/Makefile
index 886cabe307b1..4edb7d0da29b 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -1,4 +1,3 @@
-CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall
 BINARIES = execveat
 DEPS = execveat.symlink execveat.denatured script subdir
diff --git a/tools/testing/selftests/kcmp/Makefile 
b/tools/testing/selftests/kcmp/Makefile
index 0eecd183058c..2ae7450a9a89 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -1,4 +1,3 @@
-CC := $(CROSS_COMPILE)$(CC)
 CFLAGS += -I../../../../usr/include/
 
 all: kcmp_test
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 7bd3dabe2846..860906694a10 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -1,3 +1,7 @@
+# This mimics the top-level Makefile. We do it explicitly here so that this
+# Makefile can operate with or without the kbuild infrastructure.
+CC := $(CROSS_COMPILE)gcc
+
 define RUN_TESTS
@for TEST in $(TEST_PROGS); do \
(./$$TEST && echo "selftests: $$TEST [PASS]") || echo 
"selftests: $$TEST [FAIL]"; \
diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index 6ba2ac7bbb0d..fac4782c51d8 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -1,6 +1,5 @@
 # Makefile for net selftests
 
-CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall -O2 -g
 
 CFLAGS += -I../../../../usr/include/
diff --git a/tools/testing/selftests/powerpc/Makefile 
b/tools/testing/selftests/powerpc/Makefile
index 22c4f8ffa422..2958fe9a74e9 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -8,10 +8,9 @@ ifeq ($(ARCH),powerpc)
 
 GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
 
-CC := $(CROSS_COMPILE)$(CC)
 CFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' 
-I$(CURDIR) $(CFLAGS)
 
-export CC CFLAGS
+export CFLAGS
 
 TARGETS = pmu copyloops mm tm primitives stringloops
 
diff --git a/tools/testing/selftests/size/Makefile 
b/tools/testing/selftests/size/Makefile
index e4353d74ea6e..bbd0b5398b61 100644
--- a/tools/testing/selftests/size/Makefile
+++ b/tools/testing/selftests/size/Makefile
@@ -1,5 +1,3 @@
-CC = $(CROSS_COMPILE)gcc
-
 all: get_size
 
 get_size: get_size.c
diff --git a/tools/testing/selftests/vm/Makefile 
b/tools/testing/selftests/vm/Makefile
index 90e56090b0ed..cd1a55a279aa 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,6 +1,5 @@
 # Makefile for vm selftests
 
-CC = $(CROSS_COMPILE)gcc
 CFLAGS = -Wall
 BINARIES = hugepage-mmap hugepage-shm map_hugetlb thuge-gen hugetlbfstest
 BINARIES += transhuge-stress
-- 
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/9] kbuild: add a new kselftest_install make target to install selftests

2015-03-02 Thread Michael Ellerman
Add a new make target to install kernel selftests. This new target will
build and install selftests.

The default is just $(objtree)/selftests. This is preferable to
something based on $(INSTALL_MOD_PATH) (which defaults to /), as it
allows a normal user to install the tests. This is similar to the
default behaviour of make headers_install.

Therefore the most basic usage is:

$ make kselftests_install
$ ./selftests/all.sh

To install elsewhere use:

$ make kselftests_install INSTALL_SELFTESTS_PATH=/some/where
$ /some/where/all.sh

Signed-off-by: Shuah Khan 
Signed-off-by: Michael Ellerman 
---
 Makefile | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 9fab639727c7..eb096850718a 100644
--- a/Makefile
+++ b/Makefile
@@ -1081,12 +1081,20 @@ headers_check: headers_install
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) 
HDRCHECK=1
 
 # ---
-# Kernel selftest
+# Kernel selftest targets
+
+# Default base path for kselftest install
+INSTALL_SELFTESTS_PATH = $(abspath $(objtree)/selftests)
 
 PHONY += kselftest
 kselftest:
$(Q)$(MAKE) -C tools/testing/selftests run_tests
 
+# Kernel selftest install
+PHONY += kselftest_install
+kselftest_install:
+   $(Q)$(MAKE) -C tools/testing/selftests 
INSTALL_PATH=$(INSTALL_SELFTESTS_PATH) install
+
 # ---
 # Modules
 
@@ -1295,6 +1303,9 @@ help:
@echo  'Build, install, and boot kernel before'
@echo  'running kselftest on it'
@echo  ''
+   @echo  '  kselftest_install - Install selftests to 
INSTALL_SELFTESTS_PATH'
+   @echo  '  default: $(INSTALL_SELFTESTS_PATH)'
+   @echo  ''
@echo  'Kernel packaging:'
@$(MAKE) $(build)=$(package-dir) help
@echo  ''
-- 
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 9/9] selftests/mount: Use implicit rules

2015-03-02 Thread Michael Ellerman
There's no need to open-code the build rules, use the implicit ones.

This has the nice side effect of enabling cross compilation.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/mount/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/mount/Makefile 
b/tools/testing/selftests/mount/Makefile
index a5b367f032ba..a6c62bedb0d9 100644
--- a/tools/testing/selftests/mount/Makefile
+++ b/tools/testing/selftests/mount/Makefile
@@ -1,13 +1,13 @@
 # Makefile for mount selftests.
 
-all: unprivileged-remount-test
+TEST_PROGS := unprivileged-remount-test
+
+CFLAGS += -O2 -Wall
 
-unprivileged-remount-test: unprivileged-remount-test.c
-   gcc -Wall -O2 unprivileged-remount-test.c -o unprivileged-remount-test
+all: $(TEST_PROGS)
 
 include ../lib.mk
 
-TEST_PROGS := unprivileged-remount-test
 override RUN_TESTS := if [ -f /proc/self/uid_map ] ; then 
./unprivileged-remount-test ; fi
 override EMIT_TESTS := echo "$(RUN_TESTS)"
 
-- 
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 8/9] selftests/mqueue: Use implicit rules

2015-03-02 Thread Michael Ellerman
There's no need to open-code the build rules, use the implicit ones.

This has the nice side effect of enabling cross compilation.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/mqueue/Makefile | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/mqueue/Makefile 
b/tools/testing/selftests/mqueue/Makefile
index 6ca7261b55dc..ed85a1d7ee36 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -1,6 +1,11 @@
-all:
-   gcc -O2 mq_open_tests.c -o mq_open_tests -lrt
-   gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
+TEST_PROGS := mq_open_tests mq_perf_tests
+
+CFLAGS += -O2
+LDLIBS += -lrt
+
+mq_perf_tests: LDLIBS += -lpthread -lpopt
+
+all: $(TEST_PROGS)
 
 include ../lib.mk
 
@@ -9,12 +14,10 @@ override define RUN_TESTS
@./mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
 endef
 
-TEST_PROGS := mq_open_tests mq_perf_tests
-
 override define EMIT_TESTS
echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests 
[FAIL]\""
echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
 endef
 
 clean:
-   rm -f mq_open_tests mq_perf_tests
+   rm -f $(TEST_PROGS)
-- 
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 1/9] selftests: Introduce minimal shared logic for running tests

2015-03-02 Thread Michael Ellerman
This adds a Make include file which most selftests can then include to
get the run_tests logic.

On its own this has the advantage of some reduction in repetition, and
also means the pass/fail message is defined in fewer places.

However the key advantage is it will allow us to implement install very
simply in a subsequent patch.

The default implementation just executes each program in $(TEST_PROGS).

We use a variable to hold the default implementation of $(RUN_TESTS)
because that gives us a clean way to override it if necessary, ie. using
override. The mount, memory-hotplug and mqueue tests use that to provide
a different implementation.

Tests are not run via /bin/bash, so if they are scripts they must be
executable, we add u+x to several.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/breakpoints/Makefile   |  5 +++--
 tools/testing/selftests/cpu-hotplug/Makefile   |  5 +++--
 tools/testing/selftests/cpu-hotplug/on-off-test.sh |  0
 tools/testing/selftests/efivarfs/Makefile  |  5 +++--
 tools/testing/selftests/efivarfs/efivarfs.sh   |  0
 tools/testing/selftests/exec/Makefile  |  5 +++--
 tools/testing/selftests/firmware/Makefile  | 20 ++--
 tools/testing/selftests/firmware/fw_filesystem.sh  |  0
 tools/testing/selftests/firmware/fw_userhelper.sh  |  0
 tools/testing/selftests/ftrace/Makefile|  5 +++--
 tools/testing/selftests/ipc/Makefile   |  5 +++--
 tools/testing/selftests/kcmp/Makefile  |  5 +++--
 tools/testing/selftests/lib.mk | 10 ++
 tools/testing/selftests/memfd/Makefile |  6 +++---
 tools/testing/selftests/memory-hotplug/Makefile|  5 +++--
 tools/testing/selftests/mount/Makefile |  8 ++--
 tools/testing/selftests/mqueue/Makefile|  9 ++---
 tools/testing/selftests/net/Makefile   |  8 
 tools/testing/selftests/ptrace/Makefile|  5 +++--
 tools/testing/selftests/size/Makefile  |  5 +++--
 tools/testing/selftests/sysctl/Makefile| 11 ++-
 tools/testing/selftests/timers/Makefile|  5 +++--
 tools/testing/selftests/user/Makefile  |  5 +++--
 tools/testing/selftests/vm/Makefile|  5 +++--
 24 files changed, 68 insertions(+), 69 deletions(-)
 mode change 100644 => 100755 tools/testing/selftests/cpu-hotplug/on-off-test.sh
 mode change 100644 => 100755 tools/testing/selftests/efivarfs/efivarfs.sh
 mode change 100644 => 100755 tools/testing/selftests/firmware/fw_filesystem.sh
 mode change 100644 => 100755 tools/testing/selftests/firmware/fw_userhelper.sh
 create mode 100644 tools/testing/selftests/lib.mk

diff --git a/tools/testing/selftests/breakpoints/Makefile 
b/tools/testing/selftests/breakpoints/Makefile
index e18b42b254af..182235640209 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -16,8 +16,9 @@ else
echo "Not an x86 target, can't build breakpoints selftests"
 endif
 
-run_tests:
-   @./breakpoint_test || echo "breakpoints selftests: [FAIL]"
+TEST_PROGS := breakpoint_test
+
+include ../lib.mk
 
 clean:
rm -fr breakpoint_test
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile 
b/tools/testing/selftests/cpu-hotplug/Makefile
index e9c28d8dc84b..15f02591d22c 100644
--- a/tools/testing/selftests/cpu-hotplug/Makefile
+++ b/tools/testing/selftests/cpu-hotplug/Makefile
@@ -1,7 +1,8 @@
 all:
 
-run_tests:
-   @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]"
+TEST_PROGS := on-off-test.sh
+
+include ../lib.mk
 
 run_full_test:
@/bin/bash ./on-off-test.sh -a || echo "cpu-hotplug selftests: [FAIL]"
diff --git a/tools/testing/selftests/cpu-hotplug/on-off-test.sh 
b/tools/testing/selftests/cpu-hotplug/on-off-test.sh
old mode 100644
new mode 100755
diff --git a/tools/testing/selftests/efivarfs/Makefile 
b/tools/testing/selftests/efivarfs/Makefile
index 29e8c6bc81b0..3052d0bda24b 100644
--- a/tools/testing/selftests/efivarfs/Makefile
+++ b/tools/testing/selftests/efivarfs/Makefile
@@ -5,8 +5,9 @@ test_objs = open-unlink create-read
 
 all: $(test_objs)
 
-run_tests: all
-   @/bin/bash ./efivarfs.sh || echo "efivarfs selftests: [FAIL]"
+TEST_PROGS := efivarfs.sh
+
+include ../lib.mk
 
 clean:
rm -f $(test_objs)
diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh 
b/tools/testing/selftests/efivarfs/efivarfs.sh
old mode 100644
new mode 100755
diff --git a/tools/testing/selftests/exec/Makefile 
b/tools/testing/selftests/exec/Makefile
index 66dfc2ce1788..a0098daeb73d 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -18,8 +18,9 @@ execveat.denatured: execveat
 %: %.c
$(CC) $(CFLAGS) -o $@ $^
 
-run_tests: all
-   ./execveat
+TEST_PROGS := execveat
+
+include ../lib.mk
 
 clean:
rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved 

[PATCH 2/9] selftests: Add install target

2015-03-02 Thread Michael Ellerman
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 
---
 tools/testing/selftests/Makefile| 33 +
 tools/testing/selftests/exec/Makefile   |  3 +++
 tools/testing/selftests/lib.mk  | 23 -
 tools/testing/selftests/memory-hotplug/Makefile |  2 ++
 tools/testing/selftests/mount/Makefile  |  2 ++
 tools/testing/selftests/mqueue/Makefile |  7 ++
 tools/testing/selftests/net/Makefile|  1 +
 tools/testing/selftests/sysctl/Makefile |  1 +
 8 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4e511221a0c1..a2345f4512bb 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -47,7 +47,40 @@ clean_hotplug:
make -C $$TARGET clean; \
done;
 
+INSTALL_PATH ?= install
+INSTALL_PATH := $(abspath $(INSTALL_PATH))
+ALL_SCRIPT := $(INSTALL_PATH)/all.sh
+
+install:
+ifdef INSTALL_PATH
+   @# Ask all targets to install their files
+   mkdir -p $(INSTALL_PATH)
+   for TARGET in $(TARGETS); do \
+   mkdir -p $(INSTALL_PATH)/$$TARGET ; \
+   make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; 
\
+   done;
+
+   @# Ask all targets to emit their test scripts
+   echo "#!/bin/bash\n\n" > $(ALL_SCRIPT)
+   echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT)
+   echo "ROOT=\$$PWD\n" >> $(ALL_SCRIPT)
+
+   for TARGET in $(TARGETS); do \
+   echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
+   echo "echo " >> 
$(ALL_SCRIPT); \
+   echo "cd $$TARGET" >> $(ALL_SCRIPT); \
+   make -s -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
+   echo "cd \$$ROOT\n" >> $(ALL_SCRIPT); \
+   done;
+
+   chmod u+x $(ALL_SCRIPT)
+else
+   $(error Error: set INSTALL_PATH to use install)
+endif
+
 clean:
for TARGET in $(TARGETS); do \
make -C $$TARGET clean; \
done;
+
+.PHONY: install
diff --git a/tools/testing/selftests/exec/Makefile 
b/tools/testing/selftests/exec/Makefile
index a0098daeb73d..886cabe307b1 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -19,8 +19,11 @@ execveat.denatured: execveat
$(CC) $(CFLAGS) -o $@ $^
 
 TEST_PROGS := execveat
+TEST_FILES := $(DEPS)
 
 include ../lib.mk
 
+override EMIT_TESTS := echo "mkdir -p subdir; (./execveat && echo \"selftests: 
execveat [PASS]\") || echo \"selftests: execveat [FAIL]\""
+
 clean:
rm -rf $(BINARIES) $(DEPS) subdir.moved execveat.moved x*
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index b30c5a49cb61..7bd3dabe2846 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -7,4 +7,25 @@ endef
 run_tests: all
$(RUN_TESTS)
 
-.PHONY: run_tests all clean
+define INSTALL_RULE
+   mkdir -p $(INSTALL_PATH)
+   install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_FILES)
+endef
+
+install: all
+ifdef INSTALL_PATH
+   $(INSTALL_RULE)
+else
+   $(error Error: set INSTALL_PATH to use install)
+endif
+
+define EMIT_TESTS
+   @for TEST in $(TEST_PROGS); do \
+   echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo 
\"selftests: $$TEST [FAIL]\""; \
+   done;
+endef
+
+emit_tests:
+   $(EMIT_TESTS)
+
+.PHONY: run_tests all clean install emit_tests
diff --git a/tools/testing/selftests/memory-hotplug/Makefile 
b/tools/testing/selftests/memory-hotplug/Makefile
index 8f7dea66ecac..598a1f68f534 100644
--- a/tools/testing/selftests/memory-hotplug/Makefile
+++ b/tools/testing/selftests/memory-hotplug/Makefile
@@ -2,7 +2,9 @@ all:
 
 include ../lib.mk
 
+TEST_PROGS := on-off-test.sh
 override RUN_TESTS := ./on-off-test.sh -r 2 || echo "selftests: memory-hotplug 
[FAIL]"
+override EMIT_TESTS := echo "$(RUN_TESTS)"
 
 run_full_test:
@/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]"
diff --git a/tools/testing/selftests/mount/Makefile 
b/tools/testing/selftests/mount/Makefile
index 06931dfd3ef0..a5b367f032ba 100644
--- a/tools/testing/selftests/mount/Makefile
+++ b/tools/testing/selftests/mount/Makefile
@@ -7,7 +7,9 @@ 

[PATCH 5/9] kbuild: Don't pass -rR to selftest makefiles

2015-03-02 Thread Michael Ellerman
The makefiles under tools/testing/selftests are not real kbuild
makefiles, they are regular stand alone makefiles. As such they *do*
want all the standard implicit rules and variables defined.

So before calling those makefiles, filter -rR out of MAKEFLAGS.

Without this not all the selftests are built correctly when called via
the top-level Makefile.

Signed-off-by: Michael Ellerman 
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index eb096850718a..df058106b9ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1088,12 +1088,12 @@ INSTALL_SELFTESTS_PATH = $(abspath $(objtree)/selftests)
 
 PHONY += kselftest
 kselftest:
-   $(Q)$(MAKE) -C tools/testing/selftests run_tests
+   $(Q)$(MAKE) -C tools/testing/selftests MAKEFLAGS="$(filter-out 
rR,$(MAKEFLAGS))" run_tests
 
 # Kernel selftest install
 PHONY += kselftest_install
 kselftest_install:
-   $(Q)$(MAKE) -C tools/testing/selftests 
INSTALL_PATH=$(INSTALL_SELFTESTS_PATH) install
+   $(Q)$(MAKE) -C tools/testing/selftests MAKEFLAGS="$(filter-out 
rR,$(MAKEFLAGS))" INSTALL_PATH=$(INSTALL_SELFTESTS_PATH) install
 
 # ---
 # Modules
-- 
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] selftests: Add install, generate tar, and run_kselftest tools

2015-03-02 Thread Shuah Khan
kselftest_install.sh tool adds support for installing selftests
at user specified location/kselftest. By default this tool
will install selftests in the selftests/kselftest directory.
For example, kselftest_install /tmp will install tests under
/tmp/kselftest

gen_kselftest_tar.sh tool will generate user specified type of
tar archive. Default is .gz

run_kselftest.sh runs all installed selftests.

Signed-off-by: Shuah Khan 
---
 tools/testing/selftests/gen_kselftest_tar.sh | 55 
 tools/testing/selftests/kselftest_install.sh | 64 
 tools/testing/selftests/run_kselftest.sh | 46 
 3 files changed, 165 insertions(+)
 create mode 100755 tools/testing/selftests/gen_kselftest_tar.sh
 create mode 100755 tools/testing/selftests/kselftest_install.sh
 create mode 100755 tools/testing/selftests/run_kselftest.sh

diff --git a/tools/testing/selftests/gen_kselftest_tar.sh 
b/tools/testing/selftests/gen_kselftest_tar.sh
new file mode 100755
index 000..17d5bd0
--- /dev/null
+++ b/tools/testing/selftests/gen_kselftest_tar.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# gen_kselftest_tar
+# Generate kselftest tarball
+# Author: Shuah Khan 
+# Copyright (C) 2015 Samsung Electronics Co., Ltd.
+
+# This software may be freely redistributed under the terms of the GNU
+# General Public License (GPLv2).
+
+# main
+main()
+{
+   if [ "$#" -eq 0 ]; then
+   echo "$0: Generating default compression gzip"
+   copts="cvzf"
+   ext=".tar.gz"
+   else
+   case "$1" in
+   tar)
+   copts="cvf"
+   ext=".tar"
+   ;;
+   targz)
+   copts="cvzf"
+   ext=".tar.gz"
+   ;;
+   tarbz2)
+   copts="cvjf"
+   ext=".tar.bz2"
+   ;;
+   tarxz)
+   copts="cvJf"
+   ext=".tar.xz"
+   ;;
+   *)
+   echo "Unknown tarball format $1"
+   exit 1
+   ;;
+   esac
+   fi
+
+   install_dir=./kselftest
+
+# Run install using INSTALL_KSFT_PATH override to generate install
+# directory
+./kselftest_install.sh
+tar $copts kselftest${ext} $install_dir
+echo "Kselftest archive kselftest${ext} created!"
+
+# clean up install directory
+rm -rf kselftest
+}
+
+main "$@"
diff --git a/tools/testing/selftests/kselftest_install.sh 
b/tools/testing/selftests/kselftest_install.sh
new file mode 100755
index 000..8af1c3c
--- /dev/null
+++ b/tools/testing/selftests/kselftest_install.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Kselftest Install
+# Install kselftest tests
+# Author: Shuah Khan 
+# Copyright (C) 2015 Samsung Electronics Co., Ltd.
+
+# This software may be freely redistributed under the terms of the GNU
+# General Public License (GPLv2).
+
+install_loc=`pwd`
+
+main()
+{
+   if [ $(basename $install_loc) !=  "selftests" ]; then
+   echo "$0: Please run it in selftests directory ..."
+   exit 1;
+   fi
+   if [ "$#" -eq 0 ]; then
+   echo "$0: Installing in default location - $install_loc ..."
+   elif [ ! -d "$1" ]; then
+   echo "$0: $1 doesn't exist!!"
+   exit 1;
+   else
+   install_loc=$1
+   echo "$0: Installing in specified location - $install_loc ..."
+   fi
+
+   install_path=$install_loc/kselftest
+   install_dir=$install_loc/kselftest
+
+# Create install directory
+   mkdir -p $install_dir
+# Build tests
+   make all
+# Installs normal tests and skips special tests and kselftest tools
+# gen_kselftesr_tar.sh and kselftes_install.sh
+# Also skips problematic * file that gets created when execveat
+# test is built. The file name is too long and resulting in error
+# messages.
+   find `pwd`/* -type d -name rcutorture -prune -o -type f \
+   -executable -print | grep -v 'tar\|install\|' | \
+   xargs install -t $install_dir
+# Install shell scripts that aren't executables
+   find `pwd`/* -type d -name rcutorture -prune -o -name "*.sh" -print | \
+   grep -v 'tar\|install\|run\|on-off' | \
+   xargs install -t $install_dir
+# Special handling for cpu-hotplug and memory-hotplug .sh with the same name
+   install `pwd`/cpu-hotplug/on-off-test.sh \
+   $install_dir/cpu-on-off-test.sh
+   install `pwd`/memory-hotplug/on-off-test.sh \
+   $install_dir/mem-on-off-test.sh
+# Special handling for scripts without .sh extension
+   install `pwd`/vm/run_vmtests $install_dir
+   install `pwd`/net/run_netsocktests 

Re: [PATCH v2 1/3] ARM: OMAP2: hwmod: AM43XX: Add hwmod support for HDQ-1W

2015-03-02 Thread Paul Walmsley
On Mon, 2 Mar 2015, Vignesh R wrote:

> From: "Poddar, Sourav" 
> 
> These adds hwmod data for hdq/1w driver on AM43xx.
> 
> Signed-off-by: Vignesh R 
> ---
> Change log:
> v2:
>  * Add SYSC_HAS_AUTOIDLE flag.
> 
>  arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 36 
> ++
>  arch/arm/mach-omap2/prcm43xx.h |  1 +
>  2 files changed, 37 insertions(+)
> 

Thanks, queued for v4.1.


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Debug 0/2] Fix regressions caused by commit 593669c2ac0f

2015-03-02 Thread Dave Airlie
On 3 March 2015 at 14:25, Jiang Liu  wrote:
> Commit 593669c2ac0f (x86/PCI/ACPI: Use common ACPI resource interfaces
> to simplify implementation) causes regression to several platforms,
> which is caused by stricter checks in new ACPI resource parsing code
> and BIOSes report incorrect ACPI resource descriptors.  So try to relax
> the check to avoid regressions.
>
> Jiang Liu (2):
>   x86/PCI/ACPI: Ignore resources consumed by host bridge itself
>   x86/PCI/ACPI: Relax ACPI resource descriptor checks to work around
> BIOS bugs

I've booted my machine with that lost its r8169 and it appears to be
working now.

So from the regression POV:
Tested-by: Dave Airlie 

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


Re: Re: [PATCH perf/core 2/4] perf-probe: Fix to handle aliased symbols in glibc

2015-03-02 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 03, 2015 at 01:11:17PM +0900, Masami Hiramatsu escreveu:
> (2015/03/03 12:05), Arnaldo Carvalho de Melo wrote:
> > Em Mon, Mar 02, 2015 at 11:45:12PM -0300, Arnaldo Carvalho de Melo escreveu:
> >> Em Tue, Mar 03, 2015 at 11:39:02AM +0900, Masami Hiramatsu escreveu:
> >>> (2015/03/03 0:46), Arnaldo Carvalho de Melo wrote:
>  Em Mon, Mar 02, 2015 at 09:49:53PM +0900, Masami Hiramatsu escreveu:
> > With this patch;
> >   -
> >   # ./perf probe -x /usr/lib64/libc-2.17.so -V malloc
> >   Available variables at malloc
> >   @<__libc_malloc+0>
> >   size_t  bytes
> >   # ./perf probe -x /usr/lib64/libc-2.17.so -a "malloc bytes"
> >   Added new event:
> > probe_libc:malloc(on malloc in /usr/lib64/libc-2.17.so with 
> > bytes)
> >
> >   You can now use it in all perf tools, such as:
> >
> >   perf record -e probe_libc:malloc -aR sleep 1
> 
> > Reported-by: Arnaldo Carvalho de Melo 
> 
>  Humm, not working for me, after the patch:
> 
>  [root@ssdandy ~]# perf probe -x /usr/lib64/libc-2.17.so -V malloc
>  Available variables at malloc
>  @<__malloc_check_init+96>
>  (No matched variables)
> >>>
> >>
> >> Will try after a 'make build-test' finishes for the current batch
> > 
> 
> Thank you for checking this,
> 
> > [root@ssdandy ~]# perf probe -vvv -x /usr/lib64/libc-2.17.so -V malloc
> > probe-definition(0): malloc
> > symbol:malloc file:(null) line:0 offset:0 return:0 lazy:(null)
> > 0 arguments
> > Open Debuginfo file: /usr/lib/debug/usr/lib64/libc-2.17.so.debug
> > Searching variables at malloc
> > Symbol malloc address found : 800c0
> > Get 2611 lines from this CU
> 
> Hmm, something wrong at here.
> 
> > Probe point found: __malloc_check_init+96
> 
> This seems that the debuginfo is a bit odd.
> Could you also run eu-addr2line for 0x800c0 and 0x800b0?
> 
> I'm using CentOS7 with a bit newer glibc rpms.
> 
> # rpm -q glibc glibc-debuginfo
> glibc-2.17-55.el7_0.5.x86_64
> glibc-debuginfo-2.17-55.el7_0.5.x86_64
> 
> And I got following results.
> 
> [mhiramat@localhost perf]$ eu-addr2line -fi -e /usr/lib64/libc-2.17.so 0x800c0
> __libc_malloc
> /usr/src/debug/glibc-2.17-c758a686/malloc/malloc.c:2855
> [mhiramat@localhost perf]$ eu-addr2line -fi -e /usr/lib64/libc-2.17.so 0x800b0
> __malloc_check_init
> /usr/src/debug/glibc-2.17-c758a686/malloc/hooks.c:75
> 
> So, 0x800b0 correctly points __malloc_check_init+96 but its address is not 
> 0x800c0.

[acme@ssdandy linux]$ eu-addr2line -fi -e /usr/lib64/libc-2.17.so 0x800c0
malloc
??:0
[acme@ssdandy linux]$ eu-addr2line -fi -e /usr/lib64/libc-2.17.so 0x800b0
__malloc_check_init
??:0
[acme@ssdandy linux]$ 

If I do it over the debuginfo files:

[acme@ssdandy linux]$ addr2line -fi -e 
/usr/lib/debug/usr/lib64/libc-2.17.so.debug  0x800c0
__malloc_check_init
/usr/src/debug/glibc-2.17-c758a686/malloc/hooks.c:75
[acme@ssdandy linux]$ addr2line -fi -e 
/usr/lib/debug/usr/lib64/libc-2.17.so.debug  0x800b0
__malloc_check_init
/usr/src/debug/glibc-2.17-c758a686/malloc/hooks.c:82
[acme@ssdandy linux]$ 

Tomorrow I'll check for newer packages or any reports about problems
with debuginfo files, please let me know if you need any further info,

Off to bed, zzZzz

- Arnaldo
 
> Thank you,
> 
> 
> > Available variables at malloc
> > @<__malloc_check_init+96>
> > (No matched variables)
> > [root@ssdandy ~]#
> > 
> > If I add one more 'v' I get the symtabs as read by symbol-elf.c and this is
> > what is there for the malloc routines:
> 
> Yeah, it seems symbol maps works fine. Debuginfo analysis failed.
> 
> > 
> > [root@ssdandy ~]# grep malloc /tmp/4
> > probe-definition(0): malloc
> > symbol:malloc file:(null) line:0 offset:0 return:0 lazy:(null)
> > Searching variables at malloc
> > symbol__new: ptmalloc_lock_all 0x7b060-0x7b173
> > symbol__new: malloc_atfork 0x801c0-0x802dd
> > symbol__new: ptmalloc_unlock_all2 0x7b180-0x7b21e
> > symbol__new: ptmalloc_unlock_all 0x7ba90-0x7bb3e
> > symbol__new: malloc_printerr 0x7bb40-0x7bc28
> > symbol__new: malloc_consolidate 0x7c3d0-0x7c9be
> > symbol__new: _int_malloc 0x7dee0-0x7f32b
> > symbol__new: malloc_check 0x7f330-0x7f44a
> > symbol__new: ptmalloc_init.part.8 0x80fe0-0x813d7
> > symbol__new: ptmalloc_init 0x813e0-0x813f5
> > symbol__new: malloc_hook_ini 0x81400-0x8143c
> > symbol__new: mallochook 0x82fc0-0x831af
> > symbol__new: tr_mallochook 0x83fc0-0x8407d
> > symbol__new: __malloc_set_state 0x814f0-0x819f6
> > symbol__new: __malloc_usable_size 0x80d30-0x80e0e
> > symbol__new: __malloc_trim 0x81d50-0x81fac
> > symbol__new: __GI___libc_malloc 0x800c0-0x801b5
> > symbol__new: __malloc_get_state 0x802e0-0x804db
> > symbol__new: __malloc_stats 0x820c0-0x822aa
> > symbol__new: __malloc_check_init 0x80050-0x800bb
> > symbol__new: __malloc 0x800c0-0x801b5
> > symbol__new: malloc_set_state 0x814f0-0x819f6
> > symbol__new: malloc 0x800c0-0x801b5
> > 

Re: [GIT PULL] clk/samsung: clk support for Exynos 5433 SoC

2015-03-02 Thread Chanwoo Choi
Dear Mike,

On 03/03/2015 03:24 AM, Mike Turquette wrote:
> Quoting Chanwoo Choi (2015-02-27 16:52:59)
>> Dear Mike and Sylwester,
>>
>> Gently ping.
> 
> Hello,
> 
> I'll merge this into clk-next towards 4.1 later this week. v3.19 was
> released on February 8, so this merge request came too late for
> inclusion into 4.0.

OK. Thanks for your reply.

Best Regards,
Chanwoo Choi

> 
>>
>> Best Regards,
>> Chanwoo Choi
>>
>> On Tue, Feb 24, 2015 at 8:48 AM, Chanwoo Choi  wrote:
>>> Dear Mike and Sylwester,
>>>
>>> This pull-request was not merged on Linux 4.0-rc1.
>>> Did you have any plan about it?
>>>
>>> Best Regards,
>>> Chanwoo Choi
>>>
>>> On 02/06/2015 04:44 AM, Sylwester Nawrocki wrote:
 Hi Mike,

 This pull request includes driver for clock controller of the Exynos
 5433 SoC.  As the hardware is quite complex, with many peripherals and
 corresponding clock management units the driver is rather huge.  I guess
 it will require a bit more cleanups than last time to balance lines
 introduced in this patch set... Please review and pull if it looks OK.

 The following changes since commit 
 e64fb42da4c6c713cfc7cad607e97e0773fa41ff:

   clk: samsung: exynos4: Add divider clock id for memory bus frequency
 (2015-01-28 15:51:17 +0100)

 are available in the git repository at:

   git://linuxtv.org/snawrocki/samsung.git tags/v3.20-exynos5433-clk

 for you to fetch changes up to b2f0e5f28e0686c0d5db238357a2e32555e97633:

   clk: samsung: exynos5433: Move CLK_SCLK_HDMI_SPDIF_DISP clock to CMU_TOP
 domain (2015-02-05 19:31:09 +0100)

 
 Clock controller driver for Exynos 5433 SoC.

 
 Chanwoo Choi (22):
   clk: samsung: exynos5433: Add binding document for Exynos5433 clock 
 domains
   clk: samsung: exynos5433: Add clocks using common clock framework
   clk: samsung: exynos5433: Add MUX clocks of CMU_TOP domain
   clk: samsung: exynos5433: Add clocks for CMU_PERIC domain
   clk: samsung: exynos5433: Add clocks for CMU_PERIS domain
   clk: samsung: exynos5433: Add clocks for CMU_G2D domain
   clk: samsung: exynos5433: Add clocks for CMU_MIF domain
   clk: samsung: exynos5433: Add clocks for CMU_DISP domain
   clk: samsung: exynos5433: Add clocks for CMU_AUD domain
   clk: samsung: exynos5433: Add clocks for CMU_BUS{0|1|2} domains
   clk: samsung: exynos5433: Add missing clocks for CMU_FSYS domain
   clk: samsung: exynos5433: Add clocks for CMU_G3D domain
   clk: samsung: exynos5433: Add clocks for CMU_GSCL domain
   clk: samsung: exynos5433: Add clocks for CMU_APOLLO domain
   clk: samsung: exynos5433: Add clocks for CMU_ATLAS domain
   clk: samsung: exynos5433: Add clocks for CMU_MSCL domain
   clk: samsung: exynos5433: Add clocks for CMU_MFC domain
   clk: samsung: exynos5433: Add clocks for CMU_HEVC domain
   clk: samsung: exynos5433: Add clocks for CMU_ISP domain
   clk: samsung: exynos5433: Add clocks for CMU_CAM0 domain
   clk: samsung: exynos5433: Add clocks for CMU_CAM1 domain
   clk: samsung: exynos5433: Move CLK_SCLK_HDMI_SPDIF_DISP clock to 
 CMU_TOP domain

 Inha Song (1):
   clk: samsung: Add CLKOUT driver support for Exynos5433 SoC

  .../devicetree/bindings/clock/exynos5433-clock.txt |  462 ++
  drivers/clk/samsung/Makefile   |1 +
  drivers/clk/samsung/clk-exynos-clkout.c|2 +
  drivers/clk/samsung/clk-exynos5433.c   | 5423 
 
  include/dt-bindings/clock/exynos5433.h | 1403 +
  5 files changed, 7291 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/clock/exynos5433-clock.txt
  create mode 100644 drivers/clk/samsung/clk-exynos5433.c
  create mode 100644 include/dt-bindings/clock/exynos5433.h

>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe 
>>> linux-samsung-soc" 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-samsung-soc" 
> 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/


[Debug 0/2] Fix regressions caused by commit 593669c2ac0f

2015-03-02 Thread Jiang Liu
Commit 593669c2ac0f (x86/PCI/ACPI: Use common ACPI resource interfaces
to simplify implementation) causes regression to several platforms,
which is caused by stricter checks in new ACPI resource parsing code
and BIOSes report incorrect ACPI resource descriptors.  So try to relax
the check to avoid regressions.

Jiang Liu (2):
  x86/PCI/ACPI: Ignore resources consumed by host bridge itself
  x86/PCI/ACPI: Relax ACPI resource descriptor checks to work around
BIOS bugs

 arch/x86/pci/acpi.c |   11 ---
 drivers/acpi/resource.c |4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)

-- 
1.7.10.4

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


[Debug 2/2] x86/PCI/ACPI: Relax ACPI resource descriptor checks to work around BIOS bugs

2015-03-02 Thread Jiang Liu
Some BIOSes report incorrect length for ACPI address space descriptors,
so relax the checks to avoid regressions.

Signed-off-by: Jiang Liu 
---
 drivers/acpi/resource.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index c723668e3e27..5589a6e2a023 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -42,8 +42,10 @@ static bool acpi_dev_resource_len_valid(u64 start, u64 end, 
u64 len, bool io)
 * CHECKME: len might be required to check versus a minimum
 * length as well. 1 for io is fine, but for memory it does
 * not make any sense at all.
+* Note: some BIOSes report incorrect length for ACPI address space
+* descriptor, so remove check of 'reslen == len' to avoid regression.
 */
-   if (len && reslen && reslen == len && start <= end)
+   if (len && reslen && start <= end)
return true;
 
pr_debug("ACPI: invalid or unassigned resource %s [%016llx - %016llx] 
length [%016llx]\n",
-- 
1.7.10.4

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


[Debug 1/2] x86/PCI/ACPI: Ignore resources consumed by host bridge itself

2015-03-02 Thread Jiang Liu
When parsing resources for PCI host bridge, we should ignore resources
consumed by host bridge itself and only report window resources available
to child PCI busses.

Signed-off-by: Jiang Liu 
---
 arch/x86/pci/acpi.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 6ac273832f28..e4695985f9de 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -331,7 +331,7 @@ static void probe_pci_root_info(struct pci_root_info *info,
struct list_head *list)
 {
int ret;
-   struct resource_entry *entry;
+   struct resource_entry *entry, *tmp;
 
sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum);
info->bridge = device;
@@ -345,8 +345,13 @@ static void probe_pci_root_info(struct pci_root_info *info,
dev_dbg(>dev,
"no IO and memory resources present in _CRS\n");
else
-   resource_list_for_each_entry(entry, list)
-   entry->res->name = info->name;
+   resource_list_for_each_entry_safe(entry, tmp, list) {
+   if ((entry->res->flags & IORESOURCE_WINDOW) == 0 ||
+   (entry->res->flags & IORESOURCE_DISABLED))
+   resource_list_destroy_entry(entry);
+   else
+   entry->res->name = info->name;
+   }
 }
 
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
-- 
1.7.10.4

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


[PATCH] ath9k_htc: avoid memcpy when downloading firmware

2015-03-02 Thread Fred Chou
From: Fred Chou 

The temporary buffer to hold firmware data is not really needed,
and memcpy can be avoided by using data pointer instead.

Signed-off-by: Fred Chou 
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 10c02f5..0bc35a8 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -986,30 +986,22 @@ static int ath9k_hif_usb_download_fw(struct 
hif_device_usb *hif_dev)
const void *data = hif_dev->fw_data;
size_t len = hif_dev->fw_size;
u32 addr = AR9271_FIRMWARE;
-   u8 *buf = kzalloc(4096, GFP_KERNEL);
u32 firm_offset;
 
-   if (!buf)
-   return -ENOMEM;
-
while (len) {
transfer = min_t(size_t, len, 4096);
-   memcpy(buf, data, transfer);
 
err = usb_control_msg(hif_dev->udev,
  usb_sndctrlpipe(hif_dev->udev, 0),
  FIRMWARE_DOWNLOAD, 0x40 | USB_DIR_OUT,
- addr >> 8, 0, buf, transfer, HZ);
-   if (err < 0) {
-   kfree(buf);
+ addr >> 8, 0, data, transfer, HZ);
+   if (err < 0)
return err;
-   }
 
len -= transfer;
data += transfer;
addr += transfer;
}
-   kfree(buf);
 
if (IS_AR7010_DEVICE(hif_dev->usb_device_id->driver_info))
firm_offset = AR7010_FIRMWARE_TEXT;
-- 
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] kernel: Unlock after locking

2015-03-02 Thread David Rientjes
On Tue, 3 Mar 2015, Tapasweni Pathak wrote:

> diff --git a/kernel/acct.c b/kernel/acct.c
> index e6c10d1a..f592218 100644
> --- a/kernel/acct.c
> +++ b/kernel/acct.c
> @@ -161,6 +161,7 @@ again:
>   acct_put(res);
>   goto again;
>   }
> + mutex_unlock(>lock);
>   return res;
>  }
> 

This function returns with the mutex held, the caller releases it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC V3] mm: change mm_advise_free to clear page dirty

2015-03-02 Thread Minchan Kim
On Tue, Mar 03, 2015 at 11:59:17AM +0800, Wang, Yalin wrote:
> > -Original Message-
> > From: Minchan Kim [mailto:minchan@gmail.com] On Behalf Of Minchan Kim
> > Sent: Tuesday, March 03, 2015 11:26 AM
> > To: Wang, Yalin
> > Cc: 'Michal Hocko'; 'Andrew Morton'; 'linux-kernel@vger.kernel.org';
> > 'linux...@kvack.org'; 'Rik van Riel'; 'Johannes Weiner'; 'Mel Gorman';
> > 'Shaohua Li'; Hugh Dickins; Cyrill Gorcunov
> > Subject: Re: [RFC V3] mm: change mm_advise_free to clear page dirty
> > 
> > Could you separte this patch in this patchset thread?
> > It's tackling differnt problem.
> > 
> > As well, I had a question to previous thread about why shared page
> > has a problem now but you didn't answer and send a new patchset.
> > It makes reviewers/maintainer time waste/confuse. Please, don't
> > hurry to send a code. Before that, resolve reviewers's comments.
> > 
> > On Tue, Mar 03, 2015 at 10:06:40AM +0800, Wang, Yalin wrote:
> > > This patch add ClearPageDirty() to clear AnonPage dirty flag,
> > > if not clear page dirty for this anon page, the page will never be
> > > treated as freeable. We also make sure the shared AnonPage is not
> > > freeable, we implement it by dirty all copyed AnonPage pte,
> > > so that make sure the Anonpage will not become freeable, unless
> > > all process which shared this page call madvise_free syscall.
> > 
> > Please, spend more time to make description clear. I really doubt
> > who understand this description without code inspection. :(
> > Of course, I'm not a person to write description clear like native
> > , either but just I'm sure I spend a more time to write description
> > rather than coding, at least. :)
> > 
> I see, I will send another mail for file private map pages.
> Sorry for my English expressions.
> I think your solution is ok,
> Your patch will make sure the anonpage pte will always be dirty.
> I add some comments for your patch:
> 
> > ---
> >  mm/madvise.c | 1 -
> >  mm/memory.c  | 9 +++--
> >  mm/rmap.c| 2 +-
> >  mm/vmscan.c  | 3 +--
> >  4 files changed, 9 insertions(+), 6 deletions(-)
> > 
> > diff --git a/mm/madvise.c b/mm/madvise.c
> > index 6d0fcb8..d64200e 100644
> > --- a/mm/madvise.c
> > +++ b/mm/madvise.c
> > @@ -309,7 +309,6 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned
> > long addr,
> > continue;
> > }
> > 
> > -   ClearPageDirty(page);
> > unlock_page(page);
> > }
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 8ae52c9..2f45e77 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -2460,9 +2460,14 @@ static int do_swap_page(struct mm_struct *mm, struct
> > vm_area_struct *vma,
> > 
> > inc_mm_counter_fast(mm, MM_ANONPAGES);
> > dec_mm_counter_fast(mm, MM_SWAPENTS);
> > -   pte = mk_pte(page, vma->vm_page_prot);
> > +
> > +   /*
> > +* Every page swapped-out was pte_dirty so we makes pte dirty again.
> > +* MADV_FREE relys on it.
> > +*/
> > +   pte = mk_pte(pte_mkdirty(page), vma->vm_page_prot);
> pte_mkdirty() usage seems wrong here.

Argh, it reveals I didn't test even build. My shame.
But RFC tag might mitigate my shame. :)
I will fix it if I send a formal version.
Thanks for the review.

> 
> > if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) {
> > -   pte = maybe_mkwrite(pte_mkdirty(pte), vma);
> > +   pte = maybe_mkwrite(pte, vma);
> > flags &= ~FAULT_FLAG_WRITE;
> > ret |= VM_FAULT_WRITE;
> > exclusive = 1;
> > diff --git a/mm/rmap.c b/mm/rmap.c
> > index 47b3ba8..34c1d66 100644
> > --- a/mm/rmap.c
> > +++ b/mm/rmap.c
> > @@ -1268,7 +1268,7 @@ static int try_to_unmap_one(struct page *page, struct
> > vm_area_struct *vma,
> > 
> > if (flags & TTU_FREE) {
> > VM_BUG_ON_PAGE(PageSwapCache(page), page);
> > -   if (!dirty && !PageDirty(page)) {
> > +   if (!dirty) {
> > /* It's a freeable page by MADV_FREE */
> > dec_mm_counter(mm, MM_ANONPAGES);
> > goto discard;
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 671e47e..7f520c9 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -805,8 +805,7 @@ static enum page_references
> > page_check_references(struct page *page,
> > return PAGEREF_KEEP;
> > }
> > 
> > -   if (PageAnon(page) && !pte_dirty && !PageSwapCache(page) &&
> > -   !PageDirty(page))
> > +   if (PageAnon(page) && !pte_dirty && !PageSwapCache(page))
> > *freeable = true;
> > 
> > /* Reclaim if clean, defer dirty pages to writeback */
> > --
> > 1.9.3
> Could we remove SetPageDirty(page); in try_to_free_swap() function based on 
> this patch?
> Because your patch will make sure the pte is always dirty,
> We don't need setpagedirty(),
> The try_to_unmap() path will re-dirty the page during reclaim 

Re: [PATCH] ARM: dts: vf610: remove unused gpio-range-cells property

2015-03-02 Thread Shawn Guo
On Mon, Mar 02, 2015 at 04:58:01PM +0100, Stefan Agner wrote:
> The anyway depricated gpio-range-cells property was never used
> by the pin controller driver. This patch removes it.
> 
> Signed-off-by: Stefan Agner 

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] ARM: imx: Fix trivial typo in comments

2015-03-02 Thread Shawn Guo
On Mon, Mar 02, 2015 at 03:45:05PM +0100, Yannick Guerrini wrote:
> change 'mutliple' to 'multiple'
> 
> Signed-off-by: Yannick Guerrini 

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: Re: [PATCH perf/core 2/4] perf-probe: Fix to handle aliased symbols in glibc

2015-03-02 Thread Masami Hiramatsu
(2015/03/03 12:05), Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 02, 2015 at 11:45:12PM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Tue, Mar 03, 2015 at 11:39:02AM +0900, Masami Hiramatsu escreveu:
>>> (2015/03/03 0:46), Arnaldo Carvalho de Melo wrote:
 Em Mon, Mar 02, 2015 at 09:49:53PM +0900, Masami Hiramatsu escreveu:
> With this patch;
>   -
>   # ./perf probe -x /usr/lib64/libc-2.17.so -V malloc
>   Available variables at malloc
>   @<__libc_malloc+0>
>   size_t  bytes
>   # ./perf probe -x /usr/lib64/libc-2.17.so -a "malloc bytes"
>   Added new event:
> probe_libc:malloc(on malloc in /usr/lib64/libc-2.17.so with bytes)
>
>   You can now use it in all perf tools, such as:
>
>   perf record -e probe_libc:malloc -aR sleep 1

> Reported-by: Arnaldo Carvalho de Melo 

 Humm, not working for me, after the patch:

 [root@ssdandy ~]# perf probe -x /usr/lib64/libc-2.17.so -V malloc
 Available variables at malloc
 @<__malloc_check_init+96>
 (No matched variables)
>>>
>>
>> Will try after a 'make build-test' finishes for the current batch
> 

Thank you for checking this,

> [root@ssdandy ~]# perf probe -vvv -x /usr/lib64/libc-2.17.so -V malloc
> probe-definition(0): malloc
> symbol:malloc file:(null) line:0 offset:0 return:0 lazy:(null)
> 0 arguments
> Open Debuginfo file: /usr/lib/debug/usr/lib64/libc-2.17.so.debug
> Searching variables at malloc
> Symbol malloc address found : 800c0
> Get 2611 lines from this CU

Hmm, something wrong at here.

> Probe point found: __malloc_check_init+96

This seems that the debuginfo is a bit odd.
Could you also run eu-addr2line for 0x800c0 and 0x800b0?

I'm using CentOS7 with a bit newer glibc rpms.

# rpm -q glibc glibc-debuginfo
glibc-2.17-55.el7_0.5.x86_64
glibc-debuginfo-2.17-55.el7_0.5.x86_64

And I got following results.

[mhiramat@localhost perf]$ eu-addr2line -fi -e /usr/lib64/libc-2.17.so 0x800c0
__libc_malloc
/usr/src/debug/glibc-2.17-c758a686/malloc/malloc.c:2855
[mhiramat@localhost perf]$ eu-addr2line -fi -e /usr/lib64/libc-2.17.so 0x800b0
__malloc_check_init
/usr/src/debug/glibc-2.17-c758a686/malloc/hooks.c:75

So, 0x800b0 correctly points __malloc_check_init+96 but its address is not 
0x800c0.

Thank you,


> Available variables at malloc
> @<__malloc_check_init+96>
> (No matched variables)
> [root@ssdandy ~]#
> 
> If I add one more 'v' I get the symtabs as read by symbol-elf.c and this is
> what is there for the malloc routines:

Yeah, it seems symbol maps works fine. Debuginfo analysis failed.

> 
> [root@ssdandy ~]# grep malloc /tmp/4
> probe-definition(0): malloc
> symbol:malloc file:(null) line:0 offset:0 return:0 lazy:(null)
> Searching variables at malloc
> symbol__new: ptmalloc_lock_all 0x7b060-0x7b173
> symbol__new: malloc_atfork 0x801c0-0x802dd
> symbol__new: ptmalloc_unlock_all2 0x7b180-0x7b21e
> symbol__new: ptmalloc_unlock_all 0x7ba90-0x7bb3e
> symbol__new: malloc_printerr 0x7bb40-0x7bc28
> symbol__new: malloc_consolidate 0x7c3d0-0x7c9be
> symbol__new: _int_malloc 0x7dee0-0x7f32b
> symbol__new: malloc_check 0x7f330-0x7f44a
> symbol__new: ptmalloc_init.part.8 0x80fe0-0x813d7
> symbol__new: ptmalloc_init 0x813e0-0x813f5
> symbol__new: malloc_hook_ini 0x81400-0x8143c
> symbol__new: mallochook 0x82fc0-0x831af
> symbol__new: tr_mallochook 0x83fc0-0x8407d
> symbol__new: __malloc_set_state 0x814f0-0x819f6
> symbol__new: __malloc_usable_size 0x80d30-0x80e0e
> symbol__new: __malloc_trim 0x81d50-0x81fac
> symbol__new: __GI___libc_malloc 0x800c0-0x801b5
> symbol__new: __malloc_get_state 0x802e0-0x804db
> symbol__new: __malloc_stats 0x820c0-0x822aa
> symbol__new: __malloc_check_init 0x80050-0x800bb
> symbol__new: __malloc 0x800c0-0x801b5
> symbol__new: malloc_set_state 0x814f0-0x819f6
> symbol__new: malloc 0x800c0-0x801b5
> symbol__new: malloc_info 0x82320-0x8240f
> symbol__new: malloc_trim 0x81d50-0x81fac
> symbol__new: malloc_usable_size 0x80d30-0x80e0e
> symbol__new: malloc_get_state 0x802e0-0x804db
> symbol__new: __libc_malloc 0x800c0-0x801b5
> symbol__new: malloc_stats 0x820c0-0x822aa
> symbol__new: malloc@plt 0x1f300-0x1f310
> Symbol malloc address found : 800c0
> Probe point found: __malloc_check_init+96
> [root@ssdandy ~]#
>  
 [root@ssdandy ~]#

 And then the one asking for 'bytes' to be collectd fails.

 After processing the other patches I'll try to debug this...

 [root@ssdandy ~]# cat /etc/redhat-release 
 Red Hat Enterprise Linux Server release 7.0 (Maipo)
 [root@ssdandy ~]# rpm -q glibc glibc-debuginfo
 glibc-2.17-55.el7_0.3.x86_64
 glibc-debuginfo-2.17-55.el7_0.1.x86_64
>>>   ^^^ why is this different from the glibc 
>>> version??
>>>
 [root@ssdandy ~]#
 [acme@ssdandy linux]$ readelf -Ws /usr/lib64/libc-2.17.so| grep malloc
>>> [...]
   4849: 00080050   107 FUNC

Re: [PATCH net-next 02/14] ethernet: Use eth__addr instead of memset

2015-03-02 Thread Jeff Kirsher
On Mon, 2015-03-02 at 19:54 -0800, Joe Perches wrote:
> Use the built-in function instead of memset.
> 
> Signed-off-by: Joe Perches 

Acked-by: Jeff Kirsher 
for the changes to Intel's ixgbe driver...

> ---
>  drivers/net/ethernet/amd/pcnet32.c  | 2 +-
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +-
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c| 6 +++---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c   | 2 +-
>  drivers/net/ethernet/cisco/enic/enic_main.c | 8 
>  drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +-
>  drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c   | 4 ++--
>  drivers/net/ethernet/mellanox/mlx4/en_netdev.c  | 4 ++--
>  drivers/net/ethernet/mellanox/mlx4/en_selftest.c| 2 +-
>  drivers/net/ethernet/micrel/ksz884x.c   | 2 +-
>  drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c  | 2 +-
>  drivers/net/ethernet/qlogic/qlge/qlge_main.c| 2 +-
>  drivers/net/ethernet/smsc/smsc911x.c| 2 +-
>  drivers/net/ethernet/ti/netcp_core.c| 2 +-
>  drivers/net/ethernet/toshiba/ps3_gelic_wireless.c   | 4 ++--
>  drivers/net/ethernet/xscale/ixp4xx_eth.c| 2 +-
>  17 files changed, 25 insertions(+), 25 deletions(-)
...
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
> b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 70cc4c5..903664f 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -3924,7 +3924,7 @@ static void ixgbe_flush_sw_mac_table(struct 
> ixgbe_adapter *adapter)
>   for (i = 0; i < hw->mac.num_rar_entries; i++) {
>   adapter->mac_table[i].state |= IXGBE_MAC_STATE_MODIFIED;
>   adapter->mac_table[i].state &= ~IXGBE_MAC_STATE_IN_USE;
> - memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
> + eth_zero_addr(adapter->mac_table[i].addr);
>   adapter->mac_table[i].queue = 0;
>   }
>   ixgbe_sync_mac_table(adapter);
> @@ -3992,7 +3992,7 @@ int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, 
> u8 *addr, u16 queue)
>   adapter->mac_table[i].queue == queue) {
>   adapter->mac_table[i].state |= IXGBE_MAC_STATE_MODIFIED;
>   adapter->mac_table[i].state &= ~IXGBE_MAC_STATE_IN_USE;
> - memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
> + eth_zero_addr(adapter->mac_table[i].addr);
>   adapter->mac_table[i].queue = 0;
>   ixgbe_sync_mac_table(adapter);
>   return 0;



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


  1   2   3   4   5   6   7   8   9   10   >