Re: [PATCH v3 4/4] ARM: BCM: Add SMP support for Broadcom 4708

2015-11-06 Thread Hauke Mehrtens
On 11/06/2015 10:11 PM, Kapil Hali wrote:
> From: Jon Mason 
> 
> Add SMP support for Broadcom's 4708 SoCs.
> 
> Signed-off-by: Jon Mason 
> Acked-by: Hauke Mehrtens 
> Tested-by: Hauke Mehrtens 
> Signed-off-by: Kapil Hali 

I tested this on a Netgear R6250 V1 (BCM4708) and SMP worked.

> ---
>  arch/arm/boot/dts/bcm4708.dtsi | 2 ++
>  arch/arm/mach-bcm/Kconfig  | 1 +
>  arch/arm/mach-bcm/Makefile | 3 +++
>  3 files changed, 6 insertions(+)
> 

...

> --- a/arch/arm/mach-bcm/Kconfig
> +++ b/arch/arm/mach-bcm/Kconfig
> @@ -54,6 +54,7 @@ config ARCH_BCM_NSP
>  config ARCH_BCM_5301X
>   bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
>   select ARCH_BCM_IPROC

You activated ARM_ERRATA_764369 for NSP is this not needed for NS?


> + select HAVE_SMP
>   help
> Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
>  

...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] tracing: Updates for 4.4

2015-11-06 Thread Linus Torvalds
On Fri, Nov 6, 2015 at 6:10 AM, Steven Rostedt  wrote:
>
> Most of the changes are clean ups and small fixes. Some of them have
> stable tags to them. I searched through my INBOX just as the merge window
> opened and found lots of patches to pull. I ran them through all my tests
> and they were in linux-next for a few days.

Clearly they got zero actual testing, though.

I get several very big and ugly warnings about scheduler tracing:

  kernel/trace/trace_events.c: In function ‘__ftrace_clear_event_pids’:
  kernel/trace/trace_events.c:579:32: warning: passing argument 1 of
‘unregister_trace_sched_switch’ from incompatible pointer type
[-Wincompatible-pointer-types]
unregister_trace_sched_switch(event_filter_pid_sched_switch_probe_pre, tr);
  ^
  In file included from kernel/trace/trace_events.c:25:0:
  include/trace/events/sched.h:124:1095: note: expected ‘void (*)(void
*, bool,  struct task_struct *, struct task_struct *) {aka void
(*)(void *, _Bool,  struct task_struct *, struct task_struct *)}’ but
argument is of type ‘void (*)(void *, struct task_struct *, struct
task_struct *)’

which clearly can't work, and is due to the new "bool preempt"
argument in scheduler tracing.

That *should* have shown up in linux-next, and you *should* have been
aware of it, and in turn let me know about it. Yes, yes, I notice
these things on my own, but I also expect that maintainers look out
for these things, especially when they were involved on both sides, so
it shouldn't have taken them - and this me - by surprise.

But something clearly failed in that whole process.

This is why we do *not* do some last-minute "let's just look through
my mailbox as the merge window is opening" crap.

I've done the merge, and I have it fixed up in my tree, but I'm
annoyed enough that I'm considering just unpulling. You *knew* about
this, because you are marked as having reviewed that commit
c73464b1c843 ("sched/core: Fix trace_sched_switch()") that added the
preempt argument.

So where did this all fail? Nobody ever looked at the warnings from
linux-next? Or it wasn't even in linux-next long enough to really ever
trigger?

I very much suspect that "look through my INBOX as the merge window
opened" is the real problem here. That is *not* how the merge window
works, and you damn well should know it.

 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 04/10] pwm: core: use bitops

2015-11-06 Thread Andy Shevchenko
On Fri, Nov 6, 2015 at 4:49 PM, Olliver Schinagl
 wrote:
> Hey Thierry,
>
> but why have the bit macro at all then :)

For my opinion, it's good to use in new code, or when you have this
change as a continuation of bigger series.
Though, others might have a different one :-)

>
> But that choice I guess I leave to you, as it's your section, I know some
> submaintainers prefer it and want it to be used, so I guess it's something
> in general kernel wide that should be desided on, BIT() macro preferred or
> not.
>
> Olliver
>
>
> On 06-11-15 15:46, Thierry Reding wrote:
>>
>> On Mon, Oct 26, 2015 at 10:32:35PM +0100, Olliver Schinagl wrote:
>>>
>>> From: Olliver Schinagl 
>>>
>>> The pwm header defines bits manually while there is a nice bitops.h with
>>> a BIT() macro. Use the BIT() macro to set bits in pwm.h
>>>
>>> Signed-off-by: Olliver Schinagl 
>>> ---
>>>   include/linux/pwm.h | 7 ---
>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> I don't think this is a useful change. The BIT() macro needs the same
>> number of characters to type at the expense of requiring an additional
>> include.
>>
>> Thierry
>
>
> --
> Met vriendelijke groeten, Kind regards, 与亲切的问候
>
> Olliver Schinagl
> Software Engineer
> Research & Development
> Ultimaker B.V.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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


Re: linux-next network throughput performance regression

2015-11-06 Thread David Ahern

On 11/6/15 2:18 PM, Simon Xiao wrote:

The .config file used to build linux-next kernel is attached to this mail.


Thanks.

Failed to notice this on the first response; my brain filled in. Why 
linux-next tree? Can you try net-next which is more relevant for this 
mailing list, post the top commit id and config file used?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 6/7] regulator: hisilicon: Add hi655x pmic voltage regulator driver

2015-11-06 Thread Andy Shevchenko
On Thu, Nov 5, 2015 at 3:34 PM, Chen Feng  wrote:
> Add driver support for HiSilicon Hi655x voltage regulators.

> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static int hi655x_is_enabled(struct regulator_dev *rdev)
> +{
> +   unsigned int value = 0;
> +
> +   struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
> +   struct hi655x_regulator_ctrl_regs *ctrl_regs = >ctrl_regs;
> +
> +   regmap_read(rdev->regmap, ctrl_regs->status_reg, );
> +   return (value & BIT(regulator->ctrl_mask));
> +}
> +
> +static int hi655x_enable(struct regulator_dev *rdev)
> +{
> +   int ret = 0;
> +   struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
> +   struct hi655x_regulator_ctrl_regs *ctrl_regs = >ctrl_regs;
> +
> +   ret = regmap_update_bits(rdev->regmap, ctrl_regs->enable_reg,
> +regulator->ctrl_mask, regulator->ctrl_mask);
> +   return ret;
> +}
> +
> +static int hi655x_disable(struct regulator_dev *rdev)
> +{
> +   int ret = 0;
> +   struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
> +
> +   if (!regulator) {
> +   pr_err("get driver data error!\n");
> +   return -ENODEV;
> +   }
> +   struct hi655x_regulator_ctrl_regs *ctrl_regs = >ctrl_regs;
> +
> +   ret = regmap_update_bits(rdev->regmap, ctrl_regs->disable_reg,
> +regulator->ctrl_mask, regulator->ctrl_mask);
> +   return ret;
> +}
> +
> +static int hi655x_get_voltage(struct regulator_dev *rdev)
> +{
> +   unsigned int value = 0;
> +   struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
> +
> +   if (!regulator) {
> +   pr_err("get driver data error!\n");
> +   return -ENODEV;
> +   }
> +   struct hi655x_regulator_vset_regs *vset_regs = >vset_regs;
> +
> +   regmap_read(rdev->regmap, vset_regs->vset_reg, );
> +
> +   return regulator->vset_table[value];
> +}
> +
> +static int hi655x_set_voltage(struct regulator_dev *rdev,
> + int min_uV, int max_uV, unsigned *selector)
> +{
> +   int i = 0;
> +   int ret = 0;
> +   int vol = 0;
> +   struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
> +
> +   if (!regulator) {
> +   pr_err("get driver data error!\n");
> +   return -ENODEV;
> +   }
> +
> +   struct hi655x_regulator_vset_regs *vset_regs = >vset_regs;
> +
> +   /**
> +* search the matched vol and get its index
> +*/
> +   for (i = 0; i < regulator->vol_numb; i++) {
> +   vol = regulator->vset_table[i];
> +   if ((vol >= min_uV) && (vol <= max_uV))
> +   break;
> +   }
> +
> +   if (i == regulator->vol_numb)
> +   return -1;
> +
> +   regmap_update_bits(rdev->regmap, vset_regs->vset_reg,
> +  regulator->vset_mask, i);
> +   *selector = i;
> +
> +   return ret;
> +}
> +
> +static unsigned int hi655x_map_mode(unsigned int mode)
> +{
> +   /* hi655x pmic on hi6220 SoC only support normal mode */
> +   if (mode == REGULATOR_MODE_NORMAL)
> +   return REGULATOR_MODE_NORMAL;
> +   else
> +   return -EINVAL;
> +}
> +
> +static int hi655x_set_mode(struct regulator_dev *rdev,
> +  unsigned int mode)
> +
> +{
> +   if (mode == REGULATOR_MODE_NORMAL)
> +   return 0;
> +   else
> +   return -EINVAL;
> +}
> +
> +static struct regulator_ops hi655x_regulator_ops = {
> +   .is_enabled = hi655x_is_enabled,
> +   .enable = hi655x_enable,
> +   .disable = hi655x_disable,
> +   .list_voltage = regulator_list_voltage_table,
> +   .get_voltage = hi655x_get_voltage,
> +   .set_voltage = hi655x_set_voltage,
> +   .set_mode = hi655x_set_mode,
> +};
> +
> +static const struct of_device_id of_hi655x_regulator_match_tbl[] = {
> +   {
> +   .compatible = "hisilicon,hi655x-regulator-pmic",
> +   },
> +};
> +MODULE_DEVICE_TABLE(of, of_hi655x_regulator_match_tbl);
> +
> +/**
> + * get the hi655x specific data from dt node.
> + */
> +static void of_get_hi655x_ctr(struct hi655x_regulator *regulator,
> + struct device *dev, struct device_node *np)
> +{
> +   unsigned int *vset_table = NULL;
> +
> +   of_property_read_u32_array(np, "regulator-ctrl-regs",

device property API?

> +  (u32 *)>ctrl_regs, 0x3);
> +   of_property_read_u32(np, "regulator-ctrl-mask", 
> >ctrl_mask);
> +   of_property_read_u32(np, "regulator-vset-regs",
> +(u32 *)>vset_regs);
> +   of_property_read_u32(np, "regulator-vset-mask", 

[PATCH] ideapad-laptop: add support for Yoga 3 ESC key

2015-11-06 Thread Arnd Bergmann
The ideapad-laptop handles most special keys on various Lenovo Laptops
including the Yoga line. Unfortunately, the Yoga 3 11/13/14 models have
one important exception, which is the Fn-ESC combination.

On other Lenovo Laptops, this is FnLock, which switches the function keys
between the primary (Mute, Vol down, Vol up, ...) and the secondary (F1,
F2, F3, ...) behavior. On the new machines, FnLock is only available
through BIOS setup (possibly through a yet-to-be-implemented feature
in this driver) but not through Fn-ESC, but instead the ESC key itself
switched between ESC and a "Paper Display" app for Windows.

Unfortunately, that means that you can never have both ESC *and* the
function keys working at the same time without needing to press Fn on
one of them.
As pointed out in the official Lenovo Forum by dozens of users, this
makes the machine rather useless for any serious work [1].

I have now studied the ACPI DSDT one more time and found the event
that is generated for the ESC key. Unlike all other key events on this
machine, it is actually a WMI, while the other ones are read from the
embedded controller.

I am now installing a WMI notifier that uses the event number from the
WMI subsystem as the scancode. The only event number generated here is
'128', and that fits in nicely with the two existing ranges of scancodes
used by the EC: 0-15 for the 16-bit VPCCMD_R_VPC register, 16-17 for
the VPCCMD_R_NOVO register and 64-67 for VPCCMD_R_SPECIAL_BUTTONS.

The only sane way to handle this button (in absence of the Windows Paper
Display driver) seems to be to have it emit KEY_ESC, so that is what
I use as the default. Should any user ever want to overwrite the default,
they can install their own keymap.

To ensure that we can still build the driver without adding a CONFIG_WMI
dependency, all new code is enclosed in #ifdef.

Signed-off-by: Arnd Bergmann 

[1] 
https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/YOGA-3-14-How-to-reclaim-my-Esc-key-and-permanently-disable/td-p/2070816

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 02bbc70c332d..1089eaa02b00 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -345,6 +345,7 @@ config IDEAPAD_LAPTOP
depends on SERIO_I8042
depends on BACKLIGHT_CLASS_DEVICE
depends on ACPI_VIDEO || ACPI_VIDEO = n
+   depends on ACPI_WMI || ACPI_WMI = n
select INPUT_SPARSEKMAP
help
  This is a driver for Lenovo IdeaPad netbooks contains drivers for
diff --git a/drivers/platform/x86/ideapad-laptop.c 
b/drivers/platform/x86/ideapad-laptop.c
index ad4b8b7e97cc..231db03a6417 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -47,6 +47,10 @@
 #define CFG_WIFI_BIT   (18)
 #define CFG_CAMERA_BIT (19)
 
+#if IS_ENABLED(CONFIG_ACPI_WMI)
+static const char ideapad_wmi_fnesc_event[] = 
"26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6";
+#endif
+
 enum {
VPCCMD_R_VPC1 = 0x10,
VPCCMD_R_BL_MAX,
@@ -567,6 +571,8 @@ static const struct key_entry ideapad_keymap[] = {
{ KE_KEY, 65, { KEY_PROG4 } },
{ KE_KEY, 66, { KEY_TOUCHPAD_OFF } },
{ KE_KEY, 67, { KEY_TOUCHPAD_ON } },
+   { KE_KEY, 128, { KEY_ESC } },
+
{ KE_END, 0 },
 };
 
@@ -825,6 +831,19 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 
event, void *data)
}
 }
 
+#if IS_ENABLED(CONFIG_ACPI_WMI)
+static void ideapad_wmi_notify(u32 value, void *context)
+{
+   switch (value) {
+   case 128:
+   ideapad_input_report(context, value);
+   break;
+   default:
+   pr_info("Unknown WMI event %u\n", value);
+   }
+}
+#endif
+
 /*
  * Some ideapads don't have a hardware rfkill switch, reading VPCCMD_R_RF
  * always results in 0 on these models, causing ideapad_laptop to wrongly
@@ -942,8 +961,18 @@ static int ideapad_acpi_add(struct platform_device *pdev)
ACPI_DEVICE_NOTIFY, ideapad_acpi_notify, priv);
if (ret)
goto notification_failed;
+#if IS_ENABLED(CONFIG_ACPI_WMI)
+   ret = wmi_install_notify_handler(ideapad_wmi_fnesc_event, 
ideapad_wmi_notify, priv);
+   if (ret != AE_OK && ret != AE_NOT_EXIST)
+   goto notification_failed_wmi;
+#endif
 
return 0;
+#if IS_ENABLED(CONFIG_ACPI_WMI)
+notification_failed_wmi:
+   acpi_remove_notify_handler(priv->adev->handle,
+   ACPI_DEVICE_NOTIFY, ideapad_acpi_notify);
+#endif
 notification_failed:
ideapad_backlight_exit(priv);
 backlight_failed:
@@ -962,6 +991,9 @@ static int ideapad_acpi_remove(struct platform_device *pdev)
struct ideapad_private *priv = dev_get_drvdata(>dev);
int i;
 
+#if IS_ENABLED(CONFIG_ACPI_WMI)
+   wmi_remove_notify_handler(ideapad_wmi_fnesc_event);
+#endif
acpi_remove_notify_handler(priv->adev->handle,
ACPI_DEVICE_NOTIFY, ideapad_acpi_notify);
ideapad_backlight_exit(priv);

Re: [PATCH v14 03/22] vfs: Add MAY_DELETE_SELF and MAY_DELETE_CHILD permission flags

2015-11-06 Thread Andreas Dilger
On Nov 5, 2015, at 4:39 AM, Andreas Gruenbacher  wrote:
> 
> Normally, deleting a file requires MAY_WRITE access to the parent
> directory.  With richacls, a file may be deleted with MAY_DELETE_CHILD access
> to the parent directory or with MAY_DELETE_SELF access to the file.
> 
> To support that, pass the MAY_DELETE_CHILD mask flag to inode_permission()
> when checking for delete access inside a directory, and MAY_DELETE_SELF
> when checking for delete access to a file itelf.
> 
> The MAY_DELETE_SELF permission overrides the sticky directory check.
> 
> Signed-off-by: Andreas Gruenbacher 
> Reviewed-by: J. Bruce Fields 
> ---
> fs/namei.c | 21 -
> include/linux/fs.h |  2 ++
> 2 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 0259392..2eab19e 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -453,9 +453,9 @@ static int sb_permission(struct super_block *sb, struct 
> inode *inode, int mask)
>  * this, letting us set arbitrary permissions for filesystem access without
>  * changing the "normal" UIDs which are used for other things.
>  *
> - * MAY_WRITE must be set in @mask whenever MAY_APPEND, MAY_CREATE_FILE, or
> - * MAY_CREATE_DIR are set.  That way, file systems that don't support these
> - * permissions will check for MAY_WRITE instead.
> + * MAY_WRITE must be set in @mask whenever MAY_APPEND, MAY_CREATE_FILE,
> + * MAY_CREATE_DIR, or MAY_DELETE_CHILD are set.  That way, file systems that
> + * don't support these permissions will check for MAY_WRITE instead.
>  */
> int inode_permission(struct inode *inode, int mask)
> {
> @@ -2555,7 +2555,7 @@ static int may_delete(struct inode *dir, struct dentry 
> *victim,
> bool isdir, bool replace)
> {
>   struct inode *inode = d_backing_inode(victim);
> - int error, mask = MAY_WRITE | MAY_EXEC;
> + int error, mask = MAY_EXEC;
> 
>   if (d_is_negative(victim))
>   return -ENOENT;
> @@ -2565,15 +2565,18 @@ static int may_delete(struct inode *dir, struct 
> dentry *victim,
>   audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
> 
>   if (replace)
> - mask |= isdir ? MAY_CREATE_DIR : MAY_CREATE_FILE;
> - error = inode_permission(dir, mask);
> + mask |= MAY_WRITE | (isdir ? MAY_CREATE_DIR : MAY_CREATE_FILE);
> + error = inode_permission(dir, mask | MAY_WRITE | MAY_DELETE_CHILD);
> + if (!error && check_sticky(dir, inode))
> + error = -EPERM;
> + if (error && IS_RICHACL(inode) &&
> + inode_permission(inode, MAY_DELETE_SELF) == 0)
> + error = 0;

This looks like a serious bug, as it is overriding other errors returned
from inode_permission() such as -EROFS from sb_permission() or even from
generic_permission->acl_permission_check().  Clearing the error returned
by an earlier check doesn't seem safe, only new errors should be added.

The call to inode_permission(inode) is also duplicating the sb_permission()
check from inode_permission(dir), so at most should be __inode_permission().

It looks like this would be correct if you check MAY_DELETE_SELF together
with check_sticky():

if (!error && check_sticky(dir, inode) &&
!__inode_permission(inode, MAY_DELETE_SELF))
error = -EPERM;

I ommitted the IS_RICHACL() check here, since that should probably be in
__inode_permission() when MAY_DELETE_SELF is passed?

Cheers, Andreas

>   if (error)
>   return error;
>   if (IS_APPEND(dir))
>   return -EPERM;

> -
> - if (check_sticky(dir, inode) || IS_APPEND(inode) ||
> - IS_IMMUTABLE(inode) || IS_SWAPFILE(inode))
> + if (IS_APPEND(inode) || IS_IMMUTABLE(inode) || IS_SWAPFILE(inode))
>   return -EPERM;

>   if (isdir) {
>   if (!d_is_dir(victim))
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index d6e2330..402acd7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -84,6 +84,8 @@ typedef void (dax_iodone_t)(struct buffer_head *bh_map, int 
> uptodate);
> #define MAY_NOT_BLOCK 0x0080
> #define MAY_CREATE_FILE   0x0100
> #define MAY_CREATE_DIR0x0200
> +#define MAY_DELETE_CHILD 0x0400
> +#define MAY_DELETE_SELF  0x0800
> 
> /*
>  * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
> --
> 2.5.0
> 


Cheers, Andreas







signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [PATCH v3 0/4] SMP support for Broadcom NSP

2015-11-06 Thread Heiko Stuebner
Hi,

Am Freitag, 6. November 2015, 16:11:09 schrieb Kapil Hali:
> Change in v3:
> * Fixed patch subject from RESEND PATCH to PATCH
> * Deleted arch/arm/mach-bcm/bcm_nsp.h file
> * Removed inclusion of header file bcm_nsp.h in platsmp.c
> * Removed unused variable 'timeout' in nsp_boot_secondary()

I'm still not sure why I'm getting this :-) . But with the number of patch 
(re-)sends it's crowding my inbox a bit to much for my liking, so please drop 
me of your recipient list


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


Re: [PATCH v14 03/22] vfs: Add MAY_DELETE_SELF and MAY_DELETE_CHILD permission flags

2015-11-06 Thread Andreas Dilger
On Nov 5, 2015, at 4:39 AM, Andreas Gruenbacher  wrote:
> 
> Normally, deleting a file requires MAY_WRITE access to the parent
> directory.  With richacls, a file may be deleted with MAY_DELETE_CHILD access
> to the parent directory or with MAY_DELETE_SELF access to the file.
> 
> To support that, pass the MAY_DELETE_CHILD mask flag to inode_permission()
> when checking for delete access inside a directory, and MAY_DELETE_SELF
> when checking for delete access to a file itelf.
> 
> The MAY_DELETE_SELF permission overrides the sticky directory check.
> 
> Signed-off-by: Andreas Gruenbacher 
> Reviewed-by: J. Bruce Fields 
> ---
> fs/namei.c | 21 -
> include/linux/fs.h |  2 ++
> 2 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 0259392..2eab19e 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -453,9 +453,9 @@ static int sb_permission(struct super_block *sb, struct 
> inode *inode, int mask)
>  * this, letting us set arbitrary permissions for filesystem access without
>  * changing the "normal" UIDs which are used for other things.
>  *
> - * MAY_WRITE must be set in @mask whenever MAY_APPEND, MAY_CREATE_FILE, or
> - * MAY_CREATE_DIR are set.  That way, file systems that don't support these
> - * permissions will check for MAY_WRITE instead.
> + * MAY_WRITE must be set in @mask whenever MAY_APPEND, MAY_CREATE_FILE,
> + * MAY_CREATE_DIR, or MAY_DELETE_CHILD are set.  That way, file systems that
> + * don't support these permissions will check for MAY_WRITE instead.
>  */
> int inode_permission(struct inode *inode, int mask)
> {
> @@ -2555,7 +2555,7 @@ static int may_delete(struct inode *dir, struct dentry 
> *victim,
> bool isdir, bool replace)
> {
>   struct inode *inode = d_backing_inode(victim);
> - int error, mask = MAY_WRITE | MAY_EXEC;
> + int error, mask = MAY_EXEC;
> 
>   if (d_is_negative(victim))
>   return -ENOENT;
> @@ -2565,15 +2565,18 @@ static int may_delete(struct inode *dir, struct 
> dentry *victim,
>   audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
> 
>   if (replace)
> - mask |= isdir ? MAY_CREATE_DIR : MAY_CREATE_FILE;
> - error = inode_permission(dir, mask);
> + mask |= MAY_WRITE | (isdir ? MAY_CREATE_DIR : MAY_CREATE_FILE);
> + error = inode_permission(dir, mask | MAY_WRITE | MAY_DELETE_CHILD);
> + if (!error && check_sticky(dir, inode))
> + error = -EPERM;
> + if (error && IS_RICHACL(inode) &&
> + inode_permission(inode, MAY_DELETE_SELF) == 0)
> + error = 0;

This looks like a serious bug, as it is overriding other errors returned
from inode_permission() such as -EROFS from sb_permission() or even from
generic_permission->acl_permission_check().  Clearing the error returned
by an earlier check doesn't seem safe, only new errors should be added.

The call to inode_permission(inode) is also duplicating the sb_permission()
check from inode_permission(dir), so at most should be __inode_permission().

It looks like this would be correct if you check MAY_DELETE_SELF together
with check_sticky():

if (!error && check_sticky(dir, inode) &&
!__inode_permission(inode, MAY_DELETE_SELF))
error = -EPERM;

I ommitted the IS_RICHACL() check here, since that should probably be in
__inode_permission() when MAY_DELETE_SELF is passed?

Cheers, Andreas

>   if (error)
>   return error;
>   if (IS_APPEND(dir))
>   return -EPERM;

> -
> - if (check_sticky(dir, inode) || IS_APPEND(inode) ||
> - IS_IMMUTABLE(inode) || IS_SWAPFILE(inode))
> + if (IS_APPEND(inode) || IS_IMMUTABLE(inode) || IS_SWAPFILE(inode))
>   return -EPERM;

>   if (isdir) {
>   if (!d_is_dir(victim))
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index d6e2330..402acd7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -84,6 +84,8 @@ typedef void (dax_iodone_t)(struct buffer_head *bh_map, int 
> uptodate);
> #define MAY_NOT_BLOCK 0x0080
> #define MAY_CREATE_FILE   0x0100
> #define MAY_CREATE_DIR0x0200
> +#define MAY_DELETE_CHILD 0x0400
> +#define MAY_DELETE_SELF  0x0800
> 
> /*
>  * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
> --
> 2.5.0
> 


Cheers, Andreas







signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [PATCH v5 1/5] gadget: Introduce the notifier functions

2015-11-06 Thread Mark Brown
On Fri, Nov 06, 2015 at 08:56:44AM -0800, Greg KH wrote:
> On Fri, Nov 06, 2015 at 07:35:10PM +0800, Baolin Wang wrote:

> > Thus this patch adds a notifier mechanism for usb gadget to report a
> > event to usb charger when the usb gadget state is changed.

> I thought we said we did not want another notifier chain in the previous
> versions of this patch?

Did we come up with anything better?


signature.asc
Description: PGP signature


Re: [dm-devel] [PATCH 0/4] dm verity: add support for error correction

2015-11-06 Thread Sami Tolvanen
On Fri, Nov 06, 2015 at 10:05:24PM +0100, Zdenek Kabelac wrote:
> So how do you want to correctly 'restore'  missing full sectors
> with just 0.8% data overhead ??

We use interleaving. Each byte in a 4k block is part of a different
Reed-Solomon block, which means an entire lost 4k data block looks like a
single error. When we also spread the bytes that form a single Reed-Solomon
block across the partition, we end up being able to correct several
megabytes of consecutive corrupted blocks with very small space overhead.

Sami
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ASoC: wm9713: add gpio chip

2015-11-06 Thread Mark Brown
On Fri, Nov 06, 2015 at 09:47:35PM +0100, Robert Jarzmik wrote:

> Ok, so where I should target this code at ? Should this land in
> sound/soc/soc-ac97.c ? Or somewhere else ? I'd like to see where you think the
> init_gpio() and free_gpio() should be put.

Sounds like a reasonable place, or possibly even the ALSA level AC'97
stuff (though I'd question if anyone would ever use it outside of an
ASoC system).


signature.asc
Description: PGP signature


Re: [PATCH] ARM: orion: Fix DSA platform device after mvmdio conversion

2015-11-06 Thread Florian Fainelli
On 06/11/15 11:37, Greg KH wrote:
> On Fri, Nov 06, 2015 at 11:31:30AM -0800, Florian Fainelli wrote:
>> DSA expects the mii_bus pointer to be the device structure associated
>> with the MDIO bus controller driver. First commit breaking that was
>> c3a07134e6aa ("mv643xx_eth: convert to use the Marvell Orion MDIO
>> driver"), and then, it got completely under the radar for a while.
>>
>> Reported-by: Frans van de Wiel 
>> Fixes: c3a07134e6aa ("mv643xx_eth: convert to use the Marvell Orion MDIO 
>> driver")
>> CC: sta...@vger.kernel.org
>> Signed-off-by: Florian Fainelli 
>> ---
>> Greg,
>>
>> This is the patch for kernels 3.10 through 3.17, thanks!
> 
> What is the git commit id of this in Linus's tree?
>

Upstream commit is d836ace65ee98d7079bc3c5afdbcc0e27dca20a3 ("ARM:
orion: Fix DSA platform device after mvmdio conversion").
-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5] clk: add CS2000 Fractional-N driver

2015-11-06 Thread Andy Shevchenko
On Tue, Oct 20, 2015 at 4:26 AM, Kuninori Morimoto
 wrote:
> From: Kuninori Morimoto 

Hmm… Something wrong with send-email settings?

> This patch adds CS2000 Fractional-N driver as clock provider.

> +#define CH_SIZE_ERR(ch)((ch < 0) || (ch >= CH_MAX))
> +#define hw_to_priv(_hw)container_of(_hw, struct cs2000_priv, 
> hw)

> +#define priv_to_client(priv)   (priv->client)

to_client()?

> +#define priv_to_dev(priv)  (&(priv_to_client(priv)->dev))

to_dev() ?

> +static int cs2000_bset(struct cs2000_priv *priv, u8 addr, u8 mask, u8 val)
> +{
> +   s32 data;
> +
> +   data = cs2000_read(priv, addr);
> +   if (data < 0)
> +   return data;
> +
> +   data &= ~mask;
> +   data |= (val & mask);
> +
> +   return cs2000_write(priv, addr, data);
> +}
> +
> +static int cs2000_enable_dev_config(struct cs2000_priv *priv, bool enable)
> +{
> +   u32 val;
> +   int ret;
> +
> +   val = enable ? ENDEV1 : 0;

Put in expression below?

> +   ret = cs2000_bset(priv, DEVICE_CFG1, ENDEV1, val);
> +   if (ret < 0)
> +   return ret;
> +
> +   val = enable ? ENDEV2 : 0;

Same.

> +   ret = cs2000_bset(priv, GLOBAL_CFG,  ENDEV2, val);
> +   if (ret < 0)
> +   return ret;
> +
> +   return 0;
> +}
> +
> +static int cs2000_clk_in_bound_rate(struct cs2000_priv *priv,
> +   u32 rate_in)
> +{
> +   u32 val;
> +
> +   if (rate_in >= 3200 &&
> +   rate_in < 5600)

One line here and below?

> +   val = 0x0;
> +   else if (rate_in >= 1600 &&
> +rate_in < 2800)
> +   val = 0x1;
> +   else if (rate_in >= 800 &&
> +rate_in < 1400)
> +   val = 0x2;
> +   else
> +   return -EINVAL;
> +
> +   return cs2000_bset(priv, FUNC_CFG1, 0x3 << 3, val << 3);


> +}
> +
> +static int cs2000_wait_pll_lock(struct cs2000_priv *priv)
> +{
> +   struct device *dev = priv_to_dev(priv);
> +   s32 val;
> +   unsigned int i;
> +
> +   for (i = 0; i < 256; i++) {
> +   val = cs2000_read(priv, DEVICE_CTRL);
> +   if (val < 0)
> +   return val;
> +   if (!(val & PLL_UNLOCK))
> +   return 0;
> +   udelay(1);
> +   }

unsigned int i = 256;

do {
val = read();
…
while ((val & PLL_UNLOCK) && --i);

if (!i) {
 …
 return -EIO;

Actually -ETIMEDOUT ?

}
return 0;

> +
> +   dev_err(dev, "pll lock failed\n");
> +
> +   return -EIO;
> +}
> +
> +static int cs2000_clk_out_enable(struct cs2000_priv *priv, bool enable)
> +{
> +   u32 val = enable ? 0 : 0x3;

Redundant variable?

> +
> +   /* enable both AUX_OUT, CLK_OUT */
> +   return cs2000_write(priv, DEVICE_CTRL, val);
> +}
> +
> +static u32 cs2000_rate_to_ratio(u32 rate_in, u32 rate_out)
> +{
> +   u64 ratio;
> +
> +   /*
> +* ratio = rate_out / rate_in * 2^20
> +*
> +* To avoid over flow, rate_out is u64
> +* The result should be u32
> +*/
> +   ratio = (u64)rate_out << 20;
> +   do_div(ratio, rate_in);
> +
> +   return (u32)ratio;

No need to do explicit casting.

> +}
> +
> +static unsigned long cs2000_ratio_to_rate(u32 ratio, u32 rate_in)
> +{
> +   u64 rate_out;
> +
> +   /*
> +* ratio = rate_out / rate_in * 2^20
> +*
> +* To avoid over flow, rate_out is u64
> +* The result should be u32

u32 or unsigned long?

Btw, dots at the end of sentences.

> +*/
> +
> +   rate_out = (u64)ratio * rate_in;
> +   return (unsigned long)(rate_out >> 20);

Same.

> +}
> +
> +static int cs2000_ratio_set(struct cs2000_priv *priv,
> +   int ch, u32 rate_in, u32 rate_out)
> +{
> +   u32 val;
> +   unsigned int i;
> +   int ret;
> +
> +   if (CH_SIZE_ERR(ch))
> +   return -EINVAL;
> +
> +   val = cs2000_rate_to_ratio(rate_in, rate_out);
> +   for (i = 0; i < 4; i++)

4 is magic, you have define already.

> +   ret = cs2000_write(priv,
> +  Ratio_Add(ch, i),
> +  Ratio_Val(val, i));
> +   if (ret < 0)
> +   return ret;
> +   }
> +
> +   return 0;
> +}
> +
> +static u32 cs2000_ratio_get(struct cs2000_priv *priv, int ch)
> +{
> +   u32 tmp, val;
> +   unsigned int i;
> +
> +   val = 0;
> +   for (i = 0; i < 4; i++) {

Same.

> +   tmp = cs2000_read(priv,
> + Ratio_Add(ch, i));

One line?

> +   if (tmp < 0)
> +   return 0;
> +
> +   val |= Val_Ratio(tmp, i);
> +   }
> +
> +   return val;
> +}
> +
> +static int cs2000_ratio_select(struct cs2000_priv *priv, int ch)
> +{
> +   int ret;
> +
> +   if (CH_SIZE_ERR(ch))
> +

Re: [PATCH] arm: Use kernel mm when updating section permissions

2015-11-06 Thread Kees Cook
On Fri, Nov 6, 2015 at 1:06 PM, Kevin Hilman  wrote:
> Kees Cook  writes:
>
>> On Fri, Nov 6, 2015 at 12:11 PM, Kevin Hilman  wrote:
>>> On Fri, Nov 6, 2015 at 11:12 AM, Kees Cook  wrote:
>>>
>>> [...]
>>>
 Hi Kevin and Kernel CI folks,

 Could lkdtm get added to the kernel-CI workflows? Extracting and
 validating Oops details when poking lkdtm would be extremely valuable
 for these cases. :)
>>>
>>> Yeah, we can add that.
>>>
>>> What arches should we expect this to be working on?  For starters
>>
>> This is a great question. ;) They're a mix of CONFIG and hardware
>> feature specific, so probably they should be run on all architectures
>> and we can figure out what's missing in each case.
>>
>> Everything built with CONFIG_DEBUG_RODATA should pass these:
>>
>> WRITE_RO
>> WRITE_KERN
>> EXEC_DATA
>> EXEC_STACK
>> EXEC_KMALLOC
>> EXEC_VMALLOC
>>
>> But architectures without CONFIG_DEBUG_RODATA should be shamed. ;)
>>
>> Passing EXEC_USERSPACE requires SMEP on x86, and PXN on arm64.
>> Passing ACCESS_USERSPACE rquires SMAP on x86, and PAN on arm64.
>>
>> The recent PAN emulation CONFIG_CPU_SW_DOMAIN_PAN on non-LPAE arm
>> should cover ACCESS_USERSPACE too, and maybe EXEC_USERSPACE, but I
>> haven't taken a close look.
>
> A quick test on arm32 and both ACCESS_ and EXEC_USERSPACE tests pass
> (meaning they trigger the WARNs).

I'd expect a full Oops, not a WARN, but maybe CONFIG_CPU_SW_DOMAIN_PAN
needs to use a bigger hammer.

Russell, what sort of trap is DOMAIN_PAN expected to be triggering?

>> It might be useful, frankly, to test everything in lkdtm.
>
> So I gave this a quick spin on an ARM board (qcom-apq8064-ifc6410)
> using a dumb script[1] (for now avoiding the tests that cause a lockup
> so I can test multiple features without a reboot.)  Seems like most of
> them are producing a failure.
>
> However, this got me to thinking that one should probably write a
> kselftest for this feature, and catch quite a few issues with the ones
> that don't cause a hard lockup.  One would just need to be a bit smarter
> than my script and do something to trap SIG* (or the parent catching
> SIGCHLD) in order to be able to help determine failure, then grab the
> dmesg and log it.
>
> Having these test integrated into kselftest, and maintained along with
> the the kernel features would be *way* better than trying to maintain a
> set of tests in kernel CI for this feature, since right now we're
> working just building/running all the selftests automatically.
>
> What do you think about coming up with a kselftest for this stuff?  At
> least the non-lockup stuff?

Well, all the stuff I wrote tests for in lkdtm expect the kernel to
entirely Oops, and examining the Oops from outside is needed to verify
it was the correct type of Oops. I don't think testing via lkdtm can
be done from kselftest sensibly.

-Kees

>
> I'm not volunteering to write up the kselftest, but I will guarantee
> that it get run on a broad range of boards once it exists. :)
>
> Kevin
>
> [1]
> #!/bin/sh
>
> crash_test_dummy() {
>   echo $1> /sys/kernel/debug/provoke-crash/DIRECT
> }
>
> # Find all the tests that don't lockup
> TESTS=$(cat /sys/kernel/debug/provoke-crash/DIRECT |grep -v types| grep -v 
> LOCK |grep -v PANIC)
>
> for test in $TESTS; do
>   echo "Performing test: $test"
>   crash_test_dummy $test &
>   sleep 1
> done



-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] MFD for v4.4

2015-11-06 Thread Mark Brown
On Fri, Nov 06, 2015 at 10:37:23AM -0800, Linus Torvalds wrote:
> On Fri, Nov 6, 2015 at 12:04 AM, Lee Jones  wrote:

> >   git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
> > tags/mfd-for-linus-4.4

> So I had some of the patches you listed from before throughthe regmap
> merge etc. So you and Mark Brown merged some of the same branches.

> That all looks fine, I just want to confirm that it was intentional
> and you were both aware of this, and it happened because you both
> wanted some of the infrastructure?

Yup, some of the MFD drivers wanted new regmap functionality so Lee
pulled in some branches I tagged.  At least for my stuff in general if
someone's merged something from a tag I signed I was expecting that.


signature.asc
Description: PGP signature


Re: [PATCH v4 4/5] regulator: tps65912: Add regulator driver for the TPS65912 PMIC

2015-11-06 Thread Mark Brown
On Fri, Nov 06, 2015 at 12:10:45PM -0600, Andrew F. Davis wrote:
> On 11/06/2015 04:43 AM, Mark Brown wrote:

> >No, you need to fix the bug that is causing dev->of_node to be populated
> >for the MFD function device.  Probably the issue is that you have put
> >this pointless compatible string in your DT.

> If it is pointless what is the reason we have .of_compatible in mfd_cell?

There are cases where it's useful where we're abstracting something and
gaining some meaningful reuse.  This really does not appear to be one of
those cases, there are no parameters in the DT and the compatible string
is the full device name.

> How else do you want us to populate the sub-device dev->of_node? Looking

You do not need to populate it.  There is no value in populating it and
as previously discussed putting the Linux driver model into DT can be
actively harmful if we change our idea of how we should model things.

> >Please stop this.  I don't understand why you are pushing so hard to put
> >the Linux device model representation of the device into DT but it's
> >getting very repetitive.

> I'm not pushing anything, this is how other sub-nodes of MFD devices are

Every time we go through this we finish the discussion and then you come
back with yet another excuse for trying to push the current Linux device
model into the DT or another version of the patch with the same problem.

> represented, I'm not sure what you think I'm doing that is so wrong here.

I am providing the same review feedback repeatedly, this is not good.

> No one else seems to have an issue with the DT for this device, I see no
> reason the regulator node has to be different than the other sub-device
> nodes.

I would prefer it if other areas where there's no reuse gained by
breaking things down and where we're just encoding the Linux driver
model into DT weren't done like that either.  Perhaps other people care
less here, perhaps they haven't been bitten by the problems that can
arise.  If I read such patches I'd probably comment on the issue but
I've got enough to do already without trying to review every single DT
binding.

> It looks rather out of place to have regulators be singled out like this,
> for instance look at the mfd_cells for drivers/mfd/rt5033.c

The fact that other people have merged imperfect code into the kernel is
not a good reason to merge even more of it when we have better tools.
Looking at that binding I'm seeing no reason why any of the subfunctions
should have compatible strings (and if we're going down the route you're
trying to go down we really ought to have something in the binding for
at least an interrupt controller in there as well...).

Seriously, please stop this - having to go through the same things
repeatedly is not helpful.


signature.asc
Description: PGP signature


[PATCH v3 1/4] dt-bindings: add SMP enable-method for Broadcom NSP

2015-11-06 Thread Kapil Hali
Add a compatible string "brcm,bcm-nsp-smp" for Broadcom's
Northstar Plus CPU to the 32-bit ARM CPU device tree binding
documentation file and create a new binding documentation for
Northstar Plus CPU.

Signed-off-by: Kapil Hali 
---
 .../bindings/arm/bcm/brcm,nsp-cpu-method.txt   | 36 ++
 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt

diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt 
b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
new file mode 100644
index 000..8506da7
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
@@ -0,0 +1,36 @@
+Broadcom Northstar Plus SoC CPU Enable Method
+-
+This binding defines the enable method used for starting secondary
+CPUs in the following Broadcom SoCs:
+  BCM58522, BCM58525, BCM58535, BCM58622, BCM58623, BCM58625, BCM88312
+
+The enable method is specified by defining the following required
+properties in the "cpus" device tree node:
+  - enable-method = "brcm,bcm-nsp-smp";
+  - secondary-boot-reg = <...>;
+
+The secondary-boot-reg property is a u32 value that specifies the
+physical address of the register used to request the ROM holding pen
+code release a secondary CPU.
+
+Example:
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   enable-method = "brcm,bcm-nsp-smp";
+   secondary-boot-reg = <0x042c>;
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a9";
+   next-level-cache = <>;
+   reg = <0>;
+   };
+
+   cpu1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a9";
+   next-level-cache = <>;
+   reg = <1>;
+   };
+   };
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt 
b/Documentation/devicetree/bindings/arm/cpus.txt
index 91e6e5c..6abe3f3 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -191,6 +191,7 @@ nodes to be present and contain the properties described 
below.
"allwinner,sun8i-a23"
"arm,psci"
"brcm,brahma-b15"
+   "brcm,bcm-nsp-smp"
"marvell,armada-375-smp"
"marvell,armada-380-smp"
"marvell,armada-390-smp"
-- 
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 v3 3/4] ARM: BCM: Add SMP support for Broadcom NSP

2015-11-06 Thread Kapil Hali
Add SMP support for Broadcom's Northstar Plus SoC
cpu enable method. This changes also consolidates
iProc family's - BCM NSP and BCM Kona, platform
SMP handling in a common file.

Northstar Plus SoC is based on ARM Cortex-A9
revision r3p0 which requires configuration for ARM
Errata 764369 for SMP. This change adds the needed
configuration option.

Signed-off-by: Kapil Hali 
---
 arch/arm/mach-bcm/Kconfig   |  2 +
 arch/arm/mach-bcm/Makefile  |  8 ++-
 arch/arm/mach-bcm/{kona_smp.c => platsmp.c} | 82 +
 3 files changed, 81 insertions(+), 11 deletions(-)
 rename arch/arm/mach-bcm/{kona_smp.c => platsmp.c} (75%)

diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 1679fa4..2e9dbb5 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -40,6 +40,8 @@ config ARCH_BCM_NSP
select ARCH_BCM_IPROC
select ARM_ERRATA_754322
select ARM_ERRATA_775420
+   select ARM_ERRATA_764369 if SMP
+   select HAVE_SMP
help
  Support for Broadcom Northstar Plus SoC.
  Broadcom Northstar Plus family of SoCs are used for switching control
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 892261f..5193a25 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -14,7 +14,11 @@
 obj-$(CONFIG_ARCH_BCM_CYGNUS) +=  bcm_cygnus.o
 
 # Northstar Plus
-obj-$(CONFIG_ARCH_BCM_NSP) += bcm_nsp.o
+obj-$(CONFIG_ARCH_BCM_NSP) += bcm_nsp.o
+
+ifeq ($(CONFIG_ARCH_BCM_NSP),y)
+obj-$(CONFIG_SMP)  += platsmp.o
+endif
 
 # BCM281XX
 obj-$(CONFIG_ARCH_BCM_281XX)   += board_bcm281xx.o
@@ -23,7 +27,7 @@ obj-$(CONFIG_ARCH_BCM_281XX)  += board_bcm281xx.o
 obj-$(CONFIG_ARCH_BCM_21664)   += board_bcm21664.o
 
 # BCM281XX and BCM21664 SMP support
-obj-$(CONFIG_ARCH_BCM_MOBILE_SMP) += kona_smp.o
+obj-$(CONFIG_ARCH_BCM_MOBILE_SMP) += platsmp.o
 
 # BCM281XX and BCM21664 L2 cache control
 obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o
diff --git a/arch/arm/mach-bcm/kona_smp.c b/arch/arm/mach-bcm/platsmp.c
similarity index 75%
rename from arch/arm/mach-bcm/kona_smp.c
rename to arch/arm/mach-bcm/platsmp.c
index 66a0465..dbf14fb 100644
--- a/arch/arm/mach-bcm/kona_smp.c
+++ b/arch/arm/mach-bcm/platsmp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Broadcom Corporation
+ * Copyright (C) 2014-2015 Broadcom Corporation
  * Copyright 2014 Linaro Limited
  *
  * This program is free software; you can redistribute it and/or
@@ -12,12 +12,17 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
+#include 
 #include 
 #include 
 #include 
@@ -75,6 +80,37 @@ static int __init scu_a9_enable(void)
return 0;
 }
 
+static int nsp_write_lut(void)
+{
+   void __iomem *sku_rom_lut;
+   phys_addr_t secondary_startup_phy;
+
+   if (!secondary_boot) {
+   pr_warn("required secondary boot register not specified\n");
+   return -EINVAL;
+   }
+
+   sku_rom_lut = ioremap_nocache((phys_addr_t)secondary_boot,
+   sizeof(secondary_boot));
+   if (!sku_rom_lut) {
+   pr_warn("unable to ioremap SKU-ROM LUT register\n");
+   return -ENOMEM;
+   }
+
+   secondary_startup_phy = virt_to_phys(secondary_startup);
+   BUG_ON(secondary_startup_phy > (phys_addr_t)U32_MAX);
+
+   writel_relaxed(secondary_startup_phy, sku_rom_lut);
+   /*
+* Ensure the write is visible to the secondary core.
+*/
+   smp_wmb();
+
+   iounmap(sku_rom_lut);
+
+   return 0;
+}
+
 static void __init bcm_smp_prepare_cpus(unsigned int max_cpus)
 {
static cpumask_t only_cpu_0 = { CPU_BITS_CPU0 };
@@ -95,11 +131,11 @@ static void __init bcm_smp_prepare_cpus(unsigned int 
max_cpus)
/*
 * Our secondary enable method requires a "secondary-boot-reg"
 * property to specify a register address used to request the
-* ROM code boot a secondary code.  If we have any trouble
+* ROM code boot a secondary core.  If we have any trouble
 * getting this we fall back to uniprocessor mode.
 */
if (of_property_read_u32(node, OF_SECONDARY_BOOT, _boot)) {
-   pr_err("%s: missing/invalid " OF_SECONDARY_BOOT " property\n",
+   pr_warn("%s: missing/invalid " OF_SECONDARY_BOOT " property\n",
node->name);
ret = -ENOENT;  /* Arrange to disable SMP */
goto out;
@@ -115,7 +151,6 @@ out:
of_node_put(node);
if (ret) {
/* Update the CPU present map to reflect uniprocessor mode */
-   BUG_ON(ret != -ENOENT);
pr_warn("disabling SMP\n");
init_cpu_present(_cpu_0);
}
@@ -139,7 +174,7 @@ out:
  * - Wait for the secondary boot 

[PATCH v3 2/4] ARM: dts: add SMP support for Broadcom NSP

2015-11-06 Thread Kapil Hali
Add device tree changes required for providing SMP support
for Broadcom Northstar Plus SoC.

Signed-off-by: Kapil Hali 
---
 arch/arm/boot/dts/bcm-nsp.dtsi | 33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
index 58aca27..d1875d9 100644
--- a/arch/arm/boot/dts/bcm-nsp.dtsi
+++ b/arch/arm/boot/dts/bcm-nsp.dtsi
@@ -40,24 +40,33 @@
model = "Broadcom Northstar Plus SoC";
interrupt-parent = <>;
 
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   enable-method = "brcm,bcm-nsp-smp";
+   secondary-boot-reg = <0x042c>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a9";
+   next-level-cache = <>;
+   reg = <0x0>;
+   };
+
+   cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a9";
+   next-level-cache = <>;
+   reg = <0x1>;
+   };
+   };
+
mpcore {
compatible = "simple-bus";
ranges = <0x 0x1902 0x3000>;
#address-cells = <1>;
#size-cells = <1>;
 
-   cpus {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   cpu@0 {
-   device_type = "cpu";
-   compatible = "arm,cortex-a9";
-   next-level-cache = <>;
-   reg = <0x0>;
-   };
-   };
-
L2: l2-cache {
compatible = "arm,pl310-cache";
reg = <0x2000 0x1000>;
-- 
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 v3 4/4] ARM: BCM: Add SMP support for Broadcom 4708

2015-11-06 Thread Kapil Hali
From: Jon Mason 

Add SMP support for Broadcom's 4708 SoCs.

Signed-off-by: Jon Mason 
Acked-by: Hauke Mehrtens 
Tested-by: Hauke Mehrtens 
Signed-off-by: Kapil Hali 
---
 arch/arm/boot/dts/bcm4708.dtsi | 2 ++
 arch/arm/mach-bcm/Kconfig  | 1 +
 arch/arm/mach-bcm/Makefile | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/bcm4708.dtsi b/arch/arm/boot/dts/bcm4708.dtsi
index 31141e8..22a41df 100644
--- a/arch/arm/boot/dts/bcm4708.dtsi
+++ b/arch/arm/boot/dts/bcm4708.dtsi
@@ -15,6 +15,8 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
+   enable-method = "brcm,bcm-nsp-smp";
+   secondary-boot-reg = <0x0400>;
 
cpu@0 {
device_type = "cpu";
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 2e9dbb5..4fc8fa3 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -54,6 +54,7 @@ config ARCH_BCM_NSP
 config ARCH_BCM_5301X
bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
select ARCH_BCM_IPROC
+   select HAVE_SMP
help
  Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
 
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 5193a25..7d66515 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -43,6 +43,9 @@ obj-$(CONFIG_ARCH_BCM2835)+= board_bcm2835.o
 
 # BCM5301X
 obj-$(CONFIG_ARCH_BCM_5301X)   += bcm_5301x.o
+ifeq ($(CONFIG_ARCH_BCM_5301X),y)
+obj-$(CONFIG_SMP)  += platsmp.o
+endif
 
 # BCM63XXx
 ifeq ($(CONFIG_ARCH_BCM_63XX),y)
-- 
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 v3 0/4] SMP support for Broadcom NSP

2015-11-06 Thread Kapil Hali
Change in v3:
* Fixed patch subject from RESEND PATCH to PATCH
* Deleted arch/arm/mach-bcm/bcm_nsp.h file
* Removed inclusion of header file bcm_nsp.h in platsmp.c
* Removed unused variable 'timeout' in nsp_boot_secondary()

Changes in v2:
Removed the pen_holding method of SMP bringup for NSP SoC and
replaced it with simple wakeup of secondary core using ARM IPI.


This series adds SMP support for Broadcom's Northstar Plus SoC.

There are similar SMP enablement methods for many ARMv7 bsed SoCs.
BCM NSP SoC, has a typical such mechanism - after power-on, the
secondary core is held in a standby state, primary core provides a
startup address for the secondary core and wakes it up. Booting of
the secondary core is serialized using pen_release global variable.

The startup address is programmed at a special register location
which is defined in the device tree using a "secondary-boot-reg"
property in a node whose "enable-method" property matches.

The first patch adds cpu-enable-method in the device tree bindings
documentation. It also updates ARM CPU device tree documentation
with Broadcom Northstar Plus CPU details.

The second patch adds SMP support to the BCM NSP device tree file.

The third patch, enables SMP on BCM NSP. It also consolidates
common SMP handling between BCM NSP and BCM Kona.

The final patch, enables SMP on BCM 4708 and this patch is pulled
in from Jon Mason's patch from the mailing list.

This patch series is constructed based on Linux v4.3-rc2.

The source code is available at GITHUB:
https://github.com/Broadcom/cygnus-linux/tree/nsp-smp-v1

Jon Mason (1):
  ARM: BCM: Add SMP support for Broadcom 4708

Kapil Hali (3):
  dt-bindings: add SMP enable-method for Broadcom NSP
  ARM: dts: add SMP support for Broadcom NSP
  ARM: BCM: Add SMP support for Broadcom NSP

 .../bindings/arm/bcm/brcm,nsp-cpu-method.txt   | 36 ++
 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 arch/arm/boot/dts/bcm-nsp.dtsi | 33 +
 arch/arm/boot/dts/bcm4708.dtsi |  2 +
 arch/arm/mach-bcm/Kconfig  |  3 +
 arch/arm/mach-bcm/Makefile | 11 ++-
 arch/arm/mach-bcm/{kona_smp.c => platsmp.c}| 82 +++---
 7 files changed, 145 insertions(+), 23 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
 rename arch/arm/mach-bcm/{kona_smp.c => platsmp.c} (75%)

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


[GIT PULL] trivial for 4.4 merge window

2015-11-06 Thread Jiri Kosina
Linus,

please pull from

  git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git for-linus

to trivially receive trivial stuff from trivial tree that can be trivially 
summed up as:

- treewide drop of spurious unlikely() before IS_ERR() from Viresh Kumar
- cosmetic fixes (that don't really affect basic functionality of the 
  driver) for pktcdvd and bcache, from Julia Lawall and Petr Mladek
- various comment / printk fixes and updates all over the place

Thanks.


Andrew Murray (1):
  UBI: Update comments to reflect UBI_METAONLY flag

Bastien Nocera (1):
  hwmon: applesmc: fix comment typos

Julia Lawall (1):
  pktcdvd: drop null test before destroy functions

Petr Mladek (1):
  bcache: Really show state of work pending bit

Rolf Eike Beer (2):
  class_find_device: fix reference to argument "match"
  Kconfig: remove comment about scsi_wait_scan module

Ulf Magnusson (1):
  debugfs: document that debugfs_remove*() accepts NULL and error values

Viresh Kumar (5):
  drivers: misc: Drop unlikely before IS_ERR(_OR_NULL)
  drivers: net: Drop unlikely before IS_ERR(_OR_NULL)
  fs: Drop unlikely before IS_ERR(_OR_NULL)
  mm: Drop unlikely before IS_ERR(_OR_NULL)
  net: Drop unlikely before IS_ERR(_OR_NULL)

 drivers/base/class.c | 2 +-
 drivers/block/pktcdvd.c  | 3 +--
 drivers/hwmon/applesmc.c | 4 ++--
 drivers/md/bcache/closure.c  | 4 +---
 drivers/misc/c2port/core.c   | 2 +-
 drivers/mtd/ubi/gluebi.c | 4 ++--
 drivers/net/ethernet/ti/netcp_core.c | 4 ++--
 drivers/scsi/Kconfig | 7 ---
 fs/cifs/readdir.c| 2 +-
 fs/ecryptfs/inode.c  | 2 +-
 fs/ext4/extents.c| 6 +++---
 fs/ext4/namei.c  | 2 +-
 fs/namei.c   | 4 ++--
 fs/ncpfs/dir.c   | 2 +-
 fs/nfs/objlayout/objio_osd.c | 2 +-
 fs/proc/proc_sysctl.c| 2 +-
 mm/huge_memory.c | 2 +-
 net/openvswitch/datapath.c   | 2 +-
 net/sctp/socket.c| 2 +-
 net/socket.c | 6 +++---
 20 files changed, 27 insertions(+), 37 deletions(-)

-- 
Jiri Kosina
SUSE Labs

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


[GIT PULL] HID for 4.4 merge window

2015-11-06 Thread Jiri Kosina
Linus,

please pull from

  git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git for-linus

to receive HID updates for 4.4 merge window. Highlights:

- Intel Skylake Win8 precision touchpads support fixes/improvements from 
  Mika Westerberg
- Lenovo Yoga 2 quirk from Ritesh Raj Sarraf
- potential uninitialized buffer access fix in HID core from Richard 
  Purdie
- Wacom Intuos and Wacom Cintiq 2 support improvements from Jason Gerecke 
  and Ping Cheng
- initiation of sysfs deprecation process for most of the roccat drivers, 
  from the roccat support maintiner Stefan Achatz
- quite a few device ID / quirk additions and small fixes

Thanks.



Benjamin Tissoires (2):
  HID: logitech-hidpp: split HIDPP_QUIRK_DELAYED_INIT in two
  HID: logitech-hidpp: add support to disable tap-to-click on the K400

Clément Vuchener (1):
  HID: corsair: Add Corsair Vengeance K90 driver

Daniel Martin (1):
  HID: Make I2C a known bus in hid_connect()

Dmitry Torokhov (1):
  HID: hid-input: allow input_configured callback return errors

Donavan Lance (1):
  HID: Add new Microsoft Type Cover 3 product ID

Fernando D S Lima (1):
  HID: sensor-hub: Fixup for Lenovo ThinkPad Helix 2 sensor hub report

Harald Brinkmann (1):
  HID: saitek: mode button quirk for Mad Catz R.A.T.5

Jason Gerecke (7):
  HID: wacom: Add support for Cintiq Companion 2
  HID: wacom: Report full pressure range for Intuos, Cintiq 13HD Touch
  HID: wacom: Tie cached HID_DG_CONTACTCOUNT indices to report ID
  HID: wacom: Expect 'touch_max' touches if HID_DG_CONTACTCOUNT not present
  HID: wacom: Remove useless conditions from 'wacom_query_tablet_data'
  HID: wacom: Fix ABS_MISC reporting for Cintiq Companion 2
  HID: wacom: Call 'wacom_query_tablet_data' only after 'hid_hw_start'

Jiri Kosina (1):
  HID: corsair: boolify struct k90_led.removed

Jiri Slaby (1):
  HID: fix some indenting issues

Maciej Zuk (1):
  HID: dragonrise: fix HID Descriptor for 0x0006 PID

Mika Westerberg (3):
  HID: i2c-hid: Fill in physical device providing HID functionality
  HID: multitouch: Add suffix for HID_DG_TOUCHPAD
  HID: multitouch: Fetch feature reports on demand for Win8 devices

Oliver Schmitt (1):
  HID: usbhid: Fix for the WiiU adapter from Mayflash

Ping Cheng (3):
  HID: wacom: Cleanup unsupported device_type for BAMBOO_PT
  HID: wacom: Add four new Intuos devices
  HID: wacom: fix Intuos wireless report id issue

Richard Purdie (1):
  HID: core: Avoid uninitialized buffer access

Ritesh Raj Sarraf (1):
  HID: sensor-hub: Add quirk for Lenovo Yoga 2 with ITE Chips

Simon Wood (2):
  HID: logitech: Simplify wheel detection scheme
  HID: logitech: Add support for G29

Stefan Achatz (1):
  HID: roccat: Fixed resubmit: Deprecating most Roccat sysfs attributes

 .../ABI/{testing => obsolete}/sysfs-driver-hid-roccat-arvo  |   0
 .../ABI/{testing => obsolete}/sysfs-driver-hid-roccat-isku  |   0
 Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus |  99 +++-
 .../ABI/{testing => obsolete}/sysfs-driver-hid-roccat-konepure  |   0
 Documentation/ABI/obsolete/sysfs-driver-hid-roccat-kovaplus |  50 +++
 .../ABI/{testing => obsolete}/sysfs-driver-hid-roccat-lua   |   0
 Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra |  50 +++
 .../ABI/{testing => obsolete}/sysfs-driver-hid-roccat-ryos  |   0
 .../ABI/{testing => obsolete}/sysfs-driver-hid-roccat-savu  |   0
 Documentation/ABI/testing/sysfs-driver-hid-corsair  |  15 +
 Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus  |  96 
 Documentation/ABI/testing/sysfs-driver-hid-roccat-kovaplus  |  49 --
 Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra  |  49 --
 drivers/hid/Kconfig |  15 +-
 drivers/hid/Makefile|   1 +
 drivers/hid/hid-aureal.c|   3 +-
 drivers/hid/hid-core.c  |  10 +-
 drivers/hid/hid-corsair.c   | 673 

 drivers/hid/hid-dr.c|  58 +++
 drivers/hid/hid-elecom.c|   2 +-
 drivers/hid/hid-ids.h   |   7 +
 drivers/hid/hid-lg.c|   9 +
 drivers/hid/hid-lg4ff.c | 127 --
 drivers/hid/hid-logitech-hidpp.c| 159 ++-
 drivers/hid/hid-microsoft.c |   2 +
 drivers/hid/hid-multitouch.c|  48 +-
 drivers/hid/hid-prodikeys.c |   4 +-
 drivers/hid/hid-saitek.c 

[GIT PULL] livepatching update for 4.4 merge window

2015-11-06 Thread Jiri Kosina
Linus,

please pull from

  git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching.git for-linus

to receive livepatching update for 4.4 merge window:

- fix for kernel oops in case CONFIG_DEBUG_SET_MODULE_RONX is unset (as 
  in such case it's possible for module struct to share a page with 
  executable text, which is currently not being handled with grace)
  from Josh Poimboeuf

Thanks.


Josh Poimboeuf (1):
  livepatch: Fix crash with !CONFIG_DEBUG_SET_MODULE_RONX

 arch/x86/kernel/livepatch.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

-- 
Jiri Kosina
SUSE Labs

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


Re: [PATCH] powerpc: allow cross-compilation of ppc64 kernel

2015-11-06 Thread Scott Wood
On Thu, 2015-11-05 at 12:47 +0100, Laurent Vivier wrote:
> When I try to cross compile a ppc64 kernel, it generally
> fails on the VDSO stage. This is true for powerpc64 cross-
> compiler, but also when I try to build a ppc64le kernel
> on a ppc64 host.
> 
> VDSO64L fails:
> 
>   VDSO64L arch/powerpc/kernel/vdso64/vdso64.so.dbg
> /usr/bin/powerpc64-linux-gnu-ld: arch/powerpc/kernel/vdso64/sigtramp.o:
> file class ELFCLASS64 incompatible with ELFCLASS32
> /usr/bin/powerpc64-linux-gnu-ld: final link failed: File in wrong format
> 
> This fails because gcc calls "collect2" with
> "--oformat elf32-powerpcle" with ppc64 objects, without the
> "--oformat" ld works well because it use the format of the
> first object as output format.
> 
> As this case is correctly managed to build the other kernel
> objects, this patch replaces $(GCC) by $(LD) to generate the
> VDSO objects.

I cross-compile ppc64 kernels and have not seen this problem.  I do need to 
pass in -m64 as part of $(CC) if it's not the toolchain default, which is not 
nice, but the proper fix for that is to add -m64 in the makefiles -- and if I 
don't it fails way before VDSO.

Why is GCC building ppc64 object files but telling the linker --oformat elf32-
powerpcle?  Are different options somehow being passed to GCC in one case 
versus the other?

-Scott

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


Re: [PATCH] arm: Use kernel mm when updating section permissions

2015-11-06 Thread Kevin Hilman
Kees Cook  writes:

> On Fri, Nov 6, 2015 at 12:11 PM, Kevin Hilman  wrote:
>> On Fri, Nov 6, 2015 at 11:12 AM, Kees Cook  wrote:
>>
>> [...]
>>
>>> Hi Kevin and Kernel CI folks,
>>>
>>> Could lkdtm get added to the kernel-CI workflows? Extracting and
>>> validating Oops details when poking lkdtm would be extremely valuable
>>> for these cases. :)
>>
>> Yeah, we can add that.
>>
>> What arches should we expect this to be working on?  For starters
>
> This is a great question. ;) They're a mix of CONFIG and hardware
> feature specific, so probably they should be run on all architectures
> and we can figure out what's missing in each case.
>
> Everything built with CONFIG_DEBUG_RODATA should pass these:
>
> WRITE_RO
> WRITE_KERN
> EXEC_DATA
> EXEC_STACK
> EXEC_KMALLOC
> EXEC_VMALLOC
>
> But architectures without CONFIG_DEBUG_RODATA should be shamed. ;)
>
> Passing EXEC_USERSPACE requires SMEP on x86, and PXN on arm64.
> Passing ACCESS_USERSPACE rquires SMAP on x86, and PAN on arm64.
>
> The recent PAN emulation CONFIG_CPU_SW_DOMAIN_PAN on non-LPAE arm
> should cover ACCESS_USERSPACE too, and maybe EXEC_USERSPACE, but I
> haven't taken a close look.

A quick test on arm32 and both ACCESS_ and EXEC_USERSPACE tests pass
(meaning they trigger the WARNs).

> It might be useful, frankly, to test everything in lkdtm.

So I gave this a quick spin on an ARM board (qcom-apq8064-ifc6410)
using a dumb script[1] (for now avoiding the tests that cause a lockup
so I can test multiple features without a reboot.)  Seems like most of
them are producing a failure.  

However, this got me to thinking that one should probably write a
kselftest for this feature, and catch quite a few issues with the ones
that don't cause a hard lockup.  One would just need to be a bit smarter
than my script and do something to trap SIG* (or the parent catching
SIGCHLD) in order to be able to help determine failure, then grab the
dmesg and log it.

Having these test integrated into kselftest, and maintained along with
the the kernel features would be *way* better than trying to maintain a
set of tests in kernel CI for this feature, since right now we're
working just building/running all the selftests automatically.

What do you think about coming up with a kselftest for this stuff?  At
least the non-lockup stuff?

I'm not volunteering to write up the kselftest, but I will guarantee
that it get run on a broad range of boards once it exists. :)

Kevin

[1]
#!/bin/sh

crash_test_dummy() {
  echo $1> /sys/kernel/debug/provoke-crash/DIRECT
}

# Find all the tests that don't lockup
TESTS=$(cat /sys/kernel/debug/provoke-crash/DIRECT |grep -v types| grep -v LOCK 
|grep -v PANIC)

for test in $TESTS; do
  echo "Performing test: $test"
  crash_test_dummy $test &
  sleep 1
done
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [dm-devel] [PATCH 0/4] dm verity: add support for error correction

2015-11-06 Thread Zdenek Kabelac

Dne 6.11.2015 v 21:27 Sami Tolvanen napsal(a):

On Fri, Nov 06, 2015 at 08:20:15PM +0100, Zdenek Kabelac wrote:

i.e. you have 1G of space - you want to give 250MB as 'redundancy' -
so create 4 partition


well data safety has it's price - user should choose what he prefers
 - more games and videos or more safety...



We cannot afford to set aside 25% of read-only partition space for
redundancy on mobile devices, and would rather not impact performance
any more than dm-verity already does. With error correction we have
0.8% space overhead in our use case and no performance degradation if
the partition is not corrupted.



I'm probably missing here some hw knowledge here - but if you loose
a flash block of some size  - then you typically get  'error' for
all bytes the sector/block.

So how do you want to correctly 'restore'  missing full sectors  with just 
0.8% data overhead ??


Or is the device which fails to correct block returning something 'still 
usable'  (since e.g.  SATA disk certainly not)


Zdenek

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v14 04/22] vfs: Make the inode passed to inode_change_ok non-const

2015-11-06 Thread Andreas Dilger

> On Nov 5, 2015, at 4:39 AM, Andreas Gruenbacher  wrote:
> 
> We will need to call iop->permission and iop->get_acl from
> inode_change_ok() for additional permission checks, and both take a
> non-const inode.

Seems unfortunate that those functions cannot themselves be changed to
take a const struct inode, but it doesn't look possible.

Reviewed-by: Andreas Dilger 

> Signed-off-by: Andreas Gruenbacher 
> Reviewed-by: J. Bruce Fields 
> ---
> fs/attr.c  | 2 +-
> include/linux/fs.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/attr.c b/fs/attr.c
> index 6530ced..328be71 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -28,7 +28,7 @@
>  * Should be called as the first thing in ->setattr implementations,
>  * possibly after taking additional locks.
>  */
> -int inode_change_ok(const struct inode *inode, struct iattr *attr)
> +int inode_change_ok(struct inode *inode, struct iattr *attr)
> {
>   unsigned int ia_valid = attr->ia_valid;
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 402acd7..aab32c8 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2871,7 +2871,7 @@ extern int buffer_migrate_page(struct address_space *,
> #define buffer_migrate_page NULL
> #endif
> 
> -extern int inode_change_ok(const struct inode *, struct iattr *);
> +extern int inode_change_ok(struct inode *, struct iattr *);
> extern int inode_newsize_ok(const struct inode *, loff_t offset);
> extern void setattr_copy(struct inode *inode, const struct iattr *attr);
> 
> --
> 2.5.0
> 


Cheers, Andreas







signature.asc
Description: Message signed with OpenPGP using GPGMail


[PATCH 04/11] bpf tools: Improve libbpf error reporting

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

In this patch, a series of libbpf specific error numbers and
libbpf_strerror() are introduced to help reporting errors.

Functions are updated to pass correct the error number through the
CHECK_ERR() macro.

All users of bpf_object__open{_buffer}() and bpf_program__title() in
perf are modified accordingly. In addition, due to the error codes
changing, bpf__strerror_load() is also modified to use them.

bpf__strerror_head() is also changed accordingly so it can parse libbpf
errors. bpf_loader_strerror() is introduced for that purpose, and will
be improved by the following patch.

load_program() is improved not to dump log buffer if it is empty. log
buffer is also used to deduce whether the error was caused by an invalid
program or other problem.

v1 -> v2:

 - Using macro for error code.

 - Fetch error message based on array index, eliminate for-loop.

 - Use log buffer to detect the reason of failure. 3 new error code
   are introduced to replace LIBBPF_ERRNO__LOAD.

In v1:

  # perf record -e ./test_ill_program.o ls
  event syntax error: './test_ill_program.o'
   \___ Failed to load program: Validate your program and 
check 'license'/'version' sections in your object
  SKIP

  # perf record -e ./test_kversion_nomatch_program.o ls
  event syntax error: './test_kversion_nomatch_program.o'
   \___ Failed to load program: Validate your program and 
check 'license'/'version' sections in your object
  SKIP

  # perf record -e ./test_big_program.o ls
  event syntax error: './test_big_program.o'
   \___ Failed to load program: Validate your program and 
check 'license'/'version' sections in your object
  SKIP

  In v2:

  # perf record -e ./test_ill_program.o ls
  event syntax error: './test_ill_program.o'
   \___ Kernel verifier blocks program loading
  SKIP

  # perf record -e ./test_kversion_nomatch_program.o
  event syntax error: './test_kversion_nomatch_program.o'
   \___ Incorrect kernel version
  SKIP
  (Will be further improved by following patches)

  # perf record -e ./test_big_program.o
  event syntax error: './test_big_program.o'
   \___ Program too big
  SKIP

Signed-off-by: Wang Nan 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446817783-86722-2-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/lib/bpf/libbpf.c | 159 -
 tools/lib/bpf/libbpf.h |  20 ++
 tools/perf/tests/llvm.c|   2 +-
 tools/perf/util/bpf-loader.c   |  33 +++--
 tools/perf/util/parse-events.c |   4 +-
 5 files changed, 159 insertions(+), 59 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 9f3c8cf9249b..07b492d3dfaa 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -61,6 +61,60 @@ void libbpf_set_print(libbpf_print_fn_t warn,
__pr_debug = debug;
 }
 
+#define STRERR_BUFSIZE  128
+
+#define ERRNO_OFFSET(e)((e) - __LIBBPF_ERRNO__START)
+#define ERRCODE_OFFSET(c)  ERRNO_OFFSET(LIBBPF_ERRNO__##c)
+#define NR_ERRNO   (__LIBBPF_ERRNO__END - __LIBBPF_ERRNO__START)
+
+static const char *libbpf_strerror_table[NR_ERRNO] = {
+   [ERRCODE_OFFSET(LIBELF)]= "Something wrong in libelf",
+   [ERRCODE_OFFSET(FORMAT)]= "BPF object format invalid",
+   [ERRCODE_OFFSET(KVERSION)]  = "'version' section incorrect or lost",
+   [ERRCODE_OFFSET(ENDIAN)]= "Endian missmatch",
+   [ERRCODE_OFFSET(INTERNAL)]  = "Internal error in libbpf",
+   [ERRCODE_OFFSET(RELOC)] = "Relocation failed",
+   [ERRCODE_OFFSET(VERIFY)]= "Kernel verifier blocks program 
loading",
+   [ERRCODE_OFFSET(PROG2BIG)]  = "Program too big",
+   [ERRCODE_OFFSET(KVER)]  = "Incorrect kernel version",
+};
+
+int libbpf_strerror(int err, char *buf, size_t size)
+{
+   if (!buf || !size)
+   return -1;
+
+   err = err > 0 ? err : -err;
+
+   if (err < __LIBBPF_ERRNO__START) {
+   int ret;
+
+   ret = strerror_r(err, buf, size);
+   buf[size - 1] = '\0';
+   return ret;
+   }
+
+   if (err < __LIBBPF_ERRNO__END) {
+   const char *msg;
+
+   msg = libbpf_strerror_table[ERRNO_OFFSET(err)];
+   snprintf(buf, size, "%s", msg);
+   buf[size - 1] = '\0';
+   return 0;
+   }
+
+   snprintf(buf, size, "Unknown libbpf error %d", err);
+   buf[size - 1] = '\0';
+   return -1;
+}
+
+#define CHECK_ERR(action, err, out) do {   \
+   err = action;   \
+   if (err)\
+   goto out;   \
+} while(0)
+
+
 /* Copied from tools/perf/util/util.h */
 #ifndef zfree
 # define zfree(ptr) 

[GIT PULL] liblockdep fixes for 4.4

2015-11-06 Thread Sasha Levin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Ingo,

Please pull three fixes for liblockdep. Just keeping up with kernel
code changes and new gcc versions.


Thanks,
Sasha

===

The following changes since commit 6a13feb9c82803e2b815eca72fa7a9f5561d7861:

  Linux 4.3 (2015-11-01 16:05:25 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux.git 
liblockdep-fixes

for you to fetch changes up to 2b62c2dbb902625f5c5a30c0209f261b1cf15a2a:

  tools/liblockdep: explicitly declare lockdep API we call from liblockdep 
(2015-11-06 16:01:37 -0500)

- 
Sasha Levin (3):
  tools/liblockdep: remove task argument from debug_check_no_locks_held
  tools/liblockdep: add userspace versions of WRITE_ONCE and 
RCU_INIT_POINTER
  tools/liblockdep: explicitly declare lockdep API we call from liblockdep

 tools/lib/lockdep/common.c| 2 +-
 tools/lib/lockdep/include/liblockdep/common.h | 2 ++
 tools/lib/lockdep/uinclude/linux/compiler.h   | 2 ++
 tools/lib/lockdep/uinclude/linux/lockdep.h| 3 ++-
 4 files changed, 7 insertions(+), 2 deletions(-)

-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBAgAGBQJWPRWnAAoJEN6mb/eXdyzcWLMP/iJshjLbujVUmZjhuwz2bC3D
BSQfr0ZlT7FyLpCpEEE4F9Wk46L5cSC3+RDGT/kAKamhD/cLL/X/JLSIFBOFIll2
Ka+Ipq/VG3qAqssus2S+JkCWJZJlKpfdp7DzBQUxU+TyarSG5Yc5FOPbIcqyFOBn
ZCTYziu/SNQ/Bmv0y+SYP2tcPRIF7VoXbgXKXHXiD10r6xHJHF7kFsHqPpfl9F2A
wOqHfl8j6ZxDvSvgdvXFK9ywHWsS2AJgk8Ebj0R6QRs37bR9LBONlBDD1g+m1hlY
WCquwndww/zZjGkb+PD/hD7ceJ/wiDslLkMsBHIYfPCuoqm/iJiOeZIqyhDFaijX
nnu0x76i21TccMN09h2oFHaBGAIsCwYkXcQSi5YZxSHAf+BwzVUK8wpfOPYljnc7
X2/Lh0qp+JdjqWzB4LR7um1BPtWVgdFxU5fTTT7idH0kBXs8uVFsL3L4WMeiL/H/
nraaeegIG/T8T7qvBhmfSv7pXrCxyd8qThe4gTcg5/89BbZl0fjq6ulg5l/Clei1
bJcOczut0aP0Qfc/bjQrXYpI7z5U/pmHMA1dlMsKXZTwpsB1vuj2QjbYjVg8VHLx
GRIeyDFkq/G21DQ3khPPE8zdOG4E3p0g9Js9phplbelnQb0UsmiRffpM16HboufS
STRBksKAITetI6aolOKB
=Ddfc
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/11] perf annotate: Inform the user about objdump failures in --stdio

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Andi Kleen 

When the browser fails to annotate it is difficult for users to find out
what went wrong.

Add some errors for objdump failures that are displayed in the UI.

Note it would be even better to handle these errors smarter, like
falling back to the binary when the debug info is somehow corrupted. But
for now just giving a better error is an improvement.

Committer note:

This works for --stdio, where errors just scroll by the screen:

  # perf annotate --stdio intel_idle
  Failure running objdump  --start-address=0x81418290 
--stop-address=0x814183ae -l -d --no-show-raw -S -C 
/root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1 
2>/dev/null|grep -v 
/root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1|expand
   Percent |  Source code & Disassembly of vmlinux for cycles:pp
  --

And with that one can use that command line to try to find out more about what
happened instead of getting a blank screen, an improvement.

We need tho to improve this further to get it to work with other UIs, like
--tui and --gtk, where it continues showing a blank screen, no messages, as
the pr_err() used is enough just for --stdio.

Signed-off-by: Andi Kleen 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1446779167-18949-1-git-send-email-a...@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/annotate.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 0fc8d7a2fea5..f2974da0185a 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1084,6 +1084,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, 
size_t privsize)
struct kcore_extract kce;
bool delete_extract = false;
int lineno = 0;
+   int nline;
 
if (filename)
symbol__join_symfs(symfs_filename, filename);
@@ -1179,6 +1180,9 @@ fallback:
 
ret = decompress_to_file(m.ext, symfs_filename, fd);
 
+   if (ret)
+   pr_err("Cannot decompress %s %s\n", m.ext, 
symfs_filename);
+
free(m.ext);
close(fd);
 
@@ -1204,13 +1208,25 @@ fallback:
pr_debug("Executing: %s\n", command);
 
file = popen(command, "r");
-   if (!file)
+   if (!file) {
+   pr_err("Failure running %s\n", command);
+   /*
+* If we were using debug info should retry with
+* original binary.
+*/
goto out_remove_tmp;
+   }
 
-   while (!feof(file))
+   nline = 0;
+   while (!feof(file)) {
if (symbol__parse_objdump_line(sym, map, file, privsize,
) < 0)
break;
+   nline++;
+   }
+
+   if (nline == 0)
+   pr_err("No output from %s\n", command);
 
/*
 * kallsyms does not have symbol sizes so there may a nop at the end.
-- 
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 v14 02/22] vfs: Add MAY_CREATE_FILE and MAY_CREATE_DIR permission flags

2015-11-06 Thread Andreas Dilger
On Nov 5, 2015, at 4:39 AM, Andreas Gruenbacher  wrote:
> 
> Richacls distinguish between creating non-directories and directories. To
> support that, add an isdir parameter to may_create(). When checking
> inode_permission() for create permission, pass in an additional
> MAY_CREATE_FILE or MAY_CREATE_DIR mask flag.
> 
> To allow checking for delete *and* create access when replacing an existing
> file via vfs_rename(), add a replace parameter to may_delete().

I thought you proposed adding an enum for these parameters, and possibly
making them a single parameter flag, to make the code in the caller more
readable.  Flags like below for example, though I'm not stuck on "MAY_IS"
as a prefix, just my first thought:

enum may_flags {
MAY_IS_FILE = 0x0,  /* Essentially !MAY_IS_DIR */
MAY_IS_DIR  = 0x1,  /* Operation only allowed on directory */
MAY_IS_REPLACE  = 0x2,  /* Operation only
};

would make it immediately clear what is being passed to the function.
Some examples inline below.  If Al hates it, fine, but having functions
with multiple "true, false" or "false, true" arguments is ugly and error
prone, IMHO.

> Signed-off-by: Andreas Gruenbacher 
> Reviewed-by: J. Bruce Fields 
> ---
> fs/namei.c | 43 +--
> include/linux/fs.h |  2 ++
> 2 files changed, 27 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 224ecf1..0259392 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -453,7 +453,9 @@ static int sb_permission(struct super_block *sb, struct 
> inode *inode, int mask)
>  * this, letting us set arbitrary permissions for filesystem access without
>  * changing the "normal" UIDs which are used for other things.
>  *
> - * When checking for MAY_APPEND, MAY_WRITE must also be set in @mask.
> + * MAY_WRITE must be set in @mask whenever MAY_APPEND, MAY_CREATE_FILE, or
> + * MAY_CREATE_DIR are set.  That way, file systems that don't support these
> + * permissions will check for MAY_WRITE instead.
>  */
> int inode_permission(struct inode *inode, int mask)
> {
> @@ -2549,10 +2551,11 @@ EXPORT_SYMBOL(__check_sticky);
>  * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
>  * nfs_async_unlink().
>  */
> -static int may_delete(struct inode *dir, struct dentry *victim, bool isdir)
> +static int may_delete(struct inode *dir, struct dentry *victim,
> +   bool isdir, bool replace)
> {
>   struct inode *inode = d_backing_inode(victim);
> - int error;
> + int error, mask = MAY_WRITE | MAY_EXEC;
> 
>   if (d_is_negative(victim))
>   return -ENOENT;
> @@ -2561,7 +2564,9 @@ static int may_delete(struct inode *dir, struct dentry 
> *victim, bool isdir)
>   BUG_ON(victim->d_parent->d_inode != dir);
>   audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
> 
> - error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
> + if (replace)
> + mask |= isdir ? MAY_CREATE_DIR : MAY_CREATE_FILE;
> + error = inode_permission(dir, mask);
>   if (error)
>   return error;
>   if (IS_APPEND(dir))
> @@ -2592,14 +2597,16 @@ static int may_delete(struct inode *dir, struct 
> dentry *victim, bool isdir)
>  *  3. We should have write and exec permissions on dir
>  *  4. We can't do it if dir is immutable (done in permission())
>  */
> -static inline int may_create(struct inode *dir, struct dentry *child)
> +static inline int may_create(struct inode *dir, struct dentry *child, bool 
> isdir)
> {
> + int mask = isdir ? MAY_CREATE_DIR : MAY_CREATE_FILE;
> +
>   audit_inode_child(dir, child, AUDIT_TYPE_CHILD_CREATE);
>   if (child->d_inode)
>   return -EEXIST;
>   if (IS_DEADDIR(dir))
>   return -ENOENT;
> - return inode_permission(dir, MAY_WRITE | MAY_EXEC);
> + return inode_permission(dir, MAY_WRITE | MAY_EXEC | mask);
> }
> 
> /*
> @@ -2649,7 +2656,7 @@ EXPORT_SYMBOL(unlock_rename);
> int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
>   bool want_excl)
> {
> - int error = may_create(dir, dentry);
> + int error = may_create(dir, dentry, false);

int error = may_create(dir, dentry, MAY_IS_FILE);

>   if (error)
>   return error;
> 
> @@ -3494,7 +3501,7 @@ EXPORT_SYMBOL(user_path_create);
> 
> int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t 
> dev)
> {
> - int error = may_create(dir, dentry);
> + int error = may_create(dir, dentry, false);
> 
>   if (error)
>   return error;
> @@ -3586,7 +3593,7 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, 
> umode_t, mode, unsigned, d
> 
> int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
> {
> - int error = may_create(dir, dentry);
> + int error = may_create(dir, dentry, true);

int error = may_create(dir, dentry, MAY_IS_DIR);

>   unsigned max_links = 

[PATCH 01/11] perf stat: Make stat options global

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Jiri Olsa 

So they can be used in perf stat record command in following patch.

Signed-off-by: Jiri Olsa 
Tested-by: Kan Liang 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1446734469-11352-2-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-stat.c | 163 +++---
 1 file changed, 82 insertions(+), 81 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index b74ee0f2e714..e77880b5094d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -122,6 +122,9 @@ static bool forever 
= false;
 static struct timespec ref_time;
 static struct cpu_map  *aggr_map;
 static aggr_get_id_t   aggr_get_id;
+static boolappend_file;
+static const char  *output_name;
+static int output_fd;
 
 static volatile int done = 0;
 
@@ -927,6 +930,67 @@ static int stat__set_big_num(const struct option *opt 
__maybe_unused,
return 0;
 }
 
+static const struct option stat_options[] = {
+   OPT_BOOLEAN('T', "transaction", _run,
+   "hardware transaction statistics"),
+   OPT_CALLBACK('e', "event", _list, "event",
+"event selector. use 'perf list' to list available events",
+parse_events_option),
+   OPT_CALLBACK(0, "filter", _list, "filter",
+"event filter", parse_filter),
+   OPT_BOOLEAN('i', "no-inherit", _inherit,
+   "child tasks do not inherit counters"),
+   OPT_STRING('p', "pid", , "pid",
+  "stat events on existing process id"),
+   OPT_STRING('t', "tid", , "tid",
+  "stat events on existing thread id"),
+   OPT_BOOLEAN('a', "all-cpus", _wide,
+   "system-wide collection from all CPUs"),
+   OPT_BOOLEAN('g', "group", ,
+   "put the counters into a counter group"),
+   OPT_BOOLEAN('c', "scale", _config.scale, "scale/normalize 
counters"),
+   OPT_INCR('v', "verbose", ,
+   "be more verbose (show counter open errors, etc)"),
+   OPT_INTEGER('r', "repeat", _count,
+   "repeat command and print average + stddev (max: 100, 
forever: 0)"),
+   OPT_BOOLEAN('n', "null", _run,
+   "null run - dont start any counters"),
+   OPT_INCR('d', "detailed", _run,
+   "detailed run - start a lot of events"),
+   OPT_BOOLEAN('S', "sync", _run,
+   "call sync() before starting a run"),
+   OPT_CALLBACK_NOOPT('B', "big-num", NULL, NULL,
+  "print large numbers with thousands\' separators",
+  stat__set_big_num),
+   OPT_STRING('C', "cpu", _list, "cpu",
+   "list of cpus to monitor in system-wide"),
+   OPT_SET_UINT('A', "no-aggr", _config.aggr_mode,
+   "disable CPU count aggregation", AGGR_NONE),
+   OPT_STRING('x', "field-separator", _sep, "separator",
+  "print counts with custom separator"),
+   OPT_CALLBACK('G', "cgroup", _list, "name",
+"monitor event in cgroup name only", parse_cgroups),
+   OPT_STRING('o', "output", _name, "file", "output file name"),
+   OPT_BOOLEAN(0, "append", _file, "append to the output file"),
+   OPT_INTEGER(0, "log-fd", _fd,
+   "log output to fd, instead of stderr"),
+   OPT_STRING(0, "pre", _cmd, "command",
+   "command to run prior to the measured command"),
+   OPT_STRING(0, "post", _cmd, "command",
+   "command to run after to the measured command"),
+   OPT_UINTEGER('I', "interval-print", _config.interval,
+   "print counts at regular interval in ms (>= 10)"),
+   OPT_SET_UINT(0, "per-socket", _config.aggr_mode,
+"aggregate counts per processor socket", AGGR_SOCKET),
+   OPT_SET_UINT(0, "per-core", _config.aggr_mode,
+"aggregate counts per physical processor core", AGGR_CORE),
+   OPT_SET_UINT(0, "per-thread", _config.aggr_mode,
+"aggregate counts per thread", AGGR_THREAD),
+   OPT_UINTEGER('D', "delay", _delay,
+"ms to wait before starting measurement after program 
start"),
+   OPT_END()
+};
+
 static int perf_stat__get_socket(struct cpu_map *map, int cpu)
 {
return cpu_map__get_socket(map, cpu, NULL);
@@ -1174,69 +1238,6 @@ static int add_default_attributes(void)
 
 int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
 {
-   bool append_file = false;
-   int output_fd = 0;
-   const char *output_name = NULL;
-   const struct option options[] = {
-   OPT_BOOLEAN('T', "transaction", _run,
-   "hardware transaction statistics"),
-  

[PATCH 03/11] perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Masami Hiramatsu 

In find_perf_probe_point_from_map(), the 'ret' variable is initialized
with -ENOENT but overwritten by the return code of
kernel_get_symbol_address_by_name(), and after that it is re-initialized
with -ENOENT again.

Setting ret=-ENOENT twice looks a bit redundant. This avoids the
overwriting and just returns -ENOENT if some error happens to simplify
the code.

Signed-off-by: Masami Hiramatsu 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Wang Nan 
Cc: Zefan Li 
Link: http://lkml.kernel.org/n/tip-ufp1zgbktzmttcputozne...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/probe-event.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e659c4faddec..03875f9154e7 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1895,9 +1895,8 @@ static int find_perf_probe_point_from_map(struct 
probe_trace_point *tp,
sym = map__find_symbol(map, addr, NULL);
} else {
if (tp->symbol && !addr) {
-   ret = kernel_get_symbol_address_by_name(tp->symbol,
-   , true, false);
-   if (ret < 0)
+   if (kernel_get_symbol_address_by_name(tp->symbol,
+   , true, false) < 0)
goto out;
}
if (addr) {
@@ -1906,8 +1905,6 @@ static int find_perf_probe_point_from_map(struct 
probe_trace_point *tp,
}
}
 
-   /* ret may has be overwritten so reset it */
-   ret = -ENOENT;
if (!sym)
goto out;
 
-- 
2.1.0

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


[PATCH 11/11] perf test: Do not be case sensitive when searching for matching tests

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo 

Before:

  # perf test llvm
  # perf test LLVM
  35: Test LLVM searching and compiling: Ok
  #

After

  # perf test llvm
  35: Test LLVM searching and compiling: Ok
  #

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-c1u05npqbf6epse17ovfe...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/builtin-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 7b0120abc137..80c442eab767 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -196,7 +196,7 @@ static bool perf_test__matches(struct test *test, int curr, 
int argc, const char
continue;
}
 
-   if (strstr(test->desc, argv[i]))
+   if (strcasestr(test->desc, argv[i]))
return true;
}
 
-- 
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/


[GIT PULL 00/11] perf/core improvements and fixes

2015-11-06 Thread Arnaldo Carvalho de Melo
Hi Ingo,

Please consider pulling, this is on top of the perf-core-for-mingo tag,
that is outstanding.

Best regards,

- Arnaldo

The following changes since commit 0014de172d228e450377d1fd079d94e67128d27f:

  perf sched latency: Fix thread pid reuse issue (2015-11-05 12:51:00 -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-2

for you to fetch changes up to 345c99a303e1d97b407bf99190314a878d59ca92:

  perf test: Do not be case sensitive when searching for matching tests 
(2015-11-06 17:50:04 -0300)


perf/core improvements and fixes:

- libbpf error reporting improvements, using a strerror interface to
  more precisely tell the user about problems with the provided
  scriptlet, be it in C or as a ready made object file (Wang Nan)

- Do not be case sensitive when searching for matching 'perf test'
  entries (Arnaldo Carvalho de Melo)

- Inform the user about objdump failures in 'perf annotate' (Andi Kleen)

Infrastructure:

- Improve the LLVM 'perf test' entry, introduce new ones for
  BPF and kbuild to check the environment used by clang to
  compile .c scriptlets (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo 


Andi Kleen (1):
  perf annotate: Inform the user about objdump failures in --stdio

Arnaldo Carvalho de Melo (1):
  perf test: Do not be case sensitive when searching for matching tests

Jiri Olsa (1):
  perf stat: Make stat options global

Masami Hiramatsu (1):
  perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy

Wang Nan (7):
  bpf tools: Improve libbpf error reporting
  bpf tools: Add new API bpf_object__get_kversion()
  perf tools: Make fetch_kernel_version() publicly available
  perf bpf: Improve BPF related error messages
  perf test: Enhance the LLVM test: update basic BPF test program
  perf test: Enhance the LLVM tests: add kbuild test
  perf test: Add 'perf test BPF'

 tools/lib/bpf/libbpf.c| 167 +---
 tools/lib/bpf/libbpf.h|  21 +++
 tools/perf/builtin-stat.c | 163 +++
 tools/perf/tests/Build|  17 ++-
 tools/perf/tests/bpf-script-example.c |   4 +
 tools/perf/tests/bpf-script-test-kbuild.c |  21 +++
 tools/perf/tests/bpf.c| 209 ++
 tools/perf/tests/builtin-test.c   |   6 +-
 tools/perf/tests/llvm.c   | 137 +++-
 tools/perf/tests/llvm.h   |  18 +++
 tools/perf/tests/tests.h  |   1 +
 tools/perf/util/annotate.c|  20 ++-
 tools/perf/util/bpf-loader.c  | 139 +---
 tools/perf/util/bpf-loader.h  |  33 +
 tools/perf/util/llvm-utils.c  |  49 +++
 tools/perf/util/parse-events.c|  11 +-
 tools/perf/util/probe-event.c |   7 +-
 tools/perf/util/util.c|  30 +
 tools/perf/util/util.h|   8 ++
 19 files changed, 836 insertions(+), 225 deletions(-)
 create mode 100644 tools/perf/tests/bpf-script-test-kbuild.c
 create mode 100644 tools/perf/tests/bpf.c
 create mode 100644 tools/perf/tests/llvm.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/11] perf test: Enhance the LLVM test: update basic BPF test program

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

This patch replaces the original toy BPF program with the previously
introduced bpf-script-example.c. Dynamically embeddeding it into
'llvm-src-base.c'.

The newly introduced BPF program attaches a BPF program to
'sys_epoll_pwait()'. perf itself never use that syscall, so further test
can verify their result with it. The program would generate 1 sample in
every 2 calls of epoll_pwait() system call.

Since the resulting BPF object is useful per se for further tests,
test_llvm__fetch_bpf_obj() is introduced for creating BPF objects from
source. The LLVM test was rewritten to use it.

Committer note:

Running it:

  [root@zoo wb]# perf test -v LLVM
  35: Test LLVM searching and compiling:
  --- start ---
  test child forked, pid 17740
  Kernel build dir is set to /lib/modules/4.3.0-rc1+/build
  set env: KBUILD_DIR=/lib/modules/4.3.0-rc1+/build
  unset env: KBUILD_OPTS
  include option is set to  -nostdinc -isystem 
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include 
-I/home/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi 
-Iarch/x86/include/generated  -I/home/git/linux/include -Iinclude 
-I/home/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi 
-I/home/git/linux/include/uapi -Iinclude/generated/uapi -include 
/home/git/linux/include/linux/kconfig.h
  set env: NR_CPUS=4
  set env: LINUX_VERSION_CODE=0x40300
  set env: CLANG_EXEC=/usr/libexec/icecc/bin/clang
  set env: CLANG_OPTIONS=-xc
  set env: KERNEL_INC_OPTIONS= -nostdinc -isystem 
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/include 
-I/home/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi 
-Iarch/x86/include/generated  -I/home/git/linux/include -Iinclude 
-I/home/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi 
-I/home/git/linux/include/uapi -Iinclude/generated/uapi -include 
/home/git/linux/include/linux/kconfig.h
  set env: WORKING_DIR=/lib/modules/4.3.0-rc1+/build
  set env: CLANG_SOURCE=-
  llvm compiling command template: echo '/*
   * bpf-script-example.c
   * Test basic LLVM building
   */
  #ifndef LINUX_VERSION_CODE
  # error Need LINUX_VERSION_CODE
  # error Example: for 4.2 kernel, put 
'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
  #endif
  #define BPF_ANY 0
  #define BPF_MAP_TYPE_ARRAY 2
  #define BPF_FUNC_map_lookup_elem 1
  #define BPF_FUNC_map_update_elem 2

  static void *(*bpf_map_lookup_elem)(void *map, void *key) =
  (void *) BPF_FUNC_map_lookup_elem;
  static void *(*bpf_map_update_elem)(void *map, void *key, void *value, int 
flags) =
  (void *) BPF_FUNC_map_update_elem;

  struct bpf_map_def {
  unsigned int type;
  unsigned int key_size;
  unsigned int value_size;
  unsigned int max_entries;
  };

  #define SEC(NAME) __attribute__((section(NAME), used))
  struct bpf_map_def SEC("maps") flip_table = {
  .type = BPF_MAP_TYPE_ARRAY,
  .key_size = sizeof(int),
  .value_size = sizeof(int),
  .max_entries = 1,
  };

  SEC("func=sys_epoll_pwait")
  int bpf_func__sys_epoll_pwait(void *ctx)
  {
  int ind =0;
  int *flag = bpf_map_lookup_elem(_table, );
  int new_flag;
  if (!flag)
  return 0;
  /* flip flag and store back */
  new_flag = !*flag;
  bpf_map_update_elem(_table, , _flag, BPF_ANY);
  return new_flag;
  }
  char _license[] SEC("license") = "GPL";
  int _version SEC("version") = LINUX_VERSION_CODE;
  ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS 
-DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS 
-Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c 
"$CLANG_SOURCE" -target bpf -O2 -o -
  test child finished with 0
   end 
  Test LLVM searching and compiling: Ok
  [root@zoo wb]#

Signed-off-by: Wang Nan 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446817783-86722-6-git-send-email-wangn...@huawei.com
Signed-off-by: He Kuang 
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/Build|   9 ++-
 tools/perf/tests/bpf-script-example.c |   4 ++
 tools/perf/tests/llvm.c   | 131 ++
 tools/perf/tests/llvm.h   |  16 +
 4 files changed, 129 insertions(+), 31 deletions(-)
 create mode 100644 tools/perf/tests/llvm.h

diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 50de2253cff6..6c095b3d92a9 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -31,9 +31,16 @@ perf-y += sample-parsing.o
 perf-y += parse-no-sample-id-all.o
 perf-y += kmod-path.o
 perf-y += thread-map.o
-perf-y += llvm.o
+perf-y += llvm.o llvm-src-base.o
 perf-y += topology.o
 
+$(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
+   $(call rule_mkdir)
+   $(Q)echo '#include ' > $@
+   $(Q)echo 'const char 

[PATCH 10/11] perf test: Add 'perf test BPF'

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

This patch adds BPF testcase for testing BPF event filtering.

By utilizing the result of 'perf test LLVM', this patch compiles the
eBPF sample program then test its ability. The BPF script in 'perf test
LLVM' lets only 50% samples generated by epoll_pwait() to be captured.
This patch runs that system call for 111 times, so the result should
contain 56 samples.

Signed-off-by: Wang Nan 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Alexei Starovoitov 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446817783-86722-8-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/Build  |   1 +
 tools/perf/tests/bpf.c  | 209 
 tools/perf/tests/builtin-test.c |   4 +
 tools/perf/tests/tests.h|   1 +
 tools/perf/util/bpf-loader.c|  24 -
 tools/perf/util/bpf-loader.h|  10 ++
 6 files changed, 248 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/tests/bpf.c

diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index a47b21193fb2..f41ebf8849fe 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -32,6 +32,7 @@ perf-y += parse-no-sample-id-all.o
 perf-y += kmod-path.o
 perf-y += thread-map.o
 perf-y += llvm.o llvm-src-base.o llvm-src-kbuild.o
+perf-y += bpf.o
 perf-y += topology.o
 
 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
new file mode 100644
index ..ec16f7812c8b
--- /dev/null
+++ b/tools/perf/tests/bpf.c
@@ -0,0 +1,209 @@
+#include 
+#include 
+#include 
+#include 
+#include "tests.h"
+#include "llvm.h"
+#include "debug.h"
+#define NR_ITERS   111
+
+#ifdef HAVE_LIBBPF_SUPPORT
+
+static int epoll_pwait_loop(void)
+{
+   int i;
+
+   /* Should fail NR_ITERS times */
+   for (i = 0; i < NR_ITERS; i++)
+   epoll_pwait(-(i + 1), NULL, 0, 0, NULL);
+   return 0;
+}
+
+static struct {
+   enum test_llvm__testcase prog_id;
+   const char *desc;
+   const char *name;
+   const char *msg_compile_fail;
+   const char *msg_load_fail;
+   int (*target_func)(void);
+   int expect_result;
+} bpf_testcase_table[] = {
+   {
+   LLVM_TESTCASE_BASE,
+   "Test basic BPF filtering",
+   "[basic_bpf_test]",
+   "fix 'perf test LLVM' first",
+   "load bpf object failed",
+   _pwait_loop,
+   (NR_ITERS + 1) / 2,
+   },
+};
+
+static int do_test(struct bpf_object *obj, int (*func)(void),
+  int expect)
+{
+   struct record_opts opts = {
+   .target = {
+   .uid = UINT_MAX,
+   .uses_mmap = true,
+   },
+   .freq = 0,
+   .mmap_pages   = 256,
+   .default_interval = 1,
+   };
+
+   char pid[16];
+   char sbuf[STRERR_BUFSIZE];
+   struct perf_evlist *evlist;
+   int i, ret = TEST_FAIL, err = 0, count = 0;
+
+   struct parse_events_evlist parse_evlist;
+   struct parse_events_error parse_error;
+
+   bzero(_error, sizeof(parse_error));
+   bzero(_evlist, sizeof(parse_evlist));
+   parse_evlist.error = _error;
+   INIT_LIST_HEAD(_evlist.list);
+
+   err = parse_events_load_bpf_obj(_evlist, _evlist.list, obj);
+   if (err || list_empty(_evlist.list)) {
+   pr_debug("Failed to add events selected by BPF\n");
+   if (!err)
+   return TEST_FAIL;
+   }
+
+   snprintf(pid, sizeof(pid), "%d", getpid());
+   pid[sizeof(pid) - 1] = '\0';
+   opts.target.tid = opts.target.pid = pid;
+
+   /* Instead of perf_evlist__new_default, don't add default events */
+   evlist = perf_evlist__new();
+   if (!evlist) {
+   pr_debug("No ehough memory to create evlist\n");
+   return TEST_FAIL;
+   }
+
+   err = perf_evlist__create_maps(evlist, );
+   if (err < 0) {
+   pr_debug("Not enough memory to create thread/cpu maps\n");
+   goto out_delete_evlist;
+   }
+
+   perf_evlist__splice_list_tail(evlist, _evlist.list);
+   evlist->nr_groups = parse_evlist.nr_groups;
+
+   perf_evlist__config(evlist, );
+
+   err = perf_evlist__open(evlist);
+   if (err < 0) {
+   pr_debug("perf_evlist__open: %s\n",
+strerror_r(errno, sbuf, sizeof(sbuf)));
+   goto out_delete_evlist;
+   }
+
+   err = perf_evlist__mmap(evlist, opts.mmap_pages, false);
+   if (err < 0) {
+   pr_debug("perf_evlist__mmap: %s\n",
+strerror_r(errno, sbuf, sizeof(sbuf)));
+   goto out_delete_evlist;
+   }
+
+   perf_evlist__enable(evlist);
+   (*func)();
+   perf_evlist__disable(evlist);
+
+   for (i = 

[PATCH 06/11] perf tools: Make fetch_kernel_version() publicly available

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

There are 2 places in llvm-utils.c which find kernel version information
through uname. This patch extracts the uname related code into a
fetch_kernel_version() function and puts it into util.h so it can be
reused.

Signed-off-by: Wang Nan 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446818135-87310-1-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/llvm-utils.c | 49 +++-
 tools/perf/util/util.c   | 30 +++
 tools/perf/util/util.h   |  3 +++
 3 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c
index 8ee25bea1b24..00724d496d38 100644
--- a/tools/perf/util/llvm-utils.c
+++ b/tools/perf/util/llvm-utils.c
@@ -4,7 +4,6 @@
  */
 
 #include 
-#include 
 #include "util.h"
 #include "debug.h"
 #include "llvm-utils.h"
@@ -216,18 +215,19 @@ static int detect_kbuild_dir(char **kbuild_dir)
const char *suffix_dir = "";
 
char *autoconf_path;
-   struct utsname utsname;
 
int err;
 
if (!test_dir) {
-   err = uname();
-   if (err) {
-   pr_warning("uname failed: %s\n", strerror(errno));
+   /* _UTSNAME_LENGTH is 65 */
+   char release[128];
+
+   err = fetch_kernel_version(NULL, release,
+  sizeof(release));
+   if (err)
return -EINVAL;
-   }
 
-   test_dir = utsname.release;
+   test_dir = release;
prefix_dir = "/lib/modules/";
suffix_dir = "/build";
}
@@ -325,38 +325,18 @@ get_kbuild_opts(char **kbuild_dir, char 
**kbuild_include_opts)
pr_debug("include option is set to %s\n", *kbuild_include_opts);
 }
 
-static unsigned long
-fetch_kernel_version(void)
-{
-   struct utsname utsname;
-   int version, patchlevel, sublevel, err;
-
-   if (uname())
-   return 0;
-
-   err = sscanf(utsname.release, "%d.%d.%d",
-, , );
-
-   if (err != 3) {
-   pr_debug("Unablt to get kernel version from uname '%s'\n",
-utsname.release);
-   return 0;
-   }
-
-   return (version << 16) + (patchlevel << 8) + sublevel;
-}
-
 int llvm__compile_bpf(const char *path, void **p_obj_buf,
  size_t *p_obj_buf_sz)
 {
+   size_t obj_buf_sz;
+   void *obj_buf = NULL;
int err, nr_cpus_avail;
-   char clang_path[PATH_MAX], nr_cpus_avail_str[64];
+   unsigned int kernel_version;
char linux_version_code_str[64];
const char *clang_opt = llvm_param.clang_opt;
-   const char *template = llvm_param.clang_bpf_cmd_template;
+   char clang_path[PATH_MAX], nr_cpus_avail_str[64];
char *kbuild_dir = NULL, *kbuild_include_opts = NULL;
-   void *obj_buf = NULL;
-   size_t obj_buf_sz;
+   const char *template = llvm_param.clang_bpf_cmd_template;
 
if (!template)
template = CLANG_BPF_CMD_DEFAULT_TEMPLATE;
@@ -388,8 +368,11 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf,
snprintf(nr_cpus_avail_str, sizeof(nr_cpus_avail_str), "%d",
 nr_cpus_avail);
 
+   if (fetch_kernel_version(_version, NULL, 0))
+   kernel_version = 0;
+
snprintf(linux_version_code_str, sizeof(linux_version_code_str),
-"0x%lx", fetch_kernel_version());
+"0x%x", kernel_version);
 
force_set_env("NR_CPUS", nr_cpus_avail_str);
force_set_env("LINUX_VERSION_CODE", linux_version_code_str);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index cd12c25e4ea4..47b1e36c7ea0 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -3,6 +3,7 @@
 #include "debug.h"
 #include 
 #include 
+#include 
 #ifdef HAVE_BACKTRACE_SUPPORT
 #include 
 #endif
@@ -665,3 +666,32 @@ bool find_process(const char *name)
closedir(dir);
return ret ? false : true;
 }
+
+int
+fetch_kernel_version(unsigned int *puint, char *str,
+size_t str_size)
+{
+   struct utsname utsname;
+   int version, patchlevel, sublevel, err;
+
+   if (uname())
+   return -1;
+
+   if (str && str_size) {
+   strncpy(str, utsname.release, str_size);
+   str[str_size - 1] = '\0';
+   }
+
+   err = sscanf(utsname.release, "%d.%d.%d",
+, , );
+
+   if (err != 3) {
+   pr_debug("Unablt to get kernel version from uname '%s'\n",
+utsname.release);
+   return -1;
+   }
+
+   if (puint)
+   *puint = (version << 16) + (patchlevel << 8) + sublevel;
+   return 0;
+}
diff --git a/tools/perf/util/util.h 

Re: [RFC 2/3] pinctrl: e3xx: Adding support for NI Ettus Research USRP E3xx pinconf

2015-11-06 Thread Andy Shevchenko
On Fri, Nov 6, 2015 at 1:41 AM, Moritz Fischer  wrote:
> The USRP E3XX series requires pinctrl to configure the idle state
> FPGA image for minimizing power consumption.
> This is required since different daughtercards have different uses
> for pins on a common connector.

> +#include 

+ empty line?

> +#include "pinctrl-utils.h"
> +#include "core.h"

> +static int e3xx_pinconf_cfg_get(struct pinctrl_dev *pctldev,
> +   unsigned pin,
> +   unsigned long *config)
> +{
> +   u32 reg, mask;
> +   int arg;
> +   struct e3xx_pinctrl *pctrl;
> +   unsigned int param;
> +
> +   param = pinconf_to_config_param(*config);
> +   pctrl = pinctrl_dev_get_drvdata(pctldev);
> +
> +   if (pin >= E3XX_NUM_DB_PINS)
> +   return -ENOTSUPP;
> +
> +   mask = BIT(pin % E3XX_PINS_PER_REG);
> +
> +   switch (param) {
> +   case PIN_CONFIG_OUTPUT:
> +   clk_enable(pctrl->clk);
> +   reg = e3xx_pinctrl_read(pctrl, E3XX_DDR_OFFSET +
> +   (pin / E3XX_PINS_PER_REG) * 4);
> +
> +   clk_disable(pctrl->clk);
> +   arg = !!(reg & mask);

So, for now arg variable seems redundant, you may use expression
inside call below.

> +   break;
> +   default:
> +   dev_err(pctrl->dev, "requested illegal configuration");
> +   return -ENOTSUPP;
> +   };
> +
> +   *config = pinconf_to_config_packed(param, arg);
> +
> +   return 0;
> +}
> +
> +static int e3xx_pinconf_cfg_set(struct pinctrl_dev *pctldev,
> +   unsigned pin,
> +   unsigned long *configs,
> +   unsigned num_configs)
> +{
> +   u32 reg, mask;
> +   int i;

unsigned

> +   struct e3xx_pinctrl *pctrl;
> +   unsigned int param, arg;
> +
> +   if (pin >= E3XX_NUM_DB_PINS)
> +   return -ENOTSUPP;
> +   mask = BIT(pin % E3XX_PINS_PER_REG);
> +
> +   pctrl = pinctrl_dev_get_drvdata(pctldev);
> +
> +   clk_enable(pctrl->clk);
> +
> +   for (i = 0; i < num_configs; i++) {
> +   param = pinconf_to_config_param(configs[i]);
> +   arg = pinconf_to_config_argument(configs[i]);
> +
> +   switch (param) {
> +   case PIN_CONFIG_OUTPUT:
> +   /* deal with value, set out bit if arg is 1 */
> +   reg = e3xx_pinctrl_read(pctrl, E3XX_OUT_OFFSET +
> +   ((pin / E3XX_PINS_PER_REG) * 
> 4))
> +   ;

Why not one the previous line?

> +   reg &= ~mask;
> +   if (arg)
> +   reg |= mask;



> +
> +   /* addresses need to be 4 byte aligned */
> +   e3xx_pinctrl_write(pctrl, E3XX_OUT_OFFSET +
> +  ((pin / E3XX_PINS_PER_REG) * 4), 
> reg)
> +   ;
> +
> +   /* set ddr bit to high for output */
> +   reg = e3xx_pinctrl_read(pctrl, E3XX_DDR_OFFSET +
> +   ((pin / E3XX_PINS_PER_REG) * 
> 4))
> +   ;

Ditto.

> +   reg |= mask;
> +
> +   /* addresses need to be 4 byte aligned */
> +   e3xx_pinctrl_write(pctrl, E3XX_DDR_OFFSET +
> + ((pin / E3XX_PINS_PER_REG) * 4), 
> reg);
> +   break;
> +
> +   default:
> +   clk_disable(pctrl->clk);
> +   return -ENOTSUPP;
> +   };
> +   }
> +
> +   clk_disable(pctrl->clk);
> +
> +   return 0;
> +}
> +
> +static int e3xx_pinconf_group_set(struct pinctrl_dev *pctldev,
> + unsigned selector,
> + unsigned long *configs,
> + unsigned num_configs)
> +{
> +   return -EAGAIN;
> +}
> +
> +static const struct pinconf_ops e3xx_pinconf_ops = {
> +   .is_generic = true,
> +   .pin_config_get = e3xx_pinconf_cfg_get,
> +   .pin_config_set = e3xx_pinconf_cfg_set,
> +   .pin_config_group_set = e3xx_pinconf_group_set,
> +};
> +
> +static struct pinctrl_desc e3xx_desc = {
> +   .name = "e3xx_pinctrl",
> +   .pins = e3xx_pins,
> +   .npins = ARRAY_SIZE(e3xx_pins),
> +   .pctlops = _pctrl_ops,
> +   .confops = _pinconf_ops,
> +   .owner = THIS_MODULE,
> +};
> +
> +static int e3xx_pinctrl_probe(struct platform_device *pdev)
> +{
> +   struct resource *res;
> +   struct e3xx_pinctrl *pctrl;
> +   int err;
> +
> +   pctrl = devm_kzalloc(>dev, sizeof(*pctrl), GFP_KERNEL);
> +   if (!pctrl)
> +   return -ENOMEM;
> +   pctrl->dev = >dev;
> 

[PATCH 05/11] bpf tools: Add new API bpf_object__get_kversion()

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

bpf_object__get_kversion() can be used to fetch value of object's
'version' section. Following patch will use it for error reporting.

Signed-off-by: Wang Nan 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446817783-86722-3-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/lib/bpf/libbpf.c | 8 
 tools/lib/bpf/libbpf.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 07b492d3dfaa..e176bad19bcb 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1055,6 +1055,14 @@ bpf_object__get_name(struct bpf_object *obj)
return obj->path;
 }
 
+unsigned int
+bpf_object__get_kversion(struct bpf_object *obj)
+{
+   if (!obj)
+   return 0;
+   return obj->kern_version;
+}
+
 struct bpf_program *
 bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
 {
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 30a40e9fa503..c9a9aef2806c 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -56,6 +56,7 @@ void bpf_object__close(struct bpf_object *object);
 int bpf_object__load(struct bpf_object *obj);
 int bpf_object__unload(struct bpf_object *obj);
 const char *bpf_object__get_name(struct bpf_object *obj);
+unsigned int bpf_object__get_kversion(struct bpf_object *obj);
 
 struct bpf_object *bpf_object__next(struct bpf_object *prev);
 #define bpf_object__for_each_safe(pos, tmp)\
-- 
2.1.0

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


[PATCH 09/11] perf test: Enhance the LLVM tests: add kbuild test

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

This patch adds a kbuild testcase to check whether kernel headers can be
correctly found.

For example:
  # mv /lib/modules/4.3.0-rc5{,.bak}
  # perf test LLVM

38: Test LLVM searching and compiling: Skip

  # perf test -v LLVM
  ...
  :11:10: fatal error: 'uapi/linux/fs.h' file not found
  #include 
  ^
  1 error generated.
  ERROR:unable to compile -
  Hint: Check error message shown above.
  Hint: You can also pre-compile it into .o using:
 clang -target bpf -O2 -c -
 with proper -I and -D options.
  Failed to compile test case: 'Test kbuild searching'
  test child finished with -2

Signed-off-by: Wang Nan 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446817783-86722-7-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/Build|  9 -
 tools/perf/tests/bpf-script-test-kbuild.c | 21 +
 tools/perf/tests/llvm.c   |  4 
 tools/perf/tests/llvm.h   |  2 ++
 4 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/tests/bpf-script-test-kbuild.c

diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 6c095b3d92a9..a47b21193fb2 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -31,7 +31,7 @@ perf-y += sample-parsing.o
 perf-y += parse-no-sample-id-all.o
 perf-y += kmod-path.o
 perf-y += thread-map.o
-perf-y += llvm.o llvm-src-base.o
+perf-y += llvm.o llvm-src-base.o llvm-src-kbuild.o
 perf-y += topology.o
 
 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
@@ -41,6 +41,13 @@ $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c
$(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@
$(Q)echo ';' >> $@
 
+$(OUTPUT)tests/llvm-src-kbuild.c: tests/bpf-script-test-kbuild.c
+   $(call rule_mkdir)
+   $(Q)echo '#include ' > $@
+   $(Q)echo 'const char test_llvm__bpf_test_kbuild_prog[] =' >> $@
+   $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@
+   $(Q)echo ';' >> $@
+
 ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 endif
diff --git a/tools/perf/tests/bpf-script-test-kbuild.c 
b/tools/perf/tests/bpf-script-test-kbuild.c
new file mode 100644
index ..3626924740d8
--- /dev/null
+++ b/tools/perf/tests/bpf-script-test-kbuild.c
@@ -0,0 +1,21 @@
+/*
+ * bpf-script-test-kbuild.c
+ * Test include from kernel header
+ */
+#ifndef LINUX_VERSION_CODE
+# error Need LINUX_VERSION_CODE
+# error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" 
into llvm section of ~/.perfconfig'
+#endif
+#define SEC(NAME) __attribute__((section(NAME), used))
+
+#include 
+#include 
+
+SEC("func=vfs_llseek")
+int bpf_func__vfs_llseek(void *ctx)
+{
+   return 0;
+}
+
+char _license[] SEC("license") = "GPL";
+int _version SEC("version") = LINUX_VERSION_CODE;
diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c
index 05683c5f183e..bc4cf507cde5 100644
--- a/tools/perf/tests/llvm.c
+++ b/tools/perf/tests/llvm.c
@@ -40,6 +40,10 @@ static struct {
.source = test_llvm__bpf_base_prog,
.desc = "Basic BPF llvm compiling test",
},
+   [LLVM_TESTCASE_KBUILD] = {
+   .source = test_llvm__bpf_test_kbuild_prog,
+   .desc = "Test kbuild searching",
+   },
 };
 
 
diff --git a/tools/perf/tests/llvm.h b/tools/perf/tests/llvm.h
index bd63cee687b5..d91d8f44efee 100644
--- a/tools/perf/tests/llvm.h
+++ b/tools/perf/tests/llvm.h
@@ -5,9 +5,11 @@
 #include  /* for bool */
 
 extern const char test_llvm__bpf_base_prog[];
+extern const char test_llvm__bpf_test_kbuild_prog[];
 
 enum test_llvm__testcase {
LLVM_TESTCASE_BASE,
+   LLVM_TESTCASE_KBUILD,
__LLVM_TESTCASE_MAX,
 };
 
-- 
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.2 011/110] iwlwifi: mvm: flush fw_dump_wk when mvm fails to start

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Andrei Otcheretianski 

commit dbf73d4a8bb8f4e1d1f3edd3be825692279e2ef3 upstream.

FW dump may be triggered when running init ucode, for example due to a
sysassert. In this case fw_dump_wk may run after mvm is freed, resulting
in a kernel panic.
Fix it by flushing the work.

Fixes: 01b988a708af ("iwlwifi: mvm: allow to collect debug data when restart is 
disabled")
Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/ops.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -582,6 +582,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *
ieee80211_unregister_hw(mvm->hw);
iwl_mvm_leds_exit(mvm);
  out_free:
+   flush_delayed_work(>fw_dump_wk);
iwl_phy_db_free(mvm->phy_db);
kfree(mvm->scan_cmd);
if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.1 11/86] iommu/amd: Fix BUG when faulting a PROT_NONE VMA

2015-11-06 Thread Linus Torvalds
On Fri, Nov 6, 2015 at 12:49 PM, Linus Torvalds
 wrote:
>
> And some "handle_mm_fault would BUG_ON()" comment is just bogus. It's
> not handle_mm_fault()'s case that you called it without checking
> proper permissions.

Side note: as to why handle_mm_fault() doesn't just do things itself,
there's a historical situation where we used to let people do things
in ptrace() that they couldn't do directly, and punch through
protections (and turn shared read-only pages into a dirty private
page).

So the permissions checking was up to the caller, because some callers
could do things that other callers could not.

I *think* we have gotten rid of all those cases, and I guess we could
consider just making handle_mm_fault() itself stricter. But that's the
historical background on why callers need to check this.

Adding linux-mm to the cc, to see if anybody there has some comments
wrt just moving all the EFAULT handling into handle_mm_fault() and
relaxing the caller requirements.

   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] ASoC: wm9713: add gpio chip

2015-11-06 Thread Robert Jarzmik
Lee Jones  writes:

> On Fri, 06 Nov 2015, Charles Keepax wrote:
>
>> On Fri, Nov 06, 2015 at 09:29:13AM +, Lee Jones wrote:
>> > On Wed, 04 Nov 2015, Robert Jarzmik wrote:
>> > 
>> > > Charles Keepax  writes:
>> > > 
>> > > > On Wed, Nov 04, 2015 at 06:12:44PM +0100, Robert Jarzmik wrote:
>> > > >> The Wolfson WM9713 provides 8 GPIOs. If the gpiolib is compiled in the
>> > > >> kernel, declare a gpio chip.
>> > > >> 
>> > > >> Signed-off-by: Robert Jarzmik 
>> 
>> Apologies Lee, we are discussing a patch that adds a GPIO driver
>> into an AC97 CODEC. I had suggested that perhaps we should put
>> the GPIO driver as a seperate driver under GPIO and link the two
>> with an MFD. But Mark has already replied in the thread to say
>> that he doesn't think that will be necessary. Although he did
>> raise some concerns that perhaps it could be done more generally
>> as it should apply to other AC97 CODECs as well.
>> 
>> So I think you can probably safely ignore this for now, sorry
>> for the noise.

Ok, so where I should target this code at ? Should this land in
sound/soc/soc-ac97.c ? Or somewhere else ? I'd like to see where you think the
init_gpio() and free_gpio() should be put.

Cheers.

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


[PATCH 07/11] perf bpf: Improve BPF related error messages

2015-11-06 Thread Arnaldo Carvalho de Melo
From: Wang Nan 

A series of bpf loader related error codes were introduced to help error
reporting. Functions were improved to return these new error codes.

Functions which return pointers were adjusted to encode error codes into
return value using the ERR_PTR() interface.

bpf_loader_strerror() was improved to convert these error messages to
strings. It checks the error codes and calls libbpf_strerror() and
strerror_r() accordingly, so caller don't need to consider checking the
range of the error code.

In bpf__strerror_load(), print kernel version of running kernel and the
object's 'version' section to notify user how to fix his/her program.

v1 -> v2:
 Use macro for error code.

 Fetch error message based on array index, eliminate for-loop.

 Print version strings.

Before:

  # perf record -e ./test_kversion_nomatch_program.o sleep 1
  event syntax error: './test_kversion_nomatch_program.o'
   \___ Failed to load program: Validate your program and 
check 'license'/'version' sections in your object
  SKIP

  After:

  # perf record -e ./test_kversion_nomatch_program.o ls
  event syntax error: './test_kversion_nomatch_program.o'
   \___ 'version' (4.4.0) doesn't match running kernel 
(4.3.0)
  SKIP

Signed-off-by: Wang Nan 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1446818289-87444-1-git-send-email-wangn...@huawei.com
[ Add 'static inline' to bpf__strerror_prepare_load() when LIBBPF is disabled ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/bpf-loader.c   | 88 --
 tools/perf/util/bpf-loader.h   | 23 +++
 tools/perf/util/parse-events.c |  7 ++--
 tools/perf/util/util.h |  5 +++
 4 files changed, 108 insertions(+), 15 deletions(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index c46256b1f5fd..e3afa1b60bb5 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -53,7 +53,7 @@ struct bpf_object *bpf__prepare_load(const char *filename, 
bool source)
 
err = llvm__compile_bpf(filename, _buf, _buf_sz);
if (err)
-   return ERR_PTR(err);
+   return ERR_PTR(-BPF_LOADER_ERRNO__COMPILE);
obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, filename);
free(obj_buf);
} else
@@ -113,14 +113,14 @@ config_bpf_program(struct bpf_program *prog)
if (err < 0) {
pr_debug("bpf: '%s' is not a valid config string\n",
 config_str);
-   err = -EINVAL;
+   err = -BPF_LOADER_ERRNO__CONFIG;
goto errout;
}
 
if (pev->group && strcmp(pev->group, PERF_BPF_PROBE_GROUP)) {
pr_debug("bpf: '%s': group for event is set and not '%s'.\n",
 config_str, PERF_BPF_PROBE_GROUP);
-   err = -EINVAL;
+   err = -BPF_LOADER_ERRNO__GROUP;
goto errout;
} else if (!pev->group)
pev->group = strdup(PERF_BPF_PROBE_GROUP);
@@ -132,9 +132,9 @@ config_bpf_program(struct bpf_program *prog)
}
 
if (!pev->event) {
-   pr_debug("bpf: '%s': event name is missing\n",
+   pr_debug("bpf: '%s': event name is missing. Section name should 
be 'key=value'\n",
 config_str);
-   err = -EINVAL;
+   err = -BPF_LOADER_ERRNO__EVENTNAME;
goto errout;
}
pr_debug("bpf: config '%s' is ok\n", config_str);
@@ -285,7 +285,7 @@ int bpf__foreach_tev(struct bpf_object *obj,
(void **));
if (err || !priv) {
pr_debug("bpf: failed to get private field\n");
-   return -EINVAL;
+   return -BPF_LOADER_ERRNO__INTERNAL;
}
 
pev = >pev;
@@ -308,6 +308,18 @@ int bpf__foreach_tev(struct bpf_object *obj,
return 0;
 }
 
+#define ERRNO_OFFSET(e)((e) - __BPF_LOADER_ERRNO__START)
+#define ERRCODE_OFFSET(c)  ERRNO_OFFSET(BPF_LOADER_ERRNO__##c)
+#define NR_ERRNO   (__BPF_LOADER_ERRNO__END - __BPF_LOADER_ERRNO__START)
+
+static const char *bpf_loader_strerror_table[NR_ERRNO] = {
+   [ERRCODE_OFFSET(CONFIG)]= "Invalid config string",
+   [ERRCODE_OFFSET(GROUP)] = "Invalid group name",
+   [ERRCODE_OFFSET(EVENTNAME)] = "No event name found in config 
string",
+   [ERRCODE_OFFSET(INTERNAL)]  = "BPF loader internal error",
+   [ERRCODE_OFFSET(COMPILE)]   = "Error when compiling BPF scriptlet",
+};
+
 static int
 bpf_loader_strerror(int err, char *buf, size_t size)
 {
@@ -322,10 +334,21 @@ bpf_loader_strerror(int err, char *buf, size_t size)
if (err >= __LIBBPF_ERRNO__START)

Re: [RFC PATCH 2/2] net: mvneta: Add naive RSS support

2015-11-06 Thread Gregory CLEMENT
Hi Marcin,
 
[...]

>> +static int  mvneta_config_rss(struct mvneta_port *pp)
>> +{
>> +   int cpu;
>> +   u32 val;
>> +
>> +   netif_tx_stop_all_queues(pp->dev);
>> +
>> +   /* Mask all ethernet port interrupts */
>> +   mvreg_write(pp, MVNETA_INTR_NEW_MASK, 0);
>
> Shouldn't the interrupts be masked on each online cpu? There is percpu
> unmask function (mvneta_percpu_unmask_interrupt), so maybe ther should
> be also mvneta_percpu_mask_interrupt. With this masking should look
> like below:
>
>  for_each_online_cpu(cpu)
>smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
> pp, true);

Indeed you are right, however I am a bit surprised to not had had issue
cause by this. I will fix it.

>
>> +   mvreg_write(pp, MVNETA_INTR_OLD_MASK, 0);
>> +   mvreg_write(pp, MVNETA_INTR_MISC_MASK, 0);
>> +
>> +   /* We have to synchronise on the napi of each CPU */
>> +   for_each_online_cpu(cpu) {
>> +   struct mvneta_pcpu_port *pcpu_port =
>> +   per_cpu_ptr(pp->ports, cpu);
>> +
>> +   napi_synchronize(_port->napi);
>> +   napi_disable(_port->napi);
>> +   }
>> +
>> +   pp->rxq_def = pp->indir[0];
>> +
>> +   /* update unicast mapping */
>> +   mvneta_set_rx_mode(pp->dev);
>> +
>> +   /* Update val of portCfg register accordingly with all RxQueue types 
>> */
>> +   val = MVNETA_PORT_CONFIG_DEFL_VALUE(pp->rxq_def);
>> +   mvreg_write(pp, MVNETA_PORT_CONFIG, val);
>> +
>> +   /* Update the elected CPU matching the new rxq_def */
>> +   mvneta_percpu_elect(pp);
>> +
>> +   /* We have to synchronise on the napi of each CPU */
>> +   for_each_online_cpu(cpu) {
>> +   struct mvneta_pcpu_port *pcpu_port =
>> +   per_cpu_ptr(pp->ports, cpu);
>> +
>> +   napi_enable(_port->napi);
>> +   }
>> +
>
> rxq_def changed, but txq vs CPU mapping remained as in the beginning -
> is it intentional?

txq vs CPU mapping is change in the mvneta_percpu_elect() function.

Thanks for this prompt review

Gregory

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.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 4.2 013/110] iommu/vt-d: fix range computation when making room for large pages

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Christian Zander 

commit ba2374fd2bf379f933773811fdb06cb6a5445f41 upstream.

In preparation for the installation of a large page, any small page
tables that may still exist in the target IOV address range are
removed.  However, if a scatter/gather list entry is large enough to
fit more than one large page, the address space for any subsequent
large pages is not cleared of conflicting small page tables.

This can cause legitimate mapping requests to fail with errors of the
form below, potentially followed by a series of IOMMU faults:

ERROR: DMA PTE for vPFN 0xfde00 already set (to 7f83a4003 not 7e9e00083)

In this example, a 4MiB scatter/gather list entry resulted in the
successful installation of a large page @ vPFN 0xfdc00, followed by
a failed attempt to install another large page @ vPFN 0xfde00, due to
the presence of a pointer to a small page table @ 0x7f83a4000.

To address this problem, compute the number of large pages that fit
into a given scatter/gather list entry, and use it to derive the
last vPFN covered by the large page(s).

Signed-off-by: Christian Zander 
Signed-off-by: David Woodhouse 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iommu/intel-iommu.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2109,15 +2109,19 @@ static int __domain_mapping(struct dmar_
return -ENOMEM;
/* It is large page*/
if (largepage_lvl > 1) {
+   unsigned long nr_superpages, end_pfn;
+
pteval |= DMA_PTE_LARGE_PAGE;
lvl_pages = lvl_to_nr_pages(largepage_lvl);
+
+   nr_superpages = sg_res / lvl_pages;
+   end_pfn = iov_pfn + nr_superpages * lvl_pages - 
1;
+
/*
 * Ensure that old small page tables are
-* removed to make room for superpage,
-* if they exist.
+* removed to make room for superpage(s).
 */
-   dma_pte_free_pagetable(domain, iov_pfn,
-  iov_pfn + lvl_pages - 1);
+   dma_pte_free_pagetable(domain, iov_pfn, 
end_pfn);
} else {
pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 001/110] mac80211: Fix hwflags debugfs file format

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Mohammed Shafi Shajakhan 

commit 4633dfc32c0019bed2996de9bbdbe7f3b518a44e upstream.

Commit 30686bf7f5b3 ("mac80211: convert HW flags to unsigned long
bitmap") accidentally removed the newline delimiter from the hwflags
debugfs file. Fix this by adding back the newline between the HW flags.

Signed-off-by: Mohammed Shafi Shajakhan 
[fix commit log]
Signed-off-by: Jouni Malinen 
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/mac80211/debugfs.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -148,7 +148,7 @@ static ssize_t hwflags_read(struct file
 
for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) {
if (test_bit(i, local->hw.flags))
-   pos += scnprintf(pos, end - pos, "%s",
+   pos += scnprintf(pos, end - pos, "%s\n",
 hw_flag_names[i]);
}
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 PATCH 0/3] CFS idle injection

2015-11-06 Thread Jacob Pan
On Fri, 06 Nov 2015 16:50:15 +
Punit Agrawal  wrote:

> * idle injection once frequencies have been capped to the lowest
>   feasible values (as suggested in the cover letter)
> 
actually, I was suggesting to start considering idle injection once
frequency capped to the energy efficient point, which can be much
higher than the lowest frequency. The idea being, deep idle power is
negligible compared to running power which allows near linear
power-perf scaling for balanced workload.
Below energy efficient frequency, continuous lowering frequency may
lose disproportion performance vs. power. i.e. worse than linear.

> One question about the implementation in these patches - should the
> implementation hook into pick_next_task in core instead of CFS? Higher
> priority tasks might get in the way of idle injection.
My take is that RT and throttling will never go well together since they
are conflicting in principle.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 015/110] iommu/amd: Dont clear DTE flags when modifying it

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Joerg Roedel 

commit cbf3ccd09d683abf1cacd36e3640872ee912d99b upstream.

During device assignment/deassignment the flags in the DTE
get lost, which might cause spurious faults, for example
when the device tries to access the system management range.
Fix this by not clearing the flags with the rest of the DTE.

Reported-by: G. Richard Bellamy 
Tested-by: G. Richard Bellamy 
Signed-off-by: Joerg Roedel 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iommu/amd_iommu.c   |4 ++--
 drivers/iommu/amd_iommu_types.h |1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1974,8 +1974,8 @@ static void set_dte_entry(u16 devid, str
 static void clear_dte_entry(u16 devid)
 {
/* remove entry from the device table seen by the hardware */
-   amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
-   amd_iommu_dev_table[devid].data[1] = 0;
+   amd_iommu_dev_table[devid].data[0]  = IOMMU_PTE_P | IOMMU_PTE_TV;
+   amd_iommu_dev_table[devid].data[1] &= DTE_FLAG_MASK;
 
amd_iommu_apply_erratum_63(devid);
 }
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@ -295,6 +295,7 @@
 #define IOMMU_PTE_IR (1ULL << 61)
 #define IOMMU_PTE_IW (1ULL << 62)
 
+#define DTE_FLAG_MASK  (0x3ffULL << 32)
 #define DTE_FLAG_IOTLB (0x01UL << 32)
 #define DTE_FLAG_GV(0x01ULL << 55)
 #define DTE_GLX_SHIFT  (56)


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


Re: [PATCH v2 2/2] arm: mm: support ARCH_MMAP_RND_BITS.

2015-11-06 Thread Kees Cook
On Thu, Nov 5, 2015 at 10:44 AM, Daniel Cashman  wrote:
> On 11/04/2015 10:30 AM, Daniel Cashman wrote:
>> On 11/3/15 3:21 PM, Kees Cook wrote:
>>> On Tue, Nov 3, 2015 at 3:14 PM, Daniel Cashman  wrote:
 On 11/03/2015 11:19 AM, Kees Cook wrote:
> Do you have patches for x86 and arm64?

 I was holding off on those until I could gauge upstream reception.  If
 desired, I could put those together and add them as [PATCH 3/4] and
 [PATCH 4/4].
>>>
>>> If they're as trivial as I'm hoping, yeah, let's toss them in now. If
>>> not, skip 'em. PowerPC, MIPS, and s390 should be relatively simple
>>> too, but one or two of those have somewhat stranger calculations when
>>> I looked, so their Kconfigs may not be as clean.
>>
>> Creating the patches should be simple, it's the choice of minimum and
>> maximum values for each architecture that I'd be most concerned about.
>> I'll put them together, though, and the ranges can be changed following
>> discussion with those more knowledgeable, if needed.  I also don't have
>> devices on which to test the PowerPC, MIPS and s390 changes, so I'll
>> need someone's help for that.
>
> Actually, in preparing the x86 and arm64 patches, it became apparent
> that the current patch-set does not address 32-bit executables running
> on 64-bit systems (compatibility mode), since only one procfs
> mmap_rnd_bits variable is created and exported. Some possible solutions:
>
> 1) Create a second set for compatibility, e.g. mmap_rnd_compat_bits,
> mmap_rnd_compat_bits_min, mmap_rnd_compat_bits_max and export it as with
> mmap_rnd_bits.  This provides the most control and is truest to the
> spirit of this patch, but pollutes the Kconfigs and procfs a bit more,
> especially if we ever need a mmap_rnd_64compat_bits...
>
> 2) Get rid of the arch-independent nature of this patch and instead let
> each arch define its own Kconfig values and procfs entries. Essentially
> the same outcome as the above, but with less disruption in the common
> kernel code, although also with a potentially variable ABI.
>
> 3) Default to the lowest-supported, e.g. arm64 running with
> CONFIG_COMPAT would be limited to the same range as arm.  This solution
> I think is highly undesirable, as it actually makes things worse for
> existing 64-bit platforms.
>
> 4) Support setting the COMPAT values by Kconfig, but don't expose them
> via procfs.  This keeps the procfs change simple and gets most of its
> benefits.
>
> 5) Leave the COMPAT values specified in code, and only adjust introduce
> config and tunable options for the 64-bit processes.  Basically keep
> this patch-set as-is and not give any benefit to compatible applications.
>
> My preference would be for either solutions 1 or 4, but would love
> feedback and/or other solutions. Thoughts?

How about a single new CONFIG+sysctl that is the compat delta. For
example, on x86, it's 20 bits. Then we don't get splashed with a whole
new set of min/maxes, but we can reasonably control compat?

-Kees

-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 014/110] iommu/amd: Fix BUG when faulting a PROT_NONE VMA

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Jay Cornwall 

commit d14f6fced5f9360edca5a1325ddb7077aab1203b upstream.

handle_mm_fault indirectly triggers a BUG in do_numa_page
when given a VMA without read/write/execute access. Check
this condition in do_fault.

do_fault -> handle_mm_fault -> handle_pte_fault -> do_numa_page

  mm/memory.c
  3147  static int do_numa_page(struct mm_struct *mm, struct vm_area_struct 
*vma,
  
  3159  /* A PROT_NONE fault should not end up here */
  3160  BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)));

Signed-off-by: Jay Cornwall 
Signed-off-by: Joerg Roedel 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iommu/amd_iommu_v2.c |7 +++
 1 file changed, 7 insertions(+)

--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -516,6 +516,13 @@ static void do_fault(struct work_struct
goto out;
}
 
+   if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) {
+   /* handle_mm_fault would BUG_ON() */
+   up_read(>mmap_sem);
+   handle_fault_error(fault);
+   goto out;
+   }
+
ret = handle_mm_fault(mm, vma, address, write);
if (ret & VM_FAULT_ERROR) {
/* failed to service fault */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 016/110] powerpc/rtas: Validate rtas.entry before calling enter_rtas()

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Vasant Hegde 

commit 8832317f662c06f5c06e638f57bfe89a71c9b266 upstream.

Currently we do not validate rtas.entry before calling enter_rtas(). This
leads to a kernel oops when user space calls rtas system call on a powernv
platform (see below). This patch adds code to validate rtas.entry before
making enter_rtas() call.

  Oops: Exception in kernel mode, sig: 4 [#1]
  SMP NR_CPUS=1024 NUMA PowerNV
  task: c4294b80 ti: c007e1a78000 task.ti: c007e1a78000
  NIP:  LR: 9c14 CTR: c0423140
  REGS: c007e1a7b920 TRAP: 0e40   Not tainted  
(3.18.17-340.el7_1.pkvm3_1_0.2400.1.ppc64le)
  MSR: 10081000   CR:   XER: 
  CFAR: c0009c0c SOFTE: 0
  NIP []   (null)
  LR [9c14] 0x9c14
  Call Trace:
  [c007e1a7bba0] [c041a7f4] avc_has_perm_noaudit+0x54/0x110 
(unreliable)
  [c007e1a7bd80] [c002ddc0] ppc_rtas+0x150/0x2d0
  [c007e1a7be30] [c0009358] syscall_exit+0x0/0x98

Fixes: 55190f88789a ("powerpc: Add skeleton PowerNV platform")
Reported-by: NAGESWARA R. SASTRY 
Signed-off-by: Vasant Hegde 
[mpe: Reword change log, trim oops, and add stable + fixes]
Signed-off-by: Michael Ellerman 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/powerpc/kernel/rtas.c |3 +++
 1 file changed, 3 insertions(+)

--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1041,6 +1041,9 @@ asmlinkage int ppc_rtas(struct rtas_args
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
 
+   if (!rtas.entry)
+   return -EINVAL;
+
if (copy_from_user(, uargs, 3 * sizeof(u32)) != 0)
return -EFAULT;
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 010/110] iwlwifi: mvm: init card correctly on ctkill exit check

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Arik Nemtsov 

commit 1a3fe0b2b6778b7866e2b3f5c9a299d5e9bbd89c upstream.

During the CT-kill exit flow, the card is powered up and partially
initialized to check if the temperature is already low enough.
Unfortunately the init bails early because the CT-kill flag is set.
Make the code bail early only for HW RF-kill, as was intended by the
author. CT-kill is self-imposed and is not really RF-kill.

Fixes: 31b8b343e019 ("iwlwifi: fix RFkill while calibrating")
Signed-off-by: Arik Nemtsov 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/fw.c  |4 ++--
 drivers/net/wireless/iwlwifi/mvm/mvm.h |5 +
 2 files changed, 7 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -364,7 +364,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mv
 * abort after reading the nvm in case RF Kill is on, we will complete
 * the init seq later when RF kill will switch to off
 */
-   if (iwl_mvm_is_radio_killed(mvm)) {
+   if (iwl_mvm_is_radio_hw_killed(mvm)) {
IWL_DEBUG_RF_KILL(mvm,
  "jump over all phy activities due to RF 
kill\n");
iwl_remove_notification(>notif_wait, _wait);
@@ -397,7 +397,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mv
ret = iwl_wait_notification(>notif_wait, _wait,
MVM_UCODE_CALIB_TIMEOUT);
 
-   if (ret && iwl_mvm_is_radio_killed(mvm)) {
+   if (ret && iwl_mvm_is_radio_hw_killed(mvm)) {
IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
ret = 1;
}
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -848,6 +848,11 @@ static inline bool iwl_mvm_is_radio_kill
   test_bit(IWL_MVM_STATUS_HW_CTKILL, >status);
 }
 
+static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
+{
+   return test_bit(IWL_MVM_STATUS_HW_RFKILL, >status);
+}
+
 /* Must be called with rcu_read_lock() held and it can only be
  * released when mvmsta is not needed anymore.
  */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 017/110] drm: fix mutex leak in drm_dp_get_mst_branch_device

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Adam Richter 

commit 30730c7f5943b3beace1e29f7f1476e05de3da14 upstream.

In Linux 4.3-rc5, there is an error case in drm_dp_get_branch_device
that returns without releasing mgr->lock, resulting a spew of kernel
messages about a kernel work function possibly having leaked a mutex
and presumably more serious adverse consequences later.  This patch
changes the error to "goto out" to unlock the mutex before returning.

[airlied: grabbed from drm-next as it fixes something we've seen]

Signed-off-by: Adam J. Richter 
Signed-off-by: Daniel Vetter 
Signed-off-by: Dave Airlie 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/drm_dp_mst_topology.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1193,17 +1193,18 @@ static struct drm_dp_mst_branch *drm_dp_
 
list_for_each_entry(port, >ports, next) {
if (port->port_num == port_num) {
-   if (!port->mstb) {
+   mstb = port->mstb;
+   if (!mstb) {
DRM_ERROR("failed to lookup MSTB with 
lct %d, rad %02x\n", lct, rad[0]);
-   return NULL;
+   goto out;
}
 
-   mstb = port->mstb;
break;
}
}
}
kref_get(>kref);
+out:
mutex_unlock(>lock);
return mstb;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 002/110] ath9k: declare required extra tx headroom

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Felix Fietkau 

commit 029cd0370241641eb70235d205aa0b90c84dce44 upstream.

ath9k inserts padding between the 802.11 header and the data area (to
align it). Since it didn't declare this extra required headroom, this
led to some nasty issues like randomly dropped packets in some setups.

Signed-off-by: Felix Fietkau 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/ath9k/init.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -874,6 +874,7 @@ static void ath9k_set_hw_capab(struct at
hw->max_rate_tries = 10;
hw->sta_data_size = sizeof(struct ath_node);
hw->vif_data_size = sizeof(struct ath_vif);
+   hw->extra_tx_headroom = 4;
 
hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 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 4.2 012/110] iwlwifi: pci: add a few more PCI subvendor IDs for the 7265 series

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Luca Coelho 

commit f08f625876476b6c4a87834dc86e3b927f4697d2 upstream.

Add 3 new subdevice IDs for the 0x095A device ID and 2 for the 0x095B
device ID.

Reported-by: Jeremy 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/pcie/drv.c |5 +
 1 file changed, 5 insertions(+)

--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -414,6 +414,11 @@ static const struct pci_device_id iwl_hw
{IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)},
{IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)},
{IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x095A, 0x5F10, iwl7265_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x095B, 0x5212, iwl7265_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x095B, 0x520A, iwl7265_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x095A, 0x9000, iwl7265_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x095A, 0x9400, iwl7265_2ac_cfg)},
 
 /* 8000 Series */
{IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)},


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 4/5] PCI: qcom: Add Qualcomm PCIe controller driver

2015-11-06 Thread Bjorn Andersson
On Mon 04 May 05:42 PDT 2015, Stanimir Varbanov wrote:

> The PCIe driver reuse the Designware common code for host
> and MSI initialization, and also program the Qualcomm
> application specific registers.
> 

I want to get the ethernet on the ifc6410 running and this seems like
the last patchset for the PCIe.

> Signed-off-by: Stanimir Varbanov 
[..]
> diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c
> new file mode 100644
> index 000..4f083c6
> --- /dev/null
> +++ b/drivers/pci/host/pcie-qcom.c
> @@ -0,0 +1,677 @@
> +/*
> + * Copyright (c) 2014, The Linux Foundation. All rights reserved.

Bump the year, it's the future now :)

> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
[..]
> +
> +struct qcom_pcie {
> + struct pcie_port pp;
> + struct device *dev;

You already have this device pointer in pp->dev.

> + union pcie_resources res;
> + void __iomem *parf;
> + void __iomem *dbi;
> + void __iomem *elbi;
> + struct phy *phy;
> + struct gpio_desc *reset;
> + unsigned int version;
> +};
> +
> +#define to_qcom_pcie(x)  container_of(x, struct qcom_pcie, pp)
> +
> +static inline void
> +writel_masked(void __iomem *addr, u32 clear_mask, u32 set_mask)
> +{
> + u32 val = readl(addr);
> +
> + val &= ~clear_mask;
> + val |= set_mask;
> + writel(val, addr);
> +}

There are no case where you do clear and set, so I would like that you
just inline this function where you need it. It adds 2 extra lines at a
few places, but a lot of clarity.

> +
> +static void qcom_ep_reset_assert_deassert(struct qcom_pcie *pcie, int assert)
> +{
> + int val, active_low;
> +
> + if (IS_ERR_OR_NULL(pcie->reset))
> + return;

This will be NULL or valid here, never ERR. So it's fine to call
gpiod_set_value() with this pointer without the check.

> +
> + active_low = gpiod_is_active_low(pcie->reset);
> +

gpiod_set_value() checks for FLAG_ACTIVE_LOW and will invert the value
first thing. So you do not need to do this manually.

> + if (assert)
> + val = !!active_low;
> + else
> + val = !active_low;
> +
> + gpiod_set_value(pcie->reset, val);
> +
> + usleep_range(PERST_DELAY_MIN_US, PERST_DELAY_MAX_US);

This doesn't seem to be called in a hot path, so you should be able to
simply msleep(1) here.

> +}
> +
> +static void qcom_ep_reset_assert(struct qcom_pcie *pcie)
> +{
> + qcom_ep_reset_assert_deassert(pcie, 1);

If we're down to this function just being a gpiod_set_value() and a
sleep we can inline it here instead of having this proxy function.

> +}
> +
> +static void qcom_ep_reset_deassert(struct qcom_pcie *pcie)
> +{
> + qcom_ep_reset_assert_deassert(pcie, 0);

Same here.

> +}
> +
> +static irqreturn_t qcom_pcie_msi_irq_handler(int irq, void *arg)
> +{
> + struct pcie_port *pp = arg;
> +
> + return dw_handle_msi_irq(pp);
> +}
> +
> +static int qcom_pcie_link_up(struct pcie_port *pp)
> +{
> + struct qcom_pcie *pcie = to_qcom_pcie(pp);
> + u32 val = readl(pcie->dbi + PCIE20_CAP_LINKCTRLSTATUS);
> +
> + return val & BIT(29) ? 1 : 0;

return !!(val & BIT(29));

Do we know what this bit 29 is?

> +}
> +
[..]
> +
> +static int qcom_pcie_get_resources_v1(struct qcom_pcie *pcie)
> +{
> + struct qcom_pcie_resources_v1 *res = >res.v1;
> + struct device *dev = pcie->dev;
> +
> + res->vdda = devm_regulator_get(dev, "vdda");
> + if (IS_ERR(res->vdda))
> + return PTR_ERR(res->vdda);
> +
> + res->iface = devm_clk_get(dev, "iface");
> + if (IS_ERR(res->iface))
> + return PTR_ERR(res->iface);
> +
> + res->aux = devm_clk_get(dev, "aux");
> + if (IS_ERR(res->aux) && PTR_ERR(res->aux) == -EPROBE_DEFER)

PTR_ERR() == x implies IS_ERR(), so you don't need both.

> + return -EPROBE_DEFER;
> + else if (IS_ERR(res->aux))
> + res->aux = NULL;
> +
> + res->master_bus = devm_clk_get(dev, "master_bus");
> + if (IS_ERR(res->master_bus))
> + return PTR_ERR(res->master_bus);
> +
> + res->slave_bus = devm_clk_get(dev, "slave_bus");
> + if (IS_ERR(res->slave_bus))
> + return PTR_ERR(res->slave_bus);
> +
> + res->core = devm_reset_control_get(dev, "core");
> + if (IS_ERR(res->core))
> + return PTR_ERR(res->core);
> +
> + return 0;
> +}
> +
> +static int qcom_pcie_enable_link_training(struct pcie_port *pp)
> +{
> + struct qcom_pcie *pcie = to_qcom_pcie(pp);
> + struct device *dev = pp->dev;
> + 

[PATCH 4.2 020/110] [media] m88ds3103: use own reg update_bits() implementation

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Antti Palosaari 

commit 56ea37da3b93dfe46cb5c3ee0ee4cc44229ece47 upstream.

Device stopped to tuning some channels after regmap conversion.
Reason is that regmap_update_bits() works a bit differently for
partially volatile registers than old homemade routine. Return
back to old routine in order to fix issue.

Fixes: 478932b16052f5ded74685d096ae920cd17d6424

Reported-by: Mark Clarkstone 
Tested-by: Mark Clarkstone 
Signed-off-by: Antti Palosaari 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/media/dvb-frontends/m88ds3103.c |   73 
 1 file changed, 47 insertions(+), 26 deletions(-)

--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -18,6 +18,27 @@
 
 static struct dvb_frontend_ops m88ds3103_ops;
 
+/* write single register with mask */
+static int m88ds3103_update_bits(struct m88ds3103_dev *dev,
+   u8 reg, u8 mask, u8 val)
+{
+   int ret;
+   u8 tmp;
+
+   /* no need for read if whole reg is written */
+   if (mask != 0xff) {
+   ret = regmap_bulk_read(dev->regmap, reg, , 1);
+   if (ret)
+   return ret;
+
+   val &= mask;
+   tmp &= ~mask;
+   val |= tmp;
+   }
+
+   return regmap_bulk_write(dev->regmap, reg, , 1);
+}
+
 /* write reg val table using reg addr auto increment */
 static int m88ds3103_wr_reg_val_tab(struct m88ds3103_dev *dev,
const struct m88ds3103_reg_val *tab, int tab_len)
@@ -394,10 +415,10 @@ static int m88ds3103_set_frontend(struct
u8tmp2 = 0x00; /* 0b00 */
break;
}
-   ret = regmap_update_bits(dev->regmap, 0x22, 0xc0, u8tmp1 << 6);
+   ret = m88ds3103_update_bits(dev, 0x22, 0xc0, u8tmp1 << 6);
if (ret)
goto err;
-   ret = regmap_update_bits(dev->regmap, 0x24, 0xc0, u8tmp2 << 6);
+   ret = m88ds3103_update_bits(dev, 0x24, 0xc0, u8tmp2 << 6);
if (ret)
goto err;
}
@@ -455,13 +476,13 @@ static int m88ds3103_set_frontend(struct
if (ret)
goto err;
}
-   ret = regmap_update_bits(dev->regmap, 0x9d, 0x08, 0x08);
+   ret = m88ds3103_update_bits(dev, 0x9d, 0x08, 0x08);
if (ret)
goto err;
ret = regmap_write(dev->regmap, 0xf1, 0x01);
if (ret)
goto err;
-   ret = regmap_update_bits(dev->regmap, 0x30, 0x80, 0x80);
+   ret = m88ds3103_update_bits(dev, 0x30, 0x80, 0x80);
if (ret)
goto err;
}
@@ -498,7 +519,7 @@ static int m88ds3103_set_frontend(struct
switch (dev->cfg->ts_mode) {
case M88DS3103_TS_SERIAL:
case M88DS3103_TS_SERIAL_D7:
-   ret = regmap_update_bits(dev->regmap, 0x29, 0x20, u8tmp1);
+   ret = m88ds3103_update_bits(dev, 0x29, 0x20, u8tmp1);
if (ret)
goto err;
u8tmp1 = 0;
@@ -567,11 +588,11 @@ static int m88ds3103_set_frontend(struct
if (ret)
goto err;
 
-   ret = regmap_update_bits(dev->regmap, 0x4d, 0x02, dev->cfg->spec_inv << 
1);
+   ret = m88ds3103_update_bits(dev, 0x4d, 0x02, dev->cfg->spec_inv << 1);
if (ret)
goto err;
 
-   ret = regmap_update_bits(dev->regmap, 0x30, 0x10, dev->cfg->agc_inv << 
4);
+   ret = m88ds3103_update_bits(dev, 0x30, 0x10, dev->cfg->agc_inv << 4);
if (ret)
goto err;
 
@@ -625,13 +646,13 @@ static int m88ds3103_init(struct dvb_fro
dev->warm = false;
 
/* wake up device from sleep */
-   ret = regmap_update_bits(dev->regmap, 0x08, 0x01, 0x01);
+   ret = m88ds3103_update_bits(dev, 0x08, 0x01, 0x01);
if (ret)
goto err;
-   ret = regmap_update_bits(dev->regmap, 0x04, 0x01, 0x00);
+   ret = m88ds3103_update_bits(dev, 0x04, 0x01, 0x00);
if (ret)
goto err;
-   ret = regmap_update_bits(dev->regmap, 0x23, 0x10, 0x00);
+   ret = m88ds3103_update_bits(dev, 0x23, 0x10, 0x00);
if (ret)
goto err;
 
@@ -749,18 +770,18 @@ static int m88ds3103_sleep(struct dvb_fr
utmp = 0x29;
else
utmp = 0x27;
-   ret = regmap_update_bits(dev->regmap, utmp, 0x01, 0x00);
+   ret = m88ds3103_update_bits(dev, utmp, 0x01, 0x00);
if (ret)
goto err;
 
/* sleep */
-   ret = regmap_update_bits(dev->regmap, 0x08, 0x01, 0x00);
+   ret = m88ds3103_update_bits(dev, 0x08, 0x01, 0x00);
if (ret)
 

[PATCH 4.2 019/110] drm: crtc: integer overflow in drm_property_create_blob()

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter 

commit 9ac0934bbe52290e4e4c2a58ec41cab9b6ca8c96 upstream.

The size here comes from the user via the ioctl, it is a number between
1-u32max so the addition here could overflow on 32 bit systems.

Fixes: f453ba046074 ('DRM: add mode setting support')
Signed-off-by: Dan Carpenter 
Reviewed-by: Daniel Stone 
Signed-off-by: Dave Airlie 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/drm_crtc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4221,7 +4221,7 @@ drm_property_create_blob(struct drm_devi
struct drm_property_blob *blob;
int ret;
 
-   if (!length)
+   if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
return ERR_PTR(-EINVAL);
 
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 021/110] [media] si2157: Bounds check firmware

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Laura Abbott 

commit a828d72df216c36e9c40b6c24dc4b17b6f7b5a76 upstream.

When reading the firmware and sending commands, the length
must be bounds checked to avoid overrunning the size of the command
buffer and smashing the stack if the firmware is not in the
expected format. Add the proper check.

Signed-off-by: Laura Abbott 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/media/tuners/si2157.c |4 
 1 file changed, 4 insertions(+)

--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -166,6 +166,10 @@ static int si2157_init(struct dvb_fronte
 
for (remaining = fw->size; remaining > 0; remaining -= 17) {
len = fw->data[fw->size - remaining];
+   if (len > SI2157_ARGLEN) {
+   dev_err(>dev, "Bad firmware length\n");
+   goto err_release_firmware;
+   }
memcpy(cmd.args, >data[(fw->size - remaining) + 1], len);
cmd.wlen = len;
cmd.rlen = 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 4.2 023/110] [media] rtl28xxu: fix control message flaws

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Antti Palosaari 

commit d18ca5b7ceca0e9674cb4bb2ed476b0fcbb23ba2 upstream.

Add lock to prevent concurrent access for control message as control
message function uses shared buffer. Without the lock there may be
remote control polling which messes the buffer causing IO errors.
Increase buffer size and add check for maximum supported message
length.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=103391
Fixes: c56222a6b25c ("[media] rtl28xxu: move usb buffers to state")

Signed-off-by: Antti Palosaari 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c |   15 +--
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -34,6 +34,14 @@ static int rtl28xxu_ctrl_msg(struct dvb_
unsigned int pipe;
u8 requesttype;
 
+   mutex_lock(>usb_mutex);
+
+   if (req->size > sizeof(dev->buf)) {
+   dev_err(>intf->dev, "too large message %u\n", req->size);
+   ret = -EINVAL;
+   goto err_mutex_unlock;
+   }
+
if (req->index & CMD_WR_FLAG) {
/* write */
memcpy(dev->buf, req->data, req->size);
@@ -50,14 +58,17 @@ static int rtl28xxu_ctrl_msg(struct dvb_
dvb_usb_dbg_usb_control_msg(d->udev, 0, requesttype, req->value,
req->index, dev->buf, req->size);
if (ret < 0)
-   goto err;
+   goto err_mutex_unlock;
 
/* read request, copy returned data to return buf */
if (requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
memcpy(req->data, dev->buf, req->size);
 
+   mutex_unlock(>usb_mutex);
+
return 0;
-err:
+err_mutex_unlock:
+   mutex_unlock(>usb_mutex);
dev_dbg(>intf->dev, "failed=%d\n", ret);
return ret;
 }
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -71,7 +71,7 @@
 
 
 struct rtl28xxu_dev {
-   u8 buf[28];
+   u8 buf[128];
u8 chip_id;
u8 tuner;
char *tuner_name;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 022/110] [media] si2168: Bounds check firmware

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Laura Abbott 

commit 47810b4341ac9d2f558894bc5995e6fa2a1298f9 upstream.

When reading the firmware and sending commands, the length must
be bounds checked to avoid overrunning the size of the command
buffer and smashing the stack if the firmware is not in the expected
format:

si2168 11-0064: found a 'Silicon Labs Si2168-B40'
si2168 11-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
si2168 11-0064: firmware download failed -95
Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: 
a085708f

Add the proper check.

Reported-by: Stuart Auchterlonie 
Reviewed-by: Antti Palosaari 
Signed-off-by: Laura Abbott 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/media/dvb-frontends/si2168.c |4 
 1 file changed, 4 insertions(+)

--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -502,6 +502,10 @@ static int si2168_init(struct dvb_fronte
/* firmware is in the new format */
for (remaining = fw->size; remaining > 0; remaining -= 17) {
len = fw->data[fw->size - remaining];
+   if (len > SI2168_ARGLEN) {
+   ret = -EINVAL;
+   break;
+   }
memcpy(cmd.args, >data[(fw->size - remaining) + 1], 
len);
cmd.wlen = len;
cmd.rlen = 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 4.1 11/86] iommu/amd: Fix BUG when faulting a PROT_NONE VMA

2015-11-06 Thread Linus Torvalds
On Fri, Nov 6, 2015 at 11:22 AM, Greg Kroah-Hartman
 wrote:
>
> From: Jay Cornwall 
>
> commit d14f6fced5f9360edca5a1325ddb7077aab1203b upstream.
>
> handle_mm_fault indirectly triggers a BUG in do_numa_page
> when given a VMA without read/write/execute access. Check
> this condition in do_fault.

This reminds me.

I think the code is still wrong.

The thing is, the VM assumes that the caller has already checked
permissions. An dby "checked permissions", I mean actually checking
permissions. The AMD iommu driver doesn't do that, it does something
completely different, namely "check it's not PROT_NONE".

So I think the code should instead do something like

   if ((write && !(vma->vm_flags & VM_WRITE)) || !(vma->vm_flags & VM_READ)) {
  up_read(>mmap_sem);
  handle_fault_error(fault);
  goto out;
   }

because it is *not* valid to call "handle_mm_fault()" with a write
fault unless you have write permissions (or with a read fault unless
you have read permissions).

And some "handle_mm_fault would BUG_ON()" comment is just bogus. It's
not handle_mm_fault()'s case that you called it without checking
proper permissions.

I'm not arguing against the stable backport, because that is fine. But
I think this should be fixed further.

Joerg?

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/


[PATCH 4.2 024/110] KVM: arm: use GIC support unconditionally

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Arnd Bergmann 

commit 4a5d69b73948d0e03cd38d77dc11edb2e707165f upstream.

The vgic code on ARM is built for all configurations that enable KVM,
but the parent_data field that it references is only present when
CONFIG_IRQ_DOMAIN_HIERARCHY is set:

virt/kvm/arm/vgic.c: In function 'kvm_vgic_map_phys_irq':
virt/kvm/arm/vgic.c:1781:13: error: 'struct irq_data' has no member named 
'parent_data'

This flag is implied by the GIC driver, and indeed the VGIC code only
makes sense if a GIC is present. This changes the CONFIG_KVM symbol
to always select GIC, which avoids the issue.

Fixes: 662d9715840 ("arm/arm64: KVM: Kill CONFIG_KVM_ARM_{VGIC,TIMER}")
Signed-off-by: Arnd Bergmann 
Acked-by: Marc Zyngier 
Signed-off-by: Christoffer Dall 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kvm/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -21,6 +21,7 @@ config KVM
depends on MMU && OF
select PREEMPT_NOTIFIERS
select ANON_INODES
+   select ARM_GIC
select HAVE_KVM_CPU_RELAX_INTERCEPT
select HAVE_KVM_ARCH_TLB_FLUSH_ALL
select KVM_MMIO


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 005/110] iwlwifi: fix firmware filename for 3160

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Johannes Berg 

commit b5a48134f8af08f5243328f8a0b05fc5ae7cf343 upstream.

The MODULE_FIRMWARE() for 3160 should be using the 7260 version as
it's done in the device configuration struct instead of referencing
IWL3160_UCODE_API_OK which doesn't even exist.

Reported-by: Hauke Mehrtens 
Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/iwl-7000.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -348,6 +348,6 @@ const struct iwl_cfg iwl7265d_n_cfg = {
 };
 
 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
-MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
+MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
 MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
 MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 025/110] ALSA: hdac: Explicitly add io.h

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Vinod Koul 

commit 42f2bb1c494543084b764e1ca253c73db910daf2 upstream.

Compiling the hdac extended core on arm fails with below error:

  sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_writel':
>> sound/hda/ext/hdac_ext_bus.c:29:2: error: implicit declaration of
>> function
+'writel' [-Werror=implicit-function-declaration]
 writel(value, addr);
 ^
   sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_readl':
>> sound/hda/ext/hdac_ext_bus.c:34:2: error: implicit declaration of
>> function
+'readl' [-Werror=implicit-function-declaration]
 return readl(addr);

This is fixed by explicitly including io.h

Fixes: 99463b3a3994 - ('ALSA: hda: provide default bus io ops extended hdac')
Reported-by: kbuild test robot 
Suggested-by: Mark Brown 
Signed-off-by: Vinod Koul 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/hda/ext/hdac_ext_bus.c |1 +
 1 file changed, 1 insertion(+)

--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 MODULE_DESCRIPTION("HDA extended core");


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 004/110] iwlwifi: dvm: fix D3 firmware PN programming

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Johannes Berg 

commit 5bd166872d8f99f156fac191299d24f828bb2348 upstream.

The code to send the RX PN data (for each TID) to the firmware
has a devastating bug: it overwrites the data for TID 0 with
all the TID data, leaving the remaining TIDs zeroed. This will
allow replays to actually be accepted by the firmware, which
could allow waking up the system.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/dvm/lib.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -1022,7 +1022,7 @@ static void iwlagn_wowlan_program_keys(s
u8 *pn = seq.ccmp.pn;
 
ieee80211_get_key_rx_seq(key, i, );
-   aes_sc->pn = cpu_to_le64(
+   aes_sc[i].pn = cpu_to_le64(
(u64)pn[5] |
((u64)pn[4] << 8) |
((u64)pn[3] << 16) |


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


Re: [PATCH] phy: ralink-usb: add driver for Mediatek/Ralink

2015-11-06 Thread Andy Shevchenko
On Wed, Nov 4, 2015 at 12:54 PM, John Crispin  wrote:
> Add a driver to setup the USB phy on Mediatek/Ralink SoCs.
> The driver is trivial and only sets the power and host/device mode.

> +/*
> + * Ralink USB phy driver
> + *
> + * Copyright (C) 2014 John Crispin 
> + *
> + * Based on code from
> + * Allwinner Technology Co., Ltd. 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#define RT_SYSC_REG_SYSCFG10x014
> +#define RT_SYSC_REG_CLKCFG10x030
> +#define RT_SYSC_REG_USB_PHY_CFG0x05c
> +
> +#define RT_RSTCTRL_UDEVBIT(25)
> +#define RT_RSTCTRL_UHSTBIT(22)
> +#define RT_SYSCFG1_USB0_HOST_MODE  BIT(10)
> +
> +#define MT7620_CLKCFG1_UPHY0_CLK_ENBIT(25)
> +#define MT7620_CLKCFG1_UPHY1_CLK_ENBIT(22)
> +#define RT_CLKCFG1_UPHY1_CLK_ENBIT(20)
> +#define RT_CLKCFG1_UPHY0_CLK_ENBIT(18)
> +
> +#define USB_PHY_UTMI_8B60M BIT(1)
> +#define UDEV_WAKEUPBIT(0)
> +
> +static atomic_t usb_pwr_ref = ATOMIC_INIT(0);
> +static struct reset_control *rstdev;
> +static struct reset_control *rsthost;
> +static u32 phy_clk;
> +static struct phy *rt_phy;
> +
> +static void usb_phy_enable(int state)
> +{
> +   if (state)
> +   rt_sysc_m32(0, phy_clk, RT_SYSC_REG_CLKCFG1);
> +   else
> +   rt_sysc_m32(phy_clk, 0, RT_SYSC_REG_CLKCFG1);
> +   mdelay(100);

Where 100 comes from? Perhaps comment line?

> +}
> +
> +static int ralink_usb_phy_init(struct phy *_phy)
> +{
> +   return 0;
> +}
> +
> +static int ralink_usb_phy_exit(struct phy *_phy)
> +{
> +   return 0;
> +}
> +
> +static int ralink_usb_phy_power_on(struct phy *_phy)

_phy -> phy ?

> +{
> +   if (atomic_inc_return(_pwr_ref) == 1) {

if (!atomic_… != 1)
 return 0;

?

> +   int host = 1;
> +   u32 t;
> +
> +   usb_phy_enable(1);
> +
> +   if (host) {
> +   rt_sysc_m32(0, RT_SYSCFG1_USB0_HOST_MODE,
> +  RT_SYSC_REG_SYSCFG1);
> +   if (!IS_ERR(rsthost))
> +   reset_control_deassert(rsthost);
> +   if (!IS_ERR(rstdev))
> +   reset_control_deassert(rstdev);
> +   } else {
> +   rt_sysc_m32(RT_SYSCFG1_USB0_HOST_MODE, 0,
> +   RT_SYSC_REG_SYSCFG1);
> +   if (!IS_ERR(rstdev))
> +   reset_control_deassert(rstdev);
> +   }
> +   mdelay(100);

Same question about 100 as above.

Aha, what about

usb_phy_enable(host);
if (host && !IS_ERR(rsthost))
 …;
if (!IS_ERR(rstdev))
 …;

?


> +
> +   t = rt_sysc_r32(RT_SYSC_REG_USB_PHY_CFG);
> +   dev_info(&_phy->dev, "remote usb device wakeup %s\n",
> +   (t & UDEV_WAKEUP) ? ("enabbled") : ("disabled"));
> +   if (t & USB_PHY_UTMI_8B60M)
> +   dev_info(&_phy->dev, "UTMI 8bit 60MHz\n");
> +   else
> +   dev_info(&_phy->dev, "UTMI 16bit 30MHz\n");
> +   }
> +
> +   return 0;
> +}
> +
> +static int ralink_usb_phy_power_off(struct phy *_phy)
> +{
> +   if (atomic_dec_return(_pwr_ref) == 0) {
> +   usb_phy_enable(0);

Okay, it seems you have to use atomic variable result as parameter to
off() / on(). Can you refactor them to have a common code together?

> +   if (!IS_ERR(rstdev))
> +   reset_control_assert(rstdev);
> +   if (!IS_ERR(rsthost))
> +   reset_control_assert(rsthost);
> +   }
> +
> +   return 0;
> +}
> +
> +static struct phy_ops ralink_usb_phy_ops = {
> +   .init   = ralink_usb_phy_init,
> +   .exit   = ralink_usb_phy_exit,
> +   .power_on   = ralink_usb_phy_power_on,
> +   .power_off  = ralink_usb_phy_power_off,
> +   .owner  = THIS_MODULE,
> +};
> +
> +static struct phy *ralink_usb_phy_xlate(struct device *dev,
> +   struct of_phandle_args *args)
> +{
> +   return rt_phy;
> +}
> +
> +static const struct of_device_id ralink_usb_phy_of_match[] = {
> +   {
> +

[PATCH 4.2 008/110] iwlwifi: mvm: fix D3 CCMP TX PN assignment

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Johannes Berg 

commit 6645d5e441db9121793421d477255f4242b3dbf3 upstream.

When going into/coming out of D3, the TX PN must be programmed into
and restored from the firmware respectively. The restore was broken
due to my previous commit to move PN assignment into the driver.
Sending the PN to the firmware still worked since we now use the
counter that's shared with mac80211, but accessing it through the
mac80211 API makes no sense now.

Fix this by reading/writing the counter directly. This actually
simplifies the code since we don't need to round-trip through the
key_seq structure.

Fixes: ca8c0f4bede6 ("iwlwifi: mvm: move TX PN assignment for CCMP to the 
driver")
Reported-by: Luca Coelho 
Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/d3.c |   15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -274,18 +274,13 @@ static void iwl_mvm_wowlan_program_keys(
break;
case WLAN_CIPHER_SUITE_CCMP:
if (sta) {
-   u8 *pn = seq.ccmp.pn;
+   u64 pn64;
 
aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc;
aes_tx_sc = >rsc_tsc->all_tsc_rsc.aes.tsc;
 
-   ieee80211_get_key_tx_seq(key, );
-   aes_tx_sc->pn = cpu_to_le64((u64)pn[5] |
-   ((u64)pn[4] << 8) |
-   ((u64)pn[3] << 16) |
-   ((u64)pn[2] << 24) |
-   ((u64)pn[1] << 32) |
-   ((u64)pn[0] << 40));
+   pn64 = atomic64_read(>tx_pn);
+   aes_tx_sc->pn = cpu_to_le64(pn64);
} else {
aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc;
}
@@ -1446,15 +1441,15 @@ static void iwl_mvm_d3_update_gtks(struc
 
switch (key->cipher) {
case WLAN_CIPHER_SUITE_CCMP:
-   iwl_mvm_aes_sc_to_seq(>aes.tsc, );
iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key);
+   atomic64_set(>tx_pn, le64_to_cpu(sc->aes.tsc.pn));
break;
case WLAN_CIPHER_SUITE_TKIP:
iwl_mvm_tkip_sc_to_seq(>tkip.tsc, );
iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key);
+   ieee80211_set_key_tx_seq(key, );
break;
}
-   ieee80211_set_key_tx_seq(key, );
 
/* that's it for this key */
return;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: Use kernel mm when updating section permissions

2015-11-06 Thread Russell King - ARM Linux
On Fri, Nov 06, 2015 at 10:44:32AM -0800, Laura Abbott wrote:
> with my test patch. I think setting both current->active_mm and _mm
> is sufficient. Maybe explicitly setting swapper_pg_dir would be cleaner?

Please, stop thinking like this.  If you're trying to change the kernel
section mappings after threads have been spawned, you need to change
them for _all_ threads, which means you need to change them for every
page table that's in existence at that time - you can't do just one
table and hope everyone updates, it doesn't work like that.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.2 007/110] iwlwifi: mvm: clear csa countdown when AP is stopped

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Avraham Stern 

commit e9cb0327b26dd7ba43a3b7a05b4b62219decf42d upstream.

The csa_countdown flag was not cleared when the AP is stopped.
As a result, if the AP was stopped after csa_countdown had started,
all the folowing channel switch commands would fail.
Fix that by clearing the csa_countdown flag when the AP is stopped.

Signed-off-by: Avraham Stern 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -2373,6 +2373,7 @@ static void iwl_mvm_stop_ap_ibss(struct
iwl_mvm_remove_time_event(mvm, mvmvif,
  >time_event_data);
RCU_INIT_POINTER(mvm->csa_vif, NULL);
+   mvmvif->csa_countdown = false;
}
 
if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 006/110] rtlwifi: rtl8821ae: Fix system lockups on boot

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Larry Finger 

commit 54328e64047a54b8fc2362c2e1f0fa16c90f739f upstream.

In commit 1277fa2ab2f9 ("rtlwifi: Remove the clear interrupt routine from all
drivers"), the code that cleared all interrupt enable bits before setting them
was removed for all PCI drivers. This fixed an issue that caused TX to be
blocked for 3-5 seconds. On some RTL8821AE units, this change causes soft
lockups to occur on boot. For that reason, the portion of the earlier commit
that applied to rtl8821ae is reverted. Kernels 4.1 and newer are affected.

See http://marc.info/?l=linux-wireless=144373370103285=2 and
https://bugzilla.opensuse.org/show_bug.cgi?id=944978 for two cases where
this regression affected user systems. Note that this bug does not appear on
any of the developer's setups. For those users whose systems are affected
by the TX blockage, but do not lock up on boot, a module parameter is added
to disable the interrupt clear

Fixes: 1277fa2ab2f9 ("rtlwifi: Remove the clear interrupt routine from all 
drivers")
Signed-off-by: Larry Finger 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/rtlwifi/pci.h  |2 ++
 drivers/net/wireless/rtlwifi/rtl8821ae/hw.c |   17 +
 drivers/net/wireless/rtlwifi/rtl8821ae/sw.c |5 +
 drivers/net/wireless/rtlwifi/wifi.h |3 +++
 4 files changed, 27 insertions(+)

--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -247,6 +247,8 @@ struct rtl_pci {
/* MSI support */
bool msi_support;
bool using_msi;
+   /* interrupt clear before set */
+   bool int_clear;
 };
 
 struct mp_adapter {
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
@@ -2253,11 +2253,28 @@ void rtl8821ae_set_qos(struct ieee80211_
}
 }
 
+static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw)
+{
+   struct rtl_priv *rtlpriv = rtl_priv(hw);
+   u32 tmp = rtl_read_dword(rtlpriv, REG_HISR);
+
+   rtl_write_dword(rtlpriv, REG_HISR, tmp);
+
+   tmp = rtl_read_dword(rtlpriv, REG_HISRE);
+   rtl_write_dword(rtlpriv, REG_HISRE, tmp);
+
+   tmp = rtl_read_dword(rtlpriv, REG_HSISR);
+   rtl_write_dword(rtlpriv, REG_HSISR, tmp);
+}
+
 void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw)
 {
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
 
+   if (!rtlpci->int_clear)
+   rtl8821ae_clear_interrupt(hw);/*clear it here first*/
+
rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0x);
rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0x);
rtlpci->irq_enabled = true;
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
@@ -96,6 +96,7 @@ int rtl8821ae_init_sw_vars(struct ieee80
 
rtl8821ae_bt_reg_init(hw);
rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
+   rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
 
rtlpriv->dm.dm_initialgain_enable = 1;
@@ -167,6 +168,7 @@ int rtl8821ae_init_sw_vars(struct ieee80
rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
+   rtlpci->msi_support = rtlpriv->cfg->mod_params->int_clear;
if (rtlpriv->cfg->mod_params->disable_watchdog)
pr_info("watchdog disabled\n");
rtlpriv->psc.reg_fwctrl_lps = 3;
@@ -308,6 +310,7 @@ static struct rtl_mod_params rtl8821ae_m
.swctrl_lps = false,
.fwctrl_lps = true,
.msi_support = true,
+   .int_clear = true,
.debug = DBG_EMERG,
.disable_watchdog = 0,
 };
@@ -437,6 +440,7 @@ module_param_named(fwlps, rtl8821ae_mod_
 module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444);
 module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog,
   bool, 0444);
+module_param_named(int_clear, rtl8821ae_mod_params.int_clear, bool, 0444);
 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
 MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
 MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
@@ -444,6 +448,7 @@ MODULE_PARM_DESC(fwlps, "Set to 1 to use
 MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
 MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 
0)\n");
+MODULE_PARM_DESC(int_clear, "Set to 1 to disable interrupt clear before set 
(default 0)\n");
 
 static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, 

[PATCH 4.2 000/110] 4.2.6-stable review

2015-11-06 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.2.6 release.
There are 110 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sun Nov  8 19:16:22 UTC 2015.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.2.6-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 4.2.6-rc1

Greg Kroah-Hartman 
xen: fix backport of previous kexec patch

Mika Westerberg 
pinctrl: baytrail: Use raw_spinlock for locking

Mika Westerberg 
pinctrl: baytrail: Serialize all register access

Minchan Kim 
thp: use is_zero_pfn() only after pte_present() check

Thomas Hellstrom 
drm/vmwgfx: Fix up user_dmabuf refcounting

Keith Busch 
NVMe: Fix memory leak on retried commands

Will Deacon 
arm64: compat: fix stxr failure case in SWP emulation

Srinivas Pandruvada 
cpufreq: intel_pstate: Fix divide by zero on Knights Landing (KNL)

Luca Abeni 
sched/deadline: Fix migration of SCHED_DEADLINE tasks

Doron Tsur 
IB/cm: Fix rb-tree duplicate free and use-after-free

Junichi Nomura 
blk-mq: fix use-after-free in blk_mq_free_tag_set()

Richard Weinberger 
um: Fix kernel mode fault condition

Sudip Mukherjee 
thermal: exynos: Fix register read in TMU

Sudip Mukherjee 
kvm: irqchip: fix memory leak

Christian Engelmayer 
btrfs: fix possible leak in btrfs_ioctl_balance()

Nikolay Borisov 
netfilter: ipset: Fix sleeping memory allocation in atomic context

Dāvis Mosāns 
mvsas: Fix NULL pointer dereference in mvs_slot_task_free

Lucas Stach 
irqchip/tegra: Propagate IRQ type setting to parent

Seth Jennings 
EDAC, sb_edac: Fix TAD presence check for sbridge_mci_bind_devs()

NeilBrown 
Revert "md: allow a partially recovered device to be hot-added to an array."

Roman Gushchin 
md/raid5: fix locking in handle_stripe_clean_event()

Jes Sorensen 
md/raid10: submit_bio_wait() returns 0 on success

Jes Sorensen 
md/raid1: submit_bio_wait() returns 0 on success

Herbert Xu 
crypto: api - Only abort operations on fatal signal

Hans de Goede 
Input: alps - only the Dell Latitude D420/430/620/630 have separate stick 
button bits

Miklos Szeredi 
ovl: fix open in stacked overlay

David Howells 
ovl: fix dentry reference leak

David Howells 
ovl: use O_LARGEFILE in ovl_copy_up()

Konstantin Khlebnikov 
ovl: free lower_mnt array in ovl_put_super

Konstantin Khlebnikov 
ovl: free stack of paths in ovl_fill_super

Sasha Levin 
PCI: Prevent out of bounds access in numa_node override

Peter Zijlstra 
module: Fix locking in symbol_put_addr()

Cathy Avery 
xen-blkfront: check for null drvdata in blkback_changed (XenbusStateClosing)

Laura Abbott 
xhci: Add spurious wakeup quirk for LynxPoint-LP controllers

Mathias Nyman 
xhci: handle no ping response error properly

Scot Doyle 
fbcon: initialize blink interval before calling fb_set_par

Russell King 
clkdev: fix clk_add_alias() with a NULL alias device name

Hezi Shahmoon 
i2c: mv64xxx: really allow I2C offloading

Bjørn Mork 
USB: qcserial: add Sierra Wireless MC74xx/EM74xx

Frederic Danis 
Revert "serial: 8250_dma: don't bother DMA with small transfers"

Arnd Bergmann 
nvme: fix 32-bit build warning

Mike Snitzer 
dm btree: fix leak of bufio-backed block in btree_split_beneath error path

Joe Thornber 
dm cache: the CLEAN_SHUTDOWN flag was not being set

Joe Thornber 
dm btree remove: fix a bug when rebalancing nodes after removal

Tejun Heo 
block: don't release bdi while request_queue has live references

Lorenzo Pieralisi 
arm64: kernel: fix tcr_el1.t0sz restore on systems with extended idmap

Will Deacon 
Revert "ARM64: unwind: Fix PC calculation"

H. Nikolaus Schaller 
ARM: 8449/1: fix bug in vdsomunge swab32 macro

H. Nikolaus Schaller 
ARM: 8445/1: fix vdsomunge not to depend on glibc specific byteswap.h

Aaro Koskinen 
ARM: OMAP1: fix incorrect INT_DMA_LCD

Linus Walleij 
ARM: ux500: modify initial levelshifter status

Tomi Valkeinen 
ARM: dts: am57xx-beagle-x15: set VDD_SD to always-on

Fabio Estevam 
ARM: dts: imx7d: Fix UART2 base address

Alim Akhtar 
ARM: dts: Fix audio card detection on Peach boards

Thomas Hebb 
ARM: dts: berlin: change BG2Q's USB PHY compatible

Marcin Wojtas 
ARM: mvebu: correct a385-db-ap compatible string

Florian Fainelli 
ARM: orion: Fix DSA platform device after mvmdio conversion

Krzysztof Kozlowski 
ARM: EXYNOS: Fix double of_node_put() when parsing child power domains

Ilya Dryomov 
rbd: prevent kernel stack blow up on rbd map

Ilya Dryomov 
rbd: don't leak parent_spec in rbd_dev_probe_parent()

Ronny Hegewald 

[PATCH 4.2 039/110] drm/amdgpu: add missing dpm check for KV dpm late init

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher 

commit 677c884ff6370add1360e2b9558285355ebe2b36 upstream.

Skip dpm late init if dpm is disabled.

Signed-off-by: Alex Deucher 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -2997,6 +2997,9 @@ static int kv_dpm_late_init(void *handle
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
int ret;
 
+   if (!amdgpu_dpm)
+   return 0;
+
/* init the sysfs and debugfs files late */
ret = amdgpu_pm_sysfs_init(adev);
if (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/


Re: linux-next network throughput performance regression

2015-11-06 Thread David Ahern

On 11/6/15 1:31 PM, Simon Xiao wrote:

I compared the network throughput performance on SLES12 bare metal servers, 
between SLES12 default kernel and latest linux-next (2015-11-05) kernel, based 
on the test results, I suspect there is a network regression exists on 
Linux-Next over the 40G Ethernet network:
a) iperf3 reports 50% performance drop with single TCP stream on latest 
linux-next;
b) iperf3 reports 10% ~ 30% performance drop with 2 to 128 TCP streams on 
latest linux-next;
Another throughput benchmarking tool (ntttcp-for-linux) test result is also 
listed at the end of the email for reference.



Can you post your kernel config file?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 009/110] iwlwifi: mvm: fix D3 firmware PN programming

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Johannes Berg 

commit 2cf5eb3ab7bb7f2e3a70edcef236cd62c87db030 upstream.

The code to send the RX PN data (for each TID) to the firmware
has a devastating bug: it overwrites the data for TID 0 with
all the TID data, leaving the remaining TIDs zeroed. This will
allow replays to actually be accepted by the firmware, which
could allow waking up the system.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/iwlwifi/mvm/d3.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -293,12 +293,12 @@ static void iwl_mvm_wowlan_program_keys(
u8 *pn = seq.ccmp.pn;
 
ieee80211_get_key_rx_seq(key, i, );
-   aes_sc->pn = cpu_to_le64((u64)pn[5] |
-((u64)pn[4] << 8) |
-((u64)pn[3] << 16) |
-((u64)pn[2] << 24) |
-((u64)pn[1] << 32) |
-((u64)pn[0] << 40));
+   aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
+  ((u64)pn[4] << 8) |
+  ((u64)pn[3] << 16) |
+  ((u64)pn[2] << 24) |
+  ((u64)pn[1] << 32) |
+  ((u64)pn[0] << 40));
}
data->use_rsc_tsc = true;
break;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 043/110] drm/radeon: dont try to recreate sysfs entries on resume

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher 

commit 49abb26651167c892393cd9f2ad23df429645ed9 upstream.

Fixes a harmless error message caused by:
51a4726b04e880fdd9b4e0e58b13f70b0a68a7f5

Signed-off-by: Alex Deucher 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/radeon/radeon.h|1 +
 drivers/gpu/drm/radeon/radeon_pm.c |   35 +--
 2 files changed, 22 insertions(+), 14 deletions(-)

--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1658,6 +1658,7 @@ struct radeon_pm {
u8  fan_max_rpm;
/* dpm */
booldpm_enabled;
+   boolsysfs_initialized;
struct radeon_dpm   dpm;
 };
 
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1533,19 +1533,23 @@ int radeon_pm_late_init(struct radeon_de
 
if (rdev->pm.pm_method == PM_METHOD_DPM) {
if (rdev->pm.dpm_enabled) {
-   ret = device_create_file(rdev->dev, 
_attr_power_dpm_state);
-   if (ret)
-   DRM_ERROR("failed to create device file for dpm 
state\n");
-   ret = device_create_file(rdev->dev, 
_attr_power_dpm_force_performance_level);
-   if (ret)
-   DRM_ERROR("failed to create device file for dpm 
state\n");
-   /* XXX: these are noops for dpm but are here for 
backwards compat */
-   ret = device_create_file(rdev->dev, 
_attr_power_profile);
-   if (ret)
-   DRM_ERROR("failed to create device file for 
power profile\n");
-   ret = device_create_file(rdev->dev, 
_attr_power_method);
-   if (ret)
-   DRM_ERROR("failed to create device file for 
power method\n");
+   if (!rdev->pm.sysfs_initialized) {
+   ret = device_create_file(rdev->dev, 
_attr_power_dpm_state);
+   if (ret)
+   DRM_ERROR("failed to create device file 
for dpm state\n");
+   ret = device_create_file(rdev->dev, 
_attr_power_dpm_force_performance_level);
+   if (ret)
+   DRM_ERROR("failed to create device file 
for dpm state\n");
+   /* XXX: these are noops for dpm but are here 
for backwards compat */
+   ret = device_create_file(rdev->dev, 
_attr_power_profile);
+   if (ret)
+   DRM_ERROR("failed to create device file 
for power profile\n");
+   ret = device_create_file(rdev->dev, 
_attr_power_method);
+   if (ret)
+   DRM_ERROR("failed to create device file 
for power method\n");
+   if (!ret)
+   rdev->pm.sysfs_initialized = true;
+   }
 
mutex_lock(>pm.mutex);
ret = radeon_dpm_late_enable(rdev);
@@ -1561,7 +1565,8 @@ int radeon_pm_late_init(struct radeon_de
}
}
} else {
-   if (rdev->pm.num_power_states > 1) {
+   if ((rdev->pm.num_power_states > 1) &&
+   (!rdev->pm.sysfs_initialized)) {
/* where's the best place to put these? */
ret = device_create_file(rdev->dev, 
_attr_power_profile);
if (ret)
@@ -1569,6 +1574,8 @@ int radeon_pm_late_init(struct radeon_de
ret = device_create_file(rdev->dev, 
_attr_power_method);
if (ret)
DRM_ERROR("failed to create device file for 
power method\n");
+   if (!ret)
+   rdev->pm.sysfs_initialized = true;
}
}
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/


[PATCH 4.2 044/110] drm/amdgpu: dont try to recreate sysfs entries on resume

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher 

commit c86f5ebfbd147d1a228ab89ee1658e18939bd7ad upstream.

Fixes an error on resume caused by:
fa022a9b65d2886486a022fd66b20c823cd76ad9

Signed-off-by: Alex Deucher 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h|1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |5 +
 2 files changed, 6 insertions(+)

--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1583,6 +1583,7 @@ struct amdgpu_pm {
u8  fan_max_rpm;
/* dpm */
booldpm_enabled;
+   boolsysfs_initialized;
struct amdgpu_dpm   dpm;
const struct firmware   *fw;/* SMC firmware */
uint32_tfw_version;
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -693,6 +693,9 @@ int amdgpu_pm_sysfs_init(struct amdgpu_d
 {
int ret;
 
+   if (adev->pm.sysfs_initialized)
+   return 0;
+
if (adev->pm.funcs->get_temperature == NULL)
return 0;
adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev,
@@ -721,6 +724,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_d
return ret;
}
 
+   adev->pm.sysfs_initialized = true;
+
return 0;
 }
 


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


BUG: unable to handle kernel NULL pointer dereference when mounting/umounting vfat in 4.3.0, worked in 4.2.4

2015-11-06 Thread Mads Lønsethagen
After updating from 4.2.4 to 4.3.0 I cannot seem to list files in my 
/boot-folder after mounting it, and I get a kernel BUG when I try to 
umount it.


exai ~ # mount /boot
exai ~ # sync
exai ~ # mount
[ ... snip ... ]
/dev/sda1 on /boot type vfat 
(rw,noatime,fmask=0022,dmask=0022,codepage=865,iocharset=utf8,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs 
(rw,nosuid,nodev,relatime,size=808900k,mode=700,uid=1000,gid=1000)

exai ~ # ls -l /boot
ls: cannot open directory /boot: No such device or address
exai ~ # umount /boot/
Killed
exai ~ # dmesg | tail -50
[   47.959725] cfg80211:   (515 KHz - 525 KHz @ 8 KHz, 
20 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   47.959726] cfg80211:   (525 KHz - 535 KHz @ 8 KHz, 
20 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   47.959727] cfg80211:   (547 KHz - 5725000 KHz @ 16 KHz), 
(N/A, 2698 mBm), (0 s)
[   47.959728] cfg80211:   (5700 KHz - 6600 KHz @ 216 KHz), 
(N/A, 4000 mBm), (N/A)
[  101.965931] BUG: unable to handle kernel NULL pointer dereference at 
0028
[  101.966053] IP: [] 
truncate_inode_pages_range+0x1e/0x6a0

[  101.966152] PGD 838e7067 PUD 6c8db067 PMD 0
[  101.966222] Oops:  [#1] PREEMPT SMP
[  101.966300] Modules linked in: iwlmvm iwlwifi vfat fat uvcvideo 
videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev 
x86_pkg_temp_thermal coretemp kvm_intel kvm microcode i2c_i801 iTCO_wdt 
xhci_pci xhci_hcd ideapad_laptop sparse_keymap int3403_thermal 
int3402_thermal processor_thermal_device int340x_thermal_zone 
intel_soc_dts_iosf int3400_thermal iosf_mbi acpi_thermal_rel 
intel_smartconnect efivarfs

[  101.967059] CPU: 0 PID: 1311 Comm: umount Not tainted 4.3.0-gentoo #1
[  101.967151] Hardware name: LENOVO 20266/Yoga2, BIOS 76CN42WW 
03/02/2015
[  101.967206] task: 880087a23000 ti: 88006c92c000 task.ti: 
88006c92c000
[  101.967269] RIP: 0010:[]  [] 
truncate_inode_pages_range+0x1e/0x6a0

[  101.967354] RSP: 0018:88006c92fcd0  EFLAGS: 00010282
[  101.967395] RAX:  RBX:  RCX: 
9e37fffc0001
[  101.967453] RDX:  RSI:  RDI: 
88008897c770
[  101.967512] RBP:  R08:  R09: 

[  101.967571] R10: 88008897c718 R11:  R12: 
a03468c0
[  101.967630] R13: 88006c93 R14: 8802532bd438 R15: 
88008897c690
[  101.967689] FS:  7fabc7f61780() GS:88025f20() 
knlGS:

[  101.967757] CS:  0010 DS:  ES:  CR0: 80050033
[  101.967802] CR2: 0028 CR3: 6c8df000 CR4: 
001406f0

[  101.967880] Stack:
[  101.967897]  88008897c770  880087a23000 

[  101.967966]  81100678  810fefd6 
88006c92fe58
[  101.968034]  00ff 0002900e19c0 810fd640 
8802540b8248

[  101.968102] Call Trace:
[  101.968117]  [] ? pagevec_lookup_tag+0x18/0x20
[  101.968167]  [] ? write_cache_pages+0xe6/0x390
[  101.968215]  [] ? domain_dirty_limits+0xe0/0xe0
[  101.968266]  [] ? finish_task_switch+0x53/0x180
[  101.968316]  [] ? find_get_pages_tag+0x126/0x160
[  101.968366]  [] ? 
__inode_wait_for_writeback+0x62/0xb0
[  101.968422]  [] ? 
autoremove_wake_function+0x30/0x30

[  101.968478]  [] ? fat_evict_inode+0x10/0x50 [fat]
[  101.968530]  [] ? evict+0xb3/0x180
[  101.968567]  [] ? dispose_list+0x2d/0x40
[  101.968611]  [] ? evict_inodes+0x13a/0x150
[  101.968656]  [] ? generic_shutdown_super+0x35/0xe0
[  101.968707]  [] ? kill_block_super+0x1c/0x60
[  101.968754]  [] ? deactivate_locked_super+0x34/0x60
[  101.968806]  [] ? cleanup_mnt+0x36/0x80
[  101.968860]  [] ? task_work_run+0x6f/0x90
[  101.968917]  [] ? 
prepare_exit_to_usermode+0x95/0xd0

[  101.968971]  [] ? int_ret_from_sys_call+0x25/0x8f
[  101.969021] Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 41 57 41 56 
41 55 41 54 55 48 89 f5 53 48 89 d3 48 81 ec 10 01 00 00 48 8b 07 48 89 
3c 24 <48> 8b 40 28 8b 80 08 04 00 00 85 c0 78 05 e8 cf 19 04 00 48 8b
[  101.969295] RIP  [] 
truncate_inode_pages_range+0x1e/0x6a0

[  101.969355]  RSP 
[  101.969377] CR2: 0028
[  101.990401] ---[ end trace a5cb453620b7ad23 ]---
exai ~ #

I sent this in to bugzilla.kernel.org[1] thinking it had something to do 
with vfat, but Ogawa Hirofumi disassembled the trace:


OGAWA Hirofumi 2015-11-06 19:36:56 UTC
--

Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 41 57 41 56 41 55 41 54 55 
48 89 f5 53 48 89 d3 48 81 ec 10 01 00 00 48 8b 07 48 89 3c 24 <48> 8b 
40 28 8b 80 08 04 00 00 85 c0 78 05 e8 cf 19 04 00 48 8b


Disassemble of oops code

   0:   ff  (bad)
   1:   ff c3   inc%ebx
   3:   66 2e 0f 1f 84 00 00nopw   %cs:0x0(%rax,%rax,1)
   a:   00 00 00
   d:   41 57   push   %r15
   f:   41 56   push   %r14
  11:   41 55 

[PATCH] Preserve task state in reentrant calls to ___wait_event

2015-11-06 Thread Chris Bainbridge
In the ACPI SBS initialisation, a reentrant call to wait_event_timeout()
causes an intermittent boot stall of several minutes usually following
the "Switching to clocksource tsc" message. This stall is caused by:

 1. drivers/acpi/sbshc.c wait_transaction_complete() calls
wait_event_timeout():

if (wait_event_timeout(hc->wait, smb_check_done(hc),
   msecs_to_jiffies(timeout)))

 2. ___wait_event sets task state to uninterruptible

 3. ___wait_event calls the "condition" smb_check_done()

 4. smb_check_done (sbshc.c) calls through to ec_read() in
drivers/acpi/ec.c

 5. ec_guard() is reached which calls wait_event_timeout()

if (wait_event_timeout(ec->wait,
   ec_transaction_completed(ec),
   guard))

ie. wait_event_timeout() is being called again inside evaluation of
the previous wait_event_timeout() condition

 5. The EC IRQ handler calls wake_up() and wakes up the sleeping task in
ec_guard()

 6. The task is now in state running even though the wait "condition" is
still being evaluated

 7. The "condition" check returns false so ___wait_event calls
schedule_timeout()

 8. Since the task state is running, the scheduler immediately schedules
it again

 9. This loop repeats for around 250 seconds event though the original
wait_event_timeout was only 1000ms.

This happens because each the call to schedule_timeout() usually
returns immediately, taking less than 1ms, so the jiffies timeout
counter is not decremented. The task is now stuck in a running
state, and so is highly likely to get rescheduled immediately, which
takes less than a jiffy.

The root problem is that wait_event_timeout() does not preserve the task
state when called by tasks that are not running. We fix this by
preserving and restoring the task state in ___wait_event().

Signed-off-by: Chris Bainbridge 
---
I am assuming here that wait_event_timeout() is supposed to support reentrant
calls. If not, perhaps it should BUG_ON when called with a non-running task
state, and the SBS HC / ACPI EC code needs to be fixed to stop doing this. If
reentrant calls are supposed to work, then this patch will preserve the task
state (there may be a more appropriate way to support reentrant calls than this
exact patch, suggestions/alternatives are welcome, but this does work).
---
 include/linux/wait.h | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1e1bf9f..a847cf8 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -209,11 +209,12 @@ wait_queue_head_t *bit_waitqueue(void *, int);
  * otherwise.
  */
 
-#define ___wait_event(wq, condition, state, exclusive, ret, cmd)   \
+#define ___wait_event(wq, condition, nstate, exclusive, ret, cmd)  \
 ({ \
__label__ __out;\
wait_queue_t __wait;\
long __ret = ret;   /* explicit shadow */   \
+   long ostate = current->state;   \
\
INIT_LIST_HEAD(&__wait.task_list);  \
if (exclusive)  \
@@ -222,16 +223,16 @@ wait_queue_head_t *bit_waitqueue(void *, int);
__wait.flags = 0;   \
\
for (;;) {  \
-   long __int = prepare_to_wait_event(, &__wait, state);\
+   long __int = prepare_to_wait_event(, &__wait, nstate);\
\
if (condition)  \
break;  \
\
-   if (___wait_is_interruptible(state) && __int) { \
+   if (___wait_is_interruptible(nstate) && __int) {\
__ret = __int;  \
if (exclusive) {\
abort_exclusive_wait(, &__wait,  \
-state, NULL);  \
+nstate, NULL); \
goto __out; \
}   \
break;  \
@@ -240,6 +241,7 @@ wait_queue_head_t 

[PATCH 4.2 049/110] iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb()

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter 

commit eda7d0f38aaf50dbb2a2de15e8db386c4f6f65fc upstream.

"num_read" is in byte units but we are write u16s so we end up write
twice as much as intended.

Signed-off-by: Dan Carpenter 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/staging/iio/accel/sca3000_ring.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(st
if (ret)
goto error_ret;
 
-   for (i = 0; i < num_read; i++)
+   for (i = 0; i < num_read / sizeof(u16); i++)
*(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i);
 
if (copy_to_user(buf, rx, num_read))


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 048/110] iio: st_accel: fix interrupt handling on LIS3LV02

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Walleij 

commit 61fd56309165d4790f99462d893b099f0b07312a upstream.

This accelerometer accidentally either emits a DRDY signal or an
IRQ signal. Accidentally I activated the IRQ signal as I thought
it was analogous to the interrupt generator on other ST
accelerometers. This was wrong. After this patch generic_buffer
gives a nice stream of accelerometer readings.

Fixes: 3acddf74f807778f "iio: st-sensors: add support for lis3lv02d 
accelerometer"
Cc: Denis CIOCCA 
Signed-off-by: Linus Walleij 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iio/accel/st_accel_core.c |6 --
 1 file changed, 6 deletions(-)

--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -149,8 +149,6 @@
 #define ST_ACCEL_4_BDU_MASK0x40
 #define ST_ACCEL_4_DRDY_IRQ_ADDR   0x21
 #define ST_ACCEL_4_DRDY_IRQ_INT1_MASK  0x04
-#define ST_ACCEL_4_IG1_EN_ADDR 0x21
-#define ST_ACCEL_4_IG1_EN_MASK 0x08
 #define ST_ACCEL_4_MULTIREAD_BIT   true
 
 /* CUSTOM VALUES FOR SENSOR 5 */
@@ -484,10 +482,6 @@ static const struct st_sensor_settings s
.drdy_irq = {
.addr = ST_ACCEL_4_DRDY_IRQ_ADDR,
.mask_int1 = ST_ACCEL_4_DRDY_IRQ_INT1_MASK,
-   .ig1 = {
-   .en_addr = ST_ACCEL_4_IG1_EN_ADDR,
-   .en_mask = ST_ACCEL_4_IG1_EN_MASK,
-   },
},
.multi_read_bit = ST_ACCEL_4_MULTIREAD_BIT,
.bootime = 2, /* guess */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 050/110] rbd: require stable pages if message data CRCs are enabled

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Ronny Hegewald 

commit bae818ee1577c27356093901a0ea48f672eda514 upstream.

rbd requires stable pages, as it performs a crc of the page data before
they are send to the OSDs.

But since kernel 3.9 (patch 1d1d1a767206fbe5d4c69493b7e6d2a8d08cc0a0
"mm: only enforce stable page writes if the backing device requires
it") it is not assumed anymore that block devices require stable pages.

This patch sets the necessary flag to get stable pages back for rbd.

In a ceph installation that provides multiple ext4 formatted rbd
devices "bad crc" messages appeared regularly (ca 1 message every 1-2
minutes on every OSD that provided the data for the rbd) in the
OSD-logs before this patch. After this patch this messages are pretty
much gone (only ca 1-2 / month / OSD).

Signed-off-by: Ronny Hegewald 
[idryo...@gmail.com: require stable pages only in crc case, changelog]
[idryo...@gmail.com: backport to 3.18-4.2: context]
Signed-off-by: Ilya Dryomov 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/block/rbd.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3819,6 +3819,9 @@ static int rbd_init_disk(struct rbd_devi
q->limits.discard_zeroes_data = 1;
 
blk_queue_merge_bvec(q, rbd_merge_bvec);
+   if (!ceph_test_opt(rbd_dev->rbd_client->client, NOCRC))
+   q->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES;
+
disk->queue = q;
 
q->queuedata = rbd_dev;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 028/110] ASoC: Add info callback for SX_TLV controls

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Charles Keepax 

commit 34198710f55b5f359f43e67d9a08fe5aadfbca1b upstream.

SX_TLV controls are intended for situations where the register behind
the control has some non-zero value indicating the minimum gain
and then gains increasing from there and eventually overflowing through
zero.

Currently every CODEC implementing these controls specifies the minimum
as the non-zero value for the minimum and the maximum as the number of
gain settings available.

This means when the info callback subtracts the minimum value from the
maximum value to calculate the number of gain levels available it is
actually under reporting the available levels. This patch fixes this
issue by adding a new snd_soc_info_volsw_sx callback that does not
subtract the minimum value.

Fixes: 1d99f2436d0d ("ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add 
SOC_SINGLE_SX_TLV")
Signed-off-by: Charles Keepax 
Acked-by: Brian Austin 
Tested-by: Brian Austin 
Signed-off-by: Mark Brown 
Signed-off-by: Greg Kroah-Hartman 

---
 include/sound/soc.h |6 --
 sound/soc/soc-ops.c |   28 
 2 files changed, 32 insertions(+), 2 deletions(-)

--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -86,7 +86,7 @@
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
SNDRV_CTL_ELEM_ACCESS_READWRITE, \
.tlv.p  = (tlv_array),\
-   .info = snd_soc_info_volsw, \
+   .info = snd_soc_info_volsw_sx, \
.get = snd_soc_get_volsw_sx,\
.put = snd_soc_put_volsw_sx, \
.private_value = (unsigned long)&(struct soc_mixer_control) \
@@ -156,7 +156,7 @@
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
SNDRV_CTL_ELEM_ACCESS_READWRITE, \
.tlv.p  = (tlv_array), \
-   .info = snd_soc_info_volsw, \
+   .info = snd_soc_info_volsw_sx, \
.get = snd_soc_get_volsw_sx, \
.put = snd_soc_put_volsw_sx, \
.private_value = (unsigned long)&(struct soc_mixer_control) \
@@ -573,6 +573,8 @@ int snd_soc_put_enum_double(struct snd_k
struct snd_ctl_elem_value *ucontrol);
 int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
+int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo);
 #define snd_soc_info_bool_ext  snd_ctl_boolean_mono_info
 int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -207,6 +207,34 @@ int snd_soc_info_volsw(struct snd_kcontr
 EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
 
 /**
+ * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls
+ * @kcontrol: mixer control
+ * @uinfo: control element information
+ *
+ * Callback to provide information about a single mixer control, or a double
+ * mixer control that spans 2 registers of the SX TLV type. SX TLV controls
+ * have a range that represents both positive and negative values either side
+ * of zero but without a sign bit.
+ *
+ * Returns 0 for success.
+ */
+int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+   struct soc_mixer_control *mc =
+   (struct soc_mixer_control *)kcontrol->private_value;
+
+   snd_soc_info_volsw(kcontrol, uinfo);
+   /* Max represents the number of levels in an SX control not the
+* maximum value, so add the minimum value back on
+*/
+   uinfo->value.integer.max += mc->min;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
+
+/**
  * snd_soc_get_volsw - single mixer get callback
  * @kcontrol: mixer control
  * @ucontrol: control element information


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 051/110] rbd: dont leak parent_spec in rbd_dev_probe_parent()

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Ilya Dryomov 

commit 1f2c6651f69c14d0d3a9cfbda44ea101b02160ba upstream.

Currently we leak parent_spec and trigger a "parent reference
underflow" warning if rbd_dev_create() in rbd_dev_probe_parent() fails.
The problem is we take the !parent out_err branch and that only drops
refcounts; parent_spec that would've been freed had we called
rbd_dev_unparent() remains and triggers rbd_warn() in
rbd_dev_parent_put() - at that point we have parent_spec != NULL and
parent_ref == 0, so counter ends up being -1 after the decrement.

Redo rbd_dev_probe_parent() to fix this.

Signed-off-by: Ilya Dryomov 
Reviewed-by: Alex Elder 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/block/rbd.c |   36 
 1 file changed, 16 insertions(+), 20 deletions(-)

--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5175,41 +5175,37 @@ out_err:
 static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)
 {
struct rbd_device *parent = NULL;
-   struct rbd_spec *parent_spec;
-   struct rbd_client *rbdc;
int ret;
 
if (!rbd_dev->parent_spec)
return 0;
-   /*
-* We need to pass a reference to the client and the parent
-* spec when creating the parent rbd_dev.  Images related by
-* parent/child relationships always share both.
-*/
-   parent_spec = rbd_spec_get(rbd_dev->parent_spec);
-   rbdc = __rbd_get_client(rbd_dev->rbd_client);
 
-   ret = -ENOMEM;
-   parent = rbd_dev_create(rbdc, parent_spec, NULL);
-   if (!parent)
+   parent = rbd_dev_create(rbd_dev->rbd_client, rbd_dev->parent_spec,
+   NULL);
+   if (!parent) {
+   ret = -ENOMEM;
goto out_err;
+   }
+
+   /*
+* Images related by parent/child relationships always share
+* rbd_client and spec/parent_spec, so bump their refcounts.
+*/
+   __rbd_get_client(rbd_dev->rbd_client);
+   rbd_spec_get(rbd_dev->parent_spec);
 
ret = rbd_dev_image_probe(parent, false);
if (ret < 0)
goto out_err;
+
rbd_dev->parent = parent;
atomic_set(_dev->parent_ref, 1);
-
return 0;
+
 out_err:
-   if (parent) {
-   rbd_dev_unparent(rbd_dev);
+   rbd_dev_unparent(rbd_dev);
+   if (parent)
rbd_dev_destroy(parent);
-   } else {
-   rbd_put_client(rbdc);
-   rbd_spec_put(parent_spec);
-   }
-
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/


[PATCH 4.2 031/110] x86/setup: Extend low identity map to cover whole kernel range

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Paolo Bonzini 

commit f5f3497cad8c8416a74b9aaceb127908755d020a upstream.

On 32-bit systems, the initial_page_table is reused by
efi_call_phys_prolog as an identity map to call
SetVirtualAddressMap.  efi_call_phys_prolog takes care of
converting the current CPU's GDT to a physical address too.

For PAE kernels the identity mapping is achieved by aliasing the
first PDPE for the kernel memory mapping into the first PDPE
of initial_page_table.  This makes the EFI stub's trick "just work".

However, for non-PAE kernels there is no guarantee that the identity
mapping in the initial_page_table extends as far as the GDT; in this
case, accesses to the GDT will cause a page fault (which quickly becomes
a triple fault).  Fix this by copying the kernel mappings from
swapper_pg_dir to initial_page_table twice, both at PAGE_OFFSET and at
identity mapping.

For some reason, this is only reproducible with QEMU's dynamic translation
mode, and not for example with KVM.  However, even under KVM one can clearly
see that the page table is bogus:

$ qemu-system-i386 -pflash OVMF.fd -M q35 vmlinuz0 -s -S -daemonize
$ gdb
(gdb) target remote localhost:1234
(gdb) hb *0x02858f6f
Hardware assisted breakpoint 1 at 0x2858f6f
(gdb) c
Continuing.

Breakpoint 1, 0x02858f6f in ?? ()
(gdb) monitor info registers
...
GDT= 0724e000 00ff
IDT= fffbb000 07ff
CR0=0005003b CR2=ff896000 CR3=032b7000 CR4=0690
...

The page directory is sane:

(gdb) x/4wx 0x32b7000
0x32b7000:  0x03398063  0x03399063  0x0339a063  0x0339b063
(gdb) x/4wx 0x3398000
0x3398000:  0x0163  0x1163  0x2163  0x3163
(gdb) x/4wx 0x3399000
0x3399000:  0x0043  0x00401003  0x00402003  0x00403003

but our particular page directory entry is empty:

(gdb) x/1wx 0x32b7000 + (0x724e000 >> 22) * 4
0x32b7070:  0x

[ It appears that you can skate past this issue if you don't receive
  any interrupts while the bogus GDT pointer is loaded, or if you avoid
  reloading the segment registers in general.

  Andy Lutomirski provides some additional insight:

   "AFAICT it's entirely permissible for the GDTR and/or LDT
descriptor to point to unmapped memory.  Any attempt to use them
(segment loads, interrupts, IRET, etc) will try to access that memory
as if the access came from CPL 0 and, if the access fails, will
generate a valid page fault with CR2 pointing into the GDT or
LDT."

  Up until commit 23a0d4e8fa6d ("efi: Disable interrupts around EFI
  calls, not in the epilog/prolog calls") interrupts were disabled
  around the prolog and epilog calls, and the functional GDT was
  re-installed before interrupts were re-enabled.

  Which explains why no one has hit this issue until now. ]

Signed-off-by: Paolo Bonzini 
Reported-by: Laszlo Ersek 
Cc: Borislav Petkov 
Cc: "H. Peter Anvin" 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Andy Lutomirski 
Signed-off-by: Matt Fleming 
[ Updated changelog. ]
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/setup.c |8 
 1 file changed, 8 insertions(+)

--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1198,6 +1198,14 @@ void __init setup_arch(char **cmdline_p)
clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
swapper_pg_dir + KERNEL_PGD_BOUNDARY,
KERNEL_PGD_PTRS);
+
+   /*
+* sync back low identity map too.  It is used for example
+* in the 32-bit EFI stub.
+*/
+   clone_pgd_range(initial_page_table,
+   swapper_pg_dir + KERNEL_PGD_BOUNDARY,
+   KERNEL_PGD_PTRS);
 #endif
 
tboot_probe();


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 053/110] ARM: EXYNOS: Fix double of_node_put() when parsing child power domains

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Krzysztof Kozlowski 

commit 51a6256b8a3c520f6f31bcd62cd15cb05960 upstream.

On each next iteration of for_each_compatible_node() the reference
counter for current device node is already decreased by the loop
iterator. The manual call to of_node_get() is required only on loop
break which is not happening here.

The double of_node_get() (with enabled CONFIG_OF_DYNAMIC) lead to
decreasing the counter below expected, initial value.

Fixes: fe4034a3fad7 ("ARM: EXYNOS: Add missing of_node_put() when parsing power 
domains")
Signed-off-by: Krzysztof Kozlowski 
Signed-off-by: Kukjin Kim 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mach-exynos/pm_domains.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -200,15 +200,15 @@ no_clk:
args.args_count = 0;
child_domain = of_genpd_get_from_provider();
if (IS_ERR(child_domain))
-   goto next_pd;
+   continue;
 
if (of_parse_phandle_with_args(np, "power-domains",
 "#power-domain-cells", 0, ) != 0)
-   goto next_pd;
+   continue;
 
parent_domain = of_genpd_get_from_provider();
if (IS_ERR(parent_domain))
-   goto next_pd;
+   continue;
 
if (pm_genpd_add_subdomain(parent_domain, child_domain))
pr_warn("%s failed to add subdomain: %s\n",
@@ -216,8 +216,6 @@ no_clk:
else
pr_info("%s has as child subdomain: %s.\n",
parent_domain->name, child_domain->name);
-next_pd:
-   of_node_put(np);
}
 
return 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.2 052/110] rbd: prevent kernel stack blow up on rbd map

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Ilya Dryomov 

commit 6d69bb536bac0d403d83db1ca841444981b280cd upstream.

Mapping an image with a long parent chain (e.g. image foo, whose parent
is bar, whose parent is baz, etc) currently leads to a kernel stack
overflow, due to the following recursion in the reply path:

  rbd_osd_req_callback()
rbd_obj_request_complete()
  rbd_img_obj_callback()
rbd_img_parent_read_callback()
  rbd_obj_request_complete()
...

Limit the parent chain to 16 images, which is ~5K worth of stack.  When
the above recursion is eliminated, this limit can be lifted.

Fixes: http://tracker.ceph.com/issues/12538

Signed-off-by: Ilya Dryomov 
Reviewed-by: Josh Durgin 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/block/rbd.c |   33 +++--
 1 file changed, 23 insertions(+), 10 deletions(-)

--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -96,6 +96,8 @@ static int atomic_dec_return_safe(atomic
 #define RBD_MINORS_PER_MAJOR   256
 #define RBD_SINGLE_MAJOR_PART_SHIFT4
 
+#define RBD_MAX_PARENT_CHAIN_LEN   16
+
 #define RBD_SNAP_DEV_NAME_PREFIX   "snap_"
 #define RBD_MAX_SNAP_NAME_LEN  \
(NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1))
@@ -426,7 +428,7 @@ static ssize_t rbd_add_single_major(stru
size_t count);
 static ssize_t rbd_remove_single_major(struct bus_type *bus, const char *buf,
   size_t count);
-static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping);
+static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth);
 static void rbd_spec_put(struct rbd_spec *spec);
 
 static int rbd_dev_id_to_minor(int dev_id)
@@ -5172,7 +5174,12 @@ out_err:
return ret;
 }
 
-static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)
+/*
+ * @depth is rbd_dev_image_probe() -> rbd_dev_probe_parent() ->
+ * rbd_dev_image_probe() recursion depth, which means it's also the
+ * length of the already discovered part of the parent chain.
+ */
+static int rbd_dev_probe_parent(struct rbd_device *rbd_dev, int depth)
 {
struct rbd_device *parent = NULL;
int ret;
@@ -5180,6 +5187,12 @@ static int rbd_dev_probe_parent(struct r
if (!rbd_dev->parent_spec)
return 0;
 
+   if (++depth > RBD_MAX_PARENT_CHAIN_LEN) {
+   pr_info("parent chain is too long (%d)\n", depth);
+   ret = -EINVAL;
+   goto out_err;
+   }
+
parent = rbd_dev_create(rbd_dev->rbd_client, rbd_dev->parent_spec,
NULL);
if (!parent) {
@@ -5194,7 +5207,7 @@ static int rbd_dev_probe_parent(struct r
__rbd_get_client(rbd_dev->rbd_client);
rbd_spec_get(rbd_dev->parent_spec);
 
-   ret = rbd_dev_image_probe(parent, false);
+   ret = rbd_dev_image_probe(parent, depth);
if (ret < 0)
goto out_err;
 
@@ -5323,7 +5336,7 @@ static void rbd_dev_image_release(struct
  * parent), initiate a watch on its header object before using that
  * object to get detailed information about the rbd image.
  */
-static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
+static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
 {
int ret;
 
@@ -5341,7 +5354,7 @@ static int rbd_dev_image_probe(struct rb
if (ret)
goto err_out_format;
 
-   if (mapping) {
+   if (!depth) {
ret = rbd_dev_header_watch_sync(rbd_dev);
if (ret) {
if (ret == -ENOENT)
@@ -5362,7 +5375,7 @@ static int rbd_dev_image_probe(struct rb
 * Otherwise this is a parent image, identified by pool, image
 * and snap ids - need to fill in names for those ids.
 */
-   if (mapping)
+   if (!depth)
ret = rbd_spec_fill_snap_id(rbd_dev);
else
ret = rbd_spec_fill_names(rbd_dev);
@@ -5384,12 +5397,12 @@ static int rbd_dev_image_probe(struct rb
 * Need to warn users if this image is the one being
 * mapped and has a parent.
 */
-   if (mapping && rbd_dev->parent_spec)
+   if (!depth && rbd_dev->parent_spec)
rbd_warn(rbd_dev,
 "WARNING: kernel layering is EXPERIMENTAL!");
}
 
-   ret = rbd_dev_probe_parent(rbd_dev);
+   ret = rbd_dev_probe_parent(rbd_dev, depth);
if (ret)
goto err_out_probe;
 
@@ -5400,7 +5413,7 @@ static int rbd_dev_image_probe(struct rb
 err_out_probe:
rbd_dev_unprobe(rbd_dev);
 err_out_watch:
-   if (mapping)
+   if (!depth)
rbd_dev_header_unwatch_sync(rbd_dev);
 out_header_name:
kfree(rbd_dev->header_name);
@@ -5463,7 +5476,7 @@ static ssize_t 

[PATCH 4.2 054/110] ARM: orion: Fix DSA platform device after mvmdio conversion

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Florian Fainelli 

commit d836ace65ee98d7079bc3c5afdbcc0e27dca20a3 upstream.

DSA expects the host_dev pointer to be the device structure associated
with the MDIO bus controller driver. First commit breaking that was
c3a07134e6aa ("mv643xx_eth: convert to use the Marvell Orion MDIO
driver"), and then, it got completely under the radar for a while.

Reported-by: Frans van de Wiel 
Fixes: c3a07134e6aa ("mv643xx_eth: convert to use the Marvell Orion MDIO 
driver")
Signed-off-by: Florian Fainelli 
Signed-off-by: Gregory CLEMENT 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/plat-orion/common.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -495,7 +495,7 @@ void __init orion_ge00_switch_init(struc
 
d->netdev = _ge00.dev;
for (i = 0; i < d->nr_chips; i++)
-   d->chip[i].host_dev = _ge00_shared.dev;
+   d->chip[i].host_dev = _ge_mvmdio.dev;
orion_switch_device.dev.platform_data = d;
 
platform_device_register(_switch_device);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v14 01/22] vfs: Add IS_ACL() and IS_RICHACL() tests

2015-11-06 Thread Andreas Dilger
On Nov 5, 2015, at 4:39 AM, Andreas Gruenbacher  wrote:
> 
> The vfs does not apply the umask for file systems that support acls. The
> test used for this used to be called IS_POSIXACL(). Switch to a new
> IS_ACL() test to check for either posix acls or richacls instead. Add a new
> MS_RICHACL flag and IS_RICHACL() test for richacls alone. The IS_POSIXACL()
> test is still needed by nfsd.
> 
> Signed-off-by: Andreas Gruenbacher 
> Reviewed-by: J. Bruce Fields 

Looks good to me.

Reviewed-by: Andreas Dilger 

> ---
> fs/Kconfig  |  3 +++
> fs/namei.c  |  8 
> include/linux/fs.h  | 12 
> include/uapi/linux/fs.h |  3 ++-
> 4 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/Kconfig b/fs/Kconfig
> index da3f32f..bff2879 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -56,6 +56,9 @@ endif # BLOCK
> config FS_POSIX_ACL
>   def_bool n
> 
> +config FS_RICHACL
> + def_bool n
> +
> config EXPORTFS
>   tristate
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 33e9495..224ecf1 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -2798,7 +2798,7 @@ static int atomic_open(struct nameidata *nd, struct 
> dentry *dentry,
>   }
> 
>   mode = op->mode;
> - if ((open_flag & O_CREAT) && !IS_POSIXACL(dir))
> + if ((open_flag & O_CREAT) && !IS_ACL(dir))
>   mode &= ~current_umask();
> 
>   excl = (open_flag & (O_EXCL | O_CREAT)) == (O_EXCL | O_CREAT);
> @@ -2982,7 +2982,7 @@ static int lookup_open(struct nameidata *nd, struct 
> path *path,
>   /* Negative dentry, just create the file */
>   if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
>   umode_t mode = op->mode;
> - if (!IS_POSIXACL(dir->d_inode))
> + if (!IS_ACL(dir->d_inode))
>   mode &= ~current_umask();
>   /*
>* This write is needed to ensure that a
> @@ -3553,7 +3553,7 @@ retry:
>   if (IS_ERR(dentry))
>   return PTR_ERR(dentry);
> 
> - if (!IS_POSIXACL(path.dentry->d_inode))
> + if (!IS_ACL(path.dentry->d_inode))
>   mode &= ~current_umask();
>   error = security_path_mknod(, dentry, mode, dev);
>   if (error)
> @@ -3622,7 +3622,7 @@ retry:
>   if (IS_ERR(dentry))
>   return PTR_ERR(dentry);
> 
> - if (!IS_POSIXACL(path.dentry->d_inode))
> + if (!IS_ACL(path.dentry->d_inode))
>   mode &= ~current_umask();
>   error = security_path_mkdir(, dentry, mode);
>   if (!error)
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 72d8a84..4efa435 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1781,6 +1781,12 @@ struct super_operations {
> #define IS_IMMUTABLE(inode)   ((inode)->i_flags & S_IMMUTABLE)
> #define IS_POSIXACL(inode)__IS_FLG(inode, MS_POSIXACL)
> 
> +#ifdef CONFIG_FS_RICHACL
> +#define IS_RICHACL(inode)__IS_FLG(inode, MS_RICHACL)
> +#else
> +#define IS_RICHACL(inode)0
> +#endif
> +
> #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
> #define IS_NOCMTIME(inode)((inode)->i_flags & S_NOCMTIME)
> #define IS_SWAPFILE(inode)((inode)->i_flags & S_SWAPFILE)
> @@ -1794,6 +1800,12 @@ struct super_operations {
>(inode)->i_rdev == WHITEOUT_DEV)
> 
> /*
> + * IS_ACL() tells the VFS to not apply the umask
> + * and use check_acl for acl permission checks when defined.
> + */
> +#define IS_ACL(inode)__IS_FLG(inode, MS_POSIXACL | 
> MS_RICHACL)
> +
> +/*
>  * Inode state bits.  Protected by inode->i_lock
>  *
>  * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index 9b964a5..6ac6bc9 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -81,7 +81,7 @@ struct inodes_stat_t {
> #define MS_VERBOSE32768   /* War is peace. Verbosity is silence.
>  MS_VERBOSE is deprecated. */
> #define MS_SILENT 32768
> -#define MS_POSIXACL  (1<<16) /* VFS does not apply the umask */
> +#define MS_POSIXACL  (1<<16) /* Supports POSIX ACLs */
> #define MS_UNBINDABLE (1<<17) /* change to unbindable */
> #define MS_PRIVATE(1<<18) /* change to private */
> #define MS_SLAVE  (1<<19) /* change to slave */
> @@ -91,6 +91,7 @@ struct inodes_stat_t {
> #define MS_I_VERSION  (1<<23) /* Update inode I_version field */
> #define MS_STRICTATIME(1<<24) /* Always perform atime updates */
> #define MS_LAZYTIME   (1<<25) /* Update the on-disk [acm]times lazily */
> +#define MS_RICHACL   (1<<26) /* Supports richacls */
> 
> /* These sb flags are internal to the kernel */
> #define MS_NOSEC  (1<<28)
> --
> 2.5.0
> 


Cheers, Andreas







signature.asc
Description: Message signed with OpenPGP using GPGMail


[PATCH 4.2 060/110] ARM: ux500: modify initial levelshifter status

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Walleij 

commit 83bf6b13834d9c926905e45cdfda23fe218fc598 upstream.

commit 1d8aca9df612f5751892fb2642d72536f2f48fd0
"ARM: ux500: fix MMC/SD card regression"
fixed broken the level shifter: it should be default ON
but became default OFF.

Fixes: 1d8aca9df612 "ARM: ux500: fix MMC/SD card regression"
Reported-and-tested-by: Ulf Hansson 
Signed-off-by: Linus Walleij 
Signed-off-by: Arnd Bergmann 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/boot/dts/ste-hrefv60plus.dtsi |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/boot/dts/ste-hrefv60plus.dtsi
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
@@ -56,7 +56,7 @@
/* VMMCI level-shifter enable */
default_hrefv60_cfg2 {
pins = "GPIO169_D22";
-   ste,config = <_out_lo>;
+   ste,config = <_out_hi>;
};
/* VMMCI level-shifter voltage select */
default_hrefv60_cfg3 {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 059/110] ARM: dts: am57xx-beagle-x15: set VDD_SD to always-on

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Tomi Valkeinen 

commit 7e381ec6a36aa44f15fc1a76e6efb9e2cd942e61 upstream.

LDO1 regulator (VDD_SD) is connected to SoC's vddshv8. vddshv8 needs to
be kept always powered (see commit 5a0f93c6576a ("ARM: dts: Add
am57xx-beagle-x15"), but at the moment VDD_SD is enabled/disabled
depending on whether an SD card is inserted or not.

This patch sets LDO1 regulator to always-on.

This patch has a side effect of fixing another issue, HDMI DDC not
working when SD card is not inserted:

Why this happens is that the tpd12s015 (HDMI level shifter/ESD
protection chip) has LS_OE GPIO input, which needs to be enabled for the
HDMI DDC to work. LS_OE comes from gpio6_28. The pin that provides
gpio6_28 is powered by vddshv8, and vddshv8 comes from VDD_SD.

So when SD card is not inserted, VDD_SD is disabled, and LS_OE stays
off.

The proper fix for the HDMI DDC issue would be to maybe have the pinctrl
framework manage the pin specific power.

Apparently this fixes also a third issue (copy paste from Kishon's
patch):

ldo1_reg in addition to being connected to the io lines is also
connected to the card detect line. On card removal, omap_hsmmc
driver does a regulator_disable causing card detect line to be
pulled down. This raises a card insertion interrupt and once the
MMC core detects there is no card inserted, it does a
regulator disable which again raises a card insertion interrupt.
This happens in a loop causing infinite MMC interrupts.

Fixes: 5a0f93c6576a ("ARM: dts: Add am57xx-beagle-x15")
Cc: Kishon Vijay Abraham I 
Signed-off-by: Tomi Valkeinen 
Reported-by: Louis McCarthy 
Acked-by: Nishanth Menon 
Signed-off-by: Tony Lindgren 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/boot/dts/am57xx-beagle-x15.dts |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts
+++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts
@@ -415,11 +415,12 @@
/* SMPS9 unused */
 
ldo1_reg: ldo1 {
-   /* VDD_SD  */
+   /* VDD_SD / VDDSHV8  */
regulator-name = "ldo1";
regulator-min-microvolt = <180>;
regulator-max-microvolt = <330>;
regulator-boot-on;
+   regulator-always-on;
};
 
ldo2_reg: ldo2 {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 00/12] KVM: x86: add support for VMX TSC scaling

2015-11-06 Thread Paolo Bonzini


On 06/11/2015 13:42, Haozhong Zhang wrote:
> On 11/06/15 11:49, Paolo Bonzini wrote:
>>
>>
>> On 20/10/2015 09:39, Haozhong Zhang wrote:
>>> This patchset adds support for VMX TSC scaling feature which is
>>> available on Intel Skylake CPU. The specification of VMX TSC scaling
>>> can be found at
>>> http://www.intel.com/content/www/us/en/processors/timestamp-counter-scaling-virtualization-white-paper.html
>>>
>>> VMX TSC scaling allows guest TSC which is read by guest rdtsc(p)
>>> instructions increases in a rate that is customized by the hypervisor
>>> and can be different than the host TSC rate. Basically, VMX TSC
>>> scaling adds a 64-bit field called TSC multiplier in VMCS so that, if
>>> VMX TSC scaling is enabled, TSC read by guest rdtsc(p) instructions
>>> will be calculated by the following formula:
>>>
>>>   guest EDX:EAX = (Host TSC * TSC multiplier) >> 48 + VMX TSC Offset
>>>
>>> where, Host TSC = Host MSR_IA32_TSC + Host MSR_IA32_TSC_ADJUST.
>>>
>>> This patchset, when cooperating with another QEMU patchset (sent in
>>> another email "target-i386: save/restore vcpu's TSC rate during
>>> migration"), allows guest programs observe a consistent TSC rate even
>>> though they are migrated among machines with different host TSC rates.
>>>
>>> VMX TSC scaling shares some common logics with SVM TSC ratio which
>>> is already supported by KVM. Patch 1 ~ 8 move those common logics from
>>> SVM code to the common code. Upon them, patch 9 ~ 12 add VMX-specific
>>> support for VMX TSC scaling.
>>>
>>> Changes in v2:
>>>  * Remove the duplicated variable 'kvm_tsc_scaling_ratio_rsvd'.
>>>  * Remove an unnecessary error check in original patch 2.
>>>  * Do 64-bit arithmetic by functions recommended by Paolo.
>>>  * Make kvm_set_tsc_khz() returns an error number so that ioctl
>>>KVM_SET_TSC_KHZ does not return 0 if errors happen.
>>>
>>> Reviewed-by: Eric Northup 
>>
>> Thanks for the patches.  There are a couple changes that I can do myself:
>>
>> 1) kvm_default_tsc_scaling_ratio can be initialized in
>> kvm_arch_hardware_setup, since it's just 1ULL <<
>> kvm_tsc_scaling_ratio_frac_bits
>>
> Agree
> 
>> 2) things that you are adding to include/linux/kvm_host.h should instead
>> go in arch/x86/include/linux/kvm_host.h
>>
> Agree, because they are x86 specific.
> 
>> That's it.  I'll commit it as soon as I test on AMD (today hopefully).

It tested fine.  I'll give it a shot with the 32-bit mul_u64_u64_shr on
Monday as well, but I don't expect any issue.

Thanks, the patches are neat!

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 026/110] ALSA: hda - Fix inverted internal mic on Lenovo G50-80

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: David Henningsson 

commit e8d65a8d985271a102f07c7456da5b86c19ffe16 upstream.

Add the appropriate quirk to indicate the Lenovo G50-80 has a stereo
mic input where one channel has reverse polarity.

Alsa-info available at:
https://launchpadlibrarian.net/220846272/AlsaInfo.txt

BugLink: https://bugs.launchpad.net/bugs/1504778
Signed-off-by: David Henningsson 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/pci/hda/patch_conexant.c |1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -819,6 +819,7 @@ static const struct snd_pci_quirk cxt506
SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410),
SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", 
CXT_PINCFG_LENOVO_TP410),
SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", 
CXT_FIXUP_MUTE_LED_EAPD),
+   SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", 
CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 034/110] fault-inject: fix inverted interval/probability values in printk

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Florian Westphal 

commit bb387002693ed28b2bb0408c5dec65521b71e5f1 upstream.

interval displays the probability and vice versa.

Fixes: 6adc4a22f20bb ("fault-inject: add ratelimit option")
Acked-by: Akinobu Mita 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

---
 lib/fault-inject.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -44,7 +44,7 @@ static void fail_dump(struct fault_attr
printk(KERN_NOTICE "FAULT_INJECTION: forcing a failure.\n"
   "name %pd, interval %lu, probability %lu, "
   "space %d, times %d\n", attr->dname,
-  attr->probability, attr->interval,
+  attr->interval, attr->probability,
   atomic_read(>space),
   atomic_read(>times));
if (attr->verbose > 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 4.2 056/110] ARM: dts: berlin: change BG2Qs USB PHY compatible

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Thomas Hebb 

commit 1f744fd317dc55cadd7132c57c499e3117aea01d upstream.

Currently, BG2Q shares a compatible with BG2. This is incorrect, since
BG2 and BG2Q use different USB PLL dividers. In reality, BG2Q shares a
divider with BG2CD. Change BG2Q's USB PHY compatible string to reflect
that.

Signed-off-by: Thomas Hebb 
Signed-off-by: Sebastian Hesselbarth 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/boot/dts/berlin2q.dtsi |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -152,7 +152,7 @@
};
 
usb_phy2: phy@a2f400 {
-   compatible = "marvell,berlin2-usb-phy";
+   compatible = "marvell,berlin2cd-usb-phy";
reg = <0xa2f400 0x128>;
#phy-cells = <0>;
resets = <_rst 0x104 14>;
@@ -170,7 +170,7 @@
};
 
usb_phy0: phy@b74000 {
-   compatible = "marvell,berlin2-usb-phy";
+   compatible = "marvell,berlin2cd-usb-phy";
reg = <0xb74000 0x128>;
#phy-cells = <0>;
resets = <_rst 0x104 12>;
@@ -178,7 +178,7 @@
};
 
usb_phy1: phy@b78000 {
-   compatible = "marvell,berlin2-usb-phy";
+   compatible = "marvell,berlin2cd-usb-phy";
reg = <0xb78000 0x128>;
#phy-cells = <0>;
resets = <_rst 0x104 13>;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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.2 033/110] mm: make sendfile(2) killable

2015-11-06 Thread Greg Kroah-Hartman
4.2-stable review patch.  If anyone has any objections, please let me know.

--

From: Jan Kara 

commit 296291cdd1629c308114504b850dc343eabc2782 upstream.

Currently a simple program below issues a sendfile(2) system call which
takes about 62 days to complete in my test KVM instance.

int fd;
off_t off = 0;

fd = open("file", O_RDWR | O_TRUNC | O_SYNC | O_CREAT, 0644);
ftruncate(fd, 2);
lseek(fd, 0, SEEK_END);
sendfile(fd, fd, , 0xfff);

Now you should not ask kernel to do a stupid stuff like copying 256MB in
2-byte chunks and call fsync(2) after each chunk but if you do, sysadmin
should have a way to stop you.

We actually do have a check for fatal_signal_pending() in
generic_perform_write() which triggers in this path however because we
always succeed in writing something before the check is done, we return
value > 0 from generic_perform_write() and thus the information about
signal gets lost.

Fix the problem by doing the signal check before writing anything.  That
way generic_perform_write() returns -EINTR, the error gets propagated up
and the sendfile loop terminates early.

Signed-off-by: Jan Kara 
Reported-by: Dmitry Vyukov 
Cc: Al Viro 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

---
 mm/filemap.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2488,6 +2488,11 @@ again:
break;
}
 
+   if (fatal_signal_pending(current)) {
+   status = -EINTR;
+   break;
+   }
+
status = a_ops->write_begin(file, mapping, pos, bytes, flags,
, );
if (unlikely(status < 0))
@@ -2525,10 +2530,6 @@ again:
written += copied;
 
balance_dirty_pages_ratelimited(mapping);
-   if (fatal_signal_pending(current)) {
-   status = -EINTR;
-   break;
-   }
} while (iov_iter_count(i));
 
return written ? written : status;


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


<    1   2   3   4   5   6   7   8   9   10   >