Re: [PATCH 2/4 v2] brd: Add getgeo to block ops

2014-08-07 Thread Davidlohr Bueso
On Fri, 2014-08-08 at 09:52 +0300, Boaz Harrosh wrote:
> On Thu, Aug 7, 2014 at 9:20 PM, One Thousand Gnomes
>  wrote:
> > On Thu, 07 Aug 2014 17:03:08 +0300
> > Boaz Harrosh  wrote:
> >
> >> From: Boaz Harrosh 
> >>
> >> Some programs like fdisk, require HDIO_GETGEO to work, which requires we
> >> implement getgeo.
> >>
> >> We set all hd_geometry members to 1, because this way fdisk
> >> math will not try its crazy geometry math and get stuff totally wrong.
> >
> > If you are running a new storage system for god sake don't use DOS
> > partitioning, use GPT or something sane.
> >
> 
> I am always using GPT, on all my systems for few years now.
> Fdisk  works exactly the same, regardless of format, regarding alignment
> and start sectors.

Yes, fdisk now supports GPT, for about the past two years now. In fact
it has been completely rewritten.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: Weird NET_RX softirq behavior

2014-08-07 Thread Jisheng Zhang
On Thu, 7 Aug 2014 22:47:58 -0700
Eric Dumazet  wrote:

> On Fri, 2014-08-08 at 10:37 +0800, Jisheng Zhang wrote:
> > nd and recive 7 packets so far, about 1400bytes. Seems small
> > comparing with the CPU1 and CPU2 NET_RX softirq numbers, right?
> > 
> > Any other possible case?
> 
> Multicast loop. Check dev_loopback_xmit() and its callers.
> 
> 

That's it! This make sense

I didn't see any NET_RX on CPU1,2,3 if I disabled mulitcast

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


Re: [PATCH v3 3/3] drivers/leds/leds-menf21bmc: introduce MEN 14F021P00 BMC LED driver

2014-08-07 Thread Andreas Werner
On Wed, Jul 30, 2014 at 06:57:46AM -0700, Guenter Roeck wrote:
> On 07/30/2014 01:08 AM, Andreas Werner wrote:
> >On Tue, Jul 29, 2014 at 02:47:08PM -0700, Guenter Roeck wrote:
> >>On 07/29/2014 02:12 PM, Wim Van Sebroeck wrote:
> >>>Hi Andreas,
> >>>
> aOn Thu, Jul 24, 2014 at 03:00:09PM -0700, Bryan Wu wrote:
> >On Thu, Jul 17, 2014 at 6:18 AM, Andreas Werner  
> >wrote:
> >>Added driver to support the 14F021P00 BMC LEDs.
> >>The BMC is a Board Management Controll include four LEDs which
> >>can be switched on and off.
> >>
> >>This driver use the I2C interface to the BMC using the menf21bmc MFD 
> >>Core driver.
> >>
> >>Signed-off-by: Andreas Werner 
> >>---
> >>  drivers/leds/Kconfig  |   6 ++
> >>  drivers/leds/Makefile |   1 +
> >>  drivers/leds/leds-menf21bmc.c | 134 
> >> ++
> >>  3 files changed, 141 insertions(+)
> >>  create mode 100644 drivers/leds/leds-menf21bmc.c
> >>
> >>diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> >>index 27cf0cd..d38ff3f 100644
> >>--- a/drivers/leds/Kconfig
> >>+++ b/drivers/leds/Kconfig
> >>@@ -458,6 +458,12 @@ config LEDS_OT200
> >>   This option enables support for the LEDs on the Bachmann 
> >> OT200.
> >>   Say Y to enable LEDs on the Bachmann OT200.
> >>
> >>+config LEDS_MENF21BMC
> >>+   tristate "LED support for the MEN 14F021P00 BMC"
> >>+   depends on LEDS_CLASS && MFD_MENF21BMC
> >
> >I think it also depends on I2C.
> 
> Yes you are right.
> 
> >
> >>+   help
> >>+ Say Y here to include support for the MEN 14F021P00 BMC LEDs.
> >>+
> >>  comment "LED driver for blink(1) USB RGB LED is under Special HID 
> >> drivers (HID_THINGM)"
> >>
> >>  config LEDS_BLINKM
> >>diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
> >>index 3c03666..cadc433 100644
> >>--- a/drivers/leds/Makefile
> >>+++ b/drivers/leds/Makefile
> >>@@ -53,6 +53,7 @@ obj-$(CONFIG_LEDS_MAX8997)+= 
> >>leds-max8997.o
> >>  obj-$(CONFIG_LEDS_LM355x)  += leds-lm355x.o
> >>  obj-$(CONFIG_LEDS_BLINKM)  += leds-blinkm.o
> >>  obj-$(CONFIG_LEDS_VERSATILE)   += leds-versatile.o
> >>+obj-$(CONFIG_LEDS_MENF21BMC)   += leds-menf21bmc.o
> >>
> >>  # LED SPI Drivers
> >>  obj-$(CONFIG_LEDS_DAC124S085)  += leds-dac124s085.o
> >>diff --git a/drivers/leds/leds-menf21bmc.c 
> >>b/drivers/leds/leds-menf21bmc.c
> >>new file mode 100644
> >>index 000..5eaa119
> >>--- /dev/null
> >>+++ b/drivers/leds/leds-menf21bmc.c
> >>@@ -0,0 +1,134 @@
> >>+/*
> >>+ *  MEN 14F021P00 Board Management Controller (BMC) LEDs Driver.
> >>+ *
> >>+ *  This is the core LED driver of the MEN 14F021P00 BMC.
> >>+ *  There are four LEDs available which can be switched on and off.
> >>+ *  STATUS LED, HOT SWAP LED, USER LED 1, USER LED 2
> >>+ *
> >>+ *  Copyright (C) 2014 MEN Mikro Elektronik Nuernberg GmbH
> >>+ *  Author: Andreas Werner 
> >>+ *  All rights reserved.
> >>+ *
> >>+ *  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.
> >>+ *
> >>+ */
> >>+
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+
> >>+#define BMC_CMD_LED_GET_SET0xA0
> >>+#define BMC_BIT_LED_STATUS BIT(0)
> >>+#define BMC_BIT_LED_HOTSWAPBIT(1)
> >>+#define BMC_BIT_LED_USER1  BIT(2)
> >>+#define BMC_BIT_LED_USER2  BIT(3)
> >>+
> >>+struct menf21bmc_led {
> >>+   struct led_classdev cdev;
> >>+   u8 led_bit;
> >>+   const char *name;
> >>+   struct i2c_client *i2c_client;
> >>+};
> >>+
> >>+static struct menf21bmc_led leds[] = {
> >>+   {
> >>+   .name = "menf21bmc:led_status",
> >>+   .led_bit = BMC_BIT_LED_STATUS,
> >>+   },
> >>+   {
> >>+   .name = "menf21bmc:led_hotswap",
> >>+   .led_bit = BMC_BIT_LED_HOTSWAP,
> >>+   },
> >>+   {
> >>+   .name = "menf21bmc:led_user1",
> >>+   .led_bit = BMC_BIT_LED_USER1,
> >>+   },
> >>+   {
> >>+   .name = "menf21bmc:led_user2",
> >>+   .led_bit = BMC_BIT_LED_USER2,
> >>+   }
> >>+};
> >>+
> >>+static DEFINE_MUTEX(led_lock);
> >>+
> >>+static void
> >>+menf21bmc_led_set(struct led_classdev *led_cdev, enum led_brightness 
> >

Re: [alsa-devel] [PATCH V4 0/2] refine esai for tdm support

2014-08-07 Thread Nicolin Chen
On Fri, Aug 08, 2014 at 02:47:20PM +0800, Shengjiu Wang wrote:
> These patchs is to refine esai for tdm support.
> 
> Changes for V4
> - update the comments for patch 2
> 
> Changes for V3
> - update the comments for patch 2
> 
> Changes for V2
> - update the comments according the reviewer's suggestion
> - add init value for slots and change pin to pins.
> 
> 
> Shengjiu Wang (2):
>   ASoC: fsl_esai: refine esai for TDM support
>   Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."
> 
>  sound/soc/fsl/Kconfig|1 -
>  sound/soc/fsl/fsl_esai.c |   16 +++-
>  sound/soc/fsl/fsl_esai.h |8 
>  3 files changed, 15 insertions(+), 10 deletions(-)

Acked-by: Nicolin Chen 

Thank you

> 
> -- 
> 1.7.9.5
> 
> ___
> Alsa-devel mailing list
> alsa-de...@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4 v2] brd: Add getgeo to block ops

2014-08-07 Thread Boaz Harrosh
On Thu, Aug 7, 2014 at 9:20 PM, One Thousand Gnomes
 wrote:
> On Thu, 07 Aug 2014 17:03:08 +0300
> Boaz Harrosh  wrote:
>
>> From: Boaz Harrosh 
>>
>> Some programs like fdisk, require HDIO_GETGEO to work, which requires we
>> implement getgeo.
>>
>> We set all hd_geometry members to 1, because this way fdisk
>> math will not try its crazy geometry math and get stuff totally wrong.
>
> If you are running a new storage system for god sake don't use DOS
> partitioning, use GPT or something sane.
>

I am always using GPT, on all my systems for few years now.
Fdisk  works exactly the same, regardless of format, regarding alignment
and start sectors.

Please try before you comment

>> +static int brd_getgeo(struct block_device *bd, struct hd_geometry *geo)
>> +{
>> + /* Just tell fdisk to get out of the way. The math here is so
>> +  * convoluted and does not make any sense at all. With all 1s
>> +  * The math just gets out of the way.
>> +  * NOTE: I was trying to get some values that will make fdisk
>> +  * Want to align first sector on 4K (like 8, 16, 20, ... sectors) but
>> +  * nothing worked, I searched the net the math is not your regular
>> +  * simple multiplication at all. If you managed to get these please
>> +  * fix here. For now we use 4k physical sectors for this
>> +  */
>> + geo->heads = 1;
>> + geo->sectors = 1;
>> + geo->cylinders = 1;
>> + return 0;
>
> This is then going to blow up on your with some other tool. Fix fdisk
> instead. Lying to apps generally ends up like children lying to parents -
> the lie gets more complicated to keep up each case you find until it
> breaks.
>

Exactly my point sir. What is heads sectors and cylinders for a RAM
disk. Nothing. We have been lying for  years fearing the world of storage
will explode if we tell the truth. Finally, as you say, our lies came byte us in
the arss. Best is to tell the truth and the math at fdisk will do what it is
suppose to.

And the psychology talk aside, please talk code. Do you know of any
code that will break because of these values above?

I have by now looked at fdisk's code. It will calculate several alignment
constrains and finally pick the biggest one. Also it has code for very
fist sector and different one for other partition-start sectors. This HSC
math above being one of them. With these values HSC becomes very
small and gets out of the way, for the other considerations.
That's fdisk gparted (and parted) will just use 1Mib for alignment which
is very big, and be done with it. I would imagine all other tools use one
library or the other. Do you know otherwise?

Boaz

> Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Input: cap1106 - allow changing key mapping from userspace

2014-08-07 Thread Dmitry Torokhov
On Thu, Aug 07, 2014 at 08:50:24AM +0200, Daniel Mack wrote:
> Hi Dmitry,
> 
> On 08/07/2014 08:20 AM, Dmitry Torokhov wrote:
> > On Sun, Jul 20, 2014 at 06:20:49PM -0700, Dmitry Torokhov wrote:
> >> Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings
> >> from userspace.
> >>
> >> Signed-off-by: Dmitry Torokhov 
> >> ---
> >>
> >> Just compiled, not tested.
> > 
> > *ping* Any chance you could give it a try? Thanks!
> 
> Oh, sorry, I didn't realize you're waiting for me on this.
> 
> Unfortunately, I can't test it myself anymore, as I had to return the
> board I found this chip on. But as the change looks very straight
> forward, I'd suggest you just apply that patch and I ask the vendor to
> give it a quick try. In case of any problems, I'll let you know. Does
> that sound feasible?

OK, I'll put you down as reviewed-by then so we can share the glory (and the
blame ;))

Thanks.

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


[PATCH V4 1/2] ASoC: fsl_esai: refine esai for TDM support

2014-08-07 Thread Shengjiu Wang
Original driver didn't store the number of slots, just fix the slot number
to 2, use this default number to calculate bclk and pins for TX/RX.
In this patch, add one parameter for slots, and update the calculation of
bclk and pins of TX/RX. Then driver will be compatible with slots > 2 in
TDM mode.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_esai.c |   14 +++---
 sound/soc/fsl/fsl_esai.h |8 
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 72d154e..f252370 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -38,6 +38,7 @@
  * @fsysclk: system clock source to derive HCK, SCK and FS
  * @fifo_depth: depth of tx/rx FIFO
  * @slot_width: width of each DAI slot
+ * @slots: number of slots
  * @hck_rate: clock rate of desired HCKx clock
  * @sck_rate: clock rate of desired SCKx clock
  * @hck_dir: the direction of HCKx pads
@@ -56,6 +57,7 @@ struct fsl_esai {
struct clk *fsysclk;
u32 fifo_depth;
u32 slot_width;
+   u32 slots;
u32 hck_rate[2];
u32 sck_rate[2];
bool hck_dir[2];
@@ -363,6 +365,7 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai 
*dai, u32 tx_mask,
   ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
 
esai_priv->slot_width = slot_width;
+   esai_priv->slots = slots;
 
return 0;
 }
@@ -510,10 +513,11 @@ static int fsl_esai_hw_params(struct snd_pcm_substream 
*substream,
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u32 width = snd_pcm_format_width(params_format(params));
u32 channels = params_channels(params);
+   u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
u32 bclk, mask, val;
int ret;
 
-   bclk = params_rate(params) * esai_priv->slot_width * 2;
+   bclk = params_rate(params) * esai_priv->slot_width * esai_priv->slots;
 
ret = fsl_esai_set_bclk(dai, tx, bclk);
if (ret)
@@ -530,7 +534,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream 
*substream,
mask = ESAI_xFCR_xFR_MASK | ESAI_xFCR_xWA_MASK | ESAI_xFCR_xFWM_MASK |
  (tx ? ESAI_xFCR_TE_MASK | ESAI_xFCR_TIEN : ESAI_xFCR_RE_MASK);
val = ESAI_xFCR_xWA(width) | ESAI_xFCR_xFWM(esai_priv->fifo_depth) |
-(tx ? ESAI_xFCR_TE(channels) | ESAI_xFCR_TIEN : 
ESAI_xFCR_RE(channels));
+(tx ? ESAI_xFCR_TE(pins) | ESAI_xFCR_TIEN : ESAI_xFCR_RE(pins));
 
regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx), mask, val);
 
@@ -565,6 +569,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream 
*substream, int cmd,
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u8 i, channels = substream->runtime->channels;
+   u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -579,7 +584,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream 
*substream, int cmd,
 
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
   tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
-  tx ? ESAI_xCR_TE(channels) : 
ESAI_xCR_RE(channels));
+  tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
@@ -783,6 +788,9 @@ static int fsl_esai_probe(struct platform_device *pdev)
/* Set a default slot size */
esai_priv->slot_width = 32;
 
+   /* Set a default slot number */
+   esai_priv->slots = 2;
+
/* Set a default master/slave state */
esai_priv->slave_mode = true;
 
diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h
index 75e1403..91a550f 100644
--- a/sound/soc/fsl/fsl_esai.h
+++ b/sound/soc/fsl/fsl_esai.h
@@ -130,8 +130,8 @@
 #define ESAI_xFCR_RE_WIDTH 4
 #define ESAI_xFCR_TE_MASK  (((1 << ESAI_xFCR_TE_WIDTH) - 1) << 
ESAI_xFCR_xE_SHIFT)
 #define ESAI_xFCR_RE_MASK  (((1 << ESAI_xFCR_RE_WIDTH) - 1) << 
ESAI_xFCR_xE_SHIFT)
-#define ESAI_xFCR_TE(x)((ESAI_xFCR_TE_MASK >> (ESAI_xFCR_TE_WIDTH - 
((x + 1) >> 1))) & ESAI_xFCR_TE_MASK)
-#define ESAI_xFCR_RE(x)((ESAI_xFCR_RE_MASK >> (ESAI_xFCR_RE_WIDTH - 
((x + 1) >> 1))) & ESAI_xFCR_RE_MASK)
+#define ESAI_xFCR_TE(x)((ESAI_xFCR_TE_MASK >> (ESAI_xFCR_TE_WIDTH - 
x)) & ESAI_xFCR_TE_MASK)
+#define ESAI_xFCR_RE(x)((ESAI_xFCR_RE_MASK >> (ESAI_xFCR_RE_WIDTH - 
x)) & ESAI_xFCR_RE_MASK)
 #define ESAI_xFCR_xFR_SHIFT1
 #define ESAI_xFCR_xFR_MASK (1 << ESAI_xFCR_xFR_SHIFT)
 #define ESAI_xFCR_xFR  (1 << ESAI_xFCR_xFR_SHIFT)
@@ -272,8 +272,8 @@
 #define ESAI_xCR_RE_WIDTH  4
 #define ESAI_xCR_TE_MASK   (((1 << ESAI_xCR_TE_WIDTH) - 1) << 
ESAI_xCR_xE_SHIFT)
 #define ESAI_xCR_RE_MASK   (((1 << ESAI_xCR_RE_WIDTH) - 

[PATCH V4 2/2] Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."

2014-08-07 Thread Shengjiu Wang
This reverts commit a603c8ee526f5ea9ad9b40710308766299ad8a69.

fsl_asoc_xlate_tdm_slot_mask() is different with snd_soc_xlate_tdm_slot_mask().
fsl_asoc_xlate_tdm_slot_mask() will set the enabled bit to 0, disabled bit
to 1. snd_soc_xlate_tdm_slot_mask() will set the enabled bit to 1, disabled
bit to 0.
For esai when the bit value is 1, the slot is enabled, when the bit value is 0,
the slot is disabled. If using fsl_asoc_xlate_tdm_slot_mask(), the esai will
work abnormally. So revert this patch, make the esai use default function.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/Kconfig|1 -
 sound/soc/fsl/fsl_esai.c |2 --
 2 files changed, 3 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index f54a8fc..f3012b6 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -49,7 +49,6 @@ config SND_SOC_FSL_ESAI
tristate "Enhanced Serial Audio Interface (ESAI) module support"
select REGMAP_MMIO
select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
-   select SND_SOC_FSL_UTILS
help
  Say Y if you want to add Enhanced Synchronous Audio Interface
  (ESAI) support for the Freescale CPUs.
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index f252370..b2f6b3e 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -18,7 +18,6 @@
 
 #include "fsl_esai.h"
 #include "imx-pcm.h"
-#include "fsl_utils.h"
 
 #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000
 #define FSL_ESAI_FORMATS   (SNDRV_PCM_FMTBIT_S8 | \
@@ -612,7 +611,6 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = {
.hw_params = fsl_esai_hw_params,
.set_sysclk = fsl_esai_set_dai_sysclk,
.set_fmt = fsl_esai_set_dai_fmt,
-   .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask,
.set_tdm_slot = fsl_esai_set_dai_tdm_slot,
 };
 
-- 
1.7.9.5

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


[PATCH V4 0/2] refine esai for tdm support

2014-08-07 Thread Shengjiu Wang
These patchs is to refine esai for tdm support.

Changes for V4
- update the comments for patch 2

Changes for V3
- update the comments for patch 2

Changes for V2
- update the comments according the reviewer's suggestion
- add init value for slots and change pin to pins.


Shengjiu Wang (2):
  ASoC: fsl_esai: refine esai for TDM support
  Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."

 sound/soc/fsl/Kconfig|1 -
 sound/soc/fsl/fsl_esai.c |   16 +++-
 sound/soc/fsl/fsl_esai.h |8 
 3 files changed, 15 insertions(+), 10 deletions(-)

-- 
1.7.9.5

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


Re: [PATCH v2 5/8] mm/isolation: change pageblock isolation logic to fix freepage counting bugs

2014-08-07 Thread Joonsoo Kim
On Thu, Aug 07, 2014 at 05:15:17PM +0200, Vlastimil Babka wrote:
> On 08/06/2014 09:18 AM, Joonsoo Kim wrote:
> >Current pageblock isolation logic has a problem that results in incorrect
> >freepage counting. move_freepages_block() doesn't return number of
> >moved pages so freepage count could be wrong if some pages are freed
> >inbetween set_pageblock_migratetype() and move_freepages_block(). Although
> >we fix move_freepages_block() to return number of moved pages, the problem
> 
> ^ could

Yes, but fixing that is not needed because this patch changes
isolation process and, after that, that behaviour have any problem.

> 
> >wouldn't be fixed completely because buddy allocator doesn't care if merged
> >pages are on different buddy list or not. If some page on normal buddy list
> >is merged with isolated page and moved to isolate buddy list, freepage
> >count should be subtracted, but, it didn't and can't now.
> 
> ... but it's not done now and doing that would impose unwanted
> overhead on buddy merging.

Yes, we don't want more overhead on buddy merging so this patch
introduces PageIsolated() in order to avoid merge problem.

> Also the analogous problem exists when undoing isolation?

There is no merge problem in new (un)isolation process of this patch except
for the page more than pageblock order. This case will be fixed in patch 7.

> >Signed-off-by: Joonsoo Kim 
> >---
> >  include/linux/page-isolation.h |2 +
> >  mm/internal.h  |3 ++
> >  mm/page_alloc.c|   28 ++-
> >  mm/page_isolation.c|  107 
> > 
> >  4 files changed, 118 insertions(+), 22 deletions(-)
> >
> >diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> >index 3fff8e7..3dd39fe 100644
> >--- a/include/linux/page-isolation.h
> >+++ b/include/linux/page-isolation.h
> >@@ -21,6 +21,8 @@ static inline bool is_migrate_isolate(int migratetype)
> >  }
> >  #endif
> >
> >+void deactivate_isolated_page(struct zone *zone, struct page *page,
> >+unsigned int order);
> >  bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
> >  bool skip_hwpoisoned_pages);
> >  void set_pageblock_migratetype(struct page *page, int migratetype);
> >diff --git a/mm/internal.h b/mm/internal.h
> >index 81b8884..c70750a 100644
> >--- a/mm/internal.h
> >+++ b/mm/internal.h
> >@@ -110,6 +110,9 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned 
> >long address);
> >   */
> >  extern void zone_pcp_disable(struct zone *zone);
> >  extern void zone_pcp_enable(struct zone *zone);
> >+extern void __free_one_page(struct page *page, unsigned long pfn,
> >+struct zone *zone, unsigned int order,
> >+int migratetype);
> >  extern void __free_pages_bootmem(struct page *page, unsigned int order);
> >  extern void prep_compound_page(struct page *page, unsigned long order);
> >  #ifdef CONFIG_MEMORY_FAILURE
> >diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >index 4517b1d..82da4a8 100644
> >--- a/mm/page_alloc.c
> >+++ b/mm/page_alloc.c
> >@@ -571,7 +571,7 @@ static inline int page_is_buddy(struct page *page, 
> >struct page *buddy,
> >   * -- nyc
> >   */
> >
> >-static inline void __free_one_page(struct page *page,
> >+void __free_one_page(struct page *page,
> > unsigned long pfn,
> > struct zone *zone, unsigned int order,
> > int migratetype)
> >@@ -738,14 +738,19 @@ static void free_one_page(struct zone *zone,
> > int migratetype)
> >  {
> > unsigned long nr_scanned;
> >+
> >+if (unlikely(is_migrate_isolate(migratetype))) {
> >+deactivate_isolated_page(zone, page, order);
> >+return;
> >+}
> >+
> 
> This would be more effectively done in the callers, which is where
> migratetype is determined - there are two:
> - free_hot_cold_page() already has this test, so just call deactivation
>   instead of free_one_page() - one test less in this path!
> - __free_pages_ok() could add the test to call deactivation, and
> since you remove another test in the hunk below, the net result is
> the same in this path.

Okay. Will do.

> >--- a/mm/page_isolation.c
> >+++ b/mm/page_isolation.c
> >@@ -9,6 +9,75 @@
> >  #include 
> >  #include "internal.h"
> >
> >+#define ISOLATED_PAGE_MAPCOUNT_VALUE (-64)
> >+
> >+static inline int PageIsolated(struct page *page)
> >+{
> >+return atomic_read(&page->_mapcount) == ISOLATED_PAGE_MAPCOUNT_VALUE;
> >+}
> >+
> >+static inline void __SetPageIsolated(struct page *page)
> >+{
> >+VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
> >+atomic_set(&page->_mapcount, ISOLATED_PAGE_MAPCOUNT_VALUE);
> >+}
> >+
> >+static inline void __ClearPageIsolated(struct page *page)
> >+{
> >+VM_BUG_ON_PAGE(!PageIsolated(page), page);
> >+atomic_set(&page->_mapcount, -1);
> >+}
> 
> Hmm wasn't the convention for atomic update

Re: [PATCH/RFC v4 00/21] LED / flash API integration

2014-08-07 Thread Jacek Anaszewski

Hi Bryan,

On 07/16/2014 07:21 PM, Bryan Wu wrote:

On Wed, Jul 16, 2014 at 10:19 AM, Bryan Wu  wrote:

On Fri, Jul 11, 2014 at 7:04 AM, Jacek Anaszewski
 wrote:

This is is the fourth version of the patch series being a follow up
of the discussion on Media summit 2013-10-23, related to the
LED / flash API integration (the notes from the discussion were
enclosed in the message [1], paragraph 5).
The series is based on linux-next-20140707



I really apologize that I missed your discussion email in my Gmail
inbox, it was archived some where. Even in this series some of these
patches are archived in different tab.

I will start to review and help to push this.



In the mean time, could you please provide an git tree for me to pull?
It's much easier for me to review in my git.


Few days ago I sent to your private email the path to the git
repository to pull, but I am resending it through the lists to
make sure that it will not get filtered somehow again.

git://linuxtv.org/snawrocki/samsung.git
branch: led_flash_integration_v4

gitweb:
http://git.linuxtv.org/cgit.cgi/snawrocki/samsung.git/log/?h=led_flash_integration_v4

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


Re: [PATCH v3 tip/core/rcu 3/9] rcu: Add synchronous grace-period waiting for RCU-tasks

2014-08-07 Thread Peter Zijlstra
On Thu, Aug 07, 2014 at 05:18:23PM -0400, Steven Rostedt wrote:
> On Thu, 7 Aug 2014 22:08:13 +0200
> Peter Zijlstra  wrote:
> 
> > OK, you've got to start over and start at the beginning, because I'm
> > really not understanding this..
> > 
> > What is a 'trampoline' and what are you going to use them for.
> 
> Great question! :-)
> 
> The trampoline is some code that is used to jump to and then jump
> someplace else. Currently, we use this for kprobes and ftrace. For
> ftrace we have the ftrace_caller trampoline, which is static. When
> booting, most functions in the kernel call the mcount code which
> simply returns without doing anything. This too is a "trampoline". At
> boot, we convert these calls to nops (as you already know). When we
> enable callbacks from functions, we convert those calls to call
> "ftrace_caller" which is a small assembly trampoline that will call
> some function that registered with ftrace.
> 
> Now why do we need the call_rcu_task() routine?
> 
> Right now, if you register multiple callbacks to ftrace, even if they
> are not tracing the same routine, ftrace has to change ftrace_caller to
> call another trampoline (in C), that does a loop of all ops registered
> with ftrace, and compares the function to the ops hash tables to see if
> the ops function should be called for that function.
> 
> What we want to do is to create a dynamic trampoline that is a copy of
> the ftrace_caller code, but instead of calling this list trampoline, it
> calls the ops function directly. This way, each ops registered with
> ftrace can have its own custom trampoline that when called will only
> call the ops function and not have to iterate over a list. This only
> happens if the function being traced only has this one ops registered.
> For functions with multiple ops attached to it, we need to call the
> list anyway. But for the majority of the cases, this is not the case.
> 
> The one caveat for this is, how do we free this custom trampoline when
> the ops is done with it? Especially for users of ftrace that
> dynamically create their own ops (like perf, and ftrace instances).
> 
> We need to find a way to free it, but unfortunately, there's no way to
> know when it is safe to free it. There's no way to disable preemption
> or have some other notifier to let us know if a task has jumped to this
> trampoline and has been preempted (sleeping). The only safe way to know
> that no task is on the trampoline is to remove the calls to it,
> synchronize the CPUS (so the trampolines are not even in the caches),
> and then wait for all tasks to go through some quiescent state. This
> state happens to be either not running, in userspace, or when it
> voluntarily calls schedule. Because nothing that uses this trampoline
> should do that, and if the task voluntarily calls schedule, we know
> it's not on the trampoline.
> 
> Make sense?

Ok, so they're purely used in the function prologue/epilogue callchain.
And you don't want to use synchronize_tasks() because registering a trace
functions is atomic ?

But why would you use dynamic memory allocation for these trampolines at
all? Why not use the one default trampoline for this?

Suppose that thing looks like:

ftrace_mcount_handler()
{
for_each_hlist_rcu(entry,..)
entry->func();
}

so why not make it look like:

ftrace_mcount_handler()
{
asm_volatile_goto("jmp %l[label]" ::: &do_list);
return;

do_list:
for_each_hlist_rcu(entry,...)
entry->func();
}

Then, for:
no entries -> NOP, 
one entry -> "CALL $func", 
more entries -> "JMP &do_list.

No need for extra allocations and fancy means of getting rid of them,
and only a few bytes extra wrt the existing function.


pgpo3T8b8qo2r.pgp
Description: PGP signature


Re: [PATCH v2] Input - wacom: update the ABI doc according to latest changes

2014-08-07 Thread Dmitry Torokhov
On Thu, Aug 07, 2014 at 01:54:22PM -0700, Ping Cheng wrote:
> On Thu, Aug 7, 2014 at 1:43 PM, Benjamin Tissoires
>  wrote:
> > Now the devices show up under hid no matter the connection (for USB
> > and Bluetooth, not serial nor i2c).
> >
> > The USB devices can now be easily found under
> > /sys/bus/hid/devices/::.
> >
> > The Bluetooth devices could also be found under this path since their
> > inclusion (April 2010), so this patch fixes the unprecise "hidraw*" path
> > for them.
> >
> > The ABI has been unified while setting the LEDs and OLEDs. So Bluetooth
> > devices lost their own LED selector but use the USB sysfs attribute.
> > For OLEDs, Bluetooth devices handle only 1-bit images instead of 4 for USB.
> > The documentation has been updated to match this.
> >
> > Signed-off-by: Benjamin Tissoires 
> 
> Reviewed-by: Ping Cheng 

Applied, thank you.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Input updates for 3.17-rc0

2014-08-07 Thread Dmitry Torokhov
Hi Linus,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. You will get a bit update to
Wacom driver by Benjamin Tissoires, converting it to HID infrastructure
and unifying USB and Bluetooth models. You will also get a large update
to ALPS driver by Hans de Goede, which adds support for newer touchpad
models as well as cleans up and restructures the code, more changes to
Atmel MXT driver, including device tree support, a new driver for iPaq
x3xxx touchscreen, a driver for serial Wacom tablets, a driver for
Microchip's CAP1106, and assorted cleanups and improvements to existing
drover and input core.

Thanks!

Changelog:
-

Benjamin Tissoires (35):
  Input: Revert "wacom - testing result shows get_report is unnecessary."
  Input: wacom - assign phys field from struct wacom into input_dev
  Input: wacom - create a separate input device for pads
  Input: wacom - split out the pad device for Intuos/Cintiq
  Input: wacom - split out the pad device for Bamboos
  Input: wacom - split out the pad device for DTUS
  Input: wacom - split out the pad device for Graphire G4 and MO
  Input: wacom - split out the pad device for the wireless receiver
  Input: wacom - include and use linux/hid.h
  Input: wacom - switch from an USB driver to a HID driver
  Input: wacom - use hid communication instead of plain usb
  Input: wacom - use HID core to actually fetch the report descriptor
  Input: wacom - compute the HID report size to get the actual packet size
  Input: wacom - install LED/OLED sysfs files in the HID device instead of 
USB
  Input: wacom - register the input devices on top of the HID one
  Input: wacom - remove usb dependency for siblings devices
  Input: wacom - register power device at the HID level
  Input: wacom - use hid_info instead of plain dev_info
  Input: wacom - use in-kernel HID parser
  Input: wacom - use hidinput_calc_abs_res instead of duplicating its code
  Input: wacom - remove field pktlen declaration in the list of devices
  Input: wacom - keep wacom_ids ordered
  Input: wacom - move the USB (now hid) Wacom driver in drivers/hid
  Input: wacom - put a flag when the led are initialized
  Input: wacom - enhance Wireless Receiver battery reporting
  Input: wacom - use a uniq name for the battery device
  Input: wacom - register an ac power supply for wireless devices
  Input: wacom - prepare the driver to include BT devices
  Input: wacom - handle Graphire BT tablets in wacom.ko
  Input: wacom - handle Intuos 4 BT in wacom.ko
  Input: wacom - check for bluetooth protocol while setting OLEDs
  Input: wacom - add copyright note and bump version to 2.0
  Input: HID - remove hid-wacom Bluetooth driver
  Input: wacom - only register once the MODULE_* macros
  Input: wacom - update the ABI doc according to latest changes

Benson Leung (1):
  Input: atmel_mxt_ts - set pointer emulation on touchpads

Daniel Mack (1):
  Input: add driver for Microchip's CAP1106

David Herrmann (2):
  Input: uinput - uinput_validate_absbits() cleanup
  Input: uinput - add UI_GET_VERSION ioctl

Dexuan Cui (1):
  Input: hyperv-keyboard - register as a wakeup source

Dmitry Artamonow (1):
  Input: driver for touchscreen on iPaq h3xxx

Dmitry Torokhov (2):
  Input: ipaq-micro-ts - introduce open/close
  Input: wacom_serial4 - prepare for wacom USB moving to HID

Fabian Frederick (2):
  Input: keyspan_remote - remove unnecessary break after goto
  Input: edt-ft5x06 - remove unnecessary null test

Fabio Estevam (3):
  Input: mcs5000_ts - protect PM functions with CONFIG_PM_SLEEP
  Input: mcs5000_ts - remove ifdef around power management methods
  Input: imx_keypad - remove ifdef round PM methods

Hans de Goede (14):
  Input: add support for Wacom protocol 4 serial tablets
  Input: alps - improve 2-finger reporting on v3 models
  Input: alps - process_bitmap: don't invert the Y-axis on Rushmore
  Input: alps - process_bitmap: add alps_get_bitmap_points() helper function
  Input: alps - process_bitmap: fix counting of high point bits
  Input: alps - process_bitmap: round down when spreading adjescent fingers 
over 2 points
  Input: alps - use struct input_mt_pos to track coordinates
  Input: alps - use standard contact tracking instead of DIY
  Input: alps - use single touch data when v3 mt data contains only one 
finger
  Input: alps - add an alps_report_semi_mt_data function
  Input: alps - report 2 touches when we've > 2 fingers
  Input: alps - change decode function prototype to return an int
  Input: alps - cache firmware version
  Input: alps - Rushmore and v7 resolution support

Heiko Stuebner (1):
   

Re: [PATCH] sched: Reduce contention in update_cfs_rq_blocked_load

2014-08-07 Thread Yuyang Du
On Thu, Aug 07, 2014 at 09:18:52PM -0700, Jason Low wrote:
> On Fri, 2014-08-08 at 02:02 +0800, Yuyang Du wrote:
> > On Wed, Aug 06, 2014 at 11:21:35AM -0700, Jason Low wrote:
> > > I ran these tests with most of the AIM7 workloads to compare its
> > > performance between a 3.16 kernel and the kernel with these patches
> > > applied.
> > > 
> > > The table below contains the percent difference between the baseline
> > > kernel and the kernel with the patches at various user counts. A
> > > positive percent means the kernel with the patches performed better,
> > > while a negative percent means the baseline performed better.
> > > 
> > > Based on these numbers, for many of the workloads, the change was
> > > beneficial in those highly contended, while it had - impact in many
> > > of the lightly/moderately contended case (10 to 90 users).
> > > 
> > > -
> > >   |   10-90   |  100-1000   |  1100-2000
> > >   |   users   |   users |   users
> > > -
> > > alltests  |   -3.37%  |  -10.64%|   -2.25%
> > > -
> > > all_utime |   +0.33%  |   +3.73%|   +3.33%
> > > -
> > > compute   |   -5.97%  |   +2.34%|   +3.22%
> > > -
> > > custom|  -31.61%  |  -10.29%|  +15.23%
> > > -
> > > disk  |  +24.64%  |  +28.96%|  +21.28%
> > > -
> > > fserver   |   -1.35%  |   +4.82%|   +9.35%
> > > -
> > > high_systime  |   -6.73%  |   -6.28%|  +12.36%
> > > -
> > > shared|  -28.31%  |  -19.99%|   -7.10%
> > > -
> > > short |  -44.63%  |  -37.48%|  -33.62%
> > > -
> > > 
> > Thanks, Jason. Sorry for late response.
> > 
> > What about the variation of the tests? The machine you test on?
> 
> Hi Yuyang,
> 
> These tests were also done on an 8 socket machine (80 cores). In terms
> of variation between the average throughputs, typically the noise range
> is about 2% in many of the workloads.
> 

Thanks a lot, Jason.

So for this particular set of workloads on a big machine, I think the
result is mixed and overall "neutral", but I expected the variation probably
could be bigger especially for light workloads.

Any comment from the maintainers and others? Ping Peter and Ben, I haven't
heard from you for the 5th version.

Yuyang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/8] mm/isolation: close the two race problems related to pageblock isolation

2014-08-07 Thread Joonsoo Kim
On Thu, Aug 07, 2014 at 04:34:41PM +0200, Vlastimil Babka wrote:
> On 08/06/2014 09:18 AM, Joonsoo Kim wrote:
> >We got migratetype of the freeing page without holding the zone lock so
> >it could be racy. There are two cases of this race.
> >
> >1. pages are added to isolate buddy list after restoring original
> >migratetype.
> >2. pages are added to normal buddy list while pageblock is isolated.
> >
> >If case 1 happens, we can't allocate freepages on isolate buddy list
> >until next pageblock isolation occurs.
> >In case of 2, pages could be merged with pages on isolate buddy list and
> >located on normal buddy list. This makes freepage counting incorrect
> >and break the property of pageblock isolation.
> >
> >One solution to this problem is checking pageblock migratetype with
> >holding zone lock in __free_one_page() and I posted it before, but,
> >it didn't get welcome since it needs the hook in zone lock critical
> >section on freepath.
> >
> >This is another solution to this problem and impose most overhead on
> >pageblock isolation logic. Following is how this solution works.
> >
> >1. Extends irq disabled period on freepath to call
> >get_pfnblock_migratetype() with irq disabled. With this, we can be
> >sure that future freed pages will see modified pageblock migratetype
> >after certain synchronization point so we don't need to hold the zone
> >lock to get correct pageblock migratetype. Although it extends irq
> >disabled period on freepath, I guess it is marginal and better than
> >adding the hook in zone lock critical section.
> >
> >2. #1 requires IPI for synchronization and we can't hold the zone lock
> 
> It would be better to explain here that the synchronization point is
> pcplists draining.

Okay.

> 
> >during processing IPI. In this time, some pages could be moved from buddy
> >list to pcp list on page allocation path and later it could be moved again
> >from pcp list to buddy list. In this time, this page would be on isolate
> 
> It is difficult to understand the problem just by reading this. I
> guess the timelines you included while explaining the problem to me,
> would help here :)

Okay.

> >pageblock, so, the hook is required on free_pcppages_bulk() to prevent
> 
> More clearly, a recheck for pageblock's migratetype would be needed
> in free_pcppages_bulk(), which would again impose overhead outside
> isolation.

Thanks. I will replace above line with yours. :)

> >misplacement. To remove this possibility, disabling and draining pcp
> >list is needed during isolation. It guaratees that there is no page on pcp
> >list on all cpus while isolation, so misplacement problem can't happen.
> >
> >Note that this doesn't fix freepage counting problem. To fix it,
> >we need more logic. Following patches will do it.
> >
> >Signed-off-by: Joonsoo Kim 
> >---
> >  mm/internal.h   |2 ++
> >  mm/page_alloc.c |   27 ---
> >  mm/page_isolation.c |   45 +
> >  3 files changed, 55 insertions(+), 19 deletions(-)
> >
> >diff --git a/mm/internal.h b/mm/internal.h
> >index a1b651b..81b8884 100644
> >--- a/mm/internal.h
> >+++ b/mm/internal.h
> >@@ -108,6 +108,8 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned 
> >long address);
> >  /*
> >   * in mm/page_alloc.c
> >   */
> >+extern void zone_pcp_disable(struct zone *zone);
> >+extern void zone_pcp_enable(struct zone *zone);
> >  extern void __free_pages_bootmem(struct page *page, unsigned int order);
> >  extern void prep_compound_page(struct page *page, unsigned long order);
> >  #ifdef CONFIG_MEMORY_FAILURE
> >diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >index 3e1e344..4517b1d 100644
> >--- a/mm/page_alloc.c
> >+++ b/mm/page_alloc.c
> >@@ -726,11 +726,7 @@ static void free_pcppages_bulk(struct zone *zone, int 
> >count,
> > /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
> > __free_one_page(page, page_to_pfn(page), zone, 0, mt);
> > trace_mm_page_pcpu_drain(page, 0, mt);
> >-if (likely(!is_migrate_isolate_page(page))) {
> >-__mod_zone_page_state(zone, NR_FREE_PAGES, 1);
> >-if (is_migrate_cma(mt))
> >-__mod_zone_page_state(zone, 
> >NR_FREE_CMA_PAGES, 1);
> >-}
> >+__mod_zone_freepage_state(zone, 1, mt);
> 
> Could be worth mentioning that this can now be removed as it was an
> incomplete attempt to fix freepage counting, but didn't address the
> misplacement.

Okay. I will mention it.

> > } while (--to_free && --batch_free && !list_empty(list));
> > }
> > spin_unlock(&zone->lock);
> >@@ -789,8 +785,8 @@ static void __free_pages_ok(struct page *page, unsigned 
> >int order)
> > if (!free_pages_prepare(page, order))
> > return;
> >
> >-migratetype = get_pfnblock_migratetype(page, pfn);
> > local_i

Re: [PATCH] Adding a support for Skyworks SKY81452

2014-08-07 Thread Gyungoh Yoo
Thank you for your comments.
I will fix them and resubmit.

On Thu, Aug 07, 2014 at 02:34:39PM +0200, Tobias Klauser wrote:
> On 2014-08-07 at 10:05:38 +0200, Gyungoh Yoo  wrote:
> > Signed-off-by: Gyungoh Yoo 
> > ---
> >  Documentation/backlight/sky81452.txt   |  25 ++
> >  Documentation/devicetree/bindings/mfd/sky81452.txt |  24 ++
> >  .../bindings/regulator/sky81452-regulator.txt  |  16 +
> >  .../devicetree/bindings/vendor-prefixes.txt|   1 +
> >  .../video/backlight/sky81452-backlight.txt |  20 ++
> >  drivers/mfd/Kconfig|  12 +
> >  drivers/mfd/Makefile   |   1 +
> >  drivers/mfd/sky81452.c | 115 +++
> >  drivers/regulator/Kconfig  |  11 +
> >  drivers/regulator/Makefile |   1 +
> >  drivers/regulator/sky81452-regulator.c | 127 
> >  drivers/video/backlight/Kconfig|  10 +
> >  drivers/video/backlight/Makefile   |   1 +
> >  drivers/video/backlight/sky81452-backlight.c   | 333 
> > +
> >  include/linux/mfd/sky81452.h   |  31 ++
> >  include/linux/sky81452-backlight.h |  46 +++
> >  16 files changed, 774 insertions(+)
> >  create mode 100644 Documentation/backlight/sky81452.txt
> >  create mode 100644 Documentation/devicetree/bindings/mfd/sky81452.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/regulator/sky81452-regulator.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
> >  create mode 100644 drivers/mfd/sky81452.c
> >  create mode 100644 drivers/regulator/sky81452-regulator.c
> >  create mode 100644 drivers/video/backlight/sky81452-backlight.c
> >  create mode 100644 include/linux/mfd/sky81452.h
> >  create mode 100644 include/linux/sky81452-backlight.h
> 
> [...]
> 
> > diff --git a/Documentation/devicetree/bindings/mfd/sky81452.txt 
> > b/Documentation/devicetree/bindings/mfd/sky81452.txt
> > new file mode 100644
> > index 000..18dd6ac
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/sky81452.txt
> > @@ -0,0 +1,24 @@
> > +SKY81452 bindings
> > +
> > +Required properties:
> > +- compatible   : Must be "sky,sky81452"
> > +
> > +Required child nodes:
> > +- backlight: container node for backlight following the 
> > binding
> > +   in video/backlight/sky81452-backlight.txt
> > +- regulator: container node for regulators following the 
> > binding
> > +   in regulator/sky81452-regulator.txt
> > +
> > +Example:
> > +
> > +sky81452@2C {
> > +compatible = "sky,sky81452";
> > +
> > +   backlight {
> > +   ...
> > +   };
> > +
> > +   regulator {
> > +   ...
> > +   };
> > +};
> 
> Mixture of tabs and spaces in the example, please use tabs only. Same
> for the example in sky81452-backlight.txt
> 
> [...]
> 
> > diff --git a/drivers/mfd/sky81452.c b/drivers/mfd/sky81452.c
> > new file mode 100644
> > index 000..e09552f
> > --- /dev/null
> > +++ b/drivers/mfd/sky81452.c
> > @@ -0,0 +1,115 @@
> 
> [...]
> 
> > +static int sky81452_probe(struct i2c_client *client,
> > +   const struct i2c_device_id *id)
> > +{
> > +   const struct sky81452_platform_data *pdata;
> > +   struct device *dev = &client->dev;
> > +   struct regmap *map;
> > +
> > +#ifdef CONFIG_OF
> > +   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> 
> You still should check the return value in this case.
> 
> > +#else
> > +   pdata = dev_get_platdata(dev);
> > +   if (unlikely(!pdata))
> 
> There's usually no need to use unlikely() in driver code, especially not
> in non-critical functions like probe()
> 
> > +   return -EINVAL;
> > +#endif
> > +
> > +   map = devm_regmap_init_i2c(client, &sky81452_config);
> > +   if (IS_ERR(map))
> > +   return PTR_ERR(map);
> > +
> > +   i2c_set_clientdata(client, map);
> > +
> > +   return sky81452_register_devices(dev, pdata);
> > +}
> > +
> > +static int sky81452_remove(struct i2c_client *client)
> > +{
> > +   mfd_remove_devices(&client->dev);
> > +   return 0;
> > +}
> > +
> > +static const struct i2c_device_id sky81452_ids[] = {
> > +   {"sky81452", 0},
> 
> Space between braces and content please.
> 
> > +   { }
> > +};
> > +MODULE_DEVICE_TABLE(i2c, sky81452_ids);
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id sky81452_of_match[] = {
> > +   {.compatible = "sky,sky81452",},
> 
> Space between braces and content.
> 
> > +   { }
> > +};
> > +MODULE_DEVICE_TABLE(of, sky81452_of_match);
> > +#endif
> 
> The #ifdefery here is not needed since you use of_match_ptr below, whcih
> will expand to NULL of CONFIG_OF is not set.
> 
> > +
> > +static struct i2c_driver sky81452_driver = {
> > +   .driver = {
> > +   .name

Re: [PATCH] Adding a support for Skyworks SKY81452

2014-08-07 Thread Gyungoh Yoo
On Thu, Aug 07, 2014 at 11:09:52AM +0100, Lee Jones wrote:
> On Thu, 07 Aug 2014, Gyungoh Yoo wrote:
> 
> > Signed-off-by: Gyungoh Yoo 
> > ---
> >  Documentation/backlight/sky81452.txt   |  25 ++
> >  Documentation/devicetree/bindings/mfd/sky81452.txt |  24 ++
> >  .../bindings/regulator/sky81452-regulator.txt  |  16 +
> >  .../devicetree/bindings/vendor-prefixes.txt|   1 +
> >  .../video/backlight/sky81452-backlight.txt |  20 ++
> >  drivers/mfd/Kconfig|  12 +
> >  drivers/mfd/Makefile   |   1 +
> >  drivers/mfd/sky81452.c | 115 +++
> >  drivers/regulator/Kconfig  |  11 +
> >  drivers/regulator/Makefile |   1 +
> >  drivers/regulator/sky81452-regulator.c | 127 
> >  drivers/video/backlight/Kconfig|  10 +
> >  drivers/video/backlight/Makefile   |   1 +
> >  drivers/video/backlight/sky81452-backlight.c   | 333 
> > +
> >  include/linux/mfd/sky81452.h   |  31 ++
> >  include/linux/sky81452-backlight.h |  46 +++
> >  16 files changed, 774 insertions(+)
> >  create mode 100644 Documentation/backlight/sky81452.txt
> >  create mode 100644 Documentation/devicetree/bindings/mfd/sky81452.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/regulator/sky81452-regulator.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/video/backlight/sky81452-backlight.txt
> >  create mode 100644 drivers/mfd/sky81452.c
> >  create mode 100644 drivers/regulator/sky81452-regulator.c
> >  create mode 100644 drivers/video/backlight/sky81452-backlight.c
> >  create mode 100644 include/linux/mfd/sky81452.h
> >  create mode 100644 include/linux/sky81452-backlight.h
> 
> Wow, no way.  Please split this up into separate patches.  Ideally, at
> least one per subsystem and separate ones again for the DT bindings.
> 

Sorry I didn't know. I will split them and resubmit.
Thank you.

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


Re: [PATCH v2 2/8] mm/isolation: remove unstable check for isolated page

2014-08-07 Thread Joonsoo Kim
On Thu, Aug 07, 2014 at 03:49:17PM +0200, Vlastimil Babka wrote:
> On 08/06/2014 09:18 AM, Joonsoo Kim wrote:
> >The check '!PageBuddy(page) && page_count(page) == 0 &&
> >migratetype == MIGRATE_ISOLATE' would mean the page on free processing.
> 
> What is "the page on free processing"? I thought this test means the
> page is on some CPU's pcplist?

Yes, you are right.

> 
> >Although it could go into buddy allocator within a short time,
> >futher operation such as isolate_freepages_range() in CMA, called after
> >test_page_isolated_in_pageblock(), could be failed due to this unstability
> 
> By "unstability" you mean the page can be allocated again from the
> pcplist instead of being freed to buddy list?

Yes.

> >since it requires that the page is on buddy. I think that removing
> >this unstability is good thing.
> >
> >And, following patch makes isolated freepage has new status matched with
> >this condition and this check is the obstacle to that change. So remove
> >it.
> 
> You could also say that pages from isolated pageblocks can no longer
> appear on pcplists after the later patches.

Okay. I will do it.

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


linux-next: manual merge of the akpm tree with the vfs tree

2014-08-07 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm tree got a conflict in
include/linux/fs.h between commit ed44724b79d8 ("acct: switch to
__kernel_write()") from the vfs tree and commit "fs.h: remove
unnecessary extern prototypes" from the akpm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

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

diff --cc include/linux/fs.h
index 94187721ad41,dccf4bcc21bb..
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@@ -2357,16 -2356,15 +2357,16 @@@ static inline void i_readcount_inc(stru
return;
  }
  #endif
- extern int do_pipe_flags(int *, int);
+ int do_pipe_flags(int *, int);
  
- extern int kernel_read(struct file *, loff_t, char *, unsigned long);
- extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
- extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
- extern struct file * open_exec(const char *);
+ int kernel_read(struct file *, loff_t, char *, unsigned long);
+ ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
++ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
+ struct file * open_exec(const char *);
   
  /* fs/dcache.c -- generic fs support functions */
- extern int is_subdir(struct dentry *, struct dentry *);
- extern int path_is_under(struct path *, struct path *);
+ int is_subdir(struct dentry *, struct dentry *);
+ int path_is_under(struct path *, struct path *);
  
  #include 
  


signature.asc
Description: PGP signature


[Bugfix] x86, irq, PCI: Keep IRQ assignment for PCI devices during suspend/hibernation

2014-08-07 Thread Jiang Liu
Now IOAPIC driver dynamically allocates IRQ numbers for IOAPIC pins.
We need to keep IRQ assignment for PCI devices during suspend/hibernation,
otherwise it may cause failure of suspend/hibernation due to:
1) Device driver calls pci_enable_device() to allocate an IRQ number
   and register interrupt handler on the returned IRQ.
2) Device driver's suspend callback calls pci_disable_device() and
   release assigned IRQ in turn.
3) Device driver's resume callback calls pci_enable_device() to
   allocate IRQ number again. A different IRQ number may be assigned
   by IOAPIC driver this time.
4) Now the hardware delivers interrupt to the new IRQ but interrupt
   handler is still registered against the old IRQ, so it breaks
   suspend/hibernation.

To fix this issue, we keep IRQ assignment during suspend/hibernation.
Flag pci_dev.dev.power.is_prepared is used to detect that
pci_disable_device() is called during suspend/hibernation.

Reported-and-Tested-by: Borislav Petkov 
Signed-off-by: Jiang Liu 
---
Hi Ingo,
Could you please help to apply this patch onto 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-apic-for-linus?
It fixes the suspend/hibernation failure reported by Borislav.
Thanks!
Gerry
---
 arch/x86/pci/intel_mid_pci.c |2 +-
 arch/x86/pci/irq.c   |3 ++-
 drivers/acpi/pci_irq.c   |4 
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c
index 09fece368592..3865116c51fb 100644
--- a/arch/x86/pci/intel_mid_pci.c
+++ b/arch/x86/pci/intel_mid_pci.c
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
 
 static void intel_mid_pci_irq_disable(struct pci_dev *dev)
 {
-   if (dev->irq > 0)
+   if (!dev->dev.power.is_prepared && dev->irq > 0)
mp_unmap_irq(dev->irq);
 }
 
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 748cfe8ab322..bc1a2c341891 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -1256,7 +1256,8 @@ static int pirq_enable_irq(struct pci_dev *dev)
 
 static void pirq_disable_irq(struct pci_dev *dev)
 {
-   if (io_apic_assign_pci_irqs && dev->irq) {
+   if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared &&
+   dev->irq) {
mp_unmap_irq(dev->irq);
dev->irq = 0;
}
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 6ba463ceccc6..c96887d5289e 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -481,6 +481,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
if (!pin)
return;
 
+   /* Keep IOAPIC pin configuration when suspending */
+   if (dev->dev.power.is_prepared)
+   return;
+
entry = acpi_pci_irq_lookup(dev, pin);
if (!entry)
return;
-- 
1.7.10.4

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


[PATCH 09/10 v2] staging: ozwpan: Use slab cache for oz_tx_frame allocation

2014-08-07 Thread Christoph Jaeger
Use a slab cache rather than rolling our own free list.

Signed-off-by: Christoph Jaeger 
---
v2: Don't use likely()/unlikely().

 drivers/staging/ozwpan/ozpd.c| 41 ++--
 drivers/staging/ozwpan/ozpd.h|  3 +--
 drivers/staging/ozwpan/ozproto.c |  8 
 drivers/staging/ozwpan/ozproto.h |  1 +
 4 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
index c6fddb8..e849d8a 100644
--- a/drivers/staging/ozwpan/ozpd.c
+++ b/drivers/staging/ozwpan/ozpd.c
@@ -21,8 +21,6 @@
 #include 
 #include 
 
-#define OZ_MAX_TX_POOL_SIZE6
-
 static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd);
 static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f);
 static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f);
@@ -177,13 +175,6 @@ static void oz_pd_free(struct work_struct *work)
e = e->next;
kfree(fwell);
}
-   /* Deallocate all frames in tx pool.
-*/
-   while (pd->tx_pool) {
-   e = pd->tx_pool;
-   pd->tx_pool = e->next;
-   kfree(container_of(e, struct oz_tx_frame, link));
-   }
if (pd->net_dev)
dev_put(pd->net_dev);
kfree(pd);
@@ -333,17 +324,9 @@ int oz_pd_sleep(struct oz_pd *pd)
  */
 static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd)
 {
-   struct oz_tx_frame *f = NULL;
+   struct oz_tx_frame *f;
 
-   spin_lock_bh(&pd->tx_frame_lock);
-   if (pd->tx_pool) {
-   f = container_of(pd->tx_pool, struct oz_tx_frame, link);
-   pd->tx_pool = pd->tx_pool->next;
-   pd->tx_pool_count--;
-   }
-   spin_unlock_bh(&pd->tx_frame_lock);
-   if (f == NULL)
-   f = kmalloc(sizeof(struct oz_tx_frame), GFP_ATOMIC);
+   f = kmem_cache_alloc(oz_tx_frame_cache, GFP_ATOMIC);
if (f) {
f->total_size = sizeof(struct oz_hdr);
INIT_LIST_HEAD(&f->link);
@@ -359,13 +342,9 @@ static void oz_tx_isoc_free(struct oz_pd *pd, struct 
oz_tx_frame *f)
 {
pd->nb_queued_isoc_frames--;
list_del_init(&f->link);
-   if (pd->tx_pool_count < OZ_MAX_TX_POOL_SIZE) {
-   f->link.next = pd->tx_pool;
-   pd->tx_pool = &f->link;
-   pd->tx_pool_count++;
-   } else {
-   kfree(f);
-   }
+
+   kmem_cache_free(oz_tx_frame_cache, f);
+
oz_dbg(TX_FRAMES, "Releasing ISOC Frame isoc_nb= %d\n",
   pd->nb_queued_isoc_frames);
 }
@@ -375,15 +354,7 @@ static void oz_tx_isoc_free(struct oz_pd *pd, struct 
oz_tx_frame *f)
  */
 static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f)
 {
-   spin_lock_bh(&pd->tx_frame_lock);
-   if (pd->tx_pool_count < OZ_MAX_TX_POOL_SIZE) {
-   f->link.next = pd->tx_pool;
-   pd->tx_pool = &f->link;
-   pd->tx_pool_count++;
-   f = NULL;
-   }
-   spin_unlock_bh(&pd->tx_frame_lock);
-   kfree(f);
+   kmem_cache_free(oz_tx_frame_cache, f);
 }
 
 /*
diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h
index 43a26ea..212fab0 100644
--- a/drivers/staging/ozwpan/ozpd.h
+++ b/drivers/staging/ozwpan/ozpd.h
@@ -90,8 +90,6 @@ struct oz_pd {
unsignedmax_stream_buffering;
int nb_queued_frames;
int nb_queued_isoc_frames;
-   struct list_head *tx_pool;
-   int tx_pool_count;
spinlock_t  tx_frame_lock;
struct list_head *last_sent_frame;
struct list_head tx_queue;
@@ -131,5 +129,6 @@ void oz_apps_init(void);
 void oz_apps_term(void);
 
 extern struct kmem_cache *oz_elt_info_cache;
+extern struct kmem_cache *oz_tx_frame_cache;
 
 #endif /* Sentry */
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index b592e96..db6ef99 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -53,6 +53,7 @@ static u16 g_apps = 0x1;
 static int g_processing_rx;
 
 struct kmem_cache *oz_elt_info_cache;
+struct kmem_cache *oz_tx_frame_cache;
 
 /*
  * Context: softirq-serialized
@@ -483,6 +484,7 @@ void oz_protocol_term(void)
spin_unlock_bh(&g_polling_lock);
oz_dbg(ON, "Protocol stopped\n");
 
+   kmem_cache_destroy(oz_tx_frame_cache);
kmem_cache_destroy(oz_elt_info_cache);
 }
 
@@ -771,6 +773,12 @@ int oz_protocol_init(char *devs)
if (!oz_elt_info_cache)
return -ENOMEM;
 
+   oz_tx_frame_cache = KMEM_CACHE(oz_tx_frame, 0);
+   if (!oz_tx_frame_cache) {
+   kmem_cache_destroy(oz_elt_info_cache);
+   return -ENOMEM;
+   }
+
skb_queue_head_init(&g_rx_queue);
if (devs[0] == '*') {
oz_binding_add(NULL);
diff --git a/drivers/staging/ozwpan/ozproto.h b/drivers/staging/ozwpan/ozproto.h
index b

[PATCH 07/10 v2] staging: ozwpan: Use slab cache for oz_urb_link allocation

2014-08-07 Thread Christoph Jaeger
Use a slab cache rather than rolling our own free list.

Signed-off-by: Christoph Jaeger 
---
v2: Don't use likely()/unlikely().

 drivers/staging/ozwpan/ozhcd.c | 70 --
 1 file changed, 12 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 30bd928..1142f57 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -45,10 +45,6 @@
  */
 #define OZ_PLAT_DEV_NAME   "ozwpan"
 
-/* Maximum number of free urb links that can be kept in the pool.
- */
-#define OZ_MAX_LINK_POOL_SIZE  16
-
 /* Get endpoint object from the containing link.
  */
 #define ep_from_link(__e) container_of((__e), struct oz_endpoint, link)
@@ -75,6 +71,8 @@ struct oz_urb_link {
unsigned submit_counter;
 };
 
+static struct kmem_cache *oz_urb_link_cache;
+
 /* Holds state information about a USB endpoint.
  */
 #define OZ_EP_BUFFER_SIZE_ISOC  (1024 * 24)
@@ -198,9 +196,6 @@ static struct platform_device *g_plat_dev;
 static struct oz_hcd *g_ozhcd;
 static DEFINE_SPINLOCK(g_hcdlock); /* Guards g_ozhcd. */
 static const char g_hcd_name[] = "Ozmo WPAN";
-static struct list_head *g_link_pool;
-static int g_link_pool_size;
-static DEFINE_SPINLOCK(g_link_lock);
 static DEFINE_SPINLOCK(g_tasklet_lock);
 static struct tasklet_struct g_urb_process_tasklet;
 static struct tasklet_struct g_urb_cancel_tasklet;
@@ -265,68 +260,22 @@ static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 
bus_addr)
 }
 
 /*
- * Allocates an urb link, first trying the pool but going to heap if empty.
  * Context: any
  */
 static struct oz_urb_link *oz_alloc_urb_link(void)
 {
-   struct oz_urb_link *urbl = NULL;
-   unsigned long irq_state;
-
-   spin_lock_irqsave(&g_link_lock, irq_state);
-   if (g_link_pool) {
-   urbl = container_of(g_link_pool, struct oz_urb_link, link);
-   g_link_pool = urbl->link.next;
-   --g_link_pool_size;
-   }
-   spin_unlock_irqrestore(&g_link_lock, irq_state);
-   if (urbl == NULL)
-   urbl = kmalloc(sizeof(struct oz_urb_link), GFP_ATOMIC);
-   return urbl;
+   return kmem_cache_alloc(oz_urb_link_cache, GFP_ATOMIC);
 }
 
 /*
- * Frees an urb link by putting it in the pool if there is enough space or
- * deallocating it to heap otherwise.
  * Context: any
  */
 static void oz_free_urb_link(struct oz_urb_link *urbl)
 {
-   if (urbl) {
-   unsigned long irq_state;
-
-   spin_lock_irqsave(&g_link_lock, irq_state);
-   if (g_link_pool_size < OZ_MAX_LINK_POOL_SIZE) {
-   urbl->link.next = g_link_pool;
-   g_link_pool = &urbl->link;
-   urbl = NULL;
-   g_link_pool_size++;
-   }
-   spin_unlock_irqrestore(&g_link_lock, irq_state);
-   kfree(urbl);
-   }
-}
-
-/*
- * Deallocates all the urb links in the pool.
- * Context: unknown
- */
-static void oz_empty_link_pool(void)
-{
-   struct list_head *e;
-   unsigned long irq_state;
+   if (!urbl)
+   return;
 
-   spin_lock_irqsave(&g_link_lock, irq_state);
-   e = g_link_pool;
-   g_link_pool = NULL;
-   g_link_pool_size = 0;
-   spin_unlock_irqrestore(&g_link_lock, irq_state);
-   while (e) {
-   struct oz_urb_link *urbl =
-   container_of(e, struct oz_urb_link, link);
-   e = e->next;
-   kfree(urbl);
-   }
+   kmem_cache_free(oz_urb_link_cache, urbl);
 }
 
 /*
@@ -2311,7 +2260,6 @@ static int oz_plat_remove(struct platform_device *dev)
oz_dbg(ON, "Removing hcd\n");
usb_remove_hcd(hcd);
usb_put_hcd(hcd);
-   oz_empty_link_pool();
return 0;
 }
 
@@ -2341,6 +2289,11 @@ int oz_hcd_init(void)
 
if (usb_disabled())
return -ENODEV;
+
+   oz_urb_link_cache = KMEM_CACHE(oz_urb_link, 0);
+   if (!oz_urb_link_cache)
+   return -ENOMEM;
+
tasklet_init(&g_urb_process_tasklet, oz_urb_process_tasklet, 0);
tasklet_init(&g_urb_cancel_tasklet, oz_urb_cancel_tasklet, 0);
err = platform_driver_register(&g_oz_plat_drv);
@@ -2380,4 +2333,5 @@ void oz_hcd_term(void)
platform_device_unregister(g_plat_dev);
platform_driver_unregister(&g_oz_plat_drv);
oz_dbg(ON, "Pending urbs:%d\n", atomic_read(&g_pending_urbs));
+   kmem_cache_destroy(oz_urb_link_cache);
 }
-- 
1.9.1

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


[PATCH 08/10 v2] staging: ozwpan: Use slab cache for oz_elt_info allocation

2014-08-07 Thread Christoph Jaeger
Use a slab cache rather than rolling our own free list.

Signed-off-by: Christoph Jaeger 
---
v2: Don't use likely()/unlikely().

 drivers/staging/ozwpan/ozeltbuf.c | 68 ++-
 drivers/staging/ozwpan/ozeltbuf.h |  5 ---
 drivers/staging/ozwpan/ozpd.c |  2 --
 drivers/staging/ozwpan/ozpd.h |  2 ++
 drivers/staging/ozwpan/ozproto.c  |  9 ++
 drivers/staging/ozwpan/ozproto.h  |  2 ++
 6 files changed, 16 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/ozwpan/ozeltbuf.c 
b/drivers/staging/ozwpan/ozeltbuf.c
index f6e6481..389ab1a 100644
--- a/drivers/staging/ozwpan/ozeltbuf.c
+++ b/drivers/staging/ozwpan/ozeltbuf.c
@@ -10,9 +10,6 @@
 #include "ozeltbuf.h"
 #include "ozpd.h"
 
-#define OZ_ELT_INFO_MAGIC_USED 0x35791057
-#define OZ_ELT_INFO_MAGIC_FREE 0x78940102
-
 /*
  * Context: softirq-serialized
  */
@@ -22,7 +19,6 @@ void oz_elt_buf_init(struct oz_elt_buf *buf)
INIT_LIST_HEAD(&buf->stream_list);
INIT_LIST_HEAD(&buf->order_list);
INIT_LIST_HEAD(&buf->isoc_list);
-   buf->max_free_elts = 32;
spin_lock_init(&buf->lock);
 }
 
@@ -49,14 +45,6 @@ void oz_elt_buf_term(struct oz_elt_buf *buf)
kfree(ei);
}
}
-   /* Free any elelment in the pool. */
-   while (buf->elt_pool) {
-   struct oz_elt_info *ei =
-   container_of(buf->elt_pool, struct oz_elt_info, link);
-   buf->elt_pool = buf->elt_pool->next;
-   kfree(ei);
-   }
-   buf->free_elts = 0;
 }
 
 /*
@@ -66,27 +54,8 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
 {
struct oz_elt_info *ei;
 
-   spin_lock_bh(&buf->lock);
-   if (buf->free_elts && buf->elt_pool) {
-   ei = container_of(buf->elt_pool, struct oz_elt_info, link);
-   buf->elt_pool = ei->link.next;
-   buf->free_elts--;
-   spin_unlock_bh(&buf->lock);
-   if (ei->magic != OZ_ELT_INFO_MAGIC_FREE) {
-   oz_dbg(ON, "%s: ei with bad magic: 0x%x\n",
-  __func__, ei->magic);
-   }
-   } else {
-   spin_unlock_bh(&buf->lock);
-   ei = kmalloc(sizeof(struct oz_elt_info), GFP_ATOMIC);
-   }
+   ei = kmem_cache_zalloc(oz_elt_info_cache, GFP_ATOMIC);
if (ei) {
-   ei->flags = 0;
-   ei->app_id = 0;
-   ei->callback = NULL;
-   ei->context = 0;
-   ei->stream = NULL;
-   ei->magic = OZ_ELT_INFO_MAGIC_USED;
INIT_LIST_HEAD(&ei->link);
INIT_LIST_HEAD(&ei->link_order);
}
@@ -99,17 +68,8 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
  */
 void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei)
 {
-   if (ei) {
-   if (ei->magic == OZ_ELT_INFO_MAGIC_USED) {
-   buf->free_elts++;
-   ei->link.next = buf->elt_pool;
-   buf->elt_pool = &ei->link;
-   ei->magic = OZ_ELT_INFO_MAGIC_FREE;
-   } else {
-   oz_dbg(ON, "%s: bad magic ei: %p magic: 0x%x\n",
-  __func__, ei, ei->magic);
-   }
-   }
+   if (ei)
+   kmem_cache_free(oz_elt_info_cache, ei);
 }
 
 
/*--
@@ -313,25 +273,3 @@ int oz_are_elts_available(struct oz_elt_buf *buf)
 {
return buf->order_list.next != &buf->order_list;
 }
-
-void oz_trim_elt_pool(struct oz_elt_buf *buf)
-{
-   struct list_head *free = NULL;
-   struct list_head *e;
-
-   spin_lock_bh(&buf->lock);
-   while (buf->free_elts > buf->max_free_elts) {
-   e = buf->elt_pool;
-   buf->elt_pool = e->next;
-   e->next = free;
-   free = e;
-   buf->free_elts--;
-   }
-   spin_unlock_bh(&buf->lock);
-   while (free) {
-   struct oz_elt_info *ei =
-   container_of(free, struct oz_elt_info, link);
-   free = free->next;
-   kfree(ei);
-   }
-}
diff --git a/drivers/staging/ozwpan/ozeltbuf.h 
b/drivers/staging/ozwpan/ozeltbuf.h
index 3846432..f09f5fe 100644
--- a/drivers/staging/ozwpan/ozeltbuf.h
+++ b/drivers/staging/ozwpan/ozeltbuf.h
@@ -34,7 +34,6 @@ struct oz_elt_info {
struct oz_elt_stream *stream;
u8 data[sizeof(struct oz_elt) + OZ_MAX_ELT_PAYLOAD];
int length;
-   unsigned magic;
 };
 /* Flags values */
 #define OZ_EI_F_MARKED 0x1
@@ -44,9 +43,6 @@ struct oz_elt_buf {
struct list_head stream_list;
struct list_head order_list;
struct list_head isoc_list;
-   struct list_head *elt_pool;
-   int free_elts;
-   int max_free_elts;
u8 tx_seq_num[OZ_NB_APPS];
 };
 
@@ -64,7

Re: Weird NET_RX softirq behavior

2014-08-07 Thread Eric Dumazet
On Fri, 2014-08-08 at 10:37 +0800, Jisheng Zhang wrote:
> nd and recive 7 packets so far, about 1400bytes. Seems small
> comparing with the CPU1 and CPU2 NET_RX softirq numbers, right?
> 
> Any other possible case?

Multicast loop. Check dev_loopback_xmit() and its callers.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 1/2] ASoC: fsl_esai: refine esai for TDM support

2014-08-07 Thread Shengjiu Wang
Original driver didn't store the number of slots, just fix the slot number
to 2, use this default number to calculate bclk and pins for TX/RX.
In this patch, add one parameter for slots, and update the calculation of
bclk and pins of TX/RX. Then driver will be compatible with slots > 2 in
TDM mode.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_esai.c |   14 +++---
 sound/soc/fsl/fsl_esai.h |8 
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 72d154e..f252370 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -38,6 +38,7 @@
  * @fsysclk: system clock source to derive HCK, SCK and FS
  * @fifo_depth: depth of tx/rx FIFO
  * @slot_width: width of each DAI slot
+ * @slots: number of slots
  * @hck_rate: clock rate of desired HCKx clock
  * @sck_rate: clock rate of desired SCKx clock
  * @hck_dir: the direction of HCKx pads
@@ -56,6 +57,7 @@ struct fsl_esai {
struct clk *fsysclk;
u32 fifo_depth;
u32 slot_width;
+   u32 slots;
u32 hck_rate[2];
u32 sck_rate[2];
bool hck_dir[2];
@@ -363,6 +365,7 @@ static int fsl_esai_set_dai_tdm_slot(struct snd_soc_dai 
*dai, u32 tx_mask,
   ESAI_xSMB_xS_MASK, ESAI_xSMB_xS(rx_mask));
 
esai_priv->slot_width = slot_width;
+   esai_priv->slots = slots;
 
return 0;
 }
@@ -510,10 +513,11 @@ static int fsl_esai_hw_params(struct snd_pcm_substream 
*substream,
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u32 width = snd_pcm_format_width(params_format(params));
u32 channels = params_channels(params);
+   u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
u32 bclk, mask, val;
int ret;
 
-   bclk = params_rate(params) * esai_priv->slot_width * 2;
+   bclk = params_rate(params) * esai_priv->slot_width * esai_priv->slots;
 
ret = fsl_esai_set_bclk(dai, tx, bclk);
if (ret)
@@ -530,7 +534,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream 
*substream,
mask = ESAI_xFCR_xFR_MASK | ESAI_xFCR_xWA_MASK | ESAI_xFCR_xFWM_MASK |
  (tx ? ESAI_xFCR_TE_MASK | ESAI_xFCR_TIEN : ESAI_xFCR_RE_MASK);
val = ESAI_xFCR_xWA(width) | ESAI_xFCR_xFWM(esai_priv->fifo_depth) |
-(tx ? ESAI_xFCR_TE(channels) | ESAI_xFCR_TIEN : 
ESAI_xFCR_RE(channels));
+(tx ? ESAI_xFCR_TE(pins) | ESAI_xFCR_TIEN : ESAI_xFCR_RE(pins));
 
regmap_update_bits(esai_priv->regmap, REG_ESAI_xFCR(tx), mask, val);
 
@@ -565,6 +569,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream 
*substream, int cmd,
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u8 i, channels = substream->runtime->channels;
+   u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -579,7 +584,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream 
*substream, int cmd,
 
regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx),
   tx ? ESAI_xCR_TE_MASK : ESAI_xCR_RE_MASK,
-  tx ? ESAI_xCR_TE(channels) : 
ESAI_xCR_RE(channels));
+  tx ? ESAI_xCR_TE(pins) : ESAI_xCR_RE(pins));
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
@@ -783,6 +788,9 @@ static int fsl_esai_probe(struct platform_device *pdev)
/* Set a default slot size */
esai_priv->slot_width = 32;
 
+   /* Set a default slot number */
+   esai_priv->slots = 2;
+
/* Set a default master/slave state */
esai_priv->slave_mode = true;
 
diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h
index 75e1403..91a550f 100644
--- a/sound/soc/fsl/fsl_esai.h
+++ b/sound/soc/fsl/fsl_esai.h
@@ -130,8 +130,8 @@
 #define ESAI_xFCR_RE_WIDTH 4
 #define ESAI_xFCR_TE_MASK  (((1 << ESAI_xFCR_TE_WIDTH) - 1) << 
ESAI_xFCR_xE_SHIFT)
 #define ESAI_xFCR_RE_MASK  (((1 << ESAI_xFCR_RE_WIDTH) - 1) << 
ESAI_xFCR_xE_SHIFT)
-#define ESAI_xFCR_TE(x)((ESAI_xFCR_TE_MASK >> (ESAI_xFCR_TE_WIDTH - 
((x + 1) >> 1))) & ESAI_xFCR_TE_MASK)
-#define ESAI_xFCR_RE(x)((ESAI_xFCR_RE_MASK >> (ESAI_xFCR_RE_WIDTH - 
((x + 1) >> 1))) & ESAI_xFCR_RE_MASK)
+#define ESAI_xFCR_TE(x)((ESAI_xFCR_TE_MASK >> (ESAI_xFCR_TE_WIDTH - 
x)) & ESAI_xFCR_TE_MASK)
+#define ESAI_xFCR_RE(x)((ESAI_xFCR_RE_MASK >> (ESAI_xFCR_RE_WIDTH - 
x)) & ESAI_xFCR_RE_MASK)
 #define ESAI_xFCR_xFR_SHIFT1
 #define ESAI_xFCR_xFR_MASK (1 << ESAI_xFCR_xFR_SHIFT)
 #define ESAI_xFCR_xFR  (1 << ESAI_xFCR_xFR_SHIFT)
@@ -272,8 +272,8 @@
 #define ESAI_xCR_RE_WIDTH  4
 #define ESAI_xCR_TE_MASK   (((1 << ESAI_xCR_TE_WIDTH) - 1) << 
ESAI_xCR_xE_SHIFT)
 #define ESAI_xCR_RE_MASK   (((1 << ESAI_xCR_RE_WIDTH) - 

Re: [patch] mm, hugetlb_cgroup: align hugetlb cgroup limit to hugepage size

2014-08-07 Thread Aneesh Kumar K.V
David Rientjes  writes:

> Memcg aligns memory.limit_in_bytes to PAGE_SIZE as part of the resource 
> counter
> since it makes no sense to allow a partial page to be charged.
>
> As a result of the hugetlb cgroup using the resource counter, it is also 
> aligned
> to PAGE_SIZE but makes no sense unless aligned to the size of the hugepage 
> being
> limited.
>
> Align hugetlb cgroup limit to hugepage size.
>
> Signed-off-by: David Rientjes 
> ---
>  mm/hugetlb_cgroup.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -275,6 +275,8 @@ static ssize_t hugetlb_cgroup_write(struct 
> kernfs_open_file *of,
>   ret = res_counter_memparse_write_strategy(buf, &val);
>   if (ret)
>   break;
> + val = ALIGN(val, 1 << (huge_page_order(&hstates[idx]) +
> +PAGE_SHIFT));

you can use  1UL << huge_page_shift(hstate); ?

>   ret = res_counter_set_limit(&h_cg->hugepage[idx], val);
>   break;
>   default:
>

-aneesh

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


linux-next: manual merge of the akpm-current tree with Linus' tree

2014-08-07 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/memcontrol.c between commit 61e02c745721 ("mm: memcontrol: clean up
reclaim size variable use in try_charge()") from Linus' tree and
various commits from the akpm-current tree.

I fixed it up (I think) and can carry the fix as necessary (no action
is required).

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


signature.asc
Description: PGP signature


[PATCH V2] regulator: DA9211 : support DA9213

2014-08-07 Thread James Ban
This is a patch for supporting DA9213.

Signed-off-by: James Ban 
---

This patch is relative to linux-next repository tag next-20140807.

Changes in V2:
- Changed a method for selecting driver table.

 drivers/regulator/Kconfig|9 ++--
 drivers/regulator/da9211-regulator.c |   95 +++---
 drivers/regulator/da9211-regulator.h |7 ++-
 include/linux/regulator/da9211.h |7 ++-
 4 files changed, 91 insertions(+), 27 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 2dc8289..1344aa8 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -199,13 +199,14 @@ config REGULATOR_DA9210
  interface.
 
 config REGULATOR_DA9211
-   tristate "Dialog Semiconductor DA9211/DA9212 regulator"
+   tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214 regulator"
depends on I2C
select REGMAP_I2C
help
- Say y here to support for the Dialog Semiconductor DA9211/DA9212.
- The DA9211/DA9212 is a multi-phase synchronous step down
- converter 12A DC-DC Buck controlled through an I2C
+ Say y here to support for the Dialog Semiconductor DA9211/DA9212
+ /DA9213/DA9214.
+ The DA9211/DA9212/DA9213/DA9214 is a multi-phase synchronous
+ step down converter 12A or 16A DC-DC Buck controlled through an I2C
  interface.
 
 config REGULATOR_DBX500_PRCMU
diff --git a/drivers/regulator/da9211-regulator.c 
b/drivers/regulator/da9211-regulator.c
index 1482ada..ccc2e36 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -1,5 +1,5 @@
 /*
- * da9211-regulator.c - Regulator device driver for DA9211
+ * da9211-regulator.c - Regulator device driver for DA9211/DA9213
  * Copyright (C) 2014  Dialog Semiconductor Ltd.
  *
  * This library is free software; you can redistribute it and/or
@@ -27,6 +27,10 @@
 #include 
 #include "da9211-regulator.h"
 
+/* DEVICE IDs */
+#define DA9211_DEVICE_ID   0x22
+#define DA9213_DEVICE_ID   0x23
+
 #define DA9211_BUCK_MODE_SLEEP 1
 #define DA9211_BUCK_MODE_SYNC  2
 #define DA9211_BUCK_MODE_AUTO  3
@@ -42,6 +46,7 @@ struct da9211 {
struct regulator_dev *rdev[DA9211_MAX_REGULATORS];
int num_regulator;
int chip_irq;
+   int chip_id;
 };
 
 static const struct regmap_range_cfg da9211_regmap_range[] = {
@@ -52,14 +57,14 @@ static const struct regmap_range_cfg da9211_regmap_range[] 
= {
.window_start = 0,
.window_len = 256,
.range_min = 0,
-   .range_max = 2*256,
+   .range_max = 5*128,
},
 };
 
 static const struct regmap_config da9211_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
-   .max_register = 2 * 256,
+   .max_register = 5 * 128,
.ranges = da9211_regmap_range,
.num_ranges = ARRAY_SIZE(da9211_regmap_range),
 };
@@ -69,11 +74,20 @@ static const struct regmap_config da9211_regmap_config = {
 #define DA9211_MAX_MV  1570
 #define DA9211_STEP_MV 10
 
-/* Current limits for buck (uA) indices corresponds with register values */
+/* Current limits for DA9211 buck (uA) indices
+ * corresponds with register values
+ */
 static const int da9211_current_limits[] = {
200, 220, 240, 260, 280, 300, 320, 340,
360, 380, 400, 420, 440, 460, 480, 500
 };
+/* Current limits for DA9213 buck (uA) indices
+ * corresponds with register values
+ */
+static const int da9213_current_limits[] = {
+   300, 320, 340, 360, 380, 400, 420, 440,
+   460, 480, 500, 520, 540, 560, 580, 600
+};
 
 static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev)
 {
@@ -129,12 +143,26 @@ static int da9211_set_current_limit(struct regulator_dev 
*rdev, int min,
 {
int id = rdev_get_id(rdev);
struct da9211 *chip = rdev_get_drvdata(rdev);
-   int i;
+   int i, max_size;
+   const int *current_limits;
+
+   switch (chip->chip_id) {
+   case DA9211:
+   current_limits = da9211_current_limits;
+   max_size = ARRAY_SIZE(da9211_current_limits)-1;
+   break;
+   case DA9213:
+   current_limits = da9213_current_limits;
+   max_size = ARRAY_SIZE(da9213_current_limits)-1;
+   break;
+   default:
+   return -EINVAL;
+   }
 
/* search for closest to maximum */
-   for (i = ARRAY_SIZE(da9211_current_limits)-1; i >= 0; i--) {
-   if (min <= da9211_current_limits[i] &&
-   max >= da9211_current_limits[i]) {
+   for (i = max_size; i >= 0; i--) {
+   if (min <= current_limits[i] &&
+   max >= current_limits[i]) {
   

Re: [PATCH v2 1/7] locking/rwsem: check for active writer/spinner before wakeup

2014-08-07 Thread Davidlohr Bueso
On Thu, 2014-08-07 at 17:45 -0700, Davidlohr Bueso wrote:
> On Thu, 2014-08-07 at 18:26 -0400, Waiman Long wrote:
> > On a highly contended rwsem, spinlock contention due to the slow
> > rwsem_wake() call can be a significant portion of the total CPU cycles
> > used. With writer lock stealing and writer optimistic spinning, there
> > is also a pretty good chance that the lock may have been stolen
> > before the waker wakes up the waiters. The woken tasks, if any,
> > will have to go back to sleep again.
> 
> Good catch! And this applies to mutexes as well. How about something
> like this:
> 
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index dadbf88..e037588 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -707,6 +707,20 @@ EXPORT_SYMBOL_GPL(__ww_mutex_lock_interruptible);
>  
>  #endif
>  
> +#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)

If DEBUG, we don't clear the owner when unlocking. This can just be 

+#ifdef CONFIG_MUTEX_SPIN_ON_OWNER

> +static inline bool mutex_has_owner(struct mutex *lock)
> +{
> + struct task_struct *owner = ACCESS_ONCE(lock->owner);
> +
> + return owner != NULL;
> +}
> +#else
> +static inline bool mutex_has_owner(struct mutex *lock)
> +{
> + return false;
> +}
> +#endif
> +
>  /*
>   * Release the lock, slowpath:
>   */
> @@ -734,6 +748,15 @@ __mutex_unlock_common_slowpath(struct mutex *lock, int 
> nested)
>   mutex_release(&lock->dep_map, nested, _RET_IP_);
>   debug_mutex_unlock(lock);
>  
> + /*
> +  * Abort the wakeup operation if there is an active writer as the
> +  * lock was stolen. mutex_unlock() should have cleared the owner field
> +  * before calling this function. If that field is now set, there must
> +  * be an active writer present.
> +  */
> + if (mutex_has_owner(lock))
> + goto done;

Err so we actually deadlock here because we do the check with the
lock->wait_lock held and at the same time another task comes into the
slowpath of a mutex_lock() call which also tries to take the wait_lock.
Ending up with hung tasks. Here's a more tested patch against
peterz-queue, survives aim7 and kernel builds on a 80core box. Thanks.


8<---
From: Davidlohr Bueso 
Subject: [PATCH] locking/mutex: Do not falsely wake-up tasks

Mutexes lock-stealing functionality allows another task to
skip its turn in the wait-queue and atomically acquire the lock.
This is fine and a nice optimization, however, when releasing
the mutex, we always wakeup the next task in FIFO order. When
the lock has been stolen this leads to wasting waking up a
task just to immediately realize it cannot acquire the lock
and just go back to sleep. This is specially true on highly
contended mutexes that stress the wait_lock.

Signed-off-by: Davidlohr Bueso 
---
 kernel/locking/mutex.c | 32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index dadbf88..52e1136 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -383,12 +383,26 @@ done:
 
return false;
 }
+
+static inline bool mutex_has_owner(struct mutex *lock)
+{
+   struct task_struct *owner = ACCESS_ONCE(lock->owner);
+
+   return owner != NULL;
+}
+
 #else
+
 static bool mutex_optimistic_spin(struct mutex *lock,
  struct ww_acquire_ctx *ww_ctx, const bool 
use_ww_ctx)
 {
return false;
 }
+
+static inline bool mutex_has_owner(struct mutex *lock)
+{
+   return false;
+}
 #endif
 
 __visible __used noinline
@@ -730,6 +744,23 @@ __mutex_unlock_common_slowpath(struct mutex *lock, int 
nested)
if (__mutex_slowpath_needs_to_unlock())
atomic_set(&lock->count, 1);
 
+/*
+ * Skipping the mutex_has_owner() check when DEBUG, allows us to
+ * avoid taking the wait_lock in order to do not call mutex_release()
+ * and debug_mutex_unlock() when !DEBUG. This can otherwise result in
+ * deadlocks when another task enters the lock's slowpath in mutex_lock().
+ */
+#ifndef CONFIG_DEBUG_MUTEXES
+   /*
+* Abort the wakeup operation if there is an another mutex owner, as the
+* lock was stolen. mutex_unlock() should have cleared the owner field
+* before calling this function. If that field is now set, another task
+* must have acquired the mutex.
+*/
+   if (mutex_has_owner(lock))
+   return;
+#endif
+
spin_lock_mutex(&lock->wait_lock, flags);
mutex_release(&lock->dep_map, nested, _RET_IP_);
debug_mutex_unlock(lock);
@@ -744,7 +775,6 @@ __mutex_unlock_common_slowpath(struct mutex *lock, int 
nested)
 
wake_up_process(waiter->task);
}
-
spin_unlock_mutex(&lock->wait_lock, flags);
 }
 
-- 
1.8.1.4



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

[PATCH 3/4] xen-pciback: use pci device flag operation helper function

2014-08-07 Thread Ethan Zhao
Use pci device flag operation helper functions when set device
to assigned or deassigned state.

Acked-by: David Vrabel 
Reviewed-by: Konrad Rzeszutek Wilk 
Signed-off-by: Ethan Zhao 
---
 drivers/xen/xen-pciback/pci_stub.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/xen-pciback/pci_stub.c 
b/drivers/xen/xen-pciback/pci_stub.c
index d57a173..e593921 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -133,7 +133,7 @@ static void pcistub_device_release(struct kref *kref)
xen_pcibk_config_free_dyn_fields(dev);
xen_pcibk_config_free_dev(dev);
 
-   dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
+   pci_clear_dev_assigned(dev);
pci_dev_put(dev);
 
kfree(psdev);
@@ -413,7 +413,7 @@ static int pcistub_init_device(struct pci_dev *dev)
dev_dbg(&dev->dev, "reset device\n");
xen_pcibk_reset_device(dev);
 
-   dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
+   pci_set_dev_assigned(dev);
return 0;
 
 config_release:
-- 
1.7.1

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


[PATCH v3 0/4 resend] Introduce device assignment flag operation helper function

2014-08-07 Thread Ethan Zhao
This patch set introduces three PCI device flag operation helper functions
when set pci device PF/VF to assigned or deassigned status also check it.
and patch 2,3,4 apply these helper functions to KVM,XEN and PCI.

v2: simplify unnecessory ternary operation in function pci_is_dev_assigned().
v3: amend helper function naming.

Appreciate suggestion from
alex.william...@redhat.com,
david.vra...@citrix.com,
alexander.h.du...@intel.com

Resend for v3.16 building.

Thanks,
Ethan
---
Ethan Zhao (4):
  PCI: introduce helper functions for device flag operation
  KVM: use pci device flag operation helper functions
  xen-pciback: use pci device flag operation helper function
  PCI: use device flag operation helper function in iov.c

 drivers/pci/iov.c  |2 +-
 drivers/xen/xen-pciback/pci_stub.c |4 ++--
 include/linux/pci.h|   13 +
 virt/kvm/assigned-dev.c|2 +-
 virt/kvm/iommu.c   |4 ++--
 5 files changed, 19 insertions(+), 6 deletions(-)

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


[PATCH 1/4] PCI: introduce helper functions for device flag operation

2014-08-07 Thread Ethan Zhao
This patch introduced three helper functions to hide direct
device flag operation.

void pci_set_dev_assigned(struct pci_dev *pdev);
void pci_clear_dev_assigned(struct pci_dev *pdev);
bool pci_is_dev_assigned(struct pci_dev *pdev);

Signed-off-by: Ethan Zhao 
---
 v2: simplify unnecessory ternary operation in function pci_is_dev_assigned();
 v3: amend helper functions naming.
---
 include/linux/pci.h |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 466bcd1..b610ab3 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1829,4 +1829,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
  */
 struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
 
+/* helper functions for operation of device flag */
+static inline void pci_set_dev_assigned(struct pci_dev *pdev)
+{
+   pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
+}
+static inline void pci_clear_dev_assigned(struct pci_dev *pdev)
+{
+   pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
+}
+static inline bool pci_is_dev_assigned(struct pci_dev *pdev)
+{
+   return pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED;
+}
 #endif /* LINUX_PCI_H */
-- 
1.7.1

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


[PATCH 4/4] PCI: use device flag operation helper function in iov.c

2014-08-07 Thread Ethan Zhao
Use device flag operation helper functions when check device
assignment status.

Signed-off-by: Ethan Zhao 
---
 drivers/pci/iov.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index cb6f247..4d109c0 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -633,7 +633,7 @@ int pci_vfs_assigned(struct pci_dev *dev)
 * our dev as the physical function and the assigned bit is set
 */
if (vfdev->is_virtfn && (vfdev->physfn == dev) &&
-   (vfdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED))
+   pci_is_dev_assigned(vfdev))
vfs_assigned++;
 
vfdev = pci_get_device(dev->vendor, dev_id, vfdev);
-- 
1.7.1

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


[PATCH 2/4] KVM: use pci device flag operation helper functions

2014-08-07 Thread Ethan Zhao
Use helper function instead of direct operation to pci device
flag when set device to assigned or deassigned.

Acked-by: Paolo Bonzini 
Signed-off-by: Ethan Zhao 
---
 virt/kvm/assigned-dev.c |2 +-
 virt/kvm/iommu.c|4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index bf06577..38581ee 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -302,7 +302,7 @@ static void kvm_free_assigned_device(struct kvm *kvm,
else
pci_restore_state(assigned_dev->dev);
 
-   assigned_dev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
+   pci_clear_dev_assigned(assigned_dev->dev);
 
pci_release_regions(assigned_dev->dev);
pci_disable_device(assigned_dev->dev);
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 0df7d4b..34a8b02 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -194,7 +194,7 @@ int kvm_assign_device(struct kvm *kvm,
goto out_unmap;
}
 
-   pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
+   pci_set_dev_assigned(pdev);
 
dev_info(&pdev->dev, "kvm assign device\n");
 
@@ -220,7 +220,7 @@ int kvm_deassign_device(struct kvm *kvm,
 
iommu_detach_device(domain, &pdev->dev);
 
-   pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
+   pci_clear_dev_assigned(pdev);
 
dev_info(&pdev->dev, "kvm deassign device\n");
 
-- 
1.7.1

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


Re: [PATCH net-next 0/2] xen-netback: Changes around carrier handling

2014-08-07 Thread David Miller
From: Zoltan Kiss 
Date: Thu, 7 Aug 2014 16:51:17 +0100

> Ok, how about this:
> * ndo_start_xmit tries to set up the grant copy operations, something
> * which is done now in the thread
> * no estimation madness, just go ahead and try to do it
> * if the skb can fit, kick the thread
> * if it fails (not enough slots to complete the TX), then:
>   * call netif_tx_stop_queue on that queue (just like now)
>   * set up timer rx_stalled (just like now)
>   * save the state of the current skb (where the grant copy op setup is
>   * halted)
> * if new slots coming in, continue to create the grant copy ops for the
> * stalled skb, and if it succeeds, kick the thread plus call
> * netif_tx_start_queue. (just like now)
> * if the timer fires, drop the stalled skb, and set the carrier off, so
> * QDisc won't bother to queue packets for a stalled interface
> * the thread will only do the actual grant copy hypercall and releasing
> * the skb
> * in any case, ndo_start_xmit should return NETDEV_TX_OK, just like now

It sounds like this would work, and indeed it would abide by the intended
rules of netif_{stop,wake}_queue() and ->ndo_start_xmit()'s return
values.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging/lustre: use rcu_dereference to access rcu protected current->real_parent field

2014-08-07 Thread Greg Kroah-Hartman
On Fri, Aug 08, 2014 at 01:06:15AM -0400, Oleg Drokin wrote:
> 
> On Aug 8, 2014, at 12:42 AM, Greg Kroah-Hartman wrote:
> 
> > On Fri, Aug 08, 2014 at 12:03:20AM -0400, Oleg Drokin wrote:
> >> Hello!
> >> 
> >> On Aug 7, 2014, at 11:49 PM, Greg Kroah-Hartman wrote:
>  
>  This is not a critical bug and in the worst case the code here may
>  cause miss of statistics counter increase.
>  This is why I think it is not worth to backport the patch at all.
> >>> You are right, and if this is just for some random "statistics" file,
> >>> can we just delete the whole function?
> >> 
> >> I hope not!
> >> This is used all around the client to tally up various operations executed 
> >> counts.
> > Why would you do that?  Why would they care?
> 
> We would do that to provide information on the client operations performed.
> They would care because they are interested in what particular clients might 
> be doing.
> 
> >> The statistic is then used by various userspace monitoring tools.
> > Why not use the in-kernel monitoring tools instead of creating your own?
> > What does userspace do with that information?
> 
> We don't really control the userspace tools. People write tools to suit their 
> needs
> to monitor loads, see odd things the end users are doing or possibly for some
> debugging even.
> Correlating these numbers with what server sees also proves useful at times
> (write combining for example).
> 
> Here's a sample of output of a recently mounted client that I poked on a bit 
> (the lines starting with # are my comments):
> # cat /proc/fs/lustre/llite/lustre-88008dde27f0/stats
> snapshot_time 1407473168.466102 secs.usecs
> read_bytes1 samples [bytes] 0 0 0
> write_bytes   4 samples [bytes] 2 7 19
> osc_write 4 samples [bytes] 2 7 19
> # The bytes counts show you minimum, maximum of writes seen and total number 
> of bytes read-written.
> # Lustre (and many other network filesystems) is very sensitive to small IO, 
> esp. reads so it's good
> # to know if you have a lot of it.
> open  6 samples [regs]
> # The "regs" type just shows you how many of given type operations were 
> performed since last statistic reset.
> # Frequently that allows people to guess where does high load come from on a 
> particular client when
> # it's otherwise not obvious because not a lot of cpu is used.
> # Some operations are heavier than others too.
> close 6 samples [regs]
> readdir   4 samples [regs]
> setattr   1 samples [regs]
> truncate  4 samples [regs]
> getattr   7 samples [regs]
> create1 samples [regs]
> alloc_inode   1 samples [regs]
> getxattr  8 samples [regs]
> inode_permission  28 samples [regs]
> 
> As more operations types are seen the list grows.
> Then there are also specific stats for readahead (data and metadata) so that 
> interested people can make informed
> decisions on the tuning there should they be unsatisfied with default 
> settings.
> 
> I am not sure there's a similar mechanism in the kernel already that
> would allow us to get this sort of data easily all in one place?

perf should show you this, if not, please add the functionality there.
A filesystem is not the place to have performance monitoring code, this
needs to be removed before it can be moved out of staging.  Please work
with the trace/perf developers on this if there is something lacking
there.

thanks,

greg k-h
dG

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


Re: [PATCH net-next 0/2] xen-netback: Changes around carrier handling

2014-08-07 Thread David Miller
From: Zoltan Kiss 
Date: Thu, 7 Aug 2014 17:49:37 +0100

> David Vrabel pointed out an important question in a reply to the
> previous version of this series: this patch deschedule NAPI if the
> carrier goes down. The backend doesn't receive packets from the
> guest. DavidVr and others said we shouldn't do this, the guest should
> be able to transmit even if it's not able/willing to receive. Other
> drivers doesn't deschedule NAPI at carrier off as well, however the
> "carrier off" information comes from the hardware, not from an
> untrusted guest who is not posting buffers on the receive ring.
> I don't have any good argument why I did it the current way, other
> than a hunch that it feels more natural.
> David, do you have an opinion on that?

Unless you have a strong reason for doing so, I don't think disabling
receives when the TX path backs up is necessary.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 07/10 v3] coresight-etm: add CoreSight ETM/PTM driver

2014-08-07 Thread Dirk Behme

On 07.08.2014 20:21, mathieu.poir...@linaro.org wrote:

From: Pratik Patel 

This driver manages CoreSight ETM (Embedded Trace Macrocell) that
supports processor tracing. Currently supported version are ARM
ETMv3.x and PTM1.x.

Signed-off-by: Pratik Patel 
Signed-off-by: Panchaxari Prasannamurthy 
Signed-off-by: Mathieu Poirier 
---

...

+static struct amba_id etm_ids[] = {
+   {   /* ETM 3.3 */
+   .id = 0x0003b921,
+   .mask   = 0x0003,
+   },
+   {   /* ETM 3.5 */
+   .id = 0x0003b956,
+   .mask   = 0x0003,
+   },
+   {   /* PTM */
+   .id = 0x0003b95f,
+   .mask   = 0x0003,
+   },
+   { 0, 0},


Maybe you like to add PTM 1.0 [1] here, too?

Best regards

Dirk

[1]

diff --git a/drivers/coresight/coresight-etm.c 
b/drivers/coresight/coresight-etm.c

index 6f5dbc7..a7a08e6 100644
--- a/drivers/coresight/coresight-etm.c
+++ b/drivers/coresight/coresight-etm.c
@@ -1284,6 +1284,8 @@ static bool etm_arch_supported(u8 arch)
break;
case ETM_ARCH_V3_5:
break;
+   case PFT_ARCH_V1_0:
+   break;
case PFT_ARCH_V1_1:
break;
default:
@@ -1418,6 +1420,7 @@ static int etm_probe(struct amba_device *adev, 
const struct amba_id *id)

put_online_cpus();

if (etm_arch_supported(drvdata->arch) == false) {
+   dev_err(dev, "ETM arch 0x%02x not supported\n", drvdata->arch);
ret = -EINVAL;
goto err_arch_supported;
}
@@ -1472,11 +1475,15 @@ static struct amba_id etm_ids[] = {
.id = 0x0003b921,
.mask   = 0x0003,
},
+   {   /* PTM 1.0 */
+   .id = 0x0003b950,
+   .mask   = 0x0003,
+   },
{   /* ETM 3.5 */
.id = 0x0003b956,
.mask   = 0x0003,
},
-   {   /* PTM */
+   {   /* PTM 1.1 */
.id = 0x0003b95f,
.mask   = 0x0003,
},
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index a19420e..596ec94 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -32,6 +32,7 @@

 #define ETM_ARCH_V3_3  (0x23)
 #define ETM_ARCH_V3_5  (0x25)
+#define PFT_ARCH_V1_0  (0x30)
 #define PFT_ARCH_V1_1  (0x31)

 #define CORESIGHT_UNLOCK   (0xC5ACCE55)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 2/2] Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."

2014-08-07 Thread Shengjiu Wang
This reverts commit a603c8ee526f5ea9ad9b40710308766299ad8a69.

fsl_asoc_xlate_tdm_slot_mask() will invert the mask, for esai the enabled bit
is changed to be disabled, So the esai will work abnormally.
when there is no definition of .xlate_tdm_slot_mask, there is default function
snd_soc_xlate_tdm_slot_mask(), which is workable for esai.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/Kconfig|1 -
 sound/soc/fsl/fsl_esai.c |2 --
 2 files changed, 3 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index f54a8fc..f3012b6 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -49,7 +49,6 @@ config SND_SOC_FSL_ESAI
tristate "Enhanced Serial Audio Interface (ESAI) module support"
select REGMAP_MMIO
select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
-   select SND_SOC_FSL_UTILS
help
  Say Y if you want to add Enhanced Synchronous Audio Interface
  (ESAI) support for the Freescale CPUs.
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index f252370..b2f6b3e 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -18,7 +18,6 @@
 
 #include "fsl_esai.h"
 #include "imx-pcm.h"
-#include "fsl_utils.h"
 
 #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000
 #define FSL_ESAI_FORMATS   (SNDRV_PCM_FMTBIT_S8 | \
@@ -612,7 +611,6 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = {
.hw_params = fsl_esai_hw_params,
.set_sysclk = fsl_esai_set_dai_sysclk,
.set_fmt = fsl_esai_set_dai_fmt,
-   .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask,
.set_tdm_slot = fsl_esai_set_dai_tdm_slot,
 };
 
-- 
1.7.9.5

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


[PATCH V3 0/2] refine esai for tdm support

2014-08-07 Thread Shengjiu Wang
These patchs is to refine esai for tdm support.

Changes for V3
- update the comments for patch 2

Changes for V2
- update the comments according the reviewer's suggestion
- add init value for slots and change pin to pins.


Shengjiu Wang (2):
  ASoC: fsl_esai: refine esai for TDM support
  Revert "ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support."

 sound/soc/fsl/Kconfig|1 -
 sound/soc/fsl/fsl_esai.c |   16 +++-
 sound/soc/fsl/fsl_esai.h |8 
 3 files changed, 15 insertions(+), 10 deletions(-)

-- 
1.7.9.5

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


Re: [PATCH] staging/lustre: use rcu_dereference to access rcu protected current->real_parent field

2014-08-07 Thread Oleg Drokin

On Aug 8, 2014, at 12:42 AM, Greg Kroah-Hartman wrote:

> On Fri, Aug 08, 2014 at 12:03:20AM -0400, Oleg Drokin wrote:
>> Hello!
>> 
>> On Aug 7, 2014, at 11:49 PM, Greg Kroah-Hartman wrote:
 
 This is not a critical bug and in the worst case the code here may
 cause miss of statistics counter increase.
 This is why I think it is not worth to backport the patch at all.
>>> You are right, and if this is just for some random "statistics" file,
>>> can we just delete the whole function?
>> 
>> I hope not!
>> This is used all around the client to tally up various operations executed 
>> counts.
> Why would you do that?  Why would they care?

We would do that to provide information on the client operations performed.
They would care because they are interested in what particular clients might be 
doing.

>> The statistic is then used by various userspace monitoring tools.
> Why not use the in-kernel monitoring tools instead of creating your own?
> What does userspace do with that information?

We don't really control the userspace tools. People write tools to suit their 
needs
to monitor loads, see odd things the end users are doing or possibly for some
debugging even.
Correlating these numbers with what server sees also proves useful at times
(write combining for example).

Here's a sample of output of a recently mounted client that I poked on a bit 
(the lines starting with # are my comments):
# cat /proc/fs/lustre/llite/lustre-88008dde27f0/stats
snapshot_time 1407473168.466102 secs.usecs
read_bytes1 samples [bytes] 0 0 0
write_bytes   4 samples [bytes] 2 7 19
osc_write 4 samples [bytes] 2 7 19
# The bytes counts show you minimum, maximum of writes seen and total number of 
bytes read-written.
# Lustre (and many other network filesystems) is very sensitive to small IO, 
esp. reads so it's good
# to know if you have a lot of it.
open  6 samples [regs]
# The "regs" type just shows you how many of given type operations were 
performed since last statistic reset.
# Frequently that allows people to guess where does high load come from on a 
particular client when
# it's otherwise not obvious because not a lot of cpu is used.
# Some operations are heavier than others too.
close 6 samples [regs]
readdir   4 samples [regs]
setattr   1 samples [regs]
truncate  4 samples [regs]
getattr   7 samples [regs]
create1 samples [regs]
alloc_inode   1 samples [regs]
getxattr  8 samples [regs]
inode_permission  28 samples [regs]

As more operations types are seen the list grows.
Then there are also specific stats for readahead (data and metadata) so that 
interested people can make informed
decisions on the tuning there should they be unsatisfied with default settings.

I am not sure there's a similar mechanism in the kernel already that would 
allow us to get this sort of data easily
all in one place?

Bye,
Oleg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v5 3/10] ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate

2014-08-07 Thread Namjae Jeon
This patch implements fallocate's FALLOC_FL_INSERT_RANGE for Ext4.

1) Make sure that both offset and len are block size aligned.
2) Update the i_size of inode by len bytes.
3) Compute the file's logical block number against offset. If the computed
   block number is not the starting block of the extent, split the extent
   such that the block number is the starting block of the extent.
4) Shift all the extents which are lying bewteen [offset, last allocated extent]
   towards right by len bytes. This step will make a hole of len bytes
   at offset.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
Changelog

v5:
 - remove allocation part.

 fs/ext4/ext4.h  |   1 +
 fs/ext4/extents.c   | 322 ++--
 include/trace/events/ext4.h |  25 
 3 files changed, 339 insertions(+), 9 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5b19760..03bd3ec 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2730,6 +2730,7 @@ extern int ext4_fiemap(struct inode *inode, struct 
fiemap_extent_info *fieinfo,
__u64 start, __u64 len);
 extern int ext4_ext_precache(struct inode *inode);
 extern int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len);
+extern int ext4_insert_range(struct file *file, loff_t offset, loff_t len);
 
 /* move_extent.c */
 extern void ext4_double_down_write_data_sem(struct inode *first,
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 76c2df3..a1e0635 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4891,7 +4891,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t 
offset, loff_t len)
 
/* Return error if mode is not supported */
if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
-FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))
+FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
+FALLOC_FL_INSERT_RANGE))
return -EOPNOTSUPP;
 
if (mode & FALLOC_FL_PUNCH_HOLE)
@@ -4914,6 +4915,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t 
offset, loff_t len)
if (mode & FALLOC_FL_ZERO_RANGE)
return ext4_zero_range(file, offset, len, mode);
 
+   if (mode & FALLOC_FL_INSERT_RANGE)
+   return ext4_insert_range(file, offset, len);
+
trace_ext4_fallocate_enter(inode, offset, len, mode);
lblk = offset >> blkbits;
/*
@@ -5216,13 +5220,13 @@ ext4_access_path(handle_t *handle, struct inode *inode,
 }
 
 /*
- * ext4_ext_shift_path_extents:
+ * ext4_ext_shift_path_extents_left:
  * Shift the extents of a path structure lying between path[depth].p_ext
- * and EXT_LAST_EXTENT(path[depth].p_hdr) downwards, by subtracting shift
+ * and EXT_LAST_EXTENT(path[depth].p_hdr) to the left, by subtracting shift
  * from starting block for each extent.
  */
 static int
-ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift,
+ext4_ext_shift_path_extents_left(struct ext4_ext_path *path, ext4_lblk_t shift,
struct inode *inode, handle_t *handle,
ext4_lblk_t *start)
 {
@@ -5292,13 +5296,13 @@ out:
 }
 
 /*
- * ext4_ext_shift_extents:
+ * ext4_ext_shift_extents_left:
  * All the extents which lies in the range from start to the last allocated
- * block for the file are shifted downwards by shift blocks.
+ * block for the file are shifted to the left by shift blocks.
  * On success, 0 is returned, error otherwise.
  */
 static int
-ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
+ext4_ext_shift_extents_left(struct inode *inode, handle_t *handle,
   ext4_lblk_t start, ext4_lblk_t shift)
 {
struct ext4_ext_path *path;
@@ -5378,7 +5382,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t 
*handle,
break;
}
}
-   ret = ext4_ext_shift_path_extents(path, shift, inode,
+   ret = ext4_ext_shift_path_extents_left(path, shift, inode,
handle, &start);
ext4_ext_drop_refs(path);
kfree(path);
@@ -5483,7 +5487,7 @@ int ext4_collapse_range(struct inode *inode, loff_t 
offset, loff_t len)
}
ext4_discard_preallocations(inode);
 
-   ret = ext4_ext_shift_extents(inode, handle, punch_stop,
+   ret = ext4_ext_shift_extents_left(inode, handle, punch_stop,
 punch_stop - punch_start);
if (ret) {
up_write(&EXT4_I(inode)->i_data_sem);
@@ -5508,3 +5512,303 @@ out_mutex:
mutex_unlock(&inode->i_mutex);
return ret;
 }
+
+/*
+ * ext4_ext_shift_path_extents_right:
+ * Shift the extents of a path structure towards right, by adding shift_lblk
+ * to the starting ee_block of each extent. Shifting is done from
+ * the last extent in the path till we reach first extent OR hit

[PATCH v5 5/10] xfstests: generic/029: Standard insert range tests

2014-08-07 Thread Namjae Jeon
This testcase(029) tries to test various corner cases for finsert range
functionality over different type of extents.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 common/punch  |  5 
 common/rc |  2 +-
 tests/generic/029 | 65 ++
 tests/generic/029.out | 78 +++
 tests/generic/group   |  1 +
 5 files changed, 150 insertions(+), 1 deletion(-)
 create mode 100644 tests/generic/029
 create mode 100644 tests/generic/029.out

diff --git a/common/punch b/common/punch
index f2d538c..4cc50d5 100644
--- a/common/punch
+++ b/common/punch
@@ -527,6 +527,11 @@ _test_generic_punch()
return
fi
 
+   # If zero_cmd is finsert, don't check unaligned offsets
+   if [ "$zero_cmd" == "finsert" ]; then
+   return
+   fi
+
echo "  16. data -> cache cold ->hole"
if [ "$remove_testfile" ]; then
rm -f $testfile
diff --git a/common/rc b/common/rc
index 2c83340..6d805cf 100644
--- a/common/rc
+++ b/common/rc
@@ -1272,7 +1272,7 @@ _require_xfs_io_command()
"falloc" )
testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
;;
-   "fpunch" | "fcollapse" | "zero" | "fzero" )
+   "fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" )
testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
-c "$command 4k 8k" $testfile 2>&1`
;;
diff --git a/tests/generic/029 b/tests/generic/029
new file mode 100644
index 000..2b18069
--- /dev/null
+++ b/tests/generic/029
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. generic/029
+#
+# Standard insert range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for finsert range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#---
+# Copyright (c) 2013 Samsung Electronics.  All Rights Reserved.
+#
+# 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.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#---
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1   # failure is the default!
+
+_cleanup()
+{
+rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "finsert"
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch falloc fpunch finsert fiemap _filter_hole_fiemap $testfile
+_check_test_fs
+
+status=0
+exit
diff --git a/tests/generic/029.out b/tests/generic/029.out
new file mode 100644
index 000..572fa45
--- /dev/null
+++ b/tests/generic/029.out
@@ -0,0 +1,78 @@
+QA output created by 029
+   1. into a hole
+cf845a781c107ec1346e849c9dd1b7e8
+   2. into allocated space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+64e72217eebcbdf31b1b058f9f5f476a
+   3. into unwritten space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+cf845a781c107ec1346e849c9dd1b7e8
+   4. hole -> data
+0: [0..31]: hole
+1: [32..47]: extent
+2: [48..55]: hole
+adb08a6d94a3b5eff90fdfebb2366d31
+   5. hole -> unwritten
+0: [0..31]: hole
+1: [32..47]: extent
+2: [48..55]: hole
+cf845a781c107ec1346e849c9dd1b7e8
+   6. data -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..55]: hole
+be0f35d4292a20040766d87883b0abd1
+   7. data -> unwritten
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+be0f35d4292a20040766d87883b0abd1
+   8. unwritten -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..55]: hole
+cf845a781c107ec1346e849c9dd1b7e8
+   9. unwritten -> data
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+adb08a6d94a3b5eff90fdfebb2366d31
+   10. hole -> data -> h

[PATCH v5 9/10] xfstests: fsstress: Add fallocate insert range

2014-08-07 Thread Namjae Jeon
This commit adds insert operation support for fsstress, which is
meant to exercise fallocate FALLOC_FL_INSERT_RANGE support.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 ltp/fsstress.c | 19 ---
 src/global.h   |  4 
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index b56fe5c..aa3e0c3 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -72,6 +72,7 @@ typedef enum {
OP_PUNCH,
OP_ZERO,
OP_COLLAPSE,
+   OP_INSERT,
OP_READ,
OP_READLINK,
OP_RENAME,
@@ -170,6 +171,7 @@ voidmknod_f(int, long);
 void   punch_f(int, long);
 void   zero_f(int, long);
 void   collapse_f(int, long);
+void   insert_f(int, long);
 void   read_f(int, long);
 void   readlink_f(int, long);
 void   rename_f(int, long);
@@ -209,6 +211,7 @@ opdesc_tops[] = {
{ OP_PUNCH, "punch", punch_f, 1, 1 },
{ OP_ZERO, "zero", zero_f, 1, 1 },
{ OP_COLLAPSE, "collapse", collapse_f, 1, 1 },
+   { OP_INSERT, "insert", insert_f, 1, 1 },
{ OP_READ, "read", read_f, 1, 0 },
{ OP_READLINK, "readlink", readlink_f, 1, 0 },
{ OP_RENAME, "rename", rename_f, 2, 1 },
@@ -2176,6 +2179,7 @@ struct print_flags falloc_flags [] = {
{ FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"},
{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
+   { FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
{ -1, NULL}
 };
 
@@ -2227,10 +2231,11 @@ do_fallocate(int opno, long r, int mode)
off %= maxfsize;
len = (off64_t)(random() % (1024 * 1024));
/*
-* Collapse range requires off and len to be block aligned, make it
-* more likely to be the case.
+* Collapse/insert range requires off and len to be block aligned,
+* make it more likely to be the case.
 */
-   if ((mode & FALLOC_FL_COLLAPSE_RANGE) && (opno % 2)) {
+   if ((mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)) &&
+   (opno % 2)) {
off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1));
}
@@ -2656,6 +2661,14 @@ collapse_f(int opno, long r)
 }
 
 void
+insert_f(int opno, long r)
+{
+#ifdef HAVE_LINUX_FALLOC_H
+   do_fallocate(opno, r, FALLOC_FL_INSERT_RANGE);
+#endif
+}
+
+void
 read_f(int opno, long r)
 {
char*buf;
diff --git a/src/global.h b/src/global.h
index 8180f66..f63246b 100644
--- a/src/global.h
+++ b/src/global.h
@@ -172,6 +172,10 @@
 #define FALLOC_FL_ZERO_RANGE   0x10
 #endif
 
+#ifndef FALLOC_FL_INSERT_RANGE
+#define FALLOC_FL_INSERT_RANGE 0x20
+#endif
+
 #endif /* HAVE_LINUX_FALLOC_H */
 
 #endif /* GLOBAL_H */
-- 
1.7.11-rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v5 7/10] xfstests: generic/031: Multi insert range tests

2014-08-07 Thread Namjae Jeon
This testcase(031) tries to test various corner cases with pre-existing holes
for finsert range functionality over different type of extents.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 tests/generic/031 | 65 +
 tests/generic/031.out | 80 +++
 tests/generic/group   |  1 +
 3 files changed, 146 insertions(+)
 create mode 100644 tests/generic/031
 create mode 100644 tests/generic/031.out

diff --git a/tests/generic/031 b/tests/generic/031
new file mode 100644
index 000..0e18f87
--- /dev/null
+++ b/tests/generic/031
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. generic/031
+#
+# Multi insert range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for finsert range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#---
+# Copyright (c) 2013 Samsung Electronics.  All Rights Reserved.
+#
+# 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.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#---
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1   # failure is the default!
+
+_cleanup()
+{
+rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "finsert"
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch -k falloc fpunch finsert fiemap _filter_hole_fiemap 
$testfile
+_check_test_fs
+
+status=0
+exit
diff --git a/tests/generic/031.out b/tests/generic/031.out
new file mode 100644
index 000..ae45352
--- /dev/null
+++ b/tests/generic/031.out
@@ -0,0 +1,80 @@
+QA output created by 031
+   1. into a hole
+cf845a781c107ec1346e849c9dd1b7e8
+   2. into allocated space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+64e72217eebcbdf31b1b058f9f5f476a
+   3. into unwritten space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+22b7303d274481990b5401b6263effe0
+   4. hole -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..55]: extent
+c4fef62ba1de9d91a977cfeec6632f19
+   5. hole -> unwritten
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..55]: extent
+1ca74f7572a0f4ab477fdbb5682e5f61
+   6. data -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..47]: hole
+4: [48..55]: extent
+be0f35d4292a20040766d87883b0abd1
+   7. data -> unwritten
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+bddb1f3895268acce30d516a99cb0f2f
+   8. unwritten -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..39]: hole
+4: [40..55]: extent
+f8fc47adc45b7cf72f988b3ddf5bff64
+   9. unwritten -> data
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+c4fef62ba1de9d91a977cfeec6632f19
+   10. hole -> data -> hole
+0: [0..7]: extent
+1: [8..39]: hole
+2: [40..63]: extent
+52af1bfcbf43f28af2328de32e0567e5
+   11. data -> hole -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..39]: extent
+3: [40..47]: hole
+4: [48..63]: extent
+e3a8d52acc4d91a8ed19d7b6f4f26a71
+   12. unwritten -> data -> unwritten
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..63]: extent
+52af1bfcbf43f28af2328de32e0567e5
+   13. data -> unwritten -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..63]: extent
+2b22165f4a24a2c36fd05ef00b41df88
+   14. data -> hole @ EOF
+0: [0..23]: extent
+1: [24..39]: hole
+2: [40..55]: extent
+aa0f20d1edcdbce60d8ef82700ba30c3
+   15. data -> hole @ 0
+0: [0..15]: hole
+1: [16..55]: extent
+86c9d033be2761385c9cfa203c426bb2
diff --git a/tests/generic/group b/tests/generic/group
index b847c47..544d422 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -33,6 +33,7 @@
 028 auto quick
 029 auto quick prealloc
 030 auto quick prealloc
+031 auto quick prea

[PATCH v5 4/10] xfsprogs: xfs_io: add finsert command for insert range via fallocate

2014-08-07 Thread Namjae Jeon
Add finsert command for fallocate FALLOC_FL_INSERT_RANGE flag.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 io/prealloc.c | 39 ++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/io/prealloc.c b/io/prealloc.c
index aba6b44..11b1e12 100644
--- a/io/prealloc.c
+++ b/io/prealloc.c
@@ -37,6 +37,10 @@
 #define FALLOC_FL_ZERO_RANGE 0x10
 #endif
 
+#ifndef FALLOC_FL_INSERT_RANGE
+#define FALLOC_FL_INSERT_RANGE 0x20
+#endif
+
 static cmdinfo_t allocsp_cmd;
 static cmdinfo_t freesp_cmd;
 static cmdinfo_t resvsp_cmd;
@@ -46,6 +50,7 @@ static cmdinfo_t zero_cmd;
 static cmdinfo_t falloc_cmd;
 static cmdinfo_t fpunch_cmd;
 static cmdinfo_t fcollapse_cmd;
+static cmdinfo_t finsert_cmd;
 static cmdinfo_t fzero_cmd;
 #endif
 
@@ -169,11 +174,14 @@ fallocate_f(
int mode = 0;
int c;
 
-   while ((c = getopt(argc, argv, "ckp")) != EOF) {
+   while ((c = getopt(argc, argv, "cikp")) != EOF) {
switch (c) {
case 'c':
mode = FALLOC_FL_COLLAPSE_RANGE;
break;
+   case 'i':
+   mode = FALLOC_FL_INSERT_RANGE;
+   break;
case 'k':
mode = FALLOC_FL_KEEP_SIZE;
break;
@@ -237,6 +245,25 @@ fcollapse_f(
 }
 
 static int
+finsert_f(
+   int argc,
+   char**argv)
+{
+   xfs_flock64_t   segment;
+   int mode = FALLOC_FL_INSERT_RANGE;
+
+   if (!offset_length(argv[1], argv[2], &segment))
+   return 0;
+
+   if (fallocate(file->fd, mode,
+   segment.l_start, segment.l_len)) {
+   perror("fallocate");
+   return 0;
+   }
+   return 0;
+}
+
+static int
 fzero_f(
int argc,
char**argv)
@@ -345,6 +372,16 @@ prealloc_init(void)
_("de-allocates space and eliminates the hole by shifting extents");
add_command(&fcollapse_cmd);
 
+   finsert_cmd.name = "finsert";
+   finsert_cmd.cfunc = finsert_f;
+   finsert_cmd.argmin = 2;
+   finsert_cmd.argmax = 2;
+   finsert_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
+   finsert_cmd.args = _("off len");
+   finsert_cmd.oneline =
+   _("creates new space for writing within file by shifting extents");
+   add_command(&finsert_cmd);
+
fzero_cmd.name = "fzero";
fzero_cmd.cfunc = fzero_f;
fzero_cmd.argmin = 2;
-- 
1.7.11-rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v5 10/10] xfstests: fsx: Add fallocate insert range operation

2014-08-07 Thread Namjae Jeon
This commit adds fallocate FALLOC_FL_INSERT_RANGE support for fsx.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 ltp/fsx.c | 96 +--
 1 file changed, 94 insertions(+), 2 deletions(-)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 47d3ee8..9dc1655 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -95,7 +95,8 @@ int   logcount = 0;   /* total ops */
 #define OP_PUNCH_HOLE  6
 #define OP_ZERO_RANGE  7
 #define OP_COLLAPSE_RANGE  8
-#define OP_MAX_FULL9
+#define OP_INSERT_RANGE9
+#define OP_MAX_FULL10
 
 /* operation modifiers */
 #define OP_CLOSEOPEN   100
@@ -145,6 +146,7 @@ int fallocate_calls = 1;/* -F flag disables 
*/
 int punch_hole_calls = 1;   /* -H flag disables */
 int zero_range_calls = 1;   /* -z flag disables */
 intcollapse_range_calls = 1;   /* -C flag disables */
+intinsert_range_calls = 1; /* -i flag disables */
 intmapped_reads = 1;   /* -R flag disables it */
 intfsxgoodfd = 0;
 into_direct;   /* -Z */
@@ -339,6 +341,14 @@ logdump(void)
 lp->args[0] + lp->args[1])
prt("\t**");
break;
+   case OP_INSERT_RANGE:
+   prt("INSERT 0x%x thru 0x%x\t(0x%x bytes)",
+   lp->args[0], lp->args[0] + lp->args[1] - 1,
+   lp->args[1]);
+   if (badoff >= lp->args[0] && badoff <
+lp->args[0] + lp->args[1])
+   prt("\t**");
+   break;
case OP_SKIPPED:
prt("SKIPPED (no operation)");
break;
@@ -1012,6 +1022,59 @@ do_collapse_range(unsigned offset, unsigned length)
 }
 #endif
 
+#ifdef FALLOC_FL_INSERT_RANGE
+void
+do_insert_range(unsigned offset, unsigned length)
+{
+   unsigned end_offset;
+   int mode = FALLOC_FL_INSERT_RANGE;
+
+   if (length == 0) {
+   if (!quiet && testcalls > simulatedopcount)
+   prt("skipping zero length insert range\n");
+   log4(OP_SKIPPED, OP_INSERT_RANGE, offset, length);
+   return;
+   }
+
+   if ((loff_t)offset >= file_size) {
+   if (!quiet && testcalls > simulatedopcount)
+   prt("skipping insert range behind EOF\n");
+   log4(OP_SKIPPED, OP_INSERT_RANGE, offset, length);
+   return;
+   }
+
+   log4(OP_INSERT_RANGE, offset, length, 0);
+
+   if (testcalls <= simulatedopcount)
+   return;
+
+   end_offset = offset + length;
+   if ((progressinterval && testcalls % progressinterval == 0) ||
+   (debug && (monitorstart == -1 || monitorend == -1 ||
+ end_offset <= monitorend))) {
+   prt("%lu insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
+   offset, offset+length, length);
+   }
+   if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
+   prt("insert range: %x to %x\n", offset, length);
+   prterr("do_insert_range: fallocate");
+   report_failure(161);
+   }
+
+   memmove(good_buf + end_offset, good_buf + offset,
+   file_size - offset);
+   memset(good_buf + offset, '\0', length);
+   file_size += length;
+}
+
+#else
+void
+do_insert_range(unsigned offset, unsigned length)
+{
+   return;
+}
+#endif
+
 #ifdef HAVE_LINUX_FALLOC_H
 /* fallocate is basically a no-op unless extending, then a lot like a truncate 
*/
 void
@@ -1192,6 +1255,12 @@ test(void)
goto out;
}
break;
+   case OP_INSERT_RANGE:
+   if (!insert_range_calls) {
+   log4(OP_SKIPPED, OP_INSERT_RANGE, offset, size);
+   goto out;
+   }
+   break;
}
 
switch (op) {
@@ -1244,6 +1313,21 @@ test(void)
}
do_collapse_range(offset, size);
break;
+   case OP_INSERT_RANGE:
+   TRIM_OFF_LEN(offset, size, (maxfilelen - 1) - file_size);
+   offset = offset & ~(block_size - 1);
+   size = size & ~(block_size - 1);
+   if (size == 0) {
+   log4(OP_SKIPPED, OP_INSERT_RANGE, offset, size);
+   goto out;
+   }
+   if (file_size + size > maxfilelen) {
+   log4(OP_SKIPPED, OP_INSERT_RANGE, offset, size);
+   goto out;
+   }
+
+   do_insert_range(offset, size);
+   break;
default:
prterr("test: unknown 

[PATCH v5 8/10] xfstests: generic/032: Delayed allocation multi insert

2014-08-07 Thread Namjae Jeon
This testcase(032) tries to test various corner cases with delayed extents and
pre-existing holes for finsert range functionality over different type of
extents.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 tests/generic/032 | 65 +
 tests/generic/032.out | 80 +++
 tests/generic/group   |  1 +
 3 files changed, 146 insertions(+)
 create mode 100644 tests/generic/032
 create mode 100644 tests/generic/032.out

diff --git a/tests/generic/032 b/tests/generic/032
new file mode 100644
index 000..32798f3
--- /dev/null
+++ b/tests/generic/032
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. generic/032
+#
+# Delayed allocation multi insert range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for finsert range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#---
+# Copyright (c) 2013 Samsung Electronics.  All Rights Reserved.
+#
+# 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.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#---
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1   # failure is the default!
+
+_cleanup()
+{
+rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "finsert"
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch -d -k falloc fpunch finsert fiemap _filter_hole_fiemap 
$testfile
+_check_test_fs
+
+status=0
+exit
diff --git a/tests/generic/032.out b/tests/generic/032.out
new file mode 100644
index 000..6d7acfd
--- /dev/null
+++ b/tests/generic/032.out
@@ -0,0 +1,80 @@
+QA output created by 032
+   1. into a hole
+cf845a781c107ec1346e849c9dd1b7e8
+   2. into allocated space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+64e72217eebcbdf31b1b058f9f5f476a
+   3. into unwritten space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+22b7303d274481990b5401b6263effe0
+   4. hole -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..55]: extent
+c4fef62ba1de9d91a977cfeec6632f19
+   5. hole -> unwritten
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..55]: extent
+1ca74f7572a0f4ab477fdbb5682e5f61
+   6. data -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..47]: hole
+4: [48..55]: extent
+be0f35d4292a20040766d87883b0abd1
+   7. data -> unwritten
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+bddb1f3895268acce30d516a99cb0f2f
+   8. unwritten -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..39]: hole
+4: [40..55]: extent
+f8fc47adc45b7cf72f988b3ddf5bff64
+   9. unwritten -> data
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+c4fef62ba1de9d91a977cfeec6632f19
+   10. hole -> data -> hole
+0: [0..7]: extent
+1: [8..39]: hole
+2: [40..63]: extent
+52af1bfcbf43f28af2328de32e0567e5
+   11. data -> hole -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..39]: extent
+3: [40..47]: hole
+4: [48..63]: extent
+e3a8d52acc4d91a8ed19d7b6f4f26a71
+   12. unwritten -> data -> unwritten
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..63]: extent
+52af1bfcbf43f28af2328de32e0567e5
+   13. data -> unwritten -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..63]: extent
+2b22165f4a24a2c36fd05ef00b41df88
+   14. data -> hole @ EOF
+0: [0..23]: extent
+1: [24..39]: hole
+2: [40..55]: extent
+aa0f20d1edcdbce60d8ef82700ba30c3
+   15. data -> hole @ 0
+0: [0..15]: hole
+1: [16..55]: extent
+86c9d033be2761385c9cfa203c426bb2
diff --git a/tests/generic/group b/tests/generic/group
index 544d422..01d719b 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -34,6 +34,7 @@
 029 auto quick prealloc
 030 auto quick pre

[PATCH v5 6/10] xfstests: generic/030: Delayed allocation insert range

2014-08-07 Thread Namjae Jeon
This testcase(030) tries to test various corner cases with delayed extents
for finsert range functionality over different type of extents.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 tests/generic/030 | 65 ++
 tests/generic/030.out | 78 +++
 tests/generic/group   |  1 +
 3 files changed, 144 insertions(+)
 create mode 100644 tests/generic/030
 create mode 100644 tests/generic/030.out

diff --git a/tests/generic/030 b/tests/generic/030
new file mode 100644
index 000..7cbfa88
--- /dev/null
+++ b/tests/generic/030
@@ -0,0 +1,65 @@
+#! /bin/bash
+# FS QA Test No. generic/030
+#
+# Delayed allocation insert range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for finsert range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#---
+# Copyright (c) 2013 Samsung Electronics.  All Rights Reserved.
+#
+# 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.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#---
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1   # failure is the default!
+
+_cleanup()
+{
+rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_command "fpunch"
+_require_xfs_io_command "falloc"
+_require_xfs_io_command "fiemap"
+_require_xfs_io_command "finsert"
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch -d falloc fpunch finsert fiemap _filter_hole_fiemap 
$testfile
+_check_test_fs
+
+status=0
+exit
diff --git a/tests/generic/030.out b/tests/generic/030.out
new file mode 100644
index 000..5812622
--- /dev/null
+++ b/tests/generic/030.out
@@ -0,0 +1,78 @@
+QA output created by 030
+   1. into a hole
+cf845a781c107ec1346e849c9dd1b7e8
+   2. into allocated space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+64e72217eebcbdf31b1b058f9f5f476a
+   3. into unwritten space
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..55]: extent
+cf845a781c107ec1346e849c9dd1b7e8
+   4. hole -> data
+0: [0..31]: hole
+1: [32..47]: extent
+2: [48..55]: hole
+adb08a6d94a3b5eff90fdfebb2366d31
+   5. hole -> unwritten
+0: [0..31]: hole
+1: [32..47]: extent
+2: [48..55]: hole
+cf845a781c107ec1346e849c9dd1b7e8
+   6. data -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..55]: hole
+be0f35d4292a20040766d87883b0abd1
+   7. data -> unwritten
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+be0f35d4292a20040766d87883b0abd1
+   8. unwritten -> hole
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..31]: extent
+3: [32..55]: hole
+cf845a781c107ec1346e849c9dd1b7e8
+   9. unwritten -> data
+0: [0..7]: extent
+1: [8..23]: hole
+2: [24..47]: extent
+3: [48..55]: hole
+adb08a6d94a3b5eff90fdfebb2366d31
+   10. hole -> data -> hole
+0: [0..39]: hole
+1: [40..47]: extent
+2: [48..63]: hole
+0487b3c52810f994c541aa166215375f
+   11. data -> hole -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..39]: extent
+3: [40..47]: hole
+4: [48..63]: extent
+e3a8d52acc4d91a8ed19d7b6f4f26a71
+   12. unwritten -> data -> unwritten
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..63]: extent
+0487b3c52810f994c541aa166215375f
+   13. data -> unwritten -> data
+0: [0..7]: extent
+1: [8..31]: hole
+2: [32..63]: extent
+2b22165f4a24a2c36fd05ef00b41df88
+   14. data -> hole @ EOF
+0: [0..23]: extent
+1: [24..39]: hole
+2: [40..55]: extent
+aa0f20d1edcdbce60d8ef82700ba30c3
+   15. data -> hole @ 0
+0: [0..15]: hole
+1: [16..55]: extent
+86c9d033be2761385c9cfa203c426bb2
diff --git a/tests/generic/group b/tests/generic/group
index b1dc921..b847c47 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -32,6 +32,7 @@
 027 auto enospc
 028 auto quick
 029 auto quick prealloc
+030 auto quick prealloc
 053 acl repair auto quick
 062 at

[PATCH v5 2/10] xfs: Add support FALLOC_FL_INSERT_RANGE for fallocate

2014-08-07 Thread Namjae Jeon
This patch implements fallocate's FALLOC_FL_INSERT_RANGE for XFS.

1) Make sure that both offset and len are block size aligned.
2) Update the i_size of inode by len bytes.
3) Compute the file's logical block number against offset. If the computed
   block number is not the starting block of the extent, split the extent
   such that the block number is the starting block of the extent.
4) Shift all the extents which are lying bewteen [offset, last allocated extent]
   towards right by len bytes. This step will make a hole of len bytes
   at offset.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
Reviewed-by: Brian Foster 
---
Changelog

v5:
 - remove allocation part.

v4:
 - set cur->bc_private.b.allocated to zero before calling xfs_btree_del_cursor.

v3:
 - remove XFS_TRANS_RESERVE and assert.
 - update the comment of blockcount calculation.
 - use 'if(blockcount)' instead of 'if (got.br_blockcount < blockcount)'.
 - move insert_file_space() calling under xfs_setattr_size to avoid code 
duplicate.

v2:
 - remove reserved enable.
 - add xfs_qm_dqattach.
 - reset blockcount in xfs_bmap_shift_extents_right.
 - update i_size to avoid data loss before insert_file_space() is called.
 - use in-memory extent array size that delayed allocation extents

 fs/xfs/libxfs/xfs_bmap.c | 379 ++-
 fs/xfs/libxfs/xfs_bmap.h |   9 +-
 fs/xfs/xfs_bmap_util.c   | 123 ++-
 fs/xfs/xfs_bmap_util.h   |   2 +
 fs/xfs/xfs_file.c|  38 -
 fs/xfs/xfs_trace.h   |   1 +
 6 files changed, 547 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index de2d26d..62f5aa7 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5413,7 +5413,7 @@ error0:
  * into, this will be considered invalid operation and we abort immediately.
  */
 int
-xfs_bmap_shift_extents(
+xfs_bmap_shift_extents_left(
struct xfs_trans*tp,
struct xfs_inode*ip,
int *done,
@@ -5443,7 +5443,7 @@ xfs_bmap_shift_extents(
(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
 mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
-   XFS_ERROR_REPORT("xfs_bmap_shift_extents",
+   XFS_ERROR_REPORT("xfs_bmap_shift_extents_left",
 XFS_ERRLEVEL_LOW, mp);
return -EFSCORRUPTED;
}
@@ -5600,3 +5600,378 @@ del_cursor:
xfs_trans_log_inode(tp, ip, logflags);
return error;
 }
+
+/*
+ * Splits an extent into two extents at split_fsb block that it is
+ * the first block of the current_ext. @current_ext is a target extent
+ * to be splitted. @split_fsb is a block where the extents is spliited.
+ * If split_fsb lies in a hole or the first block of extents, just return 0.
+ */
+STATIC int
+xfs_bmap_split_extent_at(
+   struct xfs_trans*tp,
+   struct xfs_inode*ip,
+   xfs_fileoff_t   split_fsb,
+   xfs_extnum_t*current_ext,
+   xfs_fsblock_t   *firstfsb,
+   struct xfs_bmap_free*free_list)
+{
+   int whichfork = XFS_DATA_FORK;
+   struct xfs_btree_cur*cur;
+   struct xfs_bmbt_rec_host*gotp;
+   struct xfs_bmbt_irecgot;
+   struct xfs_bmbt_irecnew; /* splitted extent */
+   struct xfs_mount*mp = ip->i_mount;
+   struct xfs_ifork*ifp;
+   xfs_fsblock_t   gotblkcnt; /* new block count for got */
+   int error = 0;
+   int logflags;
+   int i = 0;
+
+   if (unlikely(XFS_TEST_ERROR(
+   (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
+XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
+mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
+   XFS_ERROR_REPORT("xfs_bmap_split_extent_at",
+XFS_ERRLEVEL_LOW, mp);
+   return -EFSCORRUPTED;
+   }
+
+   if (XFS_FORCED_SHUTDOWN(mp))
+   return -EIO;
+
+   ASSERT(current_ext != NULL);
+
+   ifp = XFS_IFORK_PTR(ip, whichfork);
+   if (!(ifp->if_flags & XFS_IFEXTENTS)) {
+   /* Read in all the extents */
+   error = xfs_iread_extents(tp, ip, whichfork);
+   if (error)
+   return error;
+   }
+
+   gotp = xfs_iext_bno_to_ext(ifp, split_fsb, current_ext);
+   /*
+* gotp can be null in 2 cases: 1) if there are no extents
+* or 2) split_fsb lies in a hole beyond which there are
+* no extents. Either way, we are done.
+*/
+   if (!gotp)
+   return 0;
+
+   xfs_bmbt_get_all(gotp, &got);
+
+  

[PATCH v5 0/10] fs: Introduce FALLOC_FL_INSERT_RANGE for fallocate

2014-08-07 Thread Namjae Jeon
In continuation of the work of making the process of non linear editing of
media files faster, we introduce here the new flag FALLOC_FL_INSERT_RANGE
for fallocate.

This flag will work opposite to the FALLOC_FL_COLLAPSE_RANGE flag.
As such, specifying FALLOC_FL_INSERT_RANGE flag will create new space inside 
file
by inserting a hole within the range specified by offset and len. 
User can write new data in this space. e.g. ads.
Like collapse range, currently we have the limitation that offset and len should
be block size aligned for both XFS and Ext4.

The semantics of the flag are :
1) It creates space within file by inserting a hole of  len bytes starting
   at offset byte without overwriting any existing data. All the data blocks
   from offset to EOF are shifted towards right to make hole space.
2) It should be used exclusively. No other fallocate flag in combination.
3) Offset and length supplied to fallocate should be fs block size aligned
   in case of xfs and ext4.
4) Insert range does not work for the case when offset is overlapping/beyond
   i_size. If the user wants to insert space at the end of file they are
   advised to use either ftruncate(2) or fallocate(2) with mode 0.
5) It increses the size of file by len bytes.


Namjae Jeon (10):
 fs: Add support FALLOC_FL_INSERT_RANGE for fallocate
 xfs: Add support FALLOC_FL_INSERT_RANGE for fallocate
 ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate
 xfsprogs: xfs_io: add finsert command for insert range via fallocate
 xfstests: generic/029: Standard insert range tests
 xfstests: generic/030: Delayed allocation insert range
 xfstests: generic/031: Multi insert range tests
 xfstests: generic/032: Delayed allocation multi insert
 xfstests: fsstress: Add fallocate insert range operation
 xfstests: fsx: Add fallocate insert range operation

-- 
1.7.11-rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v5 1/10] fs: Add support FALLOC_FL_INSERT_RANGE for fallocate

2014-08-07 Thread Namjae Jeon
FALLOC_FL_INSERT_RANGE command is the opposite command of
FALLOC_FL_COLLAPSE_RANGE that is needed for advertisers or someone who want to
add some data in the middle of file. FALLOC_FL_INSERT_RANGE will create space
for writing new data within a file after shifting extents to right as given
length. and this command also has same limitation as FALLOC_FL_COLLAPSE_RANGE,
that is block boundary and use ftruncate(2) for crosses EOF.

Signed-off-by: Namjae Jeon 
Signed-off-by: Ashish Sangwan 
---
 fs/open.c   |  8 +++-
 include/uapi/linux/falloc.h | 15 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/fs/open.c b/fs/open.c
index 36662d0..74ed498 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -232,7 +232,8 @@ int do_fallocate(struct file *file, int mode, loff_t 
offset, loff_t len)
 
/* Return error if mode is not supported */
if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
-FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE))
+FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
+FALLOC_FL_INSERT_RANGE))
return -EOPNOTSUPP;
 
/* Punch hole and zero range are mutually exclusive */
@@ -250,6 +251,11 @@ int do_fallocate(struct file *file, int mode, loff_t 
offset, loff_t len)
(mode & ~FALLOC_FL_COLLAPSE_RANGE))
return -EINVAL;
 
+   /* Insert range should only be used exclusively. */
+   if ((mode & FALLOC_FL_INSERT_RANGE) &&
+   (mode & ~FALLOC_FL_INSERT_RANGE))
+   return -EINVAL;
+
if (!(file->f_mode & FMODE_WRITE))
return -EBADF;
 
diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
index d1197ae..1f20723 100644
--- a/include/uapi/linux/falloc.h
+++ b/include/uapi/linux/falloc.h
@@ -41,4 +41,19 @@
  */
 #define FALLOC_FL_ZERO_RANGE   0x10
 
+/*
+ * FALLOC_FL_INSERT_RANGE is use to insert space within the file size without
+ * overwriting any existing data. The contents of the file beyond offset are
+ * shifted towards right by len bytes to create a hole.  As such, this
+ * operation will increase the size of the file by len bytes.
+ * Different filesystems may implement different limitations on the granularity
+ * of the operation. Most will limit operations to filesystem block size
+ * boundaries, but this boundary may be larger or smaller depending on
+ * the filesystem and/or the configuration of the filesystem or file.
+ * Attempting to insert space using this flag at OR beyond the end of
+ * the file is considered an illegal operation - just use ftruncate(2) or
+ * fallocate(2) with mode 0 for such type of operations.
+ */
+#define FALLOC_FL_INSERT_RANGE 0x20
+
 #endif /* _UAPI_FALLOC_H_ */
-- 
1.7.11-rc0

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


Re: [PATCH 3/4] block: fix error return code

2014-08-07 Thread Julia Lawall


On Thu, 7 Aug 2014, Jeff Moyer wrote:

> Julia Lawall  writes:
> 
> > diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> > index a8de2ee..fa8077a 100644
> > --- a/drivers/block/rsxx/core.c
> > +++ b/drivers/block/rsxx/core.c
> > @@ -942,6 +942,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
> > card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event");
> > if (!card->event_wq) {
> > dev_err(CARD_TO_DEV(card), "Failed card event setup.\n");
> > +   st = -ENOMEM;
> > goto failed_event_handler;
> > }
> 
> Reviewed-by: Jeff Moyer 
> 
> BTW, just above this there is questionable code:
> 
> st = rsxx_get_num_targets(card, &card->n_targets);
> if (st)
> dev_info(CARD_TO_DEV(card),
> "Failed reading the number of DMA targets\n");
> 
> card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), 
> GFP_KERNEL);
> if (!card->ctrl) {
> st = -ENOMEM;
> goto failed_dma_setup;
> }
> 
> From my reading of the kzalloc code, ZERO_SIZE_PTR (which is 16 cast to
> a void *) would be returned from that kzalloc call if the
> rsxx_get_num_targets call failed (since you'd be kzalloc-ing 0 bytes).
> That would lead to the !card->ctrl check not working, right?
> 
> I'd suggest not continuing after rsxx_get_num_targets fails.

Good point.  I'll fix it up.

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


kernel in spinlock or deschduled : packet loss during 1 Mpps transfer

2014-08-07 Thread anshul makkar
Hi,

I am transferring 1 Million packets from send process to receive
process. Both are running in separate cores. I am using Using DMA
transfer from usermode to the ethernet card.

After transfer I can see 700 - 800 packets loss per transaction.

I doubt that during the transfer kernel may be entering some spinlocks
or descheduling the receiver processor for long enough.

Please can you share how can I debug this case. Please share as to
what approach I can take to detect that. The time involved in the
tranfer is very less around 1 Million packets per second and in that
second packet loss is happening.

Thanks
Anshul Makkar
www.justkernel.com
http://www.linkedin.com/groups/Just-Kernel-3033180
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: fault injection caused oops in proc_flush_task

2014-08-07 Thread Eric W. Biederman
Dave Jones  writes:

> Because I don't have enough oopses in my life, I decided to play
> with the fault injection code today. It's not something I hear about
> people trying too often, so I wondered what horrors lurk..
>
> So I ran this..
>
> #!/bin/bash
>
> for FAILTYPE in failslab fail_page_alloc
> do
>  echo N > /sys/kernel/debug/$FAILTYPE/task-filter
>  echo 50 > /sys/kernel/debug/$FAILTYPE/probability
>  echo 500 > /sys/kernel/debug/$FAILTYPE/interval
>  echo -1 > /sys/kernel/debug/$FAILTYPE/times
>  echo 0 > /sys/kernel/debug/$FAILTYPE/space
>  echo 0 > /sys/kernel/debug/$FAILTYPE/verbose
>  echo 2 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait
> done
>
> And then ran my usual fuzzing session, and saw this ..
>
> Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
> CPU: 2 PID: 8506 Comm: trinity-c124 Not tainted 3.16.0+ #41
> task: 880227fc95e0 ti: 8800929a task.ti: 8800929a
> RIP: 0010:[]  [] 
> proc_flush_task+0x99/0x1b0
> RSP: 0018:8800929a3d40  EFLAGS: 00010246
> RAX: 0001 RBX: 8800929a3d6b RCX: 
> RDX: 8800929a3d6c RSI: 8800929a3d58 RDI: 
> RBP: 8800929a3da8 R08: 000a R09: fffb
> R10:  R11:  R12: 0001
> R13:  R14:  R15: 0002
> FS:  7f019c95d700() GS:88024d10() knlGS:
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2:  CR3: 959e7000 CR4: 001407e0
> DR0: 0249e000 DR1:  DR2: 
> DR3:  DR6: fffe0ff0 DR7: 0600
> Stack:
>  88022ad836c0 0002929a3d58 88022ad836c0 000132313068
>  8800929a3d6b 373231003277b6b0 88022377b600 898577d0
>  88022377b6b0 278f 0010 
> Call Trace:
>  [] release_task+0x4c/0x4a0
>  [] wait_consider_task+0x70a/0xbe0
>  [] do_wait+0x144/0x2d0
>  [] SyS_wait4+0x7b/0x100
>  [] ? task_stopped_code+0x60/0x60
>  [] tracesys+0xdd/0xe2
> Code: d4 e0 a9 86 48 03 45 a8 89 4d a4 44 8b 78 30 48 8b 40 38 44 89 f9 4c 8b 
> a8 40 08 00 00 31 c0 e8 6e 21 0f 00 48 8d 75 b0 89 45 b4 <49> 8b 7d 00 e8 4e 
> 8b fa ff 48 85 c0 49 89 c6 74 18 48 89 c7 e8 
> RIP  [] proc_flush_task+0x99/0x1b0
>
>
> Right before the oops, the last thing fault injection logged wrt that pid 
> was..
>
> FAULT_INJECTION: forcing a failure
> CPU: 0 PID: 8506 Comm: trinity-c124 Not tainted 3.16.0+ #41
>  0032 898577d0 8800929a3b08 86759797
>  86c6a300 8800929a3b28 86358c30 8020
>  8020 8800929a3b38 861c6850 8800929a3b88
> Call Trace:
>  [] dump_stack+0x4e/0x7a
>  [] should_fail+0x100/0x110
>  [] should_failslab+0x40/0x50
>  [] kmem_cache_alloc+0x5e/0x270
>  [] ida_pre_get+0x69/0xf0
>  [] ? proc_fill_super+0xa0/0xa0
>  [] get_anon_bdev+0x39/0x120
>  [] ? proc_fill_super+0xa0/0xa0
>  [] set_anon_super+0x16/0x30
>  [] proc_set_super+0x1d/0x80
>  [] sget+0x33a/0x400
>  [] ? proc_root_lookup+0x40/0x40
>  [] proc_mount+0xa7/0x150
>  [] mount_fs+0x38/0x1c0
>  [] vfs_kern_mount+0x64/0x120
>  [] kern_mount_data+0x19/0x30
>  [] pid_ns_prepare_proc+0x1c/0x30
>  [] alloc_pid+0x474/0x4c0
>  [] ? flush_tlb_mm_range+0x80/0x200
>  [] ? copy_thread+0x11d/0x2c0
>  [] copy_process.part.29+0xab0/0x1be0
>  [] do_fork+0xdd/0x400
>  [] ? preempt_count_sub+0xab/0x100
>  [] ? __this_cpu_preempt_check+0x13/0x20
>  [] SyS_clone+0x16/0x20
>  [] stub_clone+0x69/0x90
>  [] ? tracesys+0xdd/0xe2
>
> Should proc_flush_task just be checking for a NULL upid->ns ?
> Or is there something in the pid_ns_prepare_proc failure path
> that we're failing to undo ?
>
> thoughts?
>
> I don't know how feasible it would be to hit that in real life
> without the fault injection stuff, but an oops can't be the right
> thing to do in any case.

Hmm.

So what we can reconstruct from your data is:

8506 probably unshared a pid namespace.
8506 called fork/clone creating the first process in a pid namespace and
 alloc_pid fails.
8506 calls wait and the task it finds to be waited for is defective
 and proc_flush_task oopses.

*scratches head*

So I don't think the last fault had anything to do with this failure.

My dissassembly puts the code at the call of shrink_dcache_parent but I
don't think my dissambly matches your kernel.  Can you disassemble
proc_flush_task so we can at least see what is failing?


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


Re: [PATCH] staging/lustre: use rcu_dereference to access rcu protected current->real_parent field

2014-08-07 Thread Greg Kroah-Hartman
On Fri, Aug 08, 2014 at 12:03:20AM -0400, Oleg Drokin wrote:
> Hello!
> 
> On Aug 7, 2014, at 11:49 PM, Greg Kroah-Hartman wrote:
> >> 
> >> This is not a critical bug and in the worst case the code here may
> >> cause miss of statistics counter increase.
> >> This is why I think it is not worth to backport the patch at all.
> > You are right, and if this is just for some random "statistics" file,
> > can we just delete the whole function?
> 
> I hope not!
> This is used all around the client to tally up various operations executed 
> counts.

Why would you do that?  Why would they care?

> The statistic is then used by various userspace monitoring tools.

Why not use the in-kernel monitoring tools instead of creating your own?
What does userspace do with that information?

thanks,

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


Re: Request to include Mailbox tree in linux-next

2014-08-07 Thread Stephen Rothwell
Hi Jassi,

On Wed, 6 Aug 2014 12:25:49 +0530 Jassi Brar  wrote:
>
>  The framework for Mailbox has undergone 10 revisions over the last
> one year, which has garnered support in the form of 'Reviewed-by' and
> 'looks good enough to be merged in this window' from people in the CC
> list.
> 
>   Could you please add it to linux-next?
> Tree:   git://git.linaro.org/landing-teams/working/fujitsu/integration.git
> Branch:   mailbox-for-3.17
> Contact:  Jassi Brar 

This is really late for v3.17.  The purpose of linux-next is to
discover interactions between trees before they are pulled into Linus'
tree and to do some cross architecture build checking.  Adding a tree
during the merge window is not very helpful to that.

However if this is really going to be merged by Linus before v3.17-rc1,
I will add it on Monday, OK?

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


signature.asc
Description: PGP signature


btrfs BUG() in __set_extent_bit on GFP_ATOMIC failure.

2014-08-07 Thread Dave Jones
While playing with fault injection, I hit this quite easily.

kernel BUG at fs/btrfs/extent_io.c:990!
invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
CPU: 1 PID: 1270 Comm: fsx Not tainted 3.16.0+ #41
task: 88023fe46d60 ti: 8802405a8000 task.ti: 8802405a8000
RIP: 0010:[]  [] 
__set_extent_bit+0x574/0x660 [btrfs]
...
 [] ? set_track+0x9c/0x140
 [] lock_extent_bits+0x94/0x310 [btrfs]
 [] ? pagecache_get_page+0xb4/0x210
 [] lock_and_cleanup_extent_if_need+0xee/0x1f0 [btrfs]
 [] __btrfs_buffered_write+0x1b1/0x680 [btrfs]
 [] ? preempt_count_sub+0xab/0x100
 [] btrfs_file_write_iter+0x17e/0x570 [btrfs]
 [] new_sync_write+0x8e/0xd0
 [] vfs_write+0xb7/0x1f0
 [] SyS_write+0x58/0xd0
 [] tracesys+0xdd/0xe2


 989 prealloc = alloc_extent_state_atomic(prealloc);
 990 BUG_ON(!prealloc);

 541 static struct extent_state *
 542 alloc_extent_state_atomic(struct extent_state *prealloc)
 543 {
 544 if (!prealloc)
 545 prealloc = alloc_extent_state(GFP_ATOMIC);
 546 
 547 return prealloc;
 548 }


Going BUG() on a GFP_ATOMIC allocation failure seems a bit excessive.
Surely there's something better we can do here ?

Dave

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


Re: [PATCH v2] Hibernate: check unsafe page should not in e820 reserved region

2014-08-07 Thread joeyli
On Thu, Aug 07, 2014 at 11:05:33PM +0200, Pavel Machek wrote:
> On Thu 2014-08-07 18:17:34, joeyli wrote:
> > On Thu, Aug 07, 2014 at 11:39:57AM +0200, Pavel Machek wrote:
> > > > > Actually, if you are doing such a check... it makes sense to check for
> > > > > _all_ the regions, nosave or not. If e820 map changed at all, it is
> > > > > not safe to resume.
> > > > >   
> > > > > Pavel
> > > > 
> > > > Currently nosave region only called register by e820 code, so 
> > > > hibernate's nosave region included e820
> > > > reserved, ACPI data and ACPI NVS region.
> > > > 
> > > > I thought hashing the start/end pfn of above regions is enough.
> > > 
> > > If ammount of memory changed, for example, it is unsafe to
> > > resume. So if you are doing the check, anyway, please hash
> > > whole e820 table.
> > 
> > There already have num_physpages in header for check the total physical 
> > page number.
> 
> Good, but if ammount of memory stayed the same, but offsets
> changed (for example), resume is unsafe, too.

I agreed

> 
> When I wrote that num_physpages check, I should have checked
> whole e820  table, instead. (If anything at all changed there,
> "new" kernel is running with wrong e820 info).
> 
> You seem to be in great position to fix that mistake now...
> 
>   Pavel

Hashing e820 is fine, but it can not provide detail information to 
user/developer when issue
happened. We only know the e820 table changed but not more information for bug 
tracking, not
too many shipping machine have serial console.

After checked the space of swsusp_info, I hope can store whole e820 table to 
snapshot header
for compare the range. The maximum space consumed 20 * E820MAX = 20 * 128 = 
2560 bytes.
Currrent swsusp_info is used 430 bytes in one page, it's enough to us for keep 
whole e820
table.

And, I thought don't need compare the range of E820_RAM and E820_RESERVED_KERN 
type
because they are using by OS and stored in snapshot image.


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


[RFC PATCH v2] kprobes: arm: enable OPTPROBES for ARM 32

2014-08-07 Thread Wang Nan
This patch introduce kprobeopt for ARM 32.

Limitations:
 - Currently only kernel compiled with ARM ISA is supported.

 - Offset between probe point and optinsn slot must not larger than
   32MiB. Masami Hiramatsu suggests replacing 2 words, it will make
   things complex. Futher patch can make such optimization.

Kprobe opt on ARM is relatively simpler than kprobe opt on x86 because
ARM instruction is always 4 bytes aligned and 4 bytes long. This patch
replace probed instruction by a 'b', branch to trampoline code and then
calls optimized_callback(). optimized_callback() calls opt_pre_handler()
to execute kprobe handler. It also emulate/simulate replaced instruction.

When unregistering kprobe, the deferred manner of unoptimizer may leave
branch instruction before optimizer is called. Different from x86_64,
which only copy the probed insn after optprobe_template_end and
reexecute them, this patch call singlestep to emulate/simulate the insn
directly. Futher patch can optimize this behavior.

v1 -> v2:

 - Improvement: if replaced instruction is conditional, generate a
   conditional branch instruction for it;

 - Introduces RELATIVEJUMP_OPCODES due to ARM kprobe_opcode_t is 4
   bytes;

 - Removes size field in struct arch_optimized_insn;

 - Use arm_gen_branch() to generate branch instruction;

 - Remove all recover logic: ARM doesn't use tail buffer, no need
   recover replaced instructions like x86;

 - Remove incorrect CONFIG_THUMB checking;

 - can_optimize() always returns true if address is well aligned;

 - Improve optimized_callback: using opt_pre_handler();

 - Bugfix: correct range checking code and improve comments;

 - Fix commit message.

Signed-off-by: Wang Nan 
Cc: Masami Hiramatsu 
Cc: Jon Medhurst (Tixy) 
Cc: Russell King - ARM Linux 
---
 arch/arm/Kconfig   |   1 +
 arch/arm/include/asm/kprobes.h |  26 +
 arch/arm/kernel/Makefile   |   3 +-
 arch/arm/kernel/kprobes-opt.c  | 257 +
 4 files changed, 286 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/kernel/kprobes-opt.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 290f02ee..2106918 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -57,6 +57,7 @@ config ARM
select HAVE_MEMBLOCK
select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
+   select HAVE_OPTPROBES if (!THUMB2_KERNEL)
select HAVE_PERF_EVENTS
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
index 49fa0df..caacc7c 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/kprobes.h
@@ -51,5 +51,31 @@ int kprobe_fault_handler(struct pt_regs *regs, unsigned int 
fsr);
 int kprobe_exceptions_notify(struct notifier_block *self,
 unsigned long val, void *data);
 
+/* optinsn template addresses */
+extern __visible kprobe_opcode_t optprobe_template_entry;
+extern __visible kprobe_opcode_t optprobe_template_val;
+extern __visible kprobe_opcode_t optprobe_template_call;
+extern __visible kprobe_opcode_t optprobe_template_end;
+
+#define MAX_OPTIMIZED_LENGTH   (4)
+#define MAX_OPTINSN_SIZE   \
+   (((unsigned long)&optprobe_template_end -   \
+ (unsigned long)&optprobe_template_entry))
+#define RELATIVEJUMP_SIZE  (4)
+#define RELATIVEJUMP_OPCODES   ((RELATIVEJUMP_SIZE) / sizeof(kprobe_opcode_t))
+
+struct arch_optimized_insn {
+   /*
+* copy of the original instructions.
+* Different from x86, ARM kprobe_opcode_t is u32.
+*/
+   kprobe_opcode_t copied_insn[RELATIVEJUMP_OPCODES];
+   /* detour code buffer */
+   kprobe_opcode_t *insn;
+   /*
+*  we always copies one instruction on arm32,
+*  size always be 4, so no size field.
+*/
+};
 
 #endif /* _ARM_KPROBES_H */
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 38ddd9f..6a38ec1 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -52,11 +52,12 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o
 obj-$(CONFIG_JUMP_LABEL)   += jump_label.o insn.o patch.o
 obj-$(CONFIG_KEXEC)+= machine_kexec.o relocate_kernel.o
 obj-$(CONFIG_UPROBES)  += probes.o probes-arm.o uprobes.o uprobes-arm.o
-obj-$(CONFIG_KPROBES)  += probes.o kprobes.o kprobes-common.o patch.o
+obj-$(CONFIG_KPROBES)  += probes.o kprobes.o kprobes-common.o patch.o 
insn.o
 ifdef CONFIG_THUMB2_KERNEL
 obj-$(CONFIG_KPROBES)  += kprobes-thumb.o probes-thumb.o
 else
 obj-$(CONFIG_KPROBES)  += kprobes-arm.o probes-arm.o
+obj-$(CONFIG_OPTPROBES)+= kprobes-opt.o
 endif
 obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o
 test-kprobes-objs  := kprobes-test.o
diff --git a/arch/arm/kernel/kprobes-opt.c b/arch/arm/kernel/kprobes-opt.c
new file mode 100644
index 0

Re: [PATCH] sched: Reduce contention in update_cfs_rq_blocked_load

2014-08-07 Thread Jason Low
On Fri, 2014-08-08 at 02:02 +0800, Yuyang Du wrote:
> On Wed, Aug 06, 2014 at 11:21:35AM -0700, Jason Low wrote:
> > I ran these tests with most of the AIM7 workloads to compare its
> > performance between a 3.16 kernel and the kernel with these patches
> > applied.
> > 
> > The table below contains the percent difference between the baseline
> > kernel and the kernel with the patches at various user counts. A
> > positive percent means the kernel with the patches performed better,
> > while a negative percent means the baseline performed better.
> > 
> > Based on these numbers, for many of the workloads, the change was
> > beneficial in those highly contended, while it had - impact in many
> > of the lightly/moderately contended case (10 to 90 users).
> > 
> > -
> >   |   10-90   |  100-1000   |  1100-2000
> >   |   users   |   users |   users
> > -
> > alltests  |   -3.37%  |  -10.64%|   -2.25%
> > -
> > all_utime |   +0.33%  |   +3.73%|   +3.33%
> > -
> > compute   |   -5.97%  |   +2.34%|   +3.22%
> > -
> > custom|  -31.61%  |  -10.29%|  +15.23%
> > -
> > disk  |  +24.64%  |  +28.96%|  +21.28%
> > -
> > fserver   |   -1.35%  |   +4.82%|   +9.35%
> > -
> > high_systime  |   -6.73%  |   -6.28%|  +12.36%
> > -
> > shared|  -28.31%  |  -19.99%|   -7.10%
> > -
> > short |  -44.63%  |  -37.48%|  -33.62%
> > -
> > 
> Thanks, Jason. Sorry for late response.
> 
> What about the variation of the tests? The machine you test on?

Hi Yuyang,

These tests were also done on an 8 socket machine (80 cores). In terms
of variation between the average throughputs, typically the noise range
is about 2% in many of the workloads.

Jason

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


Re: [PATCH] staging/lustre: use rcu_dereference to access rcu protected current->real_parent field

2014-08-07 Thread Oleg Drokin
Hello!

On Aug 7, 2014, at 11:49 PM, Greg Kroah-Hartman wrote:
>> 
>> This is not a critical bug and in the worst case the code here may
>> cause miss of statistics counter increase.
>> This is why I think it is not worth to backport the patch at all.
> You are right, and if this is just for some random "statistics" file,
> can we just delete the whole function?

I hope not!
This is used all around the client to tally up various operations executed 
counts.

The statistic is then used by various userspace monitoring tools.

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


RE: [PATCH] staging:r819xU: coding style: Fixed commenting style

2014-08-07 Thread Sharma, Sanjeev
Opps, I forget.

Let me correct and send V2 patch.

Regards
Sanjeev Sharma

-Original Message-
From: Greg KH [mailto:gre...@linuxfoundation.org] 
Sent: Thursday, August 07, 2014 9:33 PM
To: Sharma, Sanjeev
Cc: de...@driverdev.osuosl.org; oor...@gmail.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging:r819xU: coding style: Fixed commenting style

On Thu, Aug 07, 2014 at 12:15:57PM +0530, Sanjeev Sharma wrote:
> This is a patch to the r819xU_phyreg.h file that fixes commenting 
> style warning
> 
> Signed-off-by: Sanjeev Sharma 
> ---
>  drivers/staging/rtl8192u/r819xU_phyreg.h | 188 
> ---
>  1 file changed, 97 insertions(+), 91 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h 
> b/drivers/staging/rtl8192u/r819xU_phyreg.h
> index 64285d6..f07d2f1 100644
> --- a/drivers/staging/rtl8192u/r819xU_phyreg.h
> +++ b/drivers/staging/rtl8192u/r819xU_phyreg.h
> @@ -2,10 +2,10 @@
>  #define _R819XU_PHYREG_H
>  
>  
> -#define   RF_DATA0x1d4   
> // FW will write RF data in the register.
> +#define   RF_DATA0x1d4   
> /* FW will write RF data in the register.*/
>  
> -//Register   //duplicate register due to connection: RF_Mode, TRxRN, NumOf 
> L-STF
> -//page 1
> +/* Register   //duplicate register due to connection: RF_Mode, TRxRN, NumOf 
> L-STF */

Does that line look correct?

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


[PATCH v2] staging:r819xU: coding style: Fixed commenting style

2014-08-07 Thread Sanjeev Sharma
This is a patch to the r819xU_phyreg.h file that fixes
commenting style warning

Signed-off-by: Sanjeev Sharma 
---
 drivers/staging/rtl8192u/r819xU_phyreg.h | 189 ---
 1 file changed, 98 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h 
b/drivers/staging/rtl8192u/r819xU_phyreg.h
index 64285d6..b855627 100644
--- a/drivers/staging/rtl8192u/r819xU_phyreg.h
+++ b/drivers/staging/rtl8192u/r819xU_phyreg.h
@@ -2,10 +2,11 @@
 #define _R819XU_PHYREG_H
 
 
-#define   RF_DATA  0x1d4   
// FW will write RF data in the register.
+#define   RF_DATA  0x1d4   
/* FW will write RF data in the register.*/
 
-//Register   //duplicate register due to connection: RF_Mode, TRxRN, NumOf 
L-STF
-//page 1
+/* Register duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+ * page 1
+ */
 #define rPMAC_Reset0x100
 #define rPMAC_TxStart  0x104
 #define rPMAC_TxLegacySIG  0x108
@@ -34,15 +35,16 @@
 #define rPMAC_CCKCRxRC32OK 0x188
 #define rPMAC_TxStatus 0x18c
 
-//page8
-#define rFPGA0_RFMOD   0x800  //RF mode & CCK TxSC
+/* page8 */
+#define rFPGA0_RFMOD   0x800  /* RF mode & CCK TxSC */
 #define rFPGA0_TxInfo  0x804
 #define rFPGA0_PSDFunction 0x808
 #define rFPGA0_TxGainStage 0x80c
 #define rFPGA0_RFTiming1   0x810
 #define rFPGA0_RFTiming2   0x814
-//#define rFPGA0_XC_RFTiming   0x818
-//#define rFPGA0_XD_RFTiming   0x81c
+/* #define rFPGA0_XC_RFTiming  0x818
+ * #define rFPGA0_XD_RFTiming  0x81c
+ */
 #define rFPGA0_XA_HSSIParameter1   0x820
 #define rFPGA0_XA_HSSIParameter2   0x824
 #define rFPGA0_XB_HSSIParameter1   0x828
@@ -79,51 +81,51 @@
 #define rFPGA0_XAB_RFInterfaceRB   0x8e0
 #define rFPGA0_XCD_RFInterfaceRB   0x8e4
 
-//page 9
-#define rFPGA1_RFMOD   0x900  //RF mode & OFDM TxSC
+/* page 9 */
+#define rFPGA1_RFMOD   0x900  /* RF mode & OFDM TxSC */
 #define rFPGA1_TxBlock 0x904
 #define rFPGA1_DebugSelect 0x908
 #define rFPGA1_TxInfo  0x90c
 
-//page a
+/* page a */
 #define rCCK0_System   0xa00
 #define rCCK0_AFESetting   0xa04
 #define rCCK0_CCA  0xa08
-#define rCCK0_RxAGC1   0xa0c  //AGC default value, 
saturation level
-#define rCCK0_RxAGC2   0xa10  //AGC & DAGC
+#define rCCK0_RxAGC1   0xa0c  /* AGC default value, 
saturation level */
+#define rCCK0_RxAGC2   0xa10  /* AGC & DAGC */
 #define rCCK0_RxHP 0xa14
-#define rCCK0_DSPParameter10xa18  //Timing recovery & Channel 
estimation threshold
-#define rCCK0_DSPParameter20xa1c  //SQ threshold
+#define rCCK0_DSPParameter10xa18  /* Timing recovery & Channel 
estimation threshold */
+#define rCCK0_DSPParameter20xa1c  /* SQ threshold */
 #define rCCK0_TxFilter10xa20
 #define rCCK0_TxFilter20xa24
-#define rCCK0_DebugPort0xa28  //debug port and 
Tx filter3
-#define rCCK0_FalseAlarmReport 0xa2c  //0xa2d
+#define rCCK0_DebugPort0xa28  /* debug port 
and Tx filter3 */
+#define rCCK0_FalseAlarmReport 0xa2c  /* 0xa2d */
 #define rCCK0_TRSSIReport  0xa50
-#define rCCK0_RxReport 0xa54  //0xa57
-#define rCCK0_FACounterLower   0xa5c  //0xa5b
-#define rCCK0_FACounterUpper   0xa58  //0xa5c
+#define rCCK0_RxReport 0xa54  /* 0xa57 */
+#define rCCK0_FACounterLower   0xa5c  /* 0xa5b */
+#define rCCK0_FACounterUpper   0xa58  /* 0xa5c */
 
-//page c
+/* page c */
 #define rOFDM0_LSTF0xc00
 #define rOFDM0_TRxPathEnable   0xc04
 #define rOFDM0_TRMuxPar0xc08
 #define rOFDM0_TRSWIsolation   0xc0c
-#define rOFDM0_XARxAFE 0xc10  //RxIQ DC offset, Rx 
digital filter, DC notch filter
-#define rOFDM0_XARxIQImbalance 0xc14  //RxIQ imblance matrix
+#define rOFDM0_XARxAFE 0xc10  /* RxIQ DC offset, Rx 
digital filter, DC notch filter */
+#define rOFDM0_XARxIQImbalance 0xc14  /* RxIQ imblance matrix */
 #define rOFDM0_XBRxAFE 0xc18
 #define rOFDM0_XBRxIQImbalance 0xc1c
 #define rOFDM0_

[PATCH v5 3/4] ARM: dts: add rk3288 dwc2 controller support

2014-08-07 Thread Kever Yang
rk3288 has two kind of usb controller, this add the dwc2 controller
for otg and host1.

Controller can works with usb PHY default setting and Vbus on.

Signed-off-by: Kever Yang 
Reviewed-by: Doug Anderson 
Tested-by: Doug Anderson 
---

Changes in v5:
- change the sort order of dwc2 in rk3288.dtsi

Changes in v4: None
Changes in v3:
- EHCI and HSIC move new for version 3.

Changes in v2: None

 arch/arm/boot/dts/rk3288.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 5950b0a..58167f1 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -206,6 +206,26 @@
 
/* NOTE: ohci@ff52 doesn't actually work on hardware */
 
+   usb_host1: usb@ff54 {
+   compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
+   "snps,dwc2";
+   reg = <0xff54 0x4>;
+   interrupts = ;
+   clocks = <&cru HCLK_USBHOST1>;
+   clock-names = "otg";
+   status = "disabled";
+   };
+
+   usb_otg: usb@ff58 {
+   compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
+   "snps,dwc2";
+   reg = <0xff58 0x4>;
+   interrupts = ;
+   clocks = <&cru HCLK_OTG0>;
+   clock-names = "otg";
+   status = "disabled";
+   };
+
usb_hsic: usb@ff5c {
compatible = "generic-ehci";
reg = <0xff5c 0x100>;
-- 
1.9.1

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


[PATCH v5 1/4] Documentation: dt-bindings: add dt binding info for Rockchip dwc2

2014-08-07 Thread Kever Yang
This add necessary dwc2 binding documentation for Rockchip socs:
rk3066, rk3188 and rk3288

Signed-off-by: Kever Yang 
Acked-by: Stephen Warren 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Split out dr_mode and rk3288 bindings.
- add compatible "snps,dwc2" bingding info

 Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
b/Documentation/devicetree/bindings/usb/dwc2.txt
index 467ddd1..2899679 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.txt
+++ b/Documentation/devicetree/bindings/usb/dwc2.txt
@@ -4,6 +4,9 @@ Platform DesignWare HS OTG USB 2.0 controller
 Required properties:
 - compatible : One of:
   - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC.
+  - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc;
+  - "rockchip,rk3188-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3188 Soc;
+  - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc;
   - snps,dwc2: A generic DWC2 USB controller with default parameters.
 - reg : Should contain 1 register range (address and length)
 - interrupts : Should contain 1 interrupt
-- 
1.9.1

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


[PATCH v5 2/4] usb: dwc2: add compatible data for rockchip soc

2014-08-07 Thread Kever Yang
This patch add compatible data for dwc2 controller found on
rk3066, rk3188 and rk3288 processors from rockchip.

Signed-off-by: Kever Yang 
Acked-by: Paul Zimmerman 
---

Changes in v5:
- max_transfer_size change to 65535 to met the requirement of
  header file

Changes in v4:
- max_transfer_size change to 65536, this should be enough
  for most transfer, the hardware auto-detect will set this
  to 0x7 which may make dma_alloc_coherent fail when
  non-dword aligned buf from driver like usbnet happen.

Changes in v3: None
Changes in v2:
- set most parameters as driver auto-detect

 drivers/usb/dwc2/platform.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index a10e7a3..2f859bd 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -75,6 +75,34 @@ static const struct dwc2_core_params params_bcm2835 = {
.uframe_sched   = 0,
 };
 
+static const struct dwc2_core_params params_rk3066 = {
+   .otg_cap= 2,/* non-HNP/non-SRP */
+   .otg_ver= -1,
+   .dma_enable = -1,
+   .dma_desc_enable= 0,
+   .speed  = -1,
+   .enable_dynamic_fifo= 1,
+   .en_multiple_tx_fifo= -1,
+   .host_rx_fifo_size  = 520,  /* 520 DWORDs */
+   .host_nperio_tx_fifo_size   = 128,  /* 128 DWORDs */
+   .host_perio_tx_fifo_size= 256,  /* 256 DWORDs */
+   .max_transfer_size  = 65535,
+   .max_packet_count   = -1,
+   .host_channels  = -1,
+   .phy_type   = -1,
+   .phy_utmi_width = -1,
+   .phy_ulpi_ddr   = -1,
+   .phy_ulpi_ext_vbus  = -1,
+   .i2c_enable = -1,
+   .ulpi_fs_ls = -1,
+   .host_support_fs_ls_low_power   = -1,
+   .host_ls_low_power_phy_clk  = -1,
+   .ts_dline   = -1,
+   .reload_ctl = -1,
+   .ahbcfg = 0x7, /* INCR16 */
+   .uframe_sched   = -1,
+};
+
 /**
  * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the
  * DWC_otg driver
@@ -97,6 +125,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
 
 static const struct of_device_id dwc2_of_match_table[] = {
{ .compatible = "brcm,bcm2835-usb", .data = ¶ms_bcm2835 },
+   { .compatible = "rockchip,rk3066-usb", .data = ¶ms_rk3066 },
{ .compatible = "snps,dwc2", .data = NULL },
{},
 };
-- 
1.9.1

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


[PATCH v5 4/4] ARM: dts: Enable USB host1(dwc) on rk3288-evb

2014-08-07 Thread Kever Yang
USB host1 port is the host A port nearby the otg port.

Signed-off-by: Kever Yang 

---

Changes in v5:
- don't enable otg port for evb

Changes in v4: None
Changes in v3:
- Rebase

Changes in v2:
- evb patch added in version 2

 arch/arm/boot/dts/rk3288-evb.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi 
b/arch/arm/boot/dts/rk3288-evb.dtsi
index 4f57209..4b62df6 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -94,3 +94,7 @@
 &usb_host0_ehci {
status = "okay";
 };
+
+&usb_host1 {
+   status = "okay";
+};
-- 
1.9.1

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


[PATCH v5 0/4] Patches to add support for Rockchip dwc2 controller

2014-08-07 Thread Kever Yang
These patches to add support for dwc2 controller found in
Rockchip processors rk3066, rk3188 and rk3288,
and enable dts for rk3288 evb.

Changes in v5:
- max_transfer_size change to 65535 to met the requirement of
  header file
- change the sort order of dwc2 in rk3288.dtsi
- don't enable otg port for evb

Changes in v4:
- max_transfer_size change to 65536, this should be enough
  for most transfer, the hardware auto-detect will set this
  to 0x7 which may make dma_alloc_coherent fail when
  non-dword aligned buf from driver like usbnet happen.
- remove EHCI and HSIC dts patch for Doug had post it seprately.

Changes in v3:
- EHCI and HSIC move new for version 3.
- Rebase

Changes in v2:
- Split out dr_mode and rk3288 bindings.
- add compatible "snps,dwc2" bingding info
- set most parameters as driver auto-detect
- evb patch added in version 2

Kever Yang (4):
  Documentation: dt-bindings: add dt binding info for Rockchip dwc2
  usb: dwc2: add compatible data for rockchip soc
  ARM: dts: add rk3288 dwc2 controller support
  ARM: dts: Enable USB host1(dwc) on rk3288-evb

 Documentation/devicetree/bindings/usb/dwc2.txt |  3 +++
 arch/arm/boot/dts/rk3288-evb.dtsi  |  4 
 arch/arm/boot/dts/rk3288.dtsi  | 20 ++
 drivers/usb/dwc2/platform.c| 29 ++
 4 files changed, 56 insertions(+)

-- 
1.9.1

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


Re: [PATCH] staging/lustre: use rcu_dereference to access rcu protected current->real_parent field

2014-08-07 Thread Greg Kroah-Hartman
On Thu, Aug 07, 2014 at 02:13:50PM +0300, Evgeny Budilovsky wrote:
> On Thu, Aug 7, 2014 at 12:42 AM, Greg Kroah-Hartman
>  wrote:
> > On Wed, Aug 06, 2014 at 09:22:43PM +0300, Evgeny Budilovsky wrote:
> >>
> >>
> >> Signed-off-by: Evgeny Budilovsky 
> >
> > Why is this needed?  Is the current code a bug?  Where was the reference
> > added?  Is this causing a problem without this patch applied?  How far
> > back should it be backported, if at all?
> >
> > I need lots more details here before I can take this patch, sorry.
> 
> Sorry for the little information in the previous mail.
> 
> The motivation for this patch was to clean some of the warnings that
> were generated
> on drivers/staging by the sparse utility.
> 
> For this particular case the warning was
> staging/lustre/lustre/llite/lproc_llite.c:913:51: warning: dereference
> of noderef expression
> 
> And this is since current->real_parent is accessed directly and not
> trough the rcu_dereference,
> which is the common way to access it throughout the kernel.
> 
> This is not a critical bug and in the worst case the code here may
> cause miss of statistics counter increase.
> This is why I think it is not worth to backport the patch at all.

You are right, and if this is just for some random "statistics" file,
can we just delete the whole function?

thanks,

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


3.15.8 USB issue with uvc cam

2014-08-07 Thread Udo van den Heuvel
Hello,

I get WARNINGs when trying to use a Logitech C615 cam.
See attachment for full dmesg of errors but excerpt below:

[80346.835015] xhci_hcd :02:00.0: ERROR: unexpected command
completion code 0x11.
[80346.835027] usb 6-2: Not enough bandwidth for altsetting 11
[80346.835137] [ cut here ]
[80346.835155] WARNING: CPU: 3 PID: 20594 at
drivers/media/v4l2-core/videobuf2-core.c:2011
__vb2_queue_cancel+0x102/0x170 [videobuf2_core]()
[80346.835158] Modules linked in: uvcvideo cdc_acm bnep bluetooth fuse
edac_core cpufreq_userspace ipt_REJECT nf_conntrack_netbios_ns
nf_conntrack_broadcast iptable_filter ip6t_REJECT ipt_MASQUERADE
xt_tcpudp nf_conntrack_ipv6 iptable_nat nf_defrag_ipv6 nf_conntrack_ipv4
nf_defrag_ipv4 nf_nat_ipv4 nf_nat xt_conntrack nf_conntrack ip_tables
ip6table_filter ip6_tables x_tables eeprom it87 hwmon_vid ext2
snd_usb_audio snd_usbmidi_lib snd_hwdep snd_rawmidi ppdev pwc
videobuf2_vmalloc videobuf2_memops kvm_amd kvm v4l2_common
videobuf2_core snd_hda_codec_realtek snd_hda_codec_generic videodev
snd_hda_intel snd_hda_controller cp210x snd_hda_codec usbserial snd_seq
snd_seq_device microcode snd_pcm parport_serial parport_pc parport
snd_timer k10temp snd evdev i2c_piix4 button acpi_cpufreq nfsd
auth_rpcgss oid_registry
[80346.835218]  nfs_acl lockd sunrpc binfmt_misc autofs4 hid_generic
usbhid ohci_pci ehci_pci ehci_hcd ohci_hcd radeon sr_mod cdrom fbcon
bitblit cfbfillrect softcursor cfbimgblt cfbcopyarea font i2c_algo_bit
xhci_hcd backlight drm_kms_helper ttm drm fb fbdev
[80346.835250] CPU: 3 PID: 20594 Comm: skype Tainted: GW
3.15.8 #6
[80346.835254] Hardware name: Gigabyte Technology Co., Ltd. To be filled
by O.E.M./F2A85X-UP4, BIOS F5a 04/30/2013
[80346.835257]   79d580f4 814f2373

[80346.835262]  81069fe1  88040ec532e8

[80346.835267]  88040ec530d8 8803f0c46f00 a041d832
88040ec530d8
[80346.835272] Call Trace:
[80346.835283]  [] ? dump_stack+0x4a/0x75
[80346.835289]  [] ? warn_slowpath_common+0x81/0xb0
[80346.835299]  [] ? __vb2_queue_cancel+0x102/0x170
[videobuf2_core]
[80346.835307]  [] ? vb2_internal_streamoff+0x1d/0x50
[videobuf2_core]
[80346.835314]  [] ? uvc_queue_enable+0x75/0xb0 [uvcvideo]
[80346.835321]  [] ? uvc_video_enable+0x141/0x1a0
[uvcvideo]
[80346.835327]  [] ? uvc_v4l2_do_ioctl+0xd6f/0x1580
[uvcvideo]
[80346.835339]  [] ? video_usercopy+0x1f0/0x490 [videodev]
[80346.835345]  [] ?
uvc_v4l2_set_streamparm.isra.12+0x1c0/0x1c0 [uvcvideo]
[80346.835352]  [] ? preempt_count_add+0x3f/0x90
[80346.835356]  [] ? _raw_spin_lock+0xe/0x30
[80346.835360]  [] ? _raw_spin_unlock+0xd/0x30
[80346.835367]  [] ? __pte_alloc+0xce/0x170
[80346.835376]  [] ? v4l2_ioctl+0x11f/0x160 [videodev]
[80346.835386]  [] ? do_video_ioctl+0x246/0x1330
[videodev]
[80346.835392]  [] ? mmap_region+0x15a/0x5a0
[80346.835402]  [] ? v4l2_compat_ioctl32+0x82/0xb8
[videodev]
[80346.835408]  [] ? compat_SyS_ioctl+0x132/0x1120
[80346.835414]  [] ? vm_mmap_pgoff+0xe3/0x120
[80346.835421]  [] ? cstar_dispatch+0x7/0x1a
[80346.835424] ---[ end trace 44e3d272b6c91a71 ]---
[80346.835427] [ cut here ]


What is wrong here?

Kind regards,
Udo


[80346.835015] xhci_hcd :02:00.0: ERROR: unexpected command completion code 
0x11.
[80346.835027] usb 6-2: Not enough bandwidth for altsetting 11
[80346.835137] [ cut here ]
[80346.835155] WARNING: CPU: 3 PID: 20594 at 
drivers/media/v4l2-core/videobuf2-core.c:2011 __vb2_queue_cancel+0x102/0x170 
[videobuf2_core]()
[80346.835158] Modules linked in: uvcvideo cdc_acm bnep bluetooth fuse 
edac_core cpufreq_userspace ipt_REJECT nf_conntrack_netbios_ns 
nf_conntrack_broadcast iptable_filter ip6t_REJECT ipt_MASQUERADE xt_tcpudp 
nf_conntrack_ipv6 iptable_nat nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 
nf_nat_ipv4 nf_nat xt_conntrack nf_conntrack ip_tables ip6table_filter 
ip6_tables x_tables eeprom it87 hwmon_vid ext2 snd_usb_audio snd_usbmidi_lib 
snd_hwdep snd_rawmidi ppdev pwc videobuf2_vmalloc videobuf2_memops kvm_amd kvm 
v4l2_common videobuf2_core snd_hda_codec_realtek snd_hda_codec_generic videodev 
snd_hda_intel snd_hda_controller cp210x snd_hda_codec usbserial snd_seq 
snd_seq_device microcode snd_pcm parport_serial parport_pc parport snd_timer 
k10temp snd evdev i2c_piix4 button acpi_cpufreq nfsd auth_rpcgss oid_registry
[80346.835218]  nfs_acl lockd sunrpc binfmt_misc autofs4 hid_generic usbhid 
ohci_pci ehci_pci ehci_hcd ohci_hcd radeon sr_mod cdrom fbcon bitblit 
cfbfillrect softcursor cfbimgblt cfbcopyarea font i2c_algo_bit xhci_hcd 
backlight drm_kms_helper ttm drm fb fbdev
[80346.835250] CPU: 3 PID: 20594 Comm: skype Tainted: GW 3.15.8 #6
[80346.835254] Hardware name: Gigabyte Technology Co., Ltd. To be filled by 
O.E.M./F2A85X-UP4, BIOS F5a 04/30/2013
[80346.835257]   79d580f4 814f2373 

[80346.835262]  f

Re: [PATCH] Hyperv: Trigger DHCP renew after host hibernation

2014-08-07 Thread Greg KH
On Fri, Aug 08, 2014 at 03:13:58AM +, Dexuan Cui wrote:
> > -Original Message-
> > From: Richard Weinberger [mailto:richard.weinber...@gmail.com]
> > Sent: Friday, August 8, 2014 6:37 AM
> > To: David Miller; Yue Zhang (OSTC DEV)
> > Cc: o...@aepfle.de; net...@vger.kernel.org; driverdev-
> > de...@linuxdriverproject.org; LKML; Greg KH; jasow...@redhat.com;
> > Haiyang Zhang; KY Srinivasan; Thomas Shao; Dexuan Cui
> > Subject: Re: [PATCH] Hyperv: Trigger DHCP renew after host hibernation
> > 
> > On Mon, Jul 21, 2014 at 11:32 PM, David Miller 
> > wrote:
> > > From: Olaf Hering 
> > > Date: Mon, 21 Jul 2014 11:18:51 +0200
> > >
> > >> On Mon, Jul 21, Richard Weinberger wrote:
> > >>
> > >>> My concern is that 10 seconds is maybe not a the right choice.
> > >>> (As we cannot know all implementations)
> > >>
> > >> Until someone reports an issue with it, 10 is fine. Just like 20 or 666.
> > >
> > > Wrong, this is policy and belongs in userspace.
> > 
> > The "/etc/init.d/network restart" nonsense now hit Linus' tree.
> > Yue, what is your proposal to fix that?
> > 
> > //richard
> 
> Hi Richard and all,
> Sorry for the late response -- actually we have been trying to
> figure out a solution that's acceptable to all.
> 
> IMO the most feasible and need-the-least-change solution may be:
> the hyperv network VSC driver passes the event
> RNDIS_STATUS_NETWORK_CHANGE to the udev daemon?
> 
> In this way, every distro only needs to add a udev rule, which should
> be simple.

No, don't do that, again, act like any other network device, drop the
link and bring it up when it comes back.

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


Re: linux-next: build failure after merge of the mmc-uh tree

2014-08-07 Thread Stephen Rothwell
Hi all,

On Mon, 28 Jul 2014 14:46:08 +1000 Stephen Rothwell  
wrote:
>
> After merging the mmc-uh tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> drivers/mmc/host/dw_mmc.c: In function 'dw_mci_reset':
> drivers/mmc/host/dw_mmc.c:2262:3: error: implicit declaration of function 
> 'dw_mci_idmac_reset' [-Werror=implicit-function-declaration]
>dw_mci_idmac_reset(host);
>^
> 
> Caused by commit 25f7dadbd982 ("mmc: dw_mmc: change to use recommended
> reset procedure").
> 
> I have used the mmc-uh tree from next-20140725 for today.

Ping.  We are nearly half way through the merge window and there has
been a patch posted for this, but the tree is still broken ...

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


signature.asc
Description: PGP signature


fault injection caused oops in proc_flush_task

2014-08-07 Thread Dave Jones
Because I don't have enough oopses in my life, I decided to play
with the fault injection code today. It's not something I hear about
people trying too often, so I wondered what horrors lurk..

So I ran this..

#!/bin/bash

for FAILTYPE in failslab fail_page_alloc
do
 echo N > /sys/kernel/debug/$FAILTYPE/task-filter
 echo 50 > /sys/kernel/debug/$FAILTYPE/probability
 echo 500 > /sys/kernel/debug/$FAILTYPE/interval
 echo -1 > /sys/kernel/debug/$FAILTYPE/times
 echo 0 > /sys/kernel/debug/$FAILTYPE/space
 echo 0 > /sys/kernel/debug/$FAILTYPE/verbose
 echo 2 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait
done

And then ran my usual fuzzing session, and saw this ..

Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
CPU: 2 PID: 8506 Comm: trinity-c124 Not tainted 3.16.0+ #41
task: 880227fc95e0 ti: 8800929a task.ti: 8800929a
RIP: 0010:[]  [] proc_flush_task+0x99/0x1b0
RSP: 0018:8800929a3d40  EFLAGS: 00010246
RAX: 0001 RBX: 8800929a3d6b RCX: 
RDX: 8800929a3d6c RSI: 8800929a3d58 RDI: 
RBP: 8800929a3da8 R08: 000a R09: fffb
R10:  R11:  R12: 0001
R13:  R14:  R15: 0002
FS:  7f019c95d700() GS:88024d10() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2:  CR3: 959e7000 CR4: 001407e0
DR0: 0249e000 DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0600
Stack:
 88022ad836c0 0002929a3d58 88022ad836c0 000132313068
 8800929a3d6b 373231003277b6b0 88022377b600 898577d0
 88022377b6b0 278f 0010 
Call Trace:
 [] release_task+0x4c/0x4a0
 [] wait_consider_task+0x70a/0xbe0
 [] do_wait+0x144/0x2d0
 [] SyS_wait4+0x7b/0x100
 [] ? task_stopped_code+0x60/0x60
 [] tracesys+0xdd/0xe2
Code: d4 e0 a9 86 48 03 45 a8 89 4d a4 44 8b 78 30 48 8b 40 38 44 89 f9 4c 8b 
a8 40 08 00 00 31 c0 e8 6e 21 0f 00 48 8d 75 b0 89 45 b4 <49> 8b 7d 00 e8 4e 8b 
fa ff 48 85 c0 49 89 c6 74 18 48 89 c7 e8 
RIP  [] proc_flush_task+0x99/0x1b0


Right before the oops, the last thing fault injection logged wrt that pid was..

FAULT_INJECTION: forcing a failure
CPU: 0 PID: 8506 Comm: trinity-c124 Not tainted 3.16.0+ #41
 0032 898577d0 8800929a3b08 86759797
 86c6a300 8800929a3b28 86358c30 8020
 8020 8800929a3b38 861c6850 8800929a3b88
Call Trace:
 [] dump_stack+0x4e/0x7a
 [] should_fail+0x100/0x110
 [] should_failslab+0x40/0x50
 [] kmem_cache_alloc+0x5e/0x270
 [] ida_pre_get+0x69/0xf0
 [] ? proc_fill_super+0xa0/0xa0
 [] get_anon_bdev+0x39/0x120
 [] ? proc_fill_super+0xa0/0xa0
 [] set_anon_super+0x16/0x30
 [] proc_set_super+0x1d/0x80
 [] sget+0x33a/0x400
 [] ? proc_root_lookup+0x40/0x40
 [] proc_mount+0xa7/0x150
 [] mount_fs+0x38/0x1c0
 [] vfs_kern_mount+0x64/0x120
 [] kern_mount_data+0x19/0x30
 [] pid_ns_prepare_proc+0x1c/0x30
 [] alloc_pid+0x474/0x4c0
 [] ? flush_tlb_mm_range+0x80/0x200
 [] ? copy_thread+0x11d/0x2c0
 [] copy_process.part.29+0xab0/0x1be0
 [] do_fork+0xdd/0x400
 [] ? preempt_count_sub+0xab/0x100
 [] ? __this_cpu_preempt_check+0x13/0x20
 [] SyS_clone+0x16/0x20
 [] stub_clone+0x69/0x90
 [] ? tracesys+0xdd/0xe2

Should proc_flush_task just be checking for a NULL upid->ns ?
Or is there something in the pid_ns_prepare_proc failure path
that we're failing to undo ?

thoughts?

I don't know how feasible it would be to hit that in real life
without the fault injection stuff, but an oops can't be the right
thing to do in any case.

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


Re: [GIT PULL] Global signal cleanup

2014-08-07 Thread Stephen Rothwell
Hi all,

On Thu, 7 Aug 2014 08:53:56 -1000 Linus Torvalds 
 wrote:
>
> On Wed, Aug 6, 2014 at 9:35 PM, Richard Weinberger  wrote:
> >
> > It would be nice to see these rules written down somewhere.
> 
> The rules have been pretty clear: "don't rebase public trees".
> 
> That's always been the basic rule. There are _exceptions_ when
> rebasing is the right thing to do, and they all boil down to "lesser
> of two evils", but the evils really have to be pretty big.
> 
> Possible reasons to rebase:
> 
>  (a) It's not public yet. You haven't pushed to kernel.org or any
> other public site, and nobody saw you do it.

So this would not be in linux-next, so I don't care :-)

>  (b) You *really* screwed up, and the downsides of rebasing are
> smaller than the downsides of exposing it.
> 
>  As in "oops, that half-way commit doesn't even compile or work at
> all, so leaving it in that state will screw up anybody trying to find
> other bugs with 'git bisect'"
> 
>  At the same time, if you do this just before pushing to me, maybe
> you should take a step back and say "oops, my tree was completely
> broken, maybe I shouldn't push this to Linus just after fixing it".

And this is fine but shouldn't happen just before sending a pull
request (as Linus said).  But may also require informing anyone who
depends on your tree (especially if that other tree is also in
linux-next ... otherwise I could easily end up with both versions).

>  (c) You want to clean things up, and you're not even remotely ready
> to push things upstream, and while people have *seen* your work,
> nobody relies on it or uses it.

And this should not be in linux-next yet, so again I don't care and
shouldn't see it.

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


signature.asc
Description: PGP signature


RE: [PATCH] Hyperv: Trigger DHCP renew after host hibernation

2014-08-07 Thread Dexuan Cui
> -Original Message-
> From: Richard Weinberger [mailto:richard.weinber...@gmail.com]
> Sent: Friday, August 8, 2014 6:37 AM
> To: David Miller; Yue Zhang (OSTC DEV)
> Cc: o...@aepfle.de; net...@vger.kernel.org; driverdev-
> de...@linuxdriverproject.org; LKML; Greg KH; jasow...@redhat.com;
> Haiyang Zhang; KY Srinivasan; Thomas Shao; Dexuan Cui
> Subject: Re: [PATCH] Hyperv: Trigger DHCP renew after host hibernation
> 
> On Mon, Jul 21, 2014 at 11:32 PM, David Miller 
> wrote:
> > From: Olaf Hering 
> > Date: Mon, 21 Jul 2014 11:18:51 +0200
> >
> >> On Mon, Jul 21, Richard Weinberger wrote:
> >>
> >>> My concern is that 10 seconds is maybe not a the right choice.
> >>> (As we cannot know all implementations)
> >>
> >> Until someone reports an issue with it, 10 is fine. Just like 20 or 666.
> >
> > Wrong, this is policy and belongs in userspace.
> 
> The "/etc/init.d/network restart" nonsense now hit Linus' tree.
> Yue, what is your proposal to fix that?
> 
> //richard

Hi Richard and all,
Sorry for the late response -- actually we have been trying to
figure out a solution that's acceptable to all.

IMO the most feasible and need-the-least-change solution may be:
the hyperv network VSC driver passes the event
RNDIS_STATUS_NETWORK_CHANGE to the udev daemon?

In this way, every distro only needs to add a udev rule, which should
be simple.

Any comment?

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

disable "Call Trace:"

2014-08-07 Thread 積丹尼 Dan Jacobson
Idea: if the user could disable
the "Call Trace:"
seen upon "Kernel panic - not syncing: attempted to kill init!"
he would then be able to see more lines above without having it shoved
off the screen with the useless (to him) call trace.

e.g., using panic=222 call_trace=disabled would give him enough time and room
to read more of what happened from the screen.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 1/5] tracing: Do not do anything special with tracepoint_string when tracing is disabled

2014-08-07 Thread Nicolas Pitre
On Thu, 7 Aug 2014, Steven Rostedt wrote:

> Because ftrace_events.h is not included when config tracing is not
> enabled, I got error messages when compiling arm and arm64 without
> tracing enabled. This is the new patch I'm now testing that moves the
> tracepoint_string code to include/linux/tracepoint.h as well.

Makes sense.



> 
> -- Steve
> 
> From 3c49b52b155d0f723792377e1a4480a0e7ca0ba2 Mon Sep 17 00:00:00 2001
> From: Steven Rostedt 
> Date: Fri, 25 Jul 2014 16:05:29 -0400
> Subject: [PATCH] tracing: Do not do anything special with tracepoint_string
>  when tracing is disabled
> 
> When CONFIG_TRACING is not enabled, there's no reason to save the trace
> strings either by the linker or as a static variable that can be
> referenced later. Simply pass back the string that is given to
> tracepoint_string().
> 
> Had to move the define to include/linux/tracepoint.h so that it is still
> visible when CONFIG_TRACING is not set.
> 
> Link: 
> http://lkml.kernel.org/p/1406318733-26754-2-git-send-email-nicolas.pi...@linaro.org
> 
> Suggested-by: Nicolas Pitre 
> Signed-off-by: Steven Rostedt 
> ---
>  include/linux/ftrace_event.h | 34 --
>  include/linux/tracepoint.h   | 44 
> 
>  2 files changed, 44 insertions(+), 34 deletions(-)
> 
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index cff3106ffe2c..c9f619a2070f 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -574,40 +574,6 @@ do { 
> \
>   __trace_printk(ip, fmt, ##args);\
>  } while (0)
>  
> -/**
> - * tracepoint_string - register constant persistent string to trace system
> - * @str - a constant persistent string that will be referenced in tracepoints
> - *
> - * If constant strings are being used in tracepoints, it is faster and
> - * more efficient to just save the pointer to the string and reference
> - * that with a printf "%s" instead of saving the string in the ring buffer
> - * and wasting space and time.
> - *
> - * The problem with the above approach is that userspace tools that read
> - * the binary output of the trace buffers do not have access to the string.
> - * Instead they just show the address of the string which is not very
> - * useful to users.
> - *
> - * With tracepoint_string(), the string will be registered to the tracing
> - * system and exported to userspace via the debugfs/tracing/printk_formats
> - * file that maps the string address to the string text. This way userspace
> - * tools that read the binary buffers have a way to map the pointers to
> - * the ASCII strings they represent.
> - *
> - * The @str used must be a constant string and persistent as it would not
> - * make sense to show a string that no longer exists. But it is still fine
> - * to be used with modules, because when modules are unloaded, if they
> - * had tracepoints, the ring buffers are cleared too. As long as the string
> - * does not change during the life of the module, it is fine to use
> - * tracepoint_string() within a module.
> - */
> -#define tracepoint_string(str)   
> \
> - ({  \
> - static const char *___tp_str __tracepoint_string = str; \
> - ___tp_str;  \
> - })
> -#define __tracepoint_string  __attribute__((section("__tracepoint_str")))
> -
>  #ifdef CONFIG_PERF_EVENTS
>  struct perf_event;
>  
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 2e2a5f7717e5..b1293f15f592 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -249,6 +249,50 @@ extern void syscall_unregfunc(void);
>  
>  #endif /* CONFIG_TRACEPOINTS */
>  
> +#ifdef CONFIG_TRACING
> +/**
> + * tracepoint_string - register constant persistent string to trace system
> + * @str - a constant persistent string that will be referenced in tracepoints
> + *
> + * If constant strings are being used in tracepoints, it is faster and
> + * more efficient to just save the pointer to the string and reference
> + * that with a printf "%s" instead of saving the string in the ring buffer
> + * and wasting space and time.
> + *
> + * The problem with the above approach is that userspace tools that read
> + * the binary output of the trace buffers do not have access to the string.
> + * Instead they just show the address of the string which is not very
> + * useful to users.
> + *
> + * With tracepoint_string(), the string will be registered to the tracing
> + * system and exported to userspace via the debugfs/tracing/printk_formats
> + * file that maps the string address to the string text. This way userspace
> + * tools that read the binary buffers have a way to map the pointers to
> + * the ASCII strings they repres

Re: [GIT PULL] SELinux/NetLabel fixes for 3.17

2014-08-07 Thread Stephen Rothwell
Hi Paul,

I am not sure who this was directed at, but if you want Linus to pull
these (and that would be good) you need to send this to him explicitly.

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


signature.asc
Description: PGP signature


Re: [RFC 2/3] zsmalloc/zram: add zs_get_max_size_bytes and use it in zram

2014-08-07 Thread David Horner
 [2/3]


 But why isn't mem_used_max writable? (save tearing down and rebuilding
 device to reset max)

 static DEVICE_ATTR(mem_used_max, S_IRUGO, mem_used_max_show, NULL);

 static DEVICE_ATTR(mem_used_max, S_IRUGO | S_IWUSR, mem_used_max_show, NULL);

   with a check in the store() that the new value is positive and less
than current max?


 I'm also a little puzzled why there is a new API zs_get_max_size_bytes if
 the data is accessible through sysfs?
 Especially if max limit will be (as you propose for [3/3]) through accessed
 through zsmalloc and hence zram needn't access.



  [3/3]
 I concur that the zram limit is best implemented in zsmalloc.
 I am looking forward to that revised code.


> From: Minchan Kim  kernel.org>
> Subject: [RFC 2/3] zsmalloc/zram: add zs_get_max_size_bytes and use it in
> zram
> 
> Newsgroups: gmane.linux.kernel.mm
> , gmane.linux.kernel
> 
> Date: 2014-08-05 08:02:02 GMT (5 hours and 4 minutes ago)
>
> Normally, zram user can get maximum memory zsmalloc consumed via
> polling mem_used_total with sysfs in userspace.
>
> But it has a critical problem because user can miss peak memory
> usage during update interval so that gap between them could be
> huge when memory pressure is really heavy.
>
> This patch adds new API zs_get_max_size_bytes in zsmalloc so
> user(ex, zram) doesn't need to poll in short interval to get
> exact value.
>
> User can just see max memory usage once his test workload is
> done. It's pretty handy and accurate.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: Weird NET_RX softirq behavior

2014-08-07 Thread Jisheng Zhang
Hi Dmitry,

On Thu, 7 Aug 2014 07:18:13 -0700
Dmitry Popov  wrote:

> On Thu, 7 Aug 2014 17:10:50 +0800
> Jisheng Zhang  wrote:
> 
> > 2. only one netdev in the system: eth0.
> 
> There should also be lo (loopback) at least.

Yep, I forget that ;)

> 
> > 4. But NET_RX seems abnormal
> > ~ # cat /proc/softirqs 
> > CPU0   CPU1   CPU2   CPU3   
> >   NET_RX: 445587322983  0
> > 
> > I'm expecting NET_RX under CPU1, 2, 3 should be zero. Any suggestions
> > about this abnormal behavior?
> 
> Do you have any loopback traffic? It could be handled by CPU1/2 explaining
> non-zero NET_RX counters.

Yes. lo only send and recive 7 packets so far, about 1400bytes. Seems small
comparing with the CPU1 and CPU2 NET_RX softirq numbers, right?

Any other possible case?

Thanks for your reply,
Jisheng
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 1/5] tracing: Do not do anything special with tracepoint_string when tracing is disabled

2014-08-07 Thread Steven Rostedt
Because ftrace_events.h is not included when config tracing is not
enabled, I got error messages when compiling arm and arm64 without
tracing enabled. This is the new patch I'm now testing that moves the
tracepoint_string code to include/linux/tracepoint.h as well.

-- Steve

>From 3c49b52b155d0f723792377e1a4480a0e7ca0ba2 Mon Sep 17 00:00:00 2001
From: Steven Rostedt 
Date: Fri, 25 Jul 2014 16:05:29 -0400
Subject: [PATCH] tracing: Do not do anything special with tracepoint_string
 when tracing is disabled

When CONFIG_TRACING is not enabled, there's no reason to save the trace
strings either by the linker or as a static variable that can be
referenced later. Simply pass back the string that is given to
tracepoint_string().

Had to move the define to include/linux/tracepoint.h so that it is still
visible when CONFIG_TRACING is not set.

Link: 
http://lkml.kernel.org/p/1406318733-26754-2-git-send-email-nicolas.pi...@linaro.org

Suggested-by: Nicolas Pitre 
Signed-off-by: Steven Rostedt 
---
 include/linux/ftrace_event.h | 34 --
 include/linux/tracepoint.h   | 44 
 2 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index cff3106ffe2c..c9f619a2070f 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -574,40 +574,6 @@ do {   
\
__trace_printk(ip, fmt, ##args);\
 } while (0)
 
-/**
- * tracepoint_string - register constant persistent string to trace system
- * @str - a constant persistent string that will be referenced in tracepoints
- *
- * If constant strings are being used in tracepoints, it is faster and
- * more efficient to just save the pointer to the string and reference
- * that with a printf "%s" instead of saving the string in the ring buffer
- * and wasting space and time.
- *
- * The problem with the above approach is that userspace tools that read
- * the binary output of the trace buffers do not have access to the string.
- * Instead they just show the address of the string which is not very
- * useful to users.
- *
- * With tracepoint_string(), the string will be registered to the tracing
- * system and exported to userspace via the debugfs/tracing/printk_formats
- * file that maps the string address to the string text. This way userspace
- * tools that read the binary buffers have a way to map the pointers to
- * the ASCII strings they represent.
- *
- * The @str used must be a constant string and persistent as it would not
- * make sense to show a string that no longer exists. But it is still fine
- * to be used with modules, because when modules are unloaded, if they
- * had tracepoints, the ring buffers are cleared too. As long as the string
- * does not change during the life of the module, it is fine to use
- * tracepoint_string() within a module.
- */
-#define tracepoint_string(str) \
-   ({  \
-   static const char *___tp_str __tracepoint_string = str; \
-   ___tp_str;  \
-   })
-#define __tracepoint_string__attribute__((section("__tracepoint_str")))
-
 #ifdef CONFIG_PERF_EVENTS
 struct perf_event;
 
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 2e2a5f7717e5..b1293f15f592 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -249,6 +249,50 @@ extern void syscall_unregfunc(void);
 
 #endif /* CONFIG_TRACEPOINTS */
 
+#ifdef CONFIG_TRACING
+/**
+ * tracepoint_string - register constant persistent string to trace system
+ * @str - a constant persistent string that will be referenced in tracepoints
+ *
+ * If constant strings are being used in tracepoints, it is faster and
+ * more efficient to just save the pointer to the string and reference
+ * that with a printf "%s" instead of saving the string in the ring buffer
+ * and wasting space and time.
+ *
+ * The problem with the above approach is that userspace tools that read
+ * the binary output of the trace buffers do not have access to the string.
+ * Instead they just show the address of the string which is not very
+ * useful to users.
+ *
+ * With tracepoint_string(), the string will be registered to the tracing
+ * system and exported to userspace via the debugfs/tracing/printk_formats
+ * file that maps the string address to the string text. This way userspace
+ * tools that read the binary buffers have a way to map the pointers to
+ * the ASCII strings they represent.
+ *
+ * The @str used must be a constant string and persistent as it would not
+ * make sense to show a string that no longer exists. But it is still fine
+ * to be used with modules, because when modules are unloaded, if they
+ * had tracepoints, the ring buffe

[PATCH] Removed repeated word in comments in arch/tile/include/uapi/arch/sim_def.h

2014-08-07 Thread Kurt McAlpine
Hello,

I have created a simple patch that removes repeated words in 
arch/tile/include/uapi/arch/sim_def.h

Thanks,
Kurt McAlpine
>From 7496bc191f1ea2fde0af9d316e5330bc99e5638d Mon Sep 17 00:00:00 2001
From: Kurt McAlpine 
Date: Thu, 7 Aug 2014 08:50:25 +1200
Subject: [PATCH] Removed repeated word in comments
Signed-off-by: Kurt McAlpine 

---
 arch/tile/include/uapi/arch/sim_def.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/tile/include/uapi/arch/sim_def.h b/arch/tile/include/uapi/arch/sim_def.h
index 4b44a2b..1c06953 100644
--- a/arch/tile/include/uapi/arch/sim_def.h
+++ b/arch/tile/include/uapi/arch/sim_def.h
@@ -360,19 +360,19 @@
  * @{
  */
 
-/** Use with with SIM_PROFILER_CHIP_xxx to control the memory controllers. */
+/** Use with SIM_PROFILER_CHIP_xxx to control the memory controllers. */
 #define SIM_CHIP_MEMCTL0x001
 
-/** Use with with SIM_PROFILER_CHIP_xxx to control the XAUI interface. */
+/** Use with SIM_PROFILER_CHIP_xxx to control the XAUI interface. */
 #define SIM_CHIP_XAUI  0x002
 
-/** Use with with SIM_PROFILER_CHIP_xxx to control the PCIe interface. */
+/** Use with SIM_PROFILER_CHIP_xxx to control the PCIe interface. */
 #define SIM_CHIP_PCIE  0x004
 
-/** Use with with SIM_PROFILER_CHIP_xxx to control the MPIPE interface. */
+/** Use with SIM_PROFILER_CHIP_xxx to control the MPIPE interface. */
 #define SIM_CHIP_MPIPE 0x008
 
-/** Use with with SIM_PROFILER_CHIP_xxx to control the TRIO interface. */
+/** Use with SIM_PROFILER_CHIP_xxx to control the TRIO interface. */
 #define SIM_CHIP_TRIO  0x010
 
 /** Reference all chip devices. */
-- 
1.9.1



Re: Linux 3.15.9

2014-08-07 Thread Greg KH

diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt
index c584a51add15..afe68ddbe6a4 100644
--- a/Documentation/x86/x86_64/mm.txt
+++ b/Documentation/x86/x86_64/mm.txt
@@ -12,6 +12,8 @@ c900 - e8ff (=45 bits) 
vmalloc/ioremap space
 e900 - e9ff (=40 bits) hole
 ea00 - eaff (=40 bits) virtual memory map (1TB)
 ... unused hole ...
+ff00 - ff7f (=39 bits) %esp fixup stacks
+... unused hole ...
 8000 - a000 (=512 MB)  kernel text mapping, from phys 0
 a000 - ff5f (=1525 MB) module mapping space
 ff60 - ffdf (=8 MB) vsyscalls
diff --git a/Makefile b/Makefile
index d5d9a22a404a..25b85aba1e2e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 15
-SUBLEVEL = 8
+SUBLEVEL = 9
 EXTRAVERSION =
 NAME = Double Funky Skunk
 
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index 5babba0a3a75..904dcf5973f3 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -182,6 +182,7 @@
regulator-name = "ldo3";
regulator-min-microvolt = <180>;
regulator-max-microvolt = <180>;
+   regulator-always-on;
regulator-boot-on;
};
 
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi
index ab1116d086be..83a5b8685bd9 100644
--- a/arch/arm/boot/dts/hi3620.dtsi
+++ b/arch/arm/boot/dts/hi3620.dtsi
@@ -73,7 +73,7 @@
 
L2: l2-cache {
compatible = "arm,pl310-cache";
-   reg = <0xfc1 0x10>;
+   reg = <0x10 0x10>;
interrupts = <0 15 4>;
cache-unified;
cache-level = <2>;
diff --git a/arch/arm/crypto/aesbs-glue.c b/arch/arm/crypto/aesbs-glue.c
index 4522366da759..15468fbbdea3 100644
--- a/arch/arm/crypto/aesbs-glue.c
+++ b/arch/arm/crypto/aesbs-glue.c
@@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkcipher_desc *desc,
dst += AES_BLOCK_SIZE;
} while (--blocks);
}
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
@@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
  walk.nbytes, &ctx->dec, walk.iv);
kernel_neon_end();
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
while (walk.nbytes) {
u32 blocks = walk.nbytes / AES_BLOCK_SIZE;
@@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
dst += AES_BLOCK_SIZE;
src += AES_BLOCK_SIZE;
} while (--blocks);
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
@@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkcipher_desc *desc,
bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
  walk.nbytes, &ctx->enc, walk.iv);
kernel_neon_end();
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
@@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkcipher_desc *desc,
bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr,
  walk.nbytes, &ctx->dec, walk.iv);
kernel_neon_end();
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 17cd39360afe..93914d220069 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -50,6 +50,16 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
 soc_is_omap54xx() || soc_is_dra7xx())
return 1;
 
+   if (ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW ||
+ecc_opt == OMAP_ECC_BCH8_CODE_HW_DETECTION_SW) {
+   if (cpu_is_omap24xx())
+   return 0;
+   else if (cpu_is_omap3630() && (GET_OMAP_REVISION() == 0))

Linux 3.14.16

2014-08-07 Thread Greg KH
I'm announcing the release of the 3.14.16 kernel.

All users of the 3.14 kernel series must upgrade.

The updated 3.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/x86/x86_64/mm.txt |2 
 Makefile|2 
 arch/arm/boot/dts/dra7-evm.dts  |1 
 arch/arm/boot/dts/hi3620.dtsi   |2 
 arch/arm/crypto/aesbs-glue.c|   10 -
 arch/arm/mm/idmap.c |7 +
 arch/arm/mm/mmu.c   |6 
 arch/x86/Kconfig|   25 +++
 arch/x86/include/asm/espfix.h   |   16 ++
 arch/x86/include/asm/irqflags.h |2 
 arch/x86/include/asm/pgtable_64_types.h |2 
 arch/x86/include/asm/setup.h|2 
 arch/x86/kernel/Makefile|1 
 arch/x86/kernel/entry_32.S  |   12 +
 arch/x86/kernel/entry_64.S  |   77 ++-
 arch/x86/kernel/espfix_64.c |  208 
 arch/x86/kernel/ldt.c   |   10 -
 arch/x86/kernel/paravirt_patch_64.c |2 
 arch/x86/kernel/smpboot.c   |7 +
 arch/x86/mm/dump_pagetables.c   |   31 +++-
 arch/x86/vdso/vdso32-setup.c|8 -
 arch/x86/xen/setup.c|9 -
 arch/xtensa/kernel/vectors.S|  158 
 arch/xtensa/kernel/vmlinux.lds.S|4 
 crypto/af_alg.c |2 
 drivers/cpufreq/cpufreq.c   |6 
 drivers/iio/accel/bma180.c  |8 -
 drivers/iio/industrialio-buffer.c   |2 
 drivers/md/dm-bufio.c   |2 
 drivers/md/dm-cache-target.c|   13 --
 drivers/net/wireless/ath/ath9k/xmit.c   |9 +
 drivers/pnp/pnpacpi/core.c  |3 
 drivers/rapidio/devices/tsi721_dma.c|8 +
 drivers/scsi/scsi_lib.c |8 +
 drivers/staging/vt6655/bssdb.c  |2 
 drivers/staging/vt6655/device_main.c|7 -
 include/dt-bindings/pinctrl/dra.h   |7 -
 include/linux/printk.h  |6 
 init/main.c |4 
 kernel/printk/printk.c  |2 
 kernel/sched/core.c |2 
 kernel/sched/deadline.c |2 
 kernel/sched/rt.c   |2 
 kernel/time/clockevents.c   |   10 -
 kernel/time/sched_clock.c   |4 
 lib/btree.c |1 
 mm/memcontrol.c |4 
 mm/page-writeback.c |6 
 mm/page_alloc.c |   16 +-
 net/l2tp/l2tp_ppp.c |4 
 net/mac80211/tx.c   |   27 ++--
 net/wireless/trace.h|3 
 52 files changed, 628 insertions(+), 146 deletions(-)

Alexandre Bounine (1):
  rapidio/tsi721_dma: fix failure to obtain transaction descriptor

Andy Lutomirski (1):
  x86_64/entry/xen: Do not invoke espfix64 on Xen

Anssi Hannula (1):
  dm cache: fix race affecting dirty block count

Boris Ostrovsky (1):
  x86/espfix/xen: Fix allocation of pages for paravirt page tables

David Rientjes (1):
  mm, thp: do not allow thp faults to avoid cpuset restrictions

David Vrabel (1):
  x86/xen: no need to explicitly register an NMI callback

Eliad Peller (1):
  cfg80211: fix mic_failure tracing

Felix Fietkau (1):
  ath9k: fix aggregation session lockup

Greg Kroah-Hartman (1):
  Linux 3.14.16

Greg Thelen (1):
  dm bufio: fully initialize shrinker

H. Peter Anvin (6):
  Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime 
option"
  x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
  x86, espfix: Move espfix definitions into a separate header file
  x86, espfix: Fix broken header guard
  x86, espfix: Make espfix64 a Kconfig option, fix UML
  x86, espfix: Make it possible to disable 16-bit support

Haojian Zhuang (1):
  ARM: dts: fix L2 address in Hi3620

James Bottomley (1):
  scsi: handle flush errors properly

Jan Kara (1):
  timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks

Johannes Berg (1):
  Revert "mac80211: move "bufferable MMPDU" check to fix AP mode scan"

John Stultz (1):
  printk: rename printk_sched to printk_deferred

Konstantin Khlebnikov (1):
  ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout

Lars-Peter Clausen (1):
  iio: buffer: Fix demux table creation

Malcolm Priestley (2):
  staging: vt6655: Fix disassociated messages every 10 seconds
  staging: vt6655: Fix Warning on boot handle_irq_event_percpu.

Ma

Linux 3.15.9

2014-08-07 Thread Greg KH
I'm announcing the release of the 3.15.9 kernel.

All users of the 3.15 kernel series must upgrade.

NOTE, there will only be 1 more 3.15.y kernel release after this one,
please move to 3.16.y now, you have been warned.

The updated 3.15.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.15.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/x86/x86_64/mm.txt |2 
 Makefile|2 
 arch/arm/boot/dts/dra7-evm.dts  |1 
 arch/arm/boot/dts/hi3620.dtsi   |2 
 arch/arm/crypto/aesbs-glue.c|   10 -
 arch/arm/mach-omap2/gpmc-nand.c |   18 +-
 arch/arm/mm/idmap.c |7 +
 arch/arm/mm/mmu.c   |6 
 arch/powerpc/perf/core-book3s.c |6 
 arch/x86/Kconfig|   25 +++
 arch/x86/include/asm/espfix.h   |   16 ++
 arch/x86/include/asm/irqflags.h |2 
 arch/x86/include/asm/pgtable_64_types.h |2 
 arch/x86/include/asm/setup.h|2 
 arch/x86/kernel/Makefile|1 
 arch/x86/kernel/entry_32.S  |   12 +
 arch/x86/kernel/entry_64.S  |   77 ++-
 arch/x86/kernel/espfix_64.c |  208 
 arch/x86/kernel/ldt.c   |   10 -
 arch/x86/kernel/paravirt_patch_64.c |2 
 arch/x86/kernel/smpboot.c   |7 +
 arch/x86/mm/dump_pagetables.c   |   44 +-
 arch/x86/vdso/vdso32-setup.c|8 -
 arch/x86/xen/setup.c|9 -
 arch/xtensa/kernel/vectors.S|  158 
 arch/xtensa/kernel/vmlinux.lds.S|4 
 crypto/af_alg.c |2 
 drivers/gpu/drm/i915/intel_display.c|3 
 drivers/iio/accel/bma180.c  |8 -
 drivers/iio/industrialio-buffer.c   |2 
 drivers/md/dm-bufio.c   |2 
 drivers/md/dm-cache-target.c|   13 --
 drivers/net/wireless/ath/ath9k/xmit.c   |9 +
 drivers/pnp/pnpacpi/core.c  |3 
 drivers/rapidio/devices/tsi721_dma.c|8 +
 drivers/scsi/scsi_lib.c |8 +
 drivers/staging/vt6655/bssdb.c  |2 
 drivers/staging/vt6655/device_main.c|7 -
 fs/open.c   |5 
 include/dt-bindings/pinctrl/dra.h   |7 -
 include/linux/printk.h  |6 
 init/main.c |4 
 kernel/printk/printk.c  |2 
 kernel/sched/core.c |2 
 kernel/sched/deadline.c |2 
 kernel/sched/rt.c   |2 
 kernel/time/clockevents.c   |   10 -
 kernel/time/sched_clock.c   |4 
 lib/btree.c |1 
 mm/memcontrol.c |4 
 mm/page-writeback.c |6 
 mm/page_alloc.c |   16 +-
 net/l2tp/l2tp_ppp.c |4 
 net/mac80211/tx.c   |   20 +--
 net/wireless/trace.h|3 
 55 files changed, 652 insertions(+), 154 deletions(-)

Alexandre Bounine (1):
  rapidio/tsi721_dma: fix failure to obtain transaction descriptor

Andy Lutomirski (1):
  x86_64/entry/xen: Do not invoke espfix64 on Xen

Anssi Hannula (1):
  dm cache: fix race affecting dirty block count

Boris Ostrovsky (1):
  x86/espfix/xen: Fix allocation of pages for paravirt page tables

Christoph Fritz (1):
  ARM: OMAP2+: gpmc: fix gpmc_hwecc_bch_capable()

David Rientjes (1):
  mm, thp: do not allow thp faults to avoid cpuset restrictions

David Vrabel (1):
  x86/xen: no need to explicitly register an NMI callback

Eliad Peller (1):
  cfg80211: fix mic_failure tracing

Eric Biggers (1):
  vfs: fix check for fallocate on active swapfile

Felix Fietkau (1):
  ath9k: fix aggregation session lockup

Greg Kroah-Hartman (1):
  Linux 3.15.9

Greg Thelen (1):
  dm bufio: fully initialize shrinker

H. Peter Anvin (6):
  Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime 
option"
  x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
  x86, espfix: Move espfix definitions into a separate header file
  x86, espfix: Fix broken header guard
  x86, espfix: Make espfix64 a Kconfig option, fix UML
  x86, espfix: Make it possible to disable 16-bit support

Haojian Zhuang (1):
  ARM: dts: fix L2 address in Hi3620

James Bottomley (1):
  scsi: handle flush errors properly

Jan Kara (1):
  timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks

Johannes Berg (1):
  Revert "mac80211: move "bufferable MMPDU" check to fix AP mode

Re: Linux 3.14.16

2014-08-07 Thread Greg KH

diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt
index c584a51add15..afe68ddbe6a4 100644
--- a/Documentation/x86/x86_64/mm.txt
+++ b/Documentation/x86/x86_64/mm.txt
@@ -12,6 +12,8 @@ c900 - e8ff (=45 bits) 
vmalloc/ioremap space
 e900 - e9ff (=40 bits) hole
 ea00 - eaff (=40 bits) virtual memory map (1TB)
 ... unused hole ...
+ff00 - ff7f (=39 bits) %esp fixup stacks
+... unused hole ...
 8000 - a000 (=512 MB)  kernel text mapping, from phys 0
 a000 - ff5f (=1525 MB) module mapping space
 ff60 - ffdf (=8 MB) vsyscalls
diff --git a/Makefile b/Makefile
index 188523e9e880..8b22e24a2d8e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 14
-SUBLEVEL = 15
+SUBLEVEL = 16
 EXTRAVERSION =
 NAME = Remembering Coco
 
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index 5babba0a3a75..904dcf5973f3 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -182,6 +182,7 @@
regulator-name = "ldo3";
regulator-min-microvolt = <180>;
regulator-max-microvolt = <180>;
+   regulator-always-on;
regulator-boot-on;
};
 
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi
index ab1116d086be..83a5b8685bd9 100644
--- a/arch/arm/boot/dts/hi3620.dtsi
+++ b/arch/arm/boot/dts/hi3620.dtsi
@@ -73,7 +73,7 @@
 
L2: l2-cache {
compatible = "arm,pl310-cache";
-   reg = <0xfc1 0x10>;
+   reg = <0x10 0x10>;
interrupts = <0 15 4>;
cache-unified;
cache-level = <2>;
diff --git a/arch/arm/crypto/aesbs-glue.c b/arch/arm/crypto/aesbs-glue.c
index 4522366da759..15468fbbdea3 100644
--- a/arch/arm/crypto/aesbs-glue.c
+++ b/arch/arm/crypto/aesbs-glue.c
@@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkcipher_desc *desc,
dst += AES_BLOCK_SIZE;
} while (--blocks);
}
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
@@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
  walk.nbytes, &ctx->dec, walk.iv);
kernel_neon_end();
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
while (walk.nbytes) {
u32 blocks = walk.nbytes / AES_BLOCK_SIZE;
@@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
dst += AES_BLOCK_SIZE;
src += AES_BLOCK_SIZE;
} while (--blocks);
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
@@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkcipher_desc *desc,
bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
  walk.nbytes, &ctx->enc, walk.iv);
kernel_neon_end();
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
@@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkcipher_desc *desc,
bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr,
  walk.nbytes, &ctx->dec, walk.iv);
kernel_neon_end();
-   err = blkcipher_walk_done(desc, &walk, 0);
+   err = blkcipher_walk_done(desc, &walk, walk.nbytes % 
AES_BLOCK_SIZE);
}
return err;
 }
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 8e0e52eb76b5..d7a0ee898d24 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -25,6 +25,13 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, 
unsigned long end,
pr_warning("Failed to allocate identity pmd.\n");
return;
}
+   /*
+* Copy the original PMD to ensure that the PMD entries for
+* the kernel image are preserved.
+*/
+   if (!pud_none(*pud))
+   memcpy(pmd, pmd_offset(pud, 0),
+ 

Linux 3.10.52

2014-08-07 Thread Greg KH
I'm announcing the release of the 3.10.52 kernel.

All users of the 3.10 kernel series must upgrade.

The updated 3.10.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.10.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/x86/x86_64/mm.txt |2 
 Makefile|2 
 arch/arm/mm/idmap.c |7 +
 arch/x86/Kconfig|   25 +++
 arch/x86/include/asm/espfix.h   |   16 ++
 arch/x86/include/asm/irqflags.h |2 
 arch/x86/include/asm/pgtable_64_types.h |2 
 arch/x86/include/asm/setup.h|2 
 arch/x86/kernel/Makefile|1 
 arch/x86/kernel/entry_32.S  |   12 +
 arch/x86/kernel/entry_64.S  |   77 ++-
 arch/x86/kernel/espfix_64.c |  208 
 arch/x86/kernel/ldt.c   |   10 -
 arch/x86/kernel/paravirt_patch_64.c |2 
 arch/x86/kernel/smpboot.c   |7 +
 arch/x86/mm/dump_pagetables.c   |   39 --
 arch/x86/vdso/vdso32-setup.c|8 -
 crypto/af_alg.c |2 
 drivers/iio/industrialio-buffer.c   |2 
 drivers/net/ethernet/marvell/mvneta.c   |  206 ---
 drivers/rapidio/devices/tsi721_dma.c|8 +
 drivers/scsi/scsi_lib.c |8 +
 drivers/staging/vt6655/bssdb.c  |2 
 drivers/staging/vt6655/device_main.c|7 -
 include/linux/printk.h  |6 
 init/main.c |4 
 kernel/printk.c |2 
 kernel/sched/core.c |2 
 kernel/sched/rt.c   |2 
 kernel/time/clockevents.c   |   10 -
 lib/btree.c |1 
 mm/page_alloc.c |   16 +-
 net/l2tp/l2tp_ppp.c |4 
 net/mac80211/tx.c   |   27 ++--
 net/wireless/trace.h|3 
 35 files changed, 554 insertions(+), 180 deletions(-)

Alexandre Bounine (1):
  rapidio/tsi721_dma: fix failure to obtain transaction descriptor

Andy Lutomirski (1):
  x86_64/entry/xen: Do not invoke espfix64 on Xen

Boris Ostrovsky (1):
  x86/espfix/xen: Fix allocation of pages for paravirt page tables

David Rientjes (1):
  mm, thp: do not allow thp faults to avoid cpuset restrictions

Eliad Peller (1):
  cfg80211: fix mic_failure tracing

Greg Kroah-Hartman (1):
  Linux 3.10.52

H. Peter Anvin (6):
  Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime 
option"
  x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
  x86, espfix: Move espfix definitions into a separate header file
  x86, espfix: Fix broken header guard
  x86, espfix: Make espfix64 a Kconfig option, fix UML
  x86, espfix: Make it possible to disable 16-bit support

James Bottomley (1):
  scsi: handle flush errors properly

Jan Kara (1):
  timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks

Johannes Berg (1):
  Revert "mac80211: move "bufferable MMPDU" check to fix AP mode scan"

John Stultz (1):
  printk: rename printk_sched to printk_deferred

Konstantin Khlebnikov (1):
  ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout

Lars-Peter Clausen (1):
  iio: buffer: Fix demux table creation

Malcolm Priestley (2):
  staging: vt6655: Fix disassociated messages every 10 seconds
  staging: vt6655: Fix Warning on boot handle_irq_event_percpu.

Milan Broz (1):
  crypto: af_alg - properly label AF_ALG socket

Minfei Huang (1):
  lib/btree.c: fix leak of whole btree nodes

Sasha Levin (1):
  net/l2tp: don't fall back on UDP [get|set]sockopt

willy tarreau (5):
  net: mvneta: increase the 64-bit rx/tx stats out of the hot path
  net: mvneta: use per_cpu stats to fix an SMP lock up
  net: mvneta: do not schedule in mvneta_tx_timeout
  net: mvneta: add missing bit descriptions for interrupt masks and causes
  net: mvneta: replace Tx timer with a real interrupt



pgpNetkU_wCnP.pgp
Description: PGP signature


Re: Linux 3.10.52

2014-08-07 Thread Greg KH
diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt
index 881582f75c9c..bd4370487b07 100644
--- a/Documentation/x86/x86_64/mm.txt
+++ b/Documentation/x86/x86_64/mm.txt
@@ -12,6 +12,8 @@ c900 - e8ff (=45 bits) 
vmalloc/ioremap space
 e900 - e9ff (=40 bits) hole
 ea00 - eaff (=40 bits) virtual memory map (1TB)
 ... unused hole ...
+ff00 - ff7f (=39 bits) %esp fixup stacks
+... unused hole ...
 8000 - a000 (=512 MB)  kernel text mapping, from phys 0
 a000 - ff5f (=1525 MB) module mapping space
 ff60 - ffdf (=8 MB) vsyscalls
diff --git a/Makefile b/Makefile
index f9f6ee59c61a..b94f00938acc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 10
-SUBLEVEL = 51
+SUBLEVEL = 52
 EXTRAVERSION =
 NAME = TOSSUG Baby Fish
 
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 83cb3ac27095..c61d2373408c 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -24,6 +24,13 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, 
unsigned long end,
pr_warning("Failed to allocate identity pmd.\n");
return;
}
+   /*
+* Copy the original PMD to ensure that the PMD entries for
+* the kernel image are preserved.
+*/
+   if (!pud_none(*pud))
+   memcpy(pmd, pmd_offset(pud, 0),
+  PTRS_PER_PMD * sizeof(pmd_t));
pud_populate(&init_mm, pud, pmd);
pmd += pmd_index(addr);
} else
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index af88b27ce313..a649cb686692 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -952,10 +952,27 @@ config VM86
default y
depends on X86_32
---help---
- This option is required by programs like DOSEMU to run 16-bit legacy
- code on X86 processors. It also may be needed by software like
- XFree86 to initialize some video cards via BIOS. Disabling this
- option saves about 6k.
+ This option is required by programs like DOSEMU to run
+ 16-bit real mode legacy code on x86 processors. It also may
+ be needed by software like XFree86 to initialize some video
+ cards via BIOS. Disabling this option saves about 6K.
+
+config X86_16BIT
+   bool "Enable support for 16-bit segments" if EXPERT
+   default y
+   ---help---
+ This option is required by programs like Wine to run 16-bit
+ protected mode legacy code on x86 processors.  Disabling
+ this option saves about 300 bytes on i386, or around 6K text
+ plus 16K runtime memory on x86-64,
+
+config X86_ESPFIX32
+   def_bool y
+   depends on X86_16BIT && X86_32
+
+config X86_ESPFIX64
+   def_bool y
+   depends on X86_16BIT && X86_64
 
 config TOSHIBA
tristate "Toshiba Laptop support"
diff --git a/arch/x86/include/asm/espfix.h b/arch/x86/include/asm/espfix.h
new file mode 100644
index ..99efebb2f69d
--- /dev/null
+++ b/arch/x86/include/asm/espfix.h
@@ -0,0 +1,16 @@
+#ifndef _ASM_X86_ESPFIX_H
+#define _ASM_X86_ESPFIX_H
+
+#ifdef CONFIG_X86_64
+
+#include 
+
+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack);
+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr);
+
+extern void init_espfix_bsp(void);
+extern void init_espfix_ap(void);
+
+#endif /* CONFIG_X86_64 */
+
+#endif /* _ASM_X86_ESPFIX_H */
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index bba3cf88e624..0a8b519226b8 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -129,7 +129,7 @@ static inline notrace unsigned long 
arch_local_irq_save(void)
 
 #define PARAVIRT_ADJUST_EXCEPTION_FRAME/*  */
 
-#define INTERRUPT_RETURN   iretq
+#define INTERRUPT_RETURN   jmp native_iret
 #define USERGS_SYSRET64\
swapgs; \
sysretq;
diff --git a/arch/x86/include/asm/pgtable_64_types.h 
b/arch/x86/include/asm/pgtable_64_types.h
index 2d883440cb9a..b1609f2c524c 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -61,6 +61,8 @@ typedef struct { pteval_t pte; } pte_t;
 #define MODULES_VADDR_AC(0xa000, UL)
 #define MODULES_END  _AC(0xff00, UL)
 #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
+#define ESPFIX_PGD_ENTRY _AC(-2, UL)
+#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)
 
 #define EARLY_DYNAMIC_PAGE_TABLES  64
 
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index b7bf3505e1ec..2e327f114a1b 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -62,6 +62,8 @@ static inline void x86_c

Re: Linux 3.4.102

2014-08-07 Thread Greg KH

diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt
index d6498e3cd713..f33a9369e35b 100644
--- a/Documentation/x86/x86_64/mm.txt
+++ b/Documentation/x86/x86_64/mm.txt
@@ -12,6 +12,8 @@ c900 - e8ff (=45 bits) 
vmalloc/ioremap space
 e900 - e9ff (=40 bits) hole
 ea00 - eaff (=40 bits) virtual memory map (1TB)
 ... unused hole ...
+ff00 - ff7f (=39 bits) %esp fixup stacks
+... unused hole ...
 8000 - a000 (=512 MB)  kernel text mapping, from phys 0
 a000 - fff0 (=1536 MB) module mapping space
 
diff --git a/Makefile b/Makefile
index a22bcb567348..dd03fa5777a0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 4
-SUBLEVEL = 101
+SUBLEVEL = 102
 EXTRAVERSION =
 NAME = Saber-toothed Squirrel
 
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index ab88ed4f8e08..ef8f2df02540 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -22,6 +22,13 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, 
unsigned long end,
pr_warning("Failed to allocate identity pmd.\n");
return;
}
+   /*
+* Copy the original PMD to ensure that the PMD entries for
+* the kernel image are preserved.
+*/
+   if (!pud_none(*pud))
+   memcpy(pmd, pmd_offset(pud, 0),
+  PTRS_PER_PMD * sizeof(pmd_t));
pud_populate(&init_mm, pud, pmd);
pmd += pmd_index(addr);
} else
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9df4ea1caaf1..917c1098775b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -915,10 +915,27 @@ config VM86
default y
depends on X86_32
---help---
- This option is required by programs like DOSEMU to run 16-bit legacy
- code on X86 processors. It also may be needed by software like
- XFree86 to initialize some video cards via BIOS. Disabling this
- option saves about 6k.
+ This option is required by programs like DOSEMU to run
+ 16-bit real mode legacy code on x86 processors. It also may
+ be needed by software like XFree86 to initialize some video
+ cards via BIOS. Disabling this option saves about 6K.
+
+config X86_16BIT
+   bool "Enable support for 16-bit segments" if EXPERT
+   default y
+   ---help---
+ This option is required by programs like Wine to run 16-bit
+ protected mode legacy code on x86 processors.  Disabling
+ this option saves about 300 bytes on i386, or around 6K text
+ plus 16K runtime memory on x86-64,
+
+config X86_ESPFIX32
+   def_bool y
+   depends on X86_16BIT && X86_32
+
+config X86_ESPFIX64
+   def_bool y
+   depends on X86_16BIT && X86_64
 
 config TOSHIBA
tristate "Toshiba Laptop support"
diff --git a/arch/x86/include/asm/espfix.h b/arch/x86/include/asm/espfix.h
new file mode 100644
index ..99efebb2f69d
--- /dev/null
+++ b/arch/x86/include/asm/espfix.h
@@ -0,0 +1,16 @@
+#ifndef _ASM_X86_ESPFIX_H
+#define _ASM_X86_ESPFIX_H
+
+#ifdef CONFIG_X86_64
+
+#include 
+
+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack);
+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr);
+
+extern void init_espfix_bsp(void);
+extern void init_espfix_ap(void);
+
+#endif /* CONFIG_X86_64 */
+
+#endif /* _ASM_X86_ESPFIX_H */
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index bba3cf88e624..0a8b519226b8 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -129,7 +129,7 @@ static inline notrace unsigned long 
arch_local_irq_save(void)
 
 #define PARAVIRT_ADJUST_EXCEPTION_FRAME/*  */
 
-#define INTERRUPT_RETURN   iretq
+#define INTERRUPT_RETURN   jmp native_iret
 #define USERGS_SYSRET64\
swapgs; \
sysretq;
diff --git a/arch/x86/include/asm/pgtable_64_types.h 
b/arch/x86/include/asm/pgtable_64_types.h
index 766ea16fbbbd..51817fae7047 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -59,5 +59,7 @@ typedef struct { pteval_t pte; } pte_t;
 #define MODULES_VADDR_AC(0xa000, UL)
 #define MODULES_END  _AC(0xff00, UL)
 #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
+#define ESPFIX_PGD_ENTRY _AC(-2, UL)
+#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)
 
 #endif /* _ASM_X86_PGTABLE_64_DEFS_H */
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index d0f19f9fb846..16c7971457f8 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -61,6 +61,8 @@ static inline void x86_ce4100_early_setup(void) { }
 
 #ifndef _SETUP
 
+

Linux 3.4.102

2014-08-07 Thread Greg KH
I'm announcing the release of the 3.4.102 kernel.

All users of the 3.4 kernel series must upgrade.

The updated 3.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.4.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/x86/x86_64/mm.txt |2 
 Makefile|2 
 arch/arm/mm/idmap.c |7 +
 arch/x86/Kconfig|   25 +++
 arch/x86/include/asm/espfix.h   |   16 ++
 arch/x86/include/asm/irqflags.h |2 
 arch/x86/include/asm/pgtable_64_types.h |2 
 arch/x86/include/asm/setup.h|2 
 arch/x86/kernel/Makefile|1 
 arch/x86/kernel/entry_32.S  |   12 +
 arch/x86/kernel/entry_64.S  |   80 ++--
 arch/x86/kernel/espfix_64.c |  208 
 arch/x86/kernel/ldt.c   |   10 -
 arch/x86/kernel/paravirt_patch_64.c |2 
 arch/x86/kernel/smpboot.c   |7 +
 arch/x86/mm/dump_pagetables.c   |   39 --
 arch/x86/vdso/vdso32-setup.c|8 -
 crypto/af_alg.c |2 
 drivers/scsi/scsi_lib.c |8 +
 include/linux/printk.h  |6 
 include/linux/skbuff.h  |   17 --
 init/main.c |4 
 kernel/printk.c |2 
 kernel/sched/core.c |2 
 kernel/sched/rt.c   |2 
 kernel/time/clockevents.c   |   10 -
 lib/btree.c |1 
 mm/mlock.c  |2 
 mm/page_alloc.c |   16 +-
 mm/rmap.c   |   14 +-
 net/ipv4/ip_forward.c   |   68 --
 net/ipv6/addrconf.c |   14 +-
 net/ipv6/ip6_output.c   |   13 --
 net/l2tp/l2tp_ppp.c |4 
 34 files changed, 446 insertions(+), 164 deletions(-)

Andy Lutomirski (1):
  x86_64/entry/xen: Do not invoke espfix64 on Xen

Boris Ostrovsky (1):
  x86/espfix/xen: Fix allocation of pages for paravirt page tables

David Rientjes (1):
  mm, thp: do not allow thp faults to avoid cpuset restrictions

Gao feng (1):
  ipv6: reallocate addrconf router for ipv6 address when lo device up

Greg Kroah-Hartman (2):
  Revert: "net: ip, ipv6: handle gso skbs in forwarding path"
  Linux 3.4.102

H. Peter Anvin (6):
  Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime 
option"
  x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
  x86, espfix: Move espfix definitions into a separate header file
  x86, espfix: Fix broken header guard
  x86, espfix: Make espfix64 a Kconfig option, fix UML
  x86, espfix: Make it possible to disable 16-bit support

James Bottomley (1):
  scsi: handle flush errors properly

Jan Kara (1):
  timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks

John Stultz (1):
  printk: rename printk_sched to printk_deferred

Konstantin Khlebnikov (1):
  ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout

Milan Broz (1):
  crypto: af_alg - properly label AF_ALG socket

Minfei Huang (1):
  lib/btree.c: fix leak of whole btree nodes

Sasha Levin (1):
  net/l2tp: don't fall back on UDP [get|set]sockopt

Vlastimil Babka (1):
  mm: try_to_unmap_cluster() should lock_page() before mlocking



pgpGgP6pQ5XLZ.pgp
Description: PGP signature


Re: [PATCH] staging: vt6655: wpactl.c: Fix sparse warnings

2014-08-07 Thread Greg Kroah-Hartman
On Thu, Aug 07, 2014 at 11:08:34PM +0100, Martin Berglund wrote:
> Add missing __user macro casting in the function wpa_set_keys.
> This is okay since the function handles the possibility of
> param->u.wpa_key.key and param->u.wpa_key.seq pointing to
> kernelspace using a flag, fcpfkernel.
> 
> Signed-off-by: Martin Berglund 
> ---
> This was submitted as part of Eudyptula challenge task 16
> 
>  drivers/staging/vt6655/wpactl.c |8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
> index 5f454ca..d75dd79 100644
> --- a/drivers/staging/vt6655/wpactl.c
> +++ b/drivers/staging/vt6655/wpactl.c
> @@ -224,7 +224,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
>   } else {
>   spin_unlock_irq(&pDevice->lock);
>   if (param->u.wpa_key.key &&
> - copy_from_user(&abyKey[0], param->u.wpa_key.key, 
> param->u.wpa_key.key_len)) {
> + copy_from_user(&abyKey[0],
> +(void __user *)param->u.wpa_key.key,

Would it be better to mark this pointer as __user in the structure
itself?  Or is it also used as a kernel structure in other places?

thanks,

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


Re: [RFC PATCH] kprobes: arm: enable OPTPROBES for arm 32

2014-08-07 Thread Masami Hiramatsu
(2014/08/08 10:25), Wang Nan wrote:
> On 2014/8/7 14:59, Masami Hiramatsu wrote:
>> (2014/08/06 15:24), Wang Nan wrote:
> +
> +static void
> +optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
> +{
> + unsigned long flags;
> +
> + regs->ARM_pc = (unsigned long)op->kp.addr;
> + regs->ARM_ORIG_r0 = ~0UL;
> +
> +
> + local_irq_save(flags);
> + /* 
> +  * This is possible if op is under delayed unoptimizing.
> +  * We need simulate the replaced instruction.
> +  */
> + if (kprobe_disabled(&op->kp)) {
> + struct kprobe *p = &op->kp;
> + op->kp.ainsn.insn_singlestep(p->opcode, &p->ainsn, regs);
> + } else {
> + kprobe_handler(regs);
> + }

 You don't need brace "{}" for one statement.
 By the way, why don't you call opt_pre_handler()?

>>>
>>> I use kprobe_handler because it handles instruction emulation.
>>>
>>> In addition, I'm not very sure whether skipping the complex checks
>>> in kprobe_handler() is safe or not.
>>
>> That seems to do same thing on x86. Then you should do something like
>> the optimized_callback() on x86 as below.
>>
>> static void
>> optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
>> {
>> struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
>> unsigned long flags;
>>
>> local_irq_save(flags);
>> if (kprobe_running()) {
>> kprobes_inc_nmissed_count(&op->kp);
> 
> In this case we still need a singlestep, right?

Ah, right! and if the singlestep requires setting up the regs->ARM_pc,
we also do that before this check. So the right code will be;

static void
optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
{
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
unsigned long flags;

local_irq_save(flags);
/* Save skipped registers */
regs->ARM_pc = (unsigned long)op->kp.addr;
regs->ARM_ORIG_r0 = ~0UL;

if (kprobe_running())
kprobes_inc_nmissed_count(&op->kp);
else {
__this_cpu_write(current_kprobe, &op->kp);
kcb->kprobe_status = KPROBE_HIT_ACTIVE;
opt_pre_handler(&op->kp, regs);
__this_cpu_write(current_kprobe, NULL);
}
op->kp.ainsn.insn_singlestep(op->kp.opcode, &op->kp.ainsn, regs);
local_irq_restore(flags);
}

Thank you,

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


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


Re: [PATCH] sched: Reduce contention in update_cfs_rq_blocked_load

2014-08-07 Thread Yuyang Du
On Wed, Aug 06, 2014 at 11:21:35AM -0700, Jason Low wrote:
> I ran these tests with most of the AIM7 workloads to compare its
> performance between a 3.16 kernel and the kernel with these patches
> applied.
> 
> The table below contains the percent difference between the baseline
> kernel and the kernel with the patches at various user counts. A
> positive percent means the kernel with the patches performed better,
> while a negative percent means the baseline performed better.
> 
> Based on these numbers, for many of the workloads, the change was
> beneficial in those highly contended, while it had - impact in many
> of the lightly/moderately contended case (10 to 90 users).
> 
> -
>   |   10-90   |  100-1000   |  1100-2000
>   |   users   |   users |   users
> -
> alltests  |   -3.37%  |  -10.64%|   -2.25%
> -
> all_utime |   +0.33%  |   +3.73%|   +3.33%
> -
> compute   |   -5.97%  |   +2.34%|   +3.22%
> -
> custom|  -31.61%  |  -10.29%|  +15.23%
> -
> disk  |  +24.64%  |  +28.96%|  +21.28%
> -
> fserver   |   -1.35%  |   +4.82%|   +9.35%
> -
> high_systime  |   -6.73%  |   -6.28%|  +12.36%
> -
> shared|  -28.31%  |  -19.99%|   -7.10%
> -
> short |  -44.63%  |  -37.48%|  -33.62%
> -
> 
Thanks, Jason. Sorry for late response.

What about the variation of the tests? The machine you test on?

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


linux-next: build failure after merge of the ext3 tree

2014-08-07 Thread Stephen Rothwell
Hi Jan,

After merging the ext3 tree, today's linux-next build (x86_64
allmodconfig) failed like this:

ERROR: "new_inode_pseudo" [fs/reiserfs/reiserfs.ko] undefined!

Caused by commit 523096294315 ("reiserfs: Avoid warning from 
unlock_new_inode()").

I have used the ext3 tree from next-20140807 for today.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


signature.asc
Description: PGP signature


Re: [PATCH 0/5] irq / PM: Shared IRQs vs IRQF_NO_SUSPEND and suspend-to-idle wakeup

2014-08-07 Thread Rafael J. Wysocki
On Tuesday, August 05, 2014 05:22:57 PM Rafael J. Wysocki wrote:
> On Friday, August 01, 2014 04:29:40 PM Rafael J. Wysocki wrote:
> > On Friday, August 01, 2014 03:43:21 PM Thomas Gleixner wrote:
> > > On Fri, 1 Aug 2014, Rafael J. Wysocki wrote:
> > > > OK, I guess "IRQ_HANDLED from a wakeup interrupt" may be interpreted as
> > > > IRQ_HANDLED_PMWAKE.  On the other hand, if that's going to be handled in
> > > > handle_irq_event_percpu(), then using a special return code would save 
> > > > us
> > > > a brach for IRQ_HANDLED interrupts.  We could convert it to IRQ_HANDLED
> > > > immediately then.
> > > 
> > > We can handle it at the end of the function by calling
> > > note_interrupt() unconditionally do the following there:
> > > 
> > >   if (suspended) {
> > >if (ret == IRQ_NONE) {
> > >   if (shared)
> > >  yell_and_abort_or_resume();
> > >  } else {
> > >   abort_or_resume();
> > >  }
> > >   }
> > >   if (noirqdebug)
> > >return;
> > 
> > I see.
> > 
> > > > OK, I'll take a stab at the IRQF_SHARED thing if you don't mind.
> > > 
> > > Definitely not :)
> > > 
> > > > Here's my current understanding of what can be done for IRQF_NO_SUSPEND.
> > > > 
> > > > In suspend_device_irqs():
> > > > 
> > > > (1) If all actions in the list have the same setting (eg. 
> > > > IRQF_NO_SUSPEND unset),
> > > > keep the current behavior.
> > > > (2) If the actions have different settings:
> > > > - Actions with IRQF_NO_SUSPEND set are not modified.
> > > > - Actions with IRQF_NO_SUSPEND unset are switched over to a stub 
> > > > handler.
> > > > - IRQS_SUSPEND_MODE (new flag) is set for the IRQ.
> > > 
> > > Can we please do that in setup_irq() and let the shared ones always
> > > run through the stub? That keeps suspend/resume_device_irqs() simple.
> > 
> > OK
> 
> Here's a patch series based on what we talked about.
> 
> [1/5] Mechanism to wake up the system or abort suspend in progress 
> automatically.
> [2/5] Fix for shared IRQs vs IRQF_NO_SUSPEND (with wakeup in mind).
> [3/5] Wakeup interrupts support for suspend-to-idle.
> [4/5] Set IRQCHIP_SKIP_SET_WAKE for x86 IOAPIC IRQ chips.
> [5/5] Make PCIe PME wake up from suspend to idle.
> 
> All tested on MSI Wind that has a couple of issues being addressed.

Below is the doc patch I promised.

I'm not signing it off yet, as I'm sending it for comments mostly rather than
as something actually done.

Of course, it documents the situation after the series of [1-5/5] (with the
updated [3/5] I've just sent), especially as far as the suspend-to-idle goes.

Rafael


---
 Documentation/power/suspend-and-interrupts.txt |  136 +
 1 file changed, 136 insertions(+)

Index: linux-pm/Documentation/power/suspend-and-interrupts.txt
===
--- /dev/null
+++ linux-pm/Documentation/power/suspend-and-interrupts.txt
@@ -0,0 +1,136 @@
+System Suspend and Device Interrupts
+
+Copyright (C) 2014 Intel Corp.
+Author: Rafael J. Wysocki 
+
+
+Suspending and Resuming Device IRQs
+---
+
+Device interrupt request lines (IRQs) are generally disabled during system
+suspend after the "late" phase of suspending devices (that is, after all of the
+->prepare, ->suspend and ->suspend_late callbacks have been executed for all
+devices).  That is done by the suspend_device_irqs() function.
+
+The rationale for doing so is that after the "late" phase of device suspend
+there is no legitimate reason why any interrupts from suspended devices should
+trigger and if any devices have not been suspended properly yet, it is better 
to
+block interrupts from them anyway.  Also in the past we had problems with
+interrupt handlers of devices that shared IRQs with other devices and were not
+prepared for interrupts triggering after their devices had been suspended.
+In those cases they would attempt to access, for example, memory address spaces
+of suspended devices and cause unpredictable behavior to ensue as a result.
+Unfortunately, such problems are very difficult to debug and the introduction
+of suspend_device_irqs(), along with the "noirq" phase of device suspend, was
+the only practical way to prevent them from happening.
+
+Device IRQs are re-enabled during system resume, right before the "early" phase
+of resuming devices (that is, before starting to execute ->resume_early
+callbacks for devices).  The function doing that is resume_device_irqs().
+
+
+The IRQF_NO_SUSPEND Flag
+
+
+There are interrupts that can legitimately trigger during the entire system
+suspend-resume cycle, including the "noirq" phases of suspending and resuming
+devices as well as during the time when nonboot CPUs are taken offline and
+brought back online.  That applies to timer interrupts in the first place,
+but also to IPIs and to some other special-purpose interrupts, such as the ACPI
+SCI that isn't assoc

Re: [PATCH v4 2/4] usb: dwc2: add compatible data for rockchip soc

2014-08-07 Thread Kever.Yang


On 08/08/2014 04:52 AM, Doug Anderson wrote:

Paul,

On Thu, Aug 7, 2014 at 11:26 AM, Paul Zimmerman
 wrote:

From: Kever Yang [mailto:kever.y...@gmail.com] On Behalf Of Kever Yang
Sent: Thursday, August 07, 2014 2:35 AM

This patch add compatible data for dwc2 controller found on
rk3066, rk3188 and rk3288 processors from rockchip.

Signed-off-by: Kever Yang 
Acked-by: Paul Zimmerman 
---

Changes in v4:
- max_transfer_size change to 65536, this should be enough
   for most transfer, the hardware auto-detect will set this
   to 0x7 which may make dma_alloc_coherent fail when
   non-dword aligned buf from driver like usbnet happen.

Hi Kever,

Did you test this change thoroughly? I have vague memories of any
value above 65535 causing problems, at least on my hardware. And I
see it is set to 65535 in both pci.c and platform.c. I could be
wrong, but I thought I should mention it.

Certainly it is documented in the header file to have a max of 65535:

  * @max_transfer_size:  The maximum transfer size supported, in bytes
  *   2047 to 65,535
  *  Actual maximum value is autodetected and also
  *  the default.
Sorry for didn't check the header file, I'll change it to 65535 and 
resubmit.


...but looking at the register definition that I see, the size can be
up to 19 bits.  A 19-bit transfer far exceeds 65535.  Do you remember
what the error was?  Certainly I can imagine there being errors with
large calls to dma_alloc_coherent()...

I know that with Kever's change I can do USB Ethernet downloads, so it
is at least working to some degree.  ...to me it feels like Kever
should resubmit with 65535 (to match the documentation) and then work
in the background to figure out what the max_transfer_size really
ought to be.

You are right.

-Doug






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


Re: [PATCH v1] MIPS:KDUMP: set a right value to kexec_indirection_page variable

2014-08-07 Thread Yang,Wei

Ralf,

What do you think of this patch?

Thanks
Wei
On 08/04/2014 11:46 AM, Yang,Wei wrote:

ping.

BR,
Wei
On 07/31/2014 07:42 PM, wei.y...@windriver.com wrote:

From: Yang Wei 

Since there is not indirection page in crash type, so the vaule of 
the head
field of kimage structure is not equal to the address of indirection 
page but
IND_DONE. so we have to set kexec_indirection_page variable to the 
address of

the head field of image structure.

Signed-off-by: Yang Wei 

   Hi Ralf,

  Please help me take a look at this patch, I have already 
verified it on Cavium 6100EVB board.


  Thanks
  Wei
---
  arch/mips/kernel/machine_kexec.c |9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/machine_kexec.c 
b/arch/mips/kernel/machine_kexec.c

index 992e184..531b70d 100644
--- a/arch/mips/kernel/machine_kexec.c
+++ b/arch/mips/kernel/machine_kexec.c
@@ -71,8 +71,13 @@ machine_kexec(struct kimage *image)
  kexec_start_address =
  (unsigned long) phys_to_virt(image->start);
  -kexec_indirection_page =
-(unsigned long) phys_to_virt(image->head & PAGE_MASK);
+if (image->type == KEXEC_TYPE_DEFAULT) {
+kexec_indirection_page =
+(unsigned long) phys_to_virt(image->head & PAGE_MASK);
+} else {
+kexec_indirection_page = (unsigned long)&image->head;
+}
+
memcpy((void*)reboot_code_buffer, relocate_new_kernel,
 relocate_new_kernel_size);






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


[Update][PATCH 3/5] irq / PM: Make wakeup interrupts wake up from suspend-to-idle

2014-08-07 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Make IRQs enabled for system wakeup via enable_irq_wake() wake up
the system from suspend-to-idle.

For this purpose, introduce a new routine for enabling and disabling
wakeup interrupts, set_wakeup_irqs(), and make freeze_enter() call it
to enable them before starting the suspend-to-idle loop and to
disable them after that loop has been terminated.

When enabling an IRQ which is not a shared one, that routine
replaces its original handler with a stub one always returning
IRQ_NONE.  When disabling it, set_wakeup_irqs() restores the
original handler for it.  This way, IRQ_NONE is returned for all
of the wakeup interrupts during suspend-to-idle and that triggers
the abort-suspend-or-wakeup condition in note_interrupt() causing
the system to wake up.

To avoid losing wakeup events, make note_interrupt() mark wakeup
interrupts as pending before triggering wakeup for irqs_suspended
set.

Signed-off-by: Rafael J. Wysocki 
---

When I was working on the doc (that I'm going to send shortly), it
occured to me that it actually would be better to always return
IRQ_NONE from interrupt handlers for wakeup interrupts when
irqs_suspended is set - and mark them as pending to avoid losing
wakeup events.  That way they'll work uniformly, even if someone is
insane enough to use enable_irq_wake() on an IRQF_NO_SUSPEND IRQ.

Rafael

---
 include/linux/interrupt.h |1 +
 kernel/irq/pm.c   |   45 +
 kernel/irq/spurious.c |6 +-
 kernel/power/suspend.c|3 +++
 4 files changed, 54 insertions(+), 1 deletion(-)

Index: linux-pm/include/linux/interrupt.h
===
--- linux-pm.orig/include/linux/interrupt.h
+++ linux-pm/include/linux/interrupt.h
@@ -197,6 +197,7 @@ extern void irq_wake_thread(unsigned int
 /* The following three functions are for the core kernel use only. */
 extern void suspend_device_irqs(void);
 extern void resume_device_irqs(void);
+extern void set_wakeup_irqs(bool enable);
 #ifdef CONFIG_PM_SLEEP
 extern int check_wakeup_irqs(void);
 #else
Index: linux-pm/kernel/irq/pm.c
===
--- linux-pm.orig/kernel/irq/pm.c
+++ linux-pm/kernel/irq/pm.c
@@ -130,3 +130,48 @@ int check_wakeup_irqs(void)
 
return 0;
 }
+
+static irqreturn_t irq_pm_empty_handler(int irq, void *dev_id)
+{
+   return IRQ_NONE;
+}
+
+void set_wakeup_irqs(bool enable)
+{
+   struct irq_desc *desc;
+   int irq;
+
+   for_each_irq_desc(irq, desc) {
+   struct irqaction *action = desc->action;
+   unsigned long flags;
+
+   raw_spin_lock_irqsave(&desc->lock, flags);
+
+   if (action && irqd_is_wakeup_set(&desc->irq_data) &&
+   !desc->skip_suspend) {
+   if (enable) {
+   /*
+* Replace handlers for not shared interrupts.
+* Shared ones have wrapper handlers already.
+*/
+   if (!action->next) {
+   action->s_handler = action->handler;
+   action->handler = irq_pm_empty_handler;
+   }
+   desc->istate &= ~IRQS_SUSPENDED;
+   __enable_irq(desc, irq, false);
+   } else {
+   if (!(desc->istate & IRQS_SUSPENDED)) {
+   __disable_irq(desc, irq, false);
+   desc->istate |= IRQS_SUSPENDED;
+   }
+   if (action->handler == irq_pm_empty_handler) {
+   action->handler = action->s_handler;
+   action->s_handler = NULL;
+   }
+   }
+   }
+
+   raw_spin_unlock_irqrestore(&desc->lock, flags);
+   }
+}
Index: linux-pm/kernel/power/suspend.c
===
--- linux-pm.orig/kernel/power/suspend.c
+++ linux-pm/kernel/power/suspend.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,7 +56,9 @@ static void freeze_enter(void)
 {
cpuidle_use_deepest_state(true);
cpuidle_resume();
+   set_wakeup_irqs(true);
wait_event(suspend_freeze_wait_head, suspend_freeze_wake);
+   set_wakeup_irqs(false);
cpuidle_pause();
cpuidle_use_deepest_state(false);
 }
Index: linux-pm/kernel/irq/spurious.c
===
--- linux-pm.orig/kernel/irq/spurious.c
+++ linux-pm/kernel/irq/spurious.c
@@ -277,7 +277,11 @@ void note_interrupt(unsigned int irq, st
 

  1   2   3   4   5   6   7   >