Re: [ 000/102] 3.10.6-stable review

2013-08-08 Thread Guenter Roeck

On 08/08/2013 06:56 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.10.6 release.
There are 102 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sun Aug 11 01:46:31 UTC 2013.
Anything received after that time might be too late.

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



Cross build results:
Total builds: 69 Total build errors: 2

Details:

http://server.roeck-us.net:8010/builders/stable-queue-3.10/builds/47/steps/shell/logs/stdio/text

Same results as before, except that I dropped a couple of builds and added some 
others.

The failing builds are arm:allmodconfig and mips:allmodconfig.
For both, the errors don't exist in mainline and should be trivial to fix in 
case anyone is interested.

arm:
FATAL: modpost: GPL-incompatible module bcm2835-rng.ko uses GPL-only 
symbol 'platform_driver_unregister'

[This one has been fixed upstream with commit 
22e8099f4f6621b8d165e238cdef2a1cf655e159. Might be worthwhile
 adding it to -stable]

mips:
drivers/net/ethernet/3com/3c59x.c:1031:2: error: implicit declaration 
of function 'pci_iomap'
drivers/net/ethernet/3com/3c59x.c:1044:3: error: implicit declaration 
of function 'pci_iounmap'

[no idea why this works upstream]

Guenter

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


Re: [PATCH V3]hrtimer: Fix a performance regression by disable reprogramming in remove_hrtimer

2013-08-08 Thread Mike Galbraith
On Thu, 2013-08-08 at 23:02 +0800, ethan.zhao wrote: 
> 在 2013-8-6,下午3:29,Mike Galbraith  写道:
> 
> > +int sched_needs_cpu(int cpu)
> > +{
> > +   return  cpu_rq(cpu)->avg_idle < sysctl_sched_migration_cost;
> > +}
> > +
> > #else /* CONFIG_NO_HZ_COMMON */
> > 
> > static inline bool got_nohz_idle_kick(void)
> > --- a/kernel/time/tick-sched.c
> > +++ b/kernel/time/tick-sched.c
> > @@ -548,7 +548,7 @@ static ktime_t tick_nohz_stop_sched_tick
> > time_delta = timekeeping_max_deferment();
> > } while (read_seqretry(&jiffies_lock, seq));
> > 
> > -   if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
> > +   if (sched_needs_cpu(cpu) || rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
> > arch_needs_cpu(cpu) || irq_work_needs_cpu()) {
> > next_jiffies = last_jiffies + 1;
> > delta_jiffies = 1;
> 
> If the performace regression was caused by too much expensive clock device 
> reprogramming and too frequent entering /exiting of C-states…   this patch 
> should work.
> except the following result is almost always false under 3.11-rc3 code.
> 
> > return  cpu_rq(cpu)->avg_idle < sysctl_sched_migration_cost;

On my E5620 box, avg_idle works fine.  Patchlet doesn't save as much as
it used to, thanks to Peter's patch now killing the worst of the pain,
but it does still does save cycles.  I have too much regression left to
say exactly what it can now save max, doesn't matter much either.

The pertinent numbers:

v3.11-rc4-27-ge4ef108496.7 KHz  .858 1.030 throttle+peterz
v3.11-rc4-27-ge4ef108440.7 KHz  .761 1.296 nothrottle+peterz

-Mike

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/4] leds-pca9633: Unique naming of the LEDs

2013-08-08 Thread Ricardo Ribalda Delgado
If there is more than one pca963x chips on the system and there are
some LEDs without platform_data names, the driver wont be able to
provide unique naming to them.

This will cause led_class_dev_register to fail, unregistering all the
LEDs of the chip.

This patch adds the i2c address to the name of the unnamed LEDs, making
them unique.

[  555.346827] [ cut here ]
[  555.346844] WARNING: at /build/linux-voe0Su/linux-3.9.8/fs/sysfs/dir.c:536 
sysfs_add_one+0x8b/0x9d()
[  555.346847] Hardware name: QT5022
[  555.346850] sysfs: cannot create duplicate filename '/class/leds/pca9633:6'
[  555.346853] Modules linked in: qt5038_platform(O+) leds_pca9633(O) 
hid_generic ledtrig_default_on rfcomm bnep bluetooth binfmt_misc nfsd 
auth_rpcgss nfs_acl nfs lockd dns_resolver fscache sunrpc nls_utf8 nls_cp437 
vfat fat loop fuse joydev hid_multitouch usbhid hid acpi_cpufreq mperf kvm_amd 
kvm evdev pn533 nfc arc4 microcode pcspkr efivars k10temp ath9k ath9k_common 
ath9k_hw ath fglrx(PO) mac80211 cfg80211 video rfkill processor thermal_sys 
sp5100_tco button i2c_piix4 ext4 crc16 jbd2 mbcache sg sd_mod crc_t10dif ahci 
libahci igb i2c_algo_bit i2c_core dca ptp pps_core ehci_pci ohci_hcd ehci_hcd 
libata usbcore usb_common scsi_mod [last unloaded: leds_pca963x]
[  555.346940] Pid: 4766, comm: insmod Tainted: PW  O 3.9-1-amd64 #1 
Debian 3.9.8-1
[  555.346943] Call Trace:
[  555.346956]  [] ? warn_slowpath_common+0x76/0x8c
[  555.346962]  [] ? warn_slowpath_fmt+0x47/0x49
[  555.346968]  [] ? sysfs_pathname+0x3b/0x41
[  555.346973]  [] ? sysfs_add_one+0x8b/0x9d
[  555.346978]  [] ? sysfs_do_create_link_sd+0xe8/0x174
[  555.346985]  [] ? device_add+0x243/0x5ab
[  555.346991]  [] ? complete_all+0x31/0x40
[  555.346998]  [] ? init_timer_key+0xc/0x56
[  555.347004]  [] ? device_create_vargs+0x82/0xb6
[  555.347009]  [] ? device_create+0x2f/0x31
[  555.347014]  [] ? should_resched+0x5/0x23
[  555.347021]  [] ? led_classdev_register+0x24/0x103
[  555.347028]  [] ? pca9633_probe+0x173/0x239 [leds_pca9633]
[  555.347035]  [] ? __driver_attach+0x73/0x73
[  555.347049]  [] ? i2c_device_probe+0x63/0x88 [i2c_core]
[  555.347057]  [] ? driver_probe_device+0x92/0x1b0
[  555.347064]  [] ? bus_for_each_drv+0x43/0x7d
[  555.347070]  [] ? device_attach+0x68/0x83
[  555.347078]  [] ? bus_probe_device+0x25/0x8d
[  555.347083]  [] ? device_add+0x3ea/0x5ab
[  555.347088]  [] ? complete_all+0x31/0x40
[  555.347094]  [] ? init_timer_key+0xc/0x56
[  555.347104]  [] ? i2c_new_device+0x10d/0x179 [i2c_core]
[  555.347112]  [] ? qt5038_init+0x36/0x1000 [qt5038_platform]
[  555.347119]  [] ? 0xa008efff
[  555.347125]  [] ? do_one_initcall+0x74/0x128
[  555.347131]  [] ? 0xa008efff
[  555.347137]  [] ? load_module+0x1af7/0x1dfc
[  555.347144]  [] ? free_notes_attrs+0x3c/0x3c
[  555.347150]  [] ? sys_init_module+0x9e/0xab
[  555.347157]  [] ? system_call_fastpath+0x16/0x1b
[  555.347161] ---[ end trace ad00b85794e0de4d ]---
[  555.347448] leds-pca9633: probe of 0-006b failed with error -17

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/leds/leds-pca9633.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c
index 070358a..02766fb 100644
--- a/drivers/leds/leds-pca9633.c
+++ b/drivers/leds/leds-pca9633.c
@@ -159,10 +159,12 @@ static int pca9633_probe(struct i2c_client *client,
if (pdata->leds.leds[i].default_trigger)
pca9633[i].led_cdev.default_trigger =
pdata->leds.leds[i].default_trigger;
-   } else {
-   snprintf(pca9633[i].name, sizeof(pca9633[i].name),
-"pca9633:%d", i);
}
+   if (!pdata || i >= pdata->leds.num_leds ||
+   !pdata->leds.leds[i].name)
+   snprintf(pca9633[i].name, sizeof(pca9633[i].name),
+"pca9633:%d:%.2x:%d", client->adapter->nr,
+client->addr, i);
 
pca9633[i].led_cdev.name = pca9633[i].name;
pca9633[i].led_cdev.brightness_set = pca9633_led_set;
-- 
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 v3 1/4] leds-pca9633: Add support for PCA9634

2013-08-08 Thread Ricardo Ribalda Delgado
Add support for PCA9634 chip, which belongs to the same family as the
9633 but with support for 8 outputs instead of 4.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/leds/Kconfig|7 ++--
 drivers/leds/leds-pca9633.c |   74 +++
 2 files changed, 58 insertions(+), 23 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index e43402d..023af58 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -280,12 +280,13 @@ config LEDS_PCA955X
  devices include PCA9550, PCA9551, PCA9552, and PCA9553.
 
 config LEDS_PCA9633
-   tristate "LED support for PCA9633 I2C chip"
+   tristate "LED support for PCA963x I2C chip"
depends on LEDS_CLASS
depends on I2C
help
- This option enables support for LEDs connected to the PCA9633
- LED driver chip accessed via the I2C bus.
+ This option enables support for LEDs connected to the PCA963x
+ LED driver chip accessed via the I2C bus. Supported
+ devices include PCA9633 and PCA9634
 
 config LEDS_WM831X_STATUS
tristate "LED support for status LEDs on WM831x PMICs"
diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c
index 9aae567..070358a 100644
--- a/drivers/leds/leds-pca9633.c
+++ b/drivers/leds/leds-pca9633.c
@@ -1,7 +1,9 @@
 /*
  * Copyright 2011 bct electronic GmbH
+ * Copyright 2013 Qtechnology/AS
  *
  * Author: Peter Meerwald 
+ * Author: Ricardo Ribalda 
  *
  * Based on leds-pca955x.c
  *
@@ -10,6 +12,7 @@
  * directory of this archive for more details.
  *
  * LED driver for the PCA9633 I2C LED driver (7-bit slave address 0x62)
+ * LED driver for the PCA9634 I2C LED driver (7-bit slave address set by hw.)
  *
  */
 
@@ -33,20 +36,42 @@
 #define PCA9633_MODE1  0x00
 #define PCA9633_MODE2  0x01
 #define PCA9633_PWM_BASE   0x02
-#define PCA9633_LEDOUT 0x08
+
+enum pca9633_type {
+   pca9633,
+   pca9634,
+};
+
+struct pca9633_chipdef {
+   u8  ledout_base;
+   int n_leds;
+};
+
+static struct pca9633_chipdef pca9633_chipdefs[] = {
+   [pca9633] = {
+   .ledout_base= 0x8,
+   .n_leds = 4,
+   },
+   [pca9634] = {
+   .ledout_base= 0xc,
+   .n_leds = 8,
+   },
+};
 
 static const struct i2c_device_id pca9633_id[] = {
-   { "pca9633", 0 },
+   { "pca9633", pca9633 },
+   { "pca9634", pca9634 },
{ }
 };
 MODULE_DEVICE_TABLE(i2c, pca9633_id);
 
 struct pca9633_led {
struct i2c_client *client;
+   struct pca9633_chipdef *chipdef;
struct work_struct work;
enum led_brightness brightness;
struct led_classdev led_cdev;
-   int led_num; /* 0 .. 3 potentially */
+   int led_num; /* 0 .. 7 potentially */
char name[32];
 };
 
@@ -54,24 +79,26 @@ static void pca9633_led_work(struct work_struct *work)
 {
struct pca9633_led *pca9633 = container_of(work,
struct pca9633_led, work);
-   u8 ledout = i2c_smbus_read_byte_data(pca9633->client, PCA9633_LEDOUT);
-   int shift = 2 * pca9633->led_num;
+   u8 ledout_addr = pca9633->chipdef->ledout_base + (pca9633->led_num / 4);
+   u8 ledout;
+   int shift = 2 * (pca9633->led_num % 4);
u8 mask = 0x3 << shift;
 
+   ledout = i2c_smbus_read_byte_data(pca9633->client, ledout_addr);
switch (pca9633->brightness) {
case LED_FULL:
-   i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT,
+   i2c_smbus_write_byte_data(pca9633->client, ledout_addr,
(ledout & ~mask) | (PCA9633_LED_ON << shift));
break;
case LED_OFF:
-   i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT,
+   i2c_smbus_write_byte_data(pca9633->client, ledout_addr,
ledout & ~mask);
break;
default:
i2c_smbus_write_byte_data(pca9633->client,
PCA9633_PWM_BASE + pca9633->led_num,
pca9633->brightness);
-   i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT,
+   i2c_smbus_write_byte_data(pca9633->client, ledout_addr,
(ledout & ~mask) | (PCA9633_LED_PWM << shift));
break;
}
@@ -98,26 +125,30 @@ static int pca9633_probe(struct i2c_client *client,
 {
struct pca9633_led *pca9633;
struct pca9633_platform_data *pdata;
+   struct pca9633_chipdef *chip;
int i, err;
 
+   chip = &pca9633_chipdefs[id->driver_data];
pdata = client->dev.platform_data;
 
-   if (pdata) {
-   if (pdata->leds.num_leds <= 0 || pdata->leds.num_leds > 4) {
-   dev_err(&client->dev, "board info must claim at most 4 
LEDs");
-   return -EINVAL;
- 

[PATCH v3 3/4] leds-pca9633: Add mutex to the ledout register

2013-08-08 Thread Ricardo Ribalda Delgado
To update an LED a register has to be read, updated and writen. If
another LED whas been updated at the same time, this could lead into
wrong updates.

This patch addes a common mutex to all the leds of the same chip to
protect the ledout register.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/leds/leds-pca9633.c |   63 ---
 1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c
index 02766fb..9bf33d8 100644
--- a/drivers/leds/leds-pca9633.c
+++ b/drivers/leds/leds-pca9633.c
@@ -65,9 +65,17 @@ static const struct i2c_device_id pca9633_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, pca9633_id);
 
-struct pca9633_led {
-   struct i2c_client *client;
+struct pca9633_led;
+
+struct pca9633 {
struct pca9633_chipdef *chipdef;
+   struct mutex mutex;
+   struct i2c_client *client;
+   struct pca9633_led *leds;
+};
+
+struct pca9633_led {
+   struct pca9633 *chip;
struct work_struct work;
enum led_brightness brightness;
struct led_classdev led_cdev;
@@ -79,29 +87,32 @@ static void pca9633_led_work(struct work_struct *work)
 {
struct pca9633_led *pca9633 = container_of(work,
struct pca9633_led, work);
-   u8 ledout_addr = pca9633->chipdef->ledout_base + (pca9633->led_num / 4);
+   u8 ledout_addr = pca9633->chip->chipdef->ledout_base
+   + (pca9633->led_num / 4);
u8 ledout;
int shift = 2 * (pca9633->led_num % 4);
u8 mask = 0x3 << shift;
 
-   ledout = i2c_smbus_read_byte_data(pca9633->client, ledout_addr);
+   mutex_lock(&pca9633->chip->mutex);
+   ledout = i2c_smbus_read_byte_data(pca9633->chip->client, ledout_addr);
switch (pca9633->brightness) {
case LED_FULL:
-   i2c_smbus_write_byte_data(pca9633->client, ledout_addr,
+   i2c_smbus_write_byte_data(pca9633->chip->client, ledout_addr,
(ledout & ~mask) | (PCA9633_LED_ON << shift));
break;
case LED_OFF:
-   i2c_smbus_write_byte_data(pca9633->client, ledout_addr,
+   i2c_smbus_write_byte_data(pca9633->chip->client, ledout_addr,
ledout & ~mask);
break;
default:
-   i2c_smbus_write_byte_data(pca9633->client,
+   i2c_smbus_write_byte_data(pca9633->chip->client,
PCA9633_PWM_BASE + pca9633->led_num,
pca9633->brightness);
-   i2c_smbus_write_byte_data(pca9633->client, ledout_addr,
+   i2c_smbus_write_byte_data(pca9633->chip->client, ledout_addr,
(ledout & ~mask) | (PCA9633_LED_PWM << shift));
break;
}
+   mutex_unlock(&pca9633->chip->mutex);
 }
 
 static void pca9633_led_set(struct led_classdev *led_cdev,
@@ -123,6 +134,7 @@ static void pca9633_led_set(struct led_classdev *led_cdev,
 static int pca9633_probe(struct i2c_client *client,
const struct i2c_device_id *id)
 {
+   struct pca9633 *pca9633_chip;
struct pca9633_led *pca9633;
struct pca9633_platform_data *pdata;
struct pca9633_chipdef *chip;
@@ -138,17 +150,30 @@ static int pca9633_probe(struct i2c_client *client,
return -EINVAL;
}
 
+   pca9633_chip = devm_kzalloc(&client->dev, sizeof(*pca9633_chip),
+   GFP_KERNEL);
+   if (!pca9633_chip)
+   return -ENOMEM;
pca9633 = devm_kzalloc(&client->dev, chip->n_leds * sizeof(*pca9633),
GFP_KERNEL);
if (!pca9633)
return -ENOMEM;
 
-   i2c_set_clientdata(client, pca9633);
+   i2c_set_clientdata(client, pca9633_chip);
+
+   mutex_init(&pca9633_chip->mutex);
+   pca9633_chip->chipdef = chip;
+   pca9633_chip->client = client;
+   pca9633_chip->leds = pca9633;
+
+   /* Turn off LEDs by default*/
+   i2c_smbus_write_byte_data(client, chip->ledout_base, 0x00);
+   if (chip->n_leds > 4)
+   i2c_smbus_write_byte_data(client, chip->ledout_base + 1, 0x00);
 
for (i = 0; i < chip->n_leds; i++) {
-   pca9633[i].client = client;
pca9633[i].led_num = i;
-   pca9633[i].chipdef = chip;
+   pca9633[i].chip = pca9633_chip;
 
/* Platform data can specify LED names and default triggers */
if (pdata && i < pdata->leds.num_leds) {
@@ -183,11 +208,6 @@ static int pca9633_probe(struct i2c_client *client,
if (pdata && pdata->outdrv == PCA9633_OPEN_DRAIN)
i2c_smbus_write_byte_data(client, PCA9633_MODE2, 0x01);
 
-   /* Turn off LEDs */
-   i2c_smbus_write_byte_data(client, chip->ledout_base, 0x00);
-   if (chip->n_leds > 4)
-

[PATCH v3 4/4] leds-pca9633: Rename to leds-pca963x

2013-08-08 Thread Ricardo Ribalda Delgado
The driver now supports the chips pca9633 and pca9634, therefore we
rename the files to more genereic and meaningul names

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/leds/Kconfig   |2 +-
 drivers/leds/Makefile  |2 +-
 drivers/leds/leds-pca9633.c|  249 
 drivers/leds/leds-pca963x.c|  249 
 include/linux/platform_data/leds-pca9633.h |   35 
 include/linux/platform_data/leds-pca963x.h |   36 
 6 files changed, 287 insertions(+), 286 deletions(-)
 delete mode 100644 drivers/leds/leds-pca9633.c
 create mode 100644 drivers/leds/leds-pca963x.c
 delete mode 100644 include/linux/platform_data/leds-pca9633.h
 create mode 100644 include/linux/platform_data/leds-pca963x.h

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 023af58..d5cb477 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -279,7 +279,7 @@ config LEDS_PCA955X
  LED driver chips accessed via the I2C bus.  Supported
  devices include PCA9550, PCA9551, PCA9552, and PCA9553.
 
-config LEDS_PCA9633
+config LEDS_PCA963X
tristate "LED support for PCA963x I2C chip"
depends on LEDS_CLASS
depends on I2C
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index ac28977..26f9c13 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -34,7 +34,7 @@ obj-$(CONFIG_LEDS_HP6XX)  += leds-hp6xx.o
 obj-$(CONFIG_LEDS_OT200)   += leds-ot200.o
 obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
 obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
-obj-$(CONFIG_LEDS_PCA9633) += leds-pca9633.o
+obj-$(CONFIG_LEDS_PCA963X) += leds-pca963x.o
 obj-$(CONFIG_LEDS_DA903X)  += leds-da903x.o
 obj-$(CONFIG_LEDS_DA9052)  += leds-da9052.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)   += leds-wm831x-status.o
diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c
deleted file mode 100644
index 9bf33d8..000
--- a/drivers/leds/leds-pca9633.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2011 bct electronic GmbH
- * Copyright 2013 Qtechnology/AS
- *
- * Author: Peter Meerwald 
- * Author: Ricardo Ribalda 
- *
- * Based on leds-pca955x.c
- *
- * This file is subject to the terms and conditions of version 2 of
- * the GNU General Public License.  See the file COPYING in the main
- * directory of this archive for more details.
- *
- * LED driver for the PCA9633 I2C LED driver (7-bit slave address 0x62)
- * LED driver for the PCA9634 I2C LED driver (7-bit slave address set by hw.)
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* LED select registers determine the source that drives LED outputs */
-#define PCA9633_LED_OFF0x0 /* LED driver off */
-#define PCA9633_LED_ON 0x1 /* LED driver on */
-#define PCA9633_LED_PWM0x2 /* Controlled through PWM */
-#define PCA9633_LED_GRP_PWM0x3 /* Controlled through PWM/GRPPWM */
-
-#define PCA9633_MODE1  0x00
-#define PCA9633_MODE2  0x01
-#define PCA9633_PWM_BASE   0x02
-
-enum pca9633_type {
-   pca9633,
-   pca9634,
-};
-
-struct pca9633_chipdef {
-   u8  ledout_base;
-   int n_leds;
-};
-
-static struct pca9633_chipdef pca9633_chipdefs[] = {
-   [pca9633] = {
-   .ledout_base= 0x8,
-   .n_leds = 4,
-   },
-   [pca9634] = {
-   .ledout_base= 0xc,
-   .n_leds = 8,
-   },
-};
-
-static const struct i2c_device_id pca9633_id[] = {
-   { "pca9633", pca9633 },
-   { "pca9634", pca9634 },
-   { }
-};
-MODULE_DEVICE_TABLE(i2c, pca9633_id);
-
-struct pca9633_led;
-
-struct pca9633 {
-   struct pca9633_chipdef *chipdef;
-   struct mutex mutex;
-   struct i2c_client *client;
-   struct pca9633_led *leds;
-};
-
-struct pca9633_led {
-   struct pca9633 *chip;
-   struct work_struct work;
-   enum led_brightness brightness;
-   struct led_classdev led_cdev;
-   int led_num; /* 0 .. 7 potentially */
-   char name[32];
-};
-
-static void pca9633_led_work(struct work_struct *work)
-{
-   struct pca9633_led *pca9633 = container_of(work,
-   struct pca9633_led, work);
-   u8 ledout_addr = pca9633->chip->chipdef->ledout_base
-   + (pca9633->led_num / 4);
-   u8 ledout;
-   int shift = 2 * (pca9633->led_num % 4);
-   u8 mask = 0x3 << shift;
-
-   mutex_lock(&pca9633->chip->mutex);
-   ledout = i2c_smbus_read_byte_data(pca9633->chip->client, ledout_addr);
-   switch (pca9633->brightness) {
-   case LED_FULL:
-   i2c_smbus_write_byte_data(pca9633->chip->client, ledout_addr,
-   (ledout & ~mask) | (PCA9633_LED_ON << sh

[PATCH v3 0/4] PCA9633: Add support to PCA9634 and fix some problems

2013-08-08 Thread Ricardo Ribalda Delgado

Add Support for the PCA9634 chip. Simimart to the 9633, but with 8 outputs 
instead of 4.
Fix bug when 2 chips where present on the system, the ledclass will fail and 
the chip wont probe.
Protect ledout register with a mutex to support updates of more than leds at 
the same time

v2: Contains feedback from Bryan Wu
Bryan: Rename pca9633 to pca963x

v2: Contains feedback from Peter Meerwald
Peter: Fix typo on commit message. Add bus number to name

Ricardo Ribalda Delgado (4):
  leds-pca9633: Add support for PCA9634
  leds-pca9633: Unique naming of the LEDs
  leds-pca9633: Add mutex to the ledout register
  leds-pca9633: Rename to leds-pca963x

 drivers/leds/Kconfig   |9 +-
 drivers/leds/Makefile  |2 +-
 drivers/leds/leds-pca9633.c|  194 --
 drivers/leds/leds-pca963x.c|  249 
 include/linux/platform_data/leds-pca9633.h |   35 
 include/linux/platform_data/leds-pca963x.h |   36 
 6 files changed, 291 insertions(+), 234 deletions(-)
 delete mode 100644 drivers/leds/leds-pca9633.c
 create mode 100644 drivers/leds/leds-pca963x.c
 delete mode 100644 include/linux/platform_data/leds-pca9633.h
 create mode 100644 include/linux/platform_data/leds-pca963x.h

-- 
1.7.10.4

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


Re: [PATCH v2] drivers/crypto/nx: saves chaining value from co-processor

2013-08-08 Thread Herbert Xu
On Wed, Aug 07, 2013 at 06:15:50PM -0500, Fionnuala Gunter wrote:
> This patch fixes a bug that is triggered when cts(cbc(aes)) is used with
> nx-crypto driver on input larger than 32 bytes.
> 
> The chaining value from co-processor was not being saved. This value is
> needed because it is used as the IV by cts(cbc(aes)).
> 
> Signed-off-by: Fionnuala Gunter 
> Reviewed-by: Marcelo Cerri 
> ---
> v2. changed signed-off-by to reviewed-by and added more details to
> description
> 
> This bug appeared in the original submission (v3.5)

Patch applied.  However your patch was totally white-space damaged.
I've fixed it this time, but please fix this in your future
submissions.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/3] leds-pca9633: Add support for PCA9634

2013-08-08 Thread Ricardo Ribalda Delgado
Hello Bryan

I understand your concerns, but I think that it is more practical to
keep the old names.

First of all there will be some defconfig that we will break with the
new names, the same will happen with the platform data. I know that we
don't have to support out of tree systems, but it wont hurt to make
their live easier.

The patch produced when we rename a file is as big as the file itself,
so it is more difficult to get good reviews, compared to a 10 lines
patch.

Unless the manufacturer makes a statement, there is no way to know if
there will be a pca96339 that will be a completely different chip, and
that will led to many errors.

Finally, there are many examples of files named as the first device
supported, even on the led infrastructure (ie. LEDS_DA9052)

All that said, I have added a new patch to the series that does the
renaming :), therefore we can review the addition 96334 separately
than the other improvements and if we decide to have a generic name we
will have it.

Thanks for your review!


On Fri, Aug 9, 2013 at 12:49 AM, Bryan Wu  wrote:
> On Thu, Aug 8, 2013 at 3:36 PM, Peter Meerwald
>  wrote:
>> Hello,
>>
>>> > Add support for PCA9634 chip, which belongs to the same family as the
>>> > 9633 but with support for 8 outputs instead of 4.
>>
>>> Basically I like this method to add a new chip supporting. Please find
>>> my comments below.
>>
>> me too :)
>>
>>> What about just rename the whole file to leds-pca963x.c. And rename
>>> some pca9633 to pca963x in the driver.
>>
>> there are other, similar I2C LED driver chips which might be
>> handled with the current pca9633 driver, e.g. the pca9685 (which is
>> supported under pwm/ by the way)
>>
>> people have argued that the numbering scheme of chips is hard to
>> predict; hence, the driver name should be determined by the first
>> device supported to avoid subsequent renaming -- but I have no strong
>> feelings about this
>>
>
> Giving a more generic and meaningful name of this driver should be a
> easier for people to understand. So if pca9685 is coming, we can use
> leds-pca96xx.c and pca96xx for this pca96xx chip family, as long as
> they can share this driver code.
>
> Please take a look at Milo did in leds-lp55xx drivers.
>
> Thanks a lot,
> -Bryan



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


Re: [PATCH v2 0/2] drivers/crypto/nx: fixes when input data is too large

2013-08-08 Thread Herbert Xu
On Fri, Aug 02, 2013 at 12:09:50PM +, Marcelo Cerri wrote:
> This series of patches fixes two bugs that are triggered when the input data 
> is
> too large. The first one is caused by the miscalculation of physical addresses
> and the second one by some limits that the co-processor has to the input data.
> 
> Changes in v2:
> * Replace Signed-Off-By tags with Reviewed-By tags where it is
> appropriate.
> 
> Marcelo Cerri (2):
>   drivers/crypto/nx: fix physical addresses added to sg lists
>   drivers/crypto/nx: fix limits to sg lists for SHA-2

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


Re: [PATCH v9 07/16] iommu/exynos: support for device tree

2013-08-08 Thread Cho KyongHo
On Fri, 09 Aug 2013 00:41:25 +0200, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On Thursday 08 of August 2013 18:38:49 Cho KyongHo wrote:
> > This commit adds device tree support for System MMU.
> > This also include the following changes and enhancements:
> > 
> > * use managed device helper functions.
> > Simplyfies System MMU device driver.
> > 
> > * use only a single clock descriptor.
> > System MMU device descriptor is seperate if it is imposible to make
> > a single clock descriptor to make a device descriptor for a group of
> > System MMUs.
> > 
> > * removed dbgname member from sysmmu_drvdata structure.
> > debugging kernel message for a System MMU is distinguisheable with the
> > name of device descroptors.
> 
> Please put all these three changes in separate patches. This patch is hard 
> to review with all the changes mixed together...
> 

Ok.

> In addition, I believe this is the patch that should be adding device tree 
> binding documentation, not the 6/16 one, as this is where actually support 
> for this binding gets added to the kernel.

Oh, I didn't know that devicetree binding description and implementation need
to be in the same patch.
I will do as you advised.

> 
> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/Kconfig|5 +-
> >  drivers/iommu/exynos-iommu.c |  186
> > - 2 files changed, 75
> > insertions(+), 116 deletions(-)
> > 
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index 820d85c..9ad45f1 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -168,16 +168,15 @@ config TEGRA_IOMMU_SMMU
> > 
> >  config EXYNOS_IOMMU
> > bool "Exynos IOMMU Support"
> > -   depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU
> > +   depends on ARCH_EXYNOS
> > select IOMMU_API
> > +   default n
> > help
> >   Support for the IOMMU(System MMU) of Samsung Exynos application
> >   processor family. This enables H/W multimedia accellerators to 
> see
> >   non-linear physical memory chunks as a linear memory in their
> >   address spaces
> > 
> > - If unsure, say N here.
> > -
> >  config EXYNOS_IOMMU_DEBUG
> > bool "Debugging log for Exynos IOMMU"
> > depends on EXYNOS_IOMMU
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index a318049..0ee73e8 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -26,6 +26,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > 
> >  #include 
> >  #include 
> > @@ -170,15 +171,14 @@ struct sysmmu_drvdata {
> > struct list_head node; /* entry of exynos_iommu_domain.clients */
> > struct device *sysmmu;  /* System MMU's device descriptor */
> > struct device *dev; /* Owner of system MMU */
> > -   char *dbgname;
> > int nsfrs;
> > -   void __iomem **sfrbases;
> > -   struct clk *clk[2];
> > +   struct clk *clk;
> > int activations;
> > rwlock_t lock;
> > struct iommu_domain *domain;
> > sysmmu_fault_handler_t fault_handler;
> > unsigned long pgtable;
> > +   void __iomem *sfrbases[0];
> >  };
> > 
> >  static bool set_sysmmu_active(struct sysmmu_drvdata *data)
> > @@ -385,8 +385,8 @@ static irqreturn_t exynos_sysmmu_irq(int irq, void
> > *dev_id) if (!ret && (itype != SYSMMU_FAULT_UNKNOWN))
> > __raw_writel(1 << itype, data->sfrbases[i] + 
> REG_INT_CLEAR);
> > else
> > -   dev_dbg(data->sysmmu, "(%s) %s is not handled.\n",
> > -   data->dbgname, sysmmu_fault_name[itype]);
> > +   dev_dbg(data->sysmmu, "%s is not handled.\n",
> > +   sysmmu_fault_name[itype]);
> > 
> > if (itype != SYSMMU_FAULT_UNKNOWN)
> > sysmmu_unblock(data->sfrbases[i]);
> > @@ -410,10 +410,8 @@ static bool __exynos_sysmmu_disable(struct
> > sysmmu_drvdata *data) for (i = 0; i < data->nsfrs; i++)
> > __raw_writel(CTRL_DISABLE, data->sfrbases[i] + 
> REG_MMU_CTRL);
> > 
> > -   if (data->clk[1])
> > -   clk_disable(data->clk[1]);
> > -   if (data->clk[0])
> > -   clk_disable(data->clk[0]);
> > +   if (data->clk)
> > +   clk_disable(data->clk);
> > 
> > disabled = true;
> > data->pgtable = 0;
> > @@ -422,10 +420,10 @@ finish:
> > write_unlock_irqrestore(&data->lock, flags);
> > 
> > if (disabled)
> > -   dev_dbg(data->sysmmu, "(%s) Disabled\n", data->dbgname);
> > +   dev_dbg(data->sysmmu, "Disabled\n");
> > else
> > -   dev_dbg(data->sysmmu, "(%s) %d times left to be 
> disabled\n",
> > -   data->dbgname, data->activations);
> > +   dev_dbg(data->sysmmu, "%d times left to be disabled\n",
> > +   data->activations);
> > 
> > return disabled;
> >  }
> > @@ -452,14 +450,12 @@ static int __exynos_sysmmu_enable(struct
> > sysmmu_drvdata *data, ret = 1;
> > }
> > 
> > -   dev_dbg(data->

Re: [PATCH v2] drivers/crypto/nx: saves chaining value from co-processor

2013-08-08 Thread Herbert Xu
On Fri, Aug 09, 2013 at 04:25:04PM +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2013-08-07 at 18:15 -0500, Fionnuala Gunter wrote:
> > This patch fixes a bug that is triggered when cts(cbc(aes)) is used with
> > nx-crypto driver on input larger than 32 bytes.
> > 
> > The chaining value from co-processor was not being saved. This value is
> > needed because it is used as the IV by cts(cbc(aes)).
> > 
> > Signed-off-by: Fionnuala Gunter 
> > Reviewed-by: Marcelo Cerri 
> 
> Herbert, I assume you will handle this along with all the other NX fixes
> and I can safely take them out of linuxppc patchwork ?

Yes of course.

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


[PATCH 1/3] perf tools: Separate out GTK codes to libperf-gtk.so

2013-08-08 Thread Namhyung Kim
Separate out GTK codes to a shared object called libperf-gtk.so.  This
time only GTK codes are built with -fPIC and libperf remains as is.

Cc: Andi Kleen 
Reviewed-by: Pekka Enberg 
Signed-off-by: Namhyung Kim 
---
 tools/perf/Makefile| 42 ++
 tools/perf/config/Makefile | 14 ++
 2 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index e0d3d9f96771..5f96eedf9767 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -113,6 +113,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 BUILTIN_OBJS =
 LIB_H =
 LIB_OBJS =
+GTK_OBJS =
 PYRF_OBJS =
 SCRIPT_SH =
 
@@ -485,13 +486,19 @@ ifndef NO_SLANG
 endif
 
 ifndef NO_GTK2
-  LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
-  LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
-  LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
-  LIB_OBJS += $(OUTPUT)ui/gtk/util.o
-  LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
-  LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
-  LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
+  ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
+
+  GTK_OBJS += $(OUTPUT)ui/gtk/browser.o
+  GTK_OBJS += $(OUTPUT)ui/gtk/hists.o
+  GTK_OBJS += $(OUTPUT)ui/gtk/setup.o
+  GTK_OBJS += $(OUTPUT)ui/gtk/util.o
+  GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o
+  GTK_OBJS += $(OUTPUT)ui/gtk/progress.o
+  GTK_OBJS += $(OUTPUT)ui/gtk/annotate.o
+
+install-gtk: $(OUTPUT)libperf-gtk.so
+   $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'
+   $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
 endif
 
 ifndef NO_LIBPERL
@@ -545,6 +552,12 @@ $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
$(BUILTIN_OBJS) $(LIBS) -o $@
 
+$(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
+   $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
+
+$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
+   $(QUIET_LINK)$(CC) -o $@ -shared $(ALL_LDFLAGS) $(filter %.o,$^) 
$(GTK_LIBS)
+
 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h 
$(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
@@ -654,7 +667,8 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard 
*/*.h)
 
 # we compile into subdirectories. if the target directory is not the source 
directory, they might not exists. So
 # we depend the various files onto their directories.
-DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)common-cmds.h
+DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS)
+DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
 $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS)))
 # In the second step, we make a rule to actually create these directories
 $(sort $(dir $(DIRECTORY_DEPS))):
@@ -763,7 +777,9 @@ check: $(OUTPUT)common-cmds.h
 
 ### Installation rules
 
-install-bin: all
+install-gtk:
+
+install-bin: all install-gtk
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) -d -m 755 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
@@ -796,15 +812,17 @@ $(INSTALL_DOC_TARGETS):
 ### Cleaning rules
 
 clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean
-   $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive 
$(OUTPUT)perf.o $(LANG_BINDINGS)
+   $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(GTK_OBJS)
+   $(RM) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
$(RM) $(ALL_PROGRAMS) perf
-   $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS 
tags cscope*
+   $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo
+   $(RM) $(OUTPUT)common-cmds.h TAGS tags cscope*
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
$(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
$(RM) $(OUTPUT)util/*-bison*
$(RM) $(OUTPUT)util/*-flex*
$(python-clean)
 
-.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK)
+.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK) install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 214e17e97e5c..6bdfd0302c4e 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -267,11 +267,11 @@ ifndef NO_GTK2
 NO_GTK2 := 1
   else
 ifeq ($(call 
try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
-  CFLAGS += -DHAVE_GTK_INFO_BAR
+  GTK_CFLAGS := -DHAVE_GTK_INFO_BAR
 endif
-CFLAGS += -DGTK2_SUPPORT
-CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
-EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
+GTK_CFLAGS += -DGTK2_SUPPORT
+GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
+GTK_LIBS := $(shell pkg-config 

[PATCH 2/3] perf tools: Setup GTK browser dynamically

2013-08-08 Thread Namhyung Kim
Call setup/exit GTK browser function using libdl.

Cc: Andi Kleen 
Reviewed-by: Pekka Enberg 
Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/gtk/gtk.h |  3 +++
 tools/perf/ui/setup.c   | 50 +++--
 tools/perf/ui/ui.h  | 12 +---
 3 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index 3d96785ef155..09b7a062fd48 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -20,6 +20,9 @@ struct perf_gtk_context {
guint statbar_ctx_id;
 };
 
+int perf_gtk__init(void);
+void perf_gtk__exit(bool wait_for_ok);
+
 extern struct perf_gtk_context *pgctx;
 
 static inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx)
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 47d9a571f261..8c03741b 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -1,10 +1,56 @@
 #include 
+#include 
 
 #include "../util/cache.h"
 #include "../util/debug.h"
 #include "../util/hist.h"
 
 pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
+void *perf_gtk_handle;
+
+#ifdef GTK2_SUPPORT
+static int setup_gtk_browser(void)
+{
+   int (*perf_ui_init)(void);
+
+   perf_gtk_handle = dlopen("libperf-gtk.so", RTLD_LAZY);
+   if (perf_gtk_handle == NULL)
+   return -1;
+
+   perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init");
+   if (perf_ui_init == NULL)
+   goto out_close;
+
+   if (perf_ui_init() == 0)
+   return 0;
+
+out_close:
+   dlclose(perf_gtk_handle);
+   return -1;
+}
+
+static void exit_gtk_browser(bool wait_for_ok)
+{
+   void (*perf_ui_exit)(bool);
+
+   if (perf_gtk_handle == NULL)
+   return;
+
+   perf_ui_exit = dlsym(perf_gtk_handle, "perf_gtk__exit");
+   if (perf_ui_exit == NULL)
+   goto out_close;
+
+   perf_ui_exit(wait_for_ok);
+
+out_close:
+   dlclose(perf_gtk_handle);
+
+   perf_gtk_handle = NULL;
+}
+#else
+static inline int setup_gtk_browser(void) { return -1; }
+static inline void exit_gtk_browser(bool wait_for_ok __maybe_unused) {}
+#endif
 
 void setup_browser(bool fallback_to_pager)
 {
@@ -17,7 +63,7 @@ void setup_browser(bool fallback_to_pager)
 
switch (use_browser) {
case 2:
-   if (perf_gtk__init() == 0)
+   if (setup_gtk_browser() == 0)
break;
/* fall through */
case 1:
@@ -39,7 +85,7 @@ void exit_browser(bool wait_for_ok)
 {
switch (use_browser) {
case 2:
-   perf_gtk__exit(wait_for_ok);
+   exit_gtk_browser(wait_for_ok);
break;
 
case 1:
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index 70cb0d4eb8aa..4f7cbe6a2608 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -6,6 +6,7 @@
 #include 
 
 extern pthread_mutex_t ui__lock;
+extern void *perf_gtk_handle;
 
 extern int use_browser;
 
@@ -23,17 +24,6 @@ static inline int ui__init(void)
 static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
 #endif
 
-#ifdef GTK2_SUPPORT
-int perf_gtk__init(void);
-void perf_gtk__exit(bool wait_for_ok);
-#else
-static inline int perf_gtk__init(void)
-{
-   return -1;
-}
-static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {}
-#endif
-
 void ui__refresh_dimensions(bool force);
 
 #endif /* _PERF_UI_H_ */
-- 
1.7.11.7

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


[PATCH 3/3] perf tools: Run dynamic loaded GTK browser

2013-08-08 Thread Namhyung Kim
Run GTK hist and annotation browser using libdl.

Cc: Andi Kleen 
Reviewed-by: Pekka Enberg 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-annotate.c | 26 +++---
 tools/perf/builtin-report.c   | 16 ++--
 tools/perf/config/Makefile|  2 +-
 tools/perf/ui/gtk/annotate.c  | 13 ++---
 tools/perf/ui/gtk/gtk.h   | 13 +
 tools/perf/util/annotate.h| 24 
 tools/perf/util/hist.h| 15 ---
 7 files changed, 61 insertions(+), 48 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index db491e9a812b..82469b3ead07 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -30,6 +30,7 @@
 #include "util/tool.h"
 #include "arch/common.h"
 
+#include 
 #include 
 
 struct perf_annotate {
@@ -143,8 +144,18 @@ find_next:
 
if (use_browser == 2) {
int ret;
+   int (*annotate)(struct hist_entry *he,
+   struct perf_evsel *evsel,
+   struct hist_browser_timer *hbt);
+
+   annotate = dlsym(perf_gtk_handle,
+"hist_entry__gtk_annotate");
+   if (annotate == NULL) {
+   ui__error("GTK browser not found!\n");
+   return;
+   }
 
-   ret = hist_entry__gtk_annotate(he, evsel, NULL);
+   ret = annotate(he, evsel, NULL);
if (!ret || !ann->skip_missing)
return;
 
@@ -246,8 +257,17 @@ static int __cmd_annotate(struct perf_annotate *ann)
goto out_delete;
}
 
-   if (use_browser == 2)
-   perf_gtk__show_annotations();
+   if (use_browser == 2) {
+   void (*show_annotations)(void);
+
+   show_annotations = dlsym(perf_gtk_handle,
+"perf_gtk__show_annotations");
+   if (show_annotations == NULL) {
+   ui__error("GTK browser not found!\n");
+   goto out_delete;
+   }
+   show_annotations();
+   }
 
 out_delete:
/*
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d785d89ed226..05c0e80c8ae4 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -35,6 +35,7 @@
 #include "util/hist.h"
 #include "arch/common.h"
 
+#include 
 #include 
 
 struct perf_report {
@@ -592,8 +593,19 @@ static int __cmd_report(struct perf_report *rep)
ret = 0;
 
} else if (use_browser == 2) {
-   perf_evlist__gtk_browse_hists(session->evlist, help,
- NULL, rep->min_percent);
+   int (*hist_browser)(struct perf_evlist *,
+   const char *,
+   struct hist_browser_timer *,
+   float min_pcnt);
+
+   hist_browser = dlsym(perf_gtk_handle,
+"perf_evlist__gtk_browse_hists");
+   if (hist_browser == NULL) {
+   ui__error("GTK browser not found!\n");
+   return ret;
+   }
+   hist_browser(session->evlist, help, NULL,
+rep->min_percent);
}
} else
perf_evlist__tty_browse_hists(session->evlist, rep, help);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 6bdfd0302c4e..1b6ccb242609 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -269,7 +269,7 @@ ifndef NO_GTK2
 ifeq ($(call 
try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
   GTK_CFLAGS := -DHAVE_GTK_INFO_BAR
 endif
-GTK_CFLAGS += -DGTK2_SUPPORT
+CFLAGS += -DGTK2_SUPPORT
 GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
 GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
   endif
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index f538794615db..9c7ff8d31b27 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -154,9 +154,9 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, 
struct symbol *sym,
return 0;
 }
 
-int symbol__gtk_annotate(struct symbol *sym, struct map *map,
-struct perf_evsel *evsel,
-struct hist_browser_timer *hbt)
+static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
+   struct perf_evsel *evsel,
+   struct hist_browser

[PATCH 0/3] perf ui/gtk: Separate out GTK code to a shared object (v4)

2013-08-08 Thread Namhyung Kim
Hi,

This is v3 of gtk code separation patchset to reduce library
dependencies of the perf executable.

I only built libperf-gtk.so with -fPIC, and it's not linked to libperf
at build time.  All unresolved symbols used for perf should be
resolved at runtime via perf executable (so libperf.a) - I didn't know
that the linker permits unresolved symbols in a shared library at
build time.

Tested on my x86-64 machine only.  It seems work well for me.

v4 changes:
 * create output directory for ui/gtk

You can find it on my 'perf/separate-v4' branch in my tree at:

  git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git


Any comments are welcome, thanks
Namhyung


Cc: Pekka Enberg 
Cc: Andi Kleen 

Namhyung Kim (3):
  perf tools: Separate out GTK codes to libperf-gtk.so
  perf tools: Setup GTK browser dynamically
  perf tools: Run dynamic loaded GTK browser

 tools/perf/Makefile   | 42 +---
 tools/perf/builtin-annotate.c | 26 +++---
 tools/perf/builtin-report.c   | 16 --
 tools/perf/config/Makefile| 12 ---
 tools/perf/ui/gtk/annotate.c  | 13 ---
 tools/perf/ui/gtk/gtk.h   | 16 ++
 tools/perf/ui/setup.c | 50 +--
 tools/perf/ui/ui.h| 12 +--
 tools/perf/util/annotate.h| 24 -
 tools/perf/util/hist.h| 15 -
 10 files changed, 151 insertions(+), 75 deletions(-)

-- 
1.7.11.7

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


Re: [PATCH v2] drivers/crypto/nx: saves chaining value from co-processor

2013-08-08 Thread Benjamin Herrenschmidt
On Wed, 2013-08-07 at 18:15 -0500, Fionnuala Gunter wrote:
> This patch fixes a bug that is triggered when cts(cbc(aes)) is used with
> nx-crypto driver on input larger than 32 bytes.
> 
> The chaining value from co-processor was not being saved. This value is
> needed because it is used as the IV by cts(cbc(aes)).
> 
> Signed-off-by: Fionnuala Gunter 
> Reviewed-by: Marcelo Cerri 

Herbert, I assume you will handle this along with all the other NX fixes
and I can safely take them out of linuxppc patchwork ?

Cheers,
Ben.

> ---
> v2. changed signed-off-by to reviewed-by and added more details to
> description
> 
> This bug appeared in the original submission (v3.5)
> ---
>  drivers/crypto/nx/nx-aes-cbc.c |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/crypto/nx/nx-aes-cbc.c
> b/drivers/crypto/nx/nx-aes-cbc.c
> index 35d483f..a2f99a9 100644
> --- a/drivers/crypto/nx/nx-aes-cbc.c
> +++ b/drivers/crypto/nx/nx-aes-cbc.c
> @@ -95,6 +95,7 @@ static int cbc_aes_nx_crypt(struct blkcipher_desc
> *desc,
> if (rc)
> goto out;
> 
> +   memcpy(desc->info, csbcpb->cpb.aes_cbc.cv, AES_BLOCK_SIZE);
> atomic_inc(&(nx_ctx->stats->aes_ops));
> atomic64_add(csbcpb->csb.processed_byte_count,
>  &(nx_ctx->stats->aes_bytes));


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 13/18] MAINTAINERS: Update sirf patterns

2013-08-08 Thread Barry Song
2013/7/22 Joe Perches :
> commit 3370dc916c ("pinctrl:sirf:re-arch and add support for
> new SiRFatlas6 SoC") moved the files, update the patterns.
>
> Signed-off-by: Joe Perches 
> cc: Barry Song <21cn...@gmail.com>
> cc: Linus Walleij 

Acked-by: Barry Song 

> ---
>  MAINTAINERS | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7622b04..6b24f82 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -813,7 +813,7 @@ F:  arch/arm/mach-prima2/
>  F: drivers/dma/sirf-dma.c
>  F: drivers/i2c/busses/i2c-sirf.c
>  F: drivers/mmc/host/sdhci-sirf.c
> -F: drivers/pinctrl/pinctrl-sirf.c
> +F: drivers/pinctrl/sirf/
>  F: drivers/spi/spi-sirf.c
>
>  ARM/EBSA110 MACHINE SUPPORT
> --
> 1.8.1.2.459.gbcd45b4.dirty
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] netconsole: avoid a crash with multiple sysfs writers

2013-08-08 Thread Neil Horman
On Thu, Aug 08, 2013 at 09:14:31AM +0300, Dan Aloni wrote:
> On Thu, Aug 8, 2013 at 8:50 AM, Neil Horman  wrote:
> >
> > On Wed, Aug 07, 2013 at 12:02:44PM +0300, Dan Aloni wrote:
> [..]
> >
> > > When my 'ifup eth' script was fired multiple times and ran concurrent o> 
> > > @@ -682,7 +689,11 @@ restart:
> > >* we might sleep in __netpoll_cleanup()
> > >*/
> > >   spin_unlock_irqrestore(&target_list_lock, 
> > > flags);
> > > +
> > > + mutex_lock(&nt->mutex);
> > >   __netpoll_cleanup(&nt->np);
> > > + mutex_unlock(&nt->mutex);
> > > +
> > NAK, you can't hold a mutex while calling __netpoll_cleanup.  
> > __netpoll_cleanup
> > may sleep and its illegal to hold a mutex while doing so.
> > Neil
> >
> 
> To my understanding, it mostly depends on locking order, and having
> sleeplocks in the outer order and spinlocks in the inner order is
> valid as long the locking order is not reversed.
> 
> Also, drivers/net/team/team.c - another netpoll user, already does the
> same thing I intended in this patch - it locks the outer team->lock
> mutex in team_uninit() while calling team_port_del() and then
> team_port_disable_netpoll() calls __netpoll_cleanup().
> 
Sorry, you're right, I was under the impression that you were already in atomic
context, but as long as you don't have preempt disabled when you try to take the
mutex in any path, you should be ok.

Signed-off-by: Neil Horman 

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


[PATCH 1/3] f2fs: fix the use of XATTR_NODE_OFFSET

2013-08-08 Thread Jaegeuk Kim
This patch fixes the use of XATTR_NODE_OFFSET.

o The offset should not use several MSB bits which are used by marking node
blocks.

o IS_DNODE should handle XATTR_NODE_OFFSET to avoid potential abnormality
during the fsync call.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h | 12 +++-
 fs/f2fs/node.h |  4 
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index d8e386ce..eb8c45b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -135,11 +135,13 @@ static inline int update_sits_in_cursum(struct 
f2fs_summary_block *rs, int i)
 /*
  * For INODE and NODE manager
  */
-#define XATTR_NODE_OFFSET  (-1)/*
-* store xattrs to one node block per
-* file keeping -1 as its node offset to
-* distinguish from index node blocks.
-*/
+/*
+ * XATTR_NODE_OFFSET stores xattrs to one node block per file keeping -1
+ * as its node offset to distinguish from index node blocks.
+ * But some bits are used to mark the node block.
+ */
+#define XATTR_NODE_OFFSET  unsigned int)-1) << OFFSET_BIT_SHIFT) \
+   >> OFFSET_BIT_SHIFT)
 enum {
ALLOC_NODE, /* allocate a new node page if needed */
LOOKUP_NODE,/* look up a node without readahead */
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 87349c4..3496bb3 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -229,6 +229,10 @@ static inline block_t next_blkaddr_of_node(struct page 
*node_page)
 static inline bool IS_DNODE(struct page *node_page)
 {
unsigned int ofs = ofs_of_node(node_page);
+
+   if (ofs == XATTR_NODE_OFFSET)
+   return false;
+
if (ofs == 3 || ofs == 4 + NIDS_PER_BLOCK ||
ofs == 5 + 2 * NIDS_PER_BLOCK)
return false;
-- 
1.8.3.1.437.g0dbd812

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ALSA: Added jack detection KControl support

2013-08-08 Thread Felipe F. Tonello
From: "Felipe F. Tonello" 

This patch adds jack support for ALSA KControl.

This support is necessary since the new kcontrol is used by user-space
daemons, such as PulseAudio(>=2.0), to do jack detection.)

Also, HDA's CONFIG_SND_HDA_INPUT_JACK is disabled because it causes to use 
standard
snd_jack_new() to create jacks. This can cause conflict since this codec creates
jack controls directly.

It makes sure that all codecs using ALSA jack API are updated to use the new
API.

Signed-off-by: Felipe F. Tonello 
---
 include/sound/control.h|  2 +-
 include/sound/jack.h   |  8 ++--
 include/sound/soc.h|  2 +-
 sound/core/Kconfig |  1 +
 sound/core/ctljack.c   |  3 +-
 sound/core/jack.c  | 88 +++---
 sound/pci/hda/Kconfig  |  8 
 sound/pci/oxygen/xonar_wm87x6.c|  2 +-
 sound/soc/fsl/wm1133-ev1.c |  4 +-
 sound/soc/mid-x86/mfld_machine.c   |  4 +-
 sound/soc/omap/ams-delta.c |  2 +-
 sound/soc/omap/omap-abe-twl6040.c  |  2 +-
 sound/soc/omap/omap-twl4030.c  |  2 +-
 sound/soc/omap/rx51.c  |  4 +-
 sound/soc/pxa/hx4700.c |  2 +-
 sound/soc/pxa/palm27x.c|  2 +-
 sound/soc/pxa/ttc-dkb.c|  6 +--
 sound/soc/pxa/z2.c |  2 +-
 sound/soc/samsung/goni_wm8994.c|  5 ++-
 sound/soc/samsung/h1940_uda1380.c  |  2 +-
 sound/soc/samsung/littlemill.c | 10 ++---
 sound/soc/samsung/lowland.c|  6 +--
 sound/soc/samsung/rx1950_uda1380.c |  2 +-
 sound/soc/samsung/smartq_wm8987.c  |  2 +-
 sound/soc/samsung/speyside.c   |  6 +--
 sound/soc/samsung/tobermory.c  |  4 +-
 sound/soc/soc-jack.c   |  5 ++-
 sound/soc/tegra/tegra_alc5632.c|  2 +-
 sound/soc/tegra/tegra_rt5640.c |  2 +-
 sound/soc/tegra/tegra_wm8903.c |  4 +-
 30 files changed, 135 insertions(+), 59 deletions(-)

diff --git a/include/sound/control.h b/include/sound/control.h
index 5358892..ffeb6b6 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -242,6 +242,6 @@ void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool 
hook_only);
 struct snd_kcontrol *
 snd_kctl_jack_new(const char *name, int idx, void *private_data);
 void snd_kctl_jack_report(struct snd_card *card,
- struct snd_kcontrol *kctl, bool status);
+  struct snd_kcontrol *kctl, bool status);
 
 #endif /* __SOUND_CONTROL_H */
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 5891657..0d36f20 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -26,6 +26,7 @@
 #include 
 
 struct input_dev;
+struct snd_kcontrol;
 
 /**
  * Jack types which can be reported.  These values are used as a
@@ -58,11 +59,12 @@ enum snd_jack_types {
 
 struct snd_jack {
struct input_dev *input_dev;
+   struct snd_kcontrol *kctl[SND_JACK_SWITCH_TYPES]; /* control for each 
key */
int registered;
int type;
const char *id;
char name[100];
-   unsigned int key[6];   /* Keep in sync with definitions above */
+   unsigned int key[SND_JACK_SWITCH_TYPES];   /* Keep in sync with 
definitions above */
void *private_data;
void (*private_free)(struct snd_jack *);
 };
@@ -70,7 +72,7 @@ struct snd_jack {
 #ifdef CONFIG_SND_JACK
 
 int snd_jack_new(struct snd_card *card, const char *id, int type,
-struct snd_jack **jack);
+ int idx, struct snd_jack **jack);
 void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
 int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
 int keytype);
@@ -80,7 +82,7 @@ void snd_jack_report(struct snd_jack *jack, int status);
 #else
 
 static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
-  struct snd_jack **jack)
+   int idx, struct snd_jack **jack)
 {
return 0;
 }
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6eabee7..31bea52 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -436,7 +436,7 @@ int snd_soc_platform_trigger(struct snd_pcm_substream 
*substream,
 
 /* Jack reporting */
 int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
-struct snd_soc_jack *jack);
+ int idx, struct snd_soc_jack *jack);
 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
  struct snd_soc_jack_pin *pins);
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index c0c2f57..8167615 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -20,6 +20,7 @@ config SND_COMPRESS_OFFLOAD
 # to avoid having to force INPUT on.
 config SND_JACK
bool
+   select SND_KCTL_JACK
 
 config SND_SEQUENCER
tristate "Sequencer support"
diff --git a/s

[PATCH 2/3] f2fs: fix inconsistency between xattr node blocks and its inode

2013-08-08 Thread Jaegeuk Kim
Previously xattr node blocks are stored to the COLD_NODE log, which means that
our roll-forward mechanism doesn't recover the xattr node blocks at all.
Only the direct node blocks in the WARM_NODE log can be recovered.

So, let's resolve the issue simply by conducting checkpoint during fsync when a
file has a modified xattr node block.

This approach is able to degrade the performance, but normally the checkpoint
overhead is shown at the initial fsync call after the xattr entry changes.
Once the checkpoint is done, no additional overhead would be occurred.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h  | 1 +
 fs/f2fs/file.c  | 3 +++
 fs/f2fs/xattr.c | 4 
 3 files changed, 8 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index eb8c45b..c1c9670 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -181,6 +181,7 @@ struct f2fs_inode_info {
f2fs_hash_t chash;  /* hash value of given file name */
unsigned int clevel;/* maximum level of given file name */
nid_t i_xattr_nid;  /* node id that contains xattrs */
+   unsigned long long xattr_ver;   /* cp version of xattr modification */
struct extent_info ext; /* in-memory extent cache entry */
 };
 
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index c2deb27..49a414d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -161,6 +161,9 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t 
end, int datasync)
need_cp = true;
else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino))
need_cp = true;
+   else if (F2FS_I(inode)->xattr_ver ==
+   le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver))
+   need_cp = true;
 
if (need_cp) {
nid_t pino;
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 3ab07ec..0f6d2a1 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -486,6 +486,10 @@ int f2fs_setxattr(struct inode *inode, int name_index, 
const char *name,
inode->i_ctime = CURRENT_TIME;
clear_inode_flag(fi, FI_ACL_MODE);
}
+
+   /* store checkpoint version for conducting checkpoint during fsync */
+   fi->xattr_ver = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver);
+
if (ipage)
update_inode(inode, ipage);
else
-- 
1.8.3.1.437.g0dbd812

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


[PATCH 3/3] f2fs: introduce cur_cp_versioin function to reduce code size

2013-08-08 Thread Jaegeuk Kim
This patch introduces a new inline function, cur_cp_version, to reduce redundant
codes.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c | 6 +++---
 fs/f2fs/f2fs.h   | 7 ++-
 fs/f2fs/file.c   | 3 +--
 fs/f2fs/recovery.c   | 4 ++--
 fs/f2fs/xattr.c  | 2 +-
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index c5a5c39..bb31220 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -379,7 +379,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info 
*sbi,
if (!f2fs_crc_valid(crc, cp_block, crc_offset))
goto invalid_cp1;
 
-   pre_version = le64_to_cpu(cp_block->checkpoint_ver);
+   pre_version = cur_cp_version(cp_block);
 
/* Read the 2nd cp block in this CP pack */
cp_addr += le32_to_cpu(cp_block->cp_pack_total_block_count) - 1;
@@ -394,7 +394,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info 
*sbi,
if (!f2fs_crc_valid(crc, cp_block, crc_offset))
goto invalid_cp2;
 
-   cur_version = le64_to_cpu(cp_block->checkpoint_ver);
+   cur_version = cur_cp_version(cp_block);
 
if (cur_version == pre_version) {
*version = cur_version;
@@ -799,7 +799,7 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool 
is_umount)
 * Increase the version number so that
 * SIT entries and seg summaries are written at correct place
 */
-   ckpt_ver = le64_to_cpu(ckpt->checkpoint_ver);
+   ckpt_ver = cur_cp_version(ckpt);
ckpt->checkpoint_ver = cpu_to_le64(++ckpt_ver);
 
/* write cached NAT/SIT entries to NAT/SIT area */
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index c1c9670..5348b63 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -503,6 +503,11 @@ static inline void F2FS_RESET_SB_DIRT(struct f2fs_sb_info 
*sbi)
sbi->s_dirty = 0;
 }
 
+static inline unsigned long long cur_cp_version(struct f2fs_checkpoint *cp)
+{
+   return le64_to_cpu(cp->checkpoint_ver);
+}
+
 static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int 
f)
 {
unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags);
@@ -691,7 +696,7 @@ static inline block_t __start_cp_addr(struct f2fs_sb_info 
*sbi)
 {
block_t start_addr;
struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
-   unsigned long long ckpt_version = le64_to_cpu(ckpt->checkpoint_ver);
+   unsigned long long ckpt_version = cur_cp_version(ckpt);
 
start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
 
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 49a414d..dface4f 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -161,8 +161,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t 
end, int datasync)
need_cp = true;
else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino))
need_cp = true;
-   else if (F2FS_I(inode)->xattr_ver ==
-   le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver))
+   else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi)))
need_cp = true;
 
if (need_cp) {
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 639eb34..c6908b5 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -117,7 +117,7 @@ static int recover_inode(struct inode *inode, struct page 
*node_page)
 
 static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
 {
-   unsigned long long cp_ver = le64_to_cpu(sbi->ckpt->checkpoint_ver);
+   unsigned long long cp_ver = cur_cp_version(F2FS_CKPT(sbi));
struct curseg_info *curseg;
struct page *page;
block_t blkaddr;
@@ -355,7 +355,7 @@ err:
 static int recover_data(struct f2fs_sb_info *sbi,
struct list_head *head, int type)
 {
-   unsigned long long cp_ver = le64_to_cpu(sbi->ckpt->checkpoint_ver);
+   unsigned long long cp_ver = cur_cp_version(F2FS_CKPT(sbi));
struct curseg_info *curseg;
struct page *page;
int err = 0;
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 0f6d2a1..fb16f71 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -488,7 +488,7 @@ int f2fs_setxattr(struct inode *inode, int name_index, 
const char *name,
}
 
/* store checkpoint version for conducting checkpoint during fsync */
-   fi->xattr_ver = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver);
+   fi->xattr_ver = cur_cp_version(F2FS_CKPT(sbi));
 
if (ipage)
update_inode(inode, ipage);
-- 
1.8.3.1.437.g0dbd812

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


Re: [PATCH 1/3] perf tools: Separate out GTK codes to libperf-gtk.so

2013-08-08 Thread Namhyung Kim
Hi Arnaldo,

On Thu, 8 Aug 2013 12:21:16 -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 08, 2013 at 03:34:08PM +0900, Namhyung Kim escreveu:
>> Separate out GTK codes to a shared object called libperf-gtk.so.  This
>> time only GTK codes are built with -fPIC and libperf remains as is.
>
> [acme@sandy linux]$ cat /etc/fedora-release 
> Fedora release 18 (Spherical Cow)
> [acme@sandy linux]$ 
>
> Applying: perf tools: Separate out GTK codes to libperf-gtk.so
> [perf/core c1ca5ea] perf tools: Separate out GTK codes to libperf-gtk.so
>  Author: Namhyung Kim 
>  2 files changed, 38 insertions(+), 15 deletions(-)
> [acme@sandy linux]$ make -j8 O=/tmp/build/perf -C tools/perf/ install-bin
> CHK -fstack-protector-all
> 
> CC /tmp/build/perf/scripts/perl/Perf-Trace-Util/Context.o
> CC /tmp/build/perf/util/scripting-engines/trace-event-python.o
> CC /tmp/build/perf/scripts/python/Perf-Trace-Util/Context.o
> GEN perf-archive
> GEN /tmp/build/perf/python/perf.so
> CC /tmp/build/perf/perf.o
> AR /tmp/build/perf/libperf.a
> LINK /tmp/build/perf/perf
> LINK /tmp/build/perf/libperf-gtk.so
> /usr/bin/ld: /tmp/build/perf/ui/gtk/browser.o: relocation R_X86_64_32 against 
> `.rodata.str1.1' can not be used when making a shared object; recompile with 
> -fPIC
> /tmp/build/perf/ui/gtk/browser.o: could not read symbols: Bad value

Hmm.. this looks like the browser.o previously built without -fPIC.


> collect2: error: ld returned 1 exit status
> make: *** [/tmp/build/perf/libperf-gtk.so] Error 1
> make: *** Waiting for unfinished jobs
> make: Leaving directory `/home/acme/git/linux/tools/perf'
> [acme@sandy linux]$
>
> And if I just do:
>
> [acme@sandy linux]$ rm -rf /tmp/build/perf
> [acme@sandy linux]$ mkdir /tmp/build/perf
> [acme@sandy linux]$ make -j8 O=/tmp/build/perf -C tools/perf/ install-bin
> CHK -fstack-protector-all
> CHK -Wstack-protector
> CHK -Wvolatile-register-var
> CHK -D_FORTIFY_SOURCE=2
> CHK bionic
> CHK libelf
> CHK libdw
> CHK -DLIBELF_MMAP
> CHK -DLIBELF_MMAP
> CHK libunwind
> CHK libaudit
> CHK libslang
> CHK gtk2
> CHK -DHAVE_GTK_INFO_BAR
> CHK perl
> CHK python
> CHK python version
> CHK libbfd
> CHK -DHAVE_STRLCPY
> CHK -DHAVE_ON_EXIT
> CHK -DBACKTRACE_SUPPORT
> CHK libnuma
> make: Entering directory `/home/acme/git/linux/tools/perf'
> MKDIR /tmp/build/perf/arch/
> MKDIR /tmp/build/perf/arch/x86/util/
> MKDIR /tmp/build/perf/bench/
> MKDIR /tmp/build/perf/scripts/perl/Perf-Trace-Util/
> MKDIR /tmp/build/perf/scripts/python/Perf-Trace-Util/
> MKDIR /tmp/build/perf/ui/
> MKDIR /tmp/build/perf/ui/browsers/
> MKDIR /tmp/build/perf/tests/
> MKDIR /tmp/build/perf/ui/stdio/
> MKDIR /tmp/build/perf/ui/tui/
> MKDIR /tmp/build/perf/util/
> MKDIR /tmp/build/perf/util/scripting-engines/
> * new build flags or prefix
> BISON /tmp/build/perf/util/pmu-bison.c
> CC /tmp/build/perf/util/environment.o
> 
> CC /tmp/build/perf/builtin-buildid-cache.o
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/setup.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/setup.o] Error 1
> make: *** Waiting for unfinished jobs
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/util.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/util.o] Error 1
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/progress.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/progress.o] Error 1
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/browser.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/browser.o] Error 1
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/helpline.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/helpline.o] Error 1
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/annotate.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/annotate.o] Error 1
> Assembler messages:
> Fatal error: can't create /tmp/build/perf/ui/gtk/hists.o: No such file or 
> directory
> make: *** [/tmp/build/perf/ui/gtk/hists.o] Error 1
> make: Leaving directory `/home/acme/git/linux/tools/perf'
> [acme@sandy linux]$ 

Argh... sorry about that.  I forgot to add GTK_OBJS to DIRECTORY_DEPS.
Will send v4 soon.

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


linux-next: Tree for Aug 9

2013-08-08 Thread Stephen Rothwell
Hi all,

Changes since 20130808:

*crickets*



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

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

Below is a summary of the state of the merge.

We are up to 222 trees (counting Linus' and 30 trees of patches pending
for Linus' tree), more are welcome (even if they are currently empty).
Thanks to those who have contributed, and to those who haven't, please do.

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

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

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (6c2580c Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32)
Merging fixes/master (b3a3a9c Merge tag 'trace-3.11-rc2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace)
Merging kbuild-current/rc-fixes (ad81f05 Linux 3.11-rc1)
Merging arc-current/for-curr (c095ba7 Linux 3.11-rc4)
Merging arm-current/fixes (e35ac62 Merge branch 'security-fixes' into fixes)
Merging m68k-current/for-linus (ad81f05 Linux 3.11-rc1)
Merging metag-fixes/fixes (dfe248b MAINTAINERS: add linux-metag mailing list)
Merging powerpc-merge/merge (fe956a1 powerpc/windfarm: Fix noisy slots-fan on 
Xserve (rm31))
Merging sparc/master (1c2696c sparc64: Fix ITLB handler of null page)
Merging net/master (75848d3 Merge branch 'for-davem' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless)
Merging ipsec/master (01cb71d net_sched: restore "overhead xxx" handling)
Merging sound-current/for-linus (57e6dae ALSA: usb-audio: do not trust too-big 
wMaxPacketSize values)
Merging pci-current/for-linus (36dd1f3 PCI: mvebu: Disable prefetchable memory 
support in PCI-to-PCI bridge)
Merging wireless/master (5a6e0cf cw1200: Fix spurious BUG_ON() trigger when 
starting AP mode.)
Merging driver-core.current/driver-core-linus (5ae90d8 Linux 3.11-rc3)
Merging tty.current/tty-linus (c095ba7 Linux 3.11-rc4)
Merging usb.current/usb-linus (444ce9d MAINTAINERS: Add separate section for 
USB NETWORKING DRIVERS)
Merging staging.current/staging-linus (cefe8a3 Merge tag 'iio-fixes-for-3.11b' 
of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus)
Merging char-misc.current/char-misc-linus (5ae90d8 Linux 3.11-rc3)
Merging input-current/for-linus (88ce3c3 Merge branch 'next' into for-linus)
Merging md-current/for-linus (f94c0b6 md/raid5: fix interaction of 'replace' 
and 'recovery'.)
Merging audit-current/for-linus (c158a35 audit: no leading space in 
audit_log_d_path prefix)
Merging crypto-current/master (e70308e Revert "crypto: crct10dif - Wrap 
crc_t10dif function all to use crypto transform framework")
Merging ide/master (6d128e1 Revert "Makefile: Fix install error with make -j 
option")
Merging dwmw2/master (5950f08 pcmcia: remove RPX board stuff)
Merging sh-current/sh-fixes-for-linus (4403310 SH: Convert out[bwl] macros to 
inline functions)
Merging devicetree-current/devicetree/merge (cf9e236 of/irq: init struct 
resource to 0 in of_irq_to_resource())
Merging rr-fixes/fixes (aa52aee virtio-scsi: Fix virtqueue affinity setup)
Merging mfd-fixes/master (5649d8f mfd: ab8500-sysctrl: Let sysctrl driver work 
without pdata)
Merging vfio-fixes/for-linus (d24cdbf vfio-pci: Avoid deadlock on remove)
Merging drm-intel-fixes/drm-intel-fixes (3f57757 drm/i915: do not disable 
backlight on vgaswitcheroo switch off)
Merging asm-generic/master (fb9de7e xt

Re: [PATCH v2 2/3] ARM: dt: t114 dalmore: add dt entry for nct1008

2013-08-08 Thread Wei Ni
On 08/09/2013 05:33 AM, Guenter Roeck wrote:
> On 08/08/2013 01:40 PM, Stephen Warren wrote:
>> On 08/08/2013 02:36 PM, Sergei Shtylyov wrote:
>>> Hello.
>>>
>>> On 08/08/2013 10:56 AM, Wei Ni wrote:
>>>
 Enable thermal sensor nct1008 for t114 dalmore.
>>>
 Signed-off-by: Wei Ni 
 ---
arch/arm/boot/dts/tegra114-dalmore.dts |   10 +-
1 file changed, 9 insertions(+), 1 deletion(-)
>>>
 diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts
 b/arch/arm/boot/dts/tegra114-dalmore.dts
 index b5a42f0..9d4d2b2 100644
 --- a/arch/arm/boot/dts/tegra114-dalmore.dts
 +++ b/arch/arm/boot/dts/tegra114-dalmore.dts
 @@ -738,6 +738,14 @@
realtek,ldo1-en-gpios =
<&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
};
 +
 +nct1008 {
>>>
>>> ePAPR [1] says: "the name of a node should be somewhat generic,
>>> reflecting the function of the device and not its precise programming
>>> model". So I suggest "thermal"
>>
>> True, although there's quite some precedent for node-names being the
>> chip name for external chips in existing DTs. If we change this node
>> name, I'd like to see a patch that makes all the other "nct1008" nodes
>> match the new name...
>>
> 
> On the other side, one should not use a bad example as an argument or excuse
> to make the same mistake again (though I keep hearing it all the time ... ).
> I for my part tend to use something like temp-sensor or temp-sensor@1c.
> Advantage of that kind of node name is that it auto-describes the node.

Ok, so I will set the node name as "temp-sensor"
And I will send out patches to change all other "nct1008" nodes.

> 
> Guenter
> 

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


Re: [PATCH v9 06/16] ARM: dts: Add description of System MMU of Exynos SoCs

2013-08-08 Thread Cho KyongHo
On Fri, 09 Aug 2013 00:26:51 +0200, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On Thursday 08 of August 2013 18:38:35 Cho KyongHo wrote:
> > Signed-off-by: Cho KyongHo 
> > ---
> >  .../bindings/iommu/samsung,exynos4210-sysmmu.txt   |  103 +++
> >  arch/arm/boot/dts/exynos4.dtsi |  122 
> >  arch/arm/boot/dts/exynos4210.dtsi  |   25 ++
> >  arch/arm/boot/dts/exynos4x12.dtsi  |   82 ++
> >  arch/arm/boot/dts/exynos5250.dtsi  |  290
> >  5 files changed, 622 insertions(+), 0 deletions(-)
> >  create mode 100644
> > Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt
> > b/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt
> > new file mode 100644
> > index 000..92f0a33
> > --- /dev/null
> > +++
> > b/Documentation/devicetree/bindings/iommu/samsung,exynos4210-sysmmu.txt
> > @@ -0,0 +1,103 @@
> > +Samsung Exynos4210 IOMMU H/W, System MMU (System Memory Management
> > Unit) +
> > +Samsung's Exynos architecture contains System MMU that enables
> > scattered +physical memory chunks visible as a contiguous region to
> > DMA-capable peripheral +devices like MFC, FIMC, FIMD, GScaler, FIMC-IS
> > and so forth.
> > +
> > +System MMU is a sort of IOMMU and support identical translation table
> > format to +ARMv7 translation tables with minimum set of page properties
> > including access +permissions, shareability and security protection. In
> > addition, System MMU has +another capabilities like L2 TLB or
> > block-fetch buffers to minimize translation +latency.
> > +
> > +A System MMU is dedicated to a single master peripheral device.  Thus,
> > it is +important to specify the correct System MMU in the device node
> > of its master +device. Whereas a System MMU is dedicated to a master
> > device, the master device +may have more than one System MMU.
> 
> This paragraph is still not clear. What about something among these lines:
> 
Yes. It is my fault.
It is still unchanged... even though Grant sugessted clear and simple sentence.
It must be changed :)

> System MMUs are in many to one relation with peripheral devices, i.e. 
> single peripheral device might have multiple System MMUs (usually one for 
> each bus master), but one System MMU can handle only one peripheral 
> device. The relation between a System MMU and the peripheral device it 
> handles needs to be defined in device node of this peripheral device.
> 

That looks good to me.
Please let me use your sentences.

> > +Required properties:
> > +- compatible: Should be "samsung,exynos4210-sysmmu"
> > +- reg: A tuple of base address and size of System MMU registers.
> > +- interrupt-parent: The phandle of the interrupt controller of System
> > MMU +- interrupts: A tuple of numbers that indicates the interrupt
> > source. 
> 
> interrupts: An interrupt specifier for interrupt signal of System MMU, 
> according to format defined for particular interrupt parent.

Yes.. it is not changed.. 
> 
> > +- clock-names: Should be "sysmmu" if the System MMU is needed
> > to gate its clock. +   Please refer to the following
> > documents:
> > +  Documentation/devicetree/bindings/clock/clock-bindings.txt
> > +  Documentation/devicetree/bindings/clock/exynos4-clock.txt
> > +  Documentation/devicetree/bindings/clock/exynos5250-
> clock.txt
> > +  Optional "master" if the clock to the System MMU is gated 
> by
> > +  another gate clock other than "sysmmu". The System MMU 
> driver
> > +  sets "master" the parent of "sysmmu".
> > +  Exynos4 SoCs, there needs no "master" clocks.
> > +  Exynos5 SoCs, some System MMUs must have "master" clocks.
> > +- clocks: Required if the System MMU is needed to gate its clock.
> > + Please refer to the documents listed above.
> > +- samsung,power-domain: Required if the System MMU is needed to gate
> > its power. +  Please refer to the following document:
> > + Documentation/devicetree/bindings/arm/exynos/power_domain.txt
> > +
> > +Required properties for the master peripheral devices:
> > +- iommu: phandles to the System MMUs of the device
> > +
> > +Examples:
> > +A System MMU is dedicated to a single master device.
> > +   gsc_0:  gsc@0x13e0 {
> 
> nit: duplicated space after gsc_0: and incorrect 0x prefix in node unit-
> address.
> 
Ok.

> > +   compatible = "samsung,exynos5-gsc";
> > +   reg = <0x13e0 0x1000>;
> > +   interrupts = <0 85 0>;
> > +   samsung,power-domain = <&pd_gsc>;
> > +   clocks = <&clock 256>;
> > +   clock-names = "gscl";
> > +   iommu = <&sysmmu_gsc1>;
> > +   };
> > +
> > +   sysmmu_gsc0: sysmmu@13E8 {
> > +   compatible = "samsung,exynos4210-sysmmu";
> > +   reg = <0x13E8 0x1000>;
> > +   interrupt-

Re: [PATCH v2 3/3] Documentation: dt: hwmon: add OF document for lm90

2013-08-08 Thread Wei Ni
On 08/09/2013 01:37 AM, Stephen Warren wrote:
> On 08/08/2013 12:56 AM, Wei Ni wrote:
>> Add OF document for lm90 in Documentation/devicetree/.
> 
>> diff --git a/Documentation/devicetree/bindings/hwmon/lm90.txt 
>> b/Documentation/devicetree/bindings/hwmon/lm90.txt
> 
>> +Required node properties:
>> +- compatible: manufacture and chip name,
>> +  which are listed in the Documentation/hwmon/lm90
> 
> You need to specify the exact values here. DT binding documentations
> should be OS-agnostic, and hence can't depend on Linux-specific
> documentation or other details.

Ok, I will list it.

> 
>> +Optional properties:
>> +- vdd-supply: vdd regulator for the supply voltage. If this is not set,
> 
> s/set/present/.

Oh, yes, I will change it.

> 
>> +- interrupts: lm90 can support interrupt mode, you can set interrupt here.
> 
> You might want to mention that a single entry ("specifier") is expected
> in the list.

Sorry, I didn't get your point, could you explain more?

> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/3] block: brd: Staticize 'rd_size'

2013-08-08 Thread Jingoo Han
On Friday, August 09, 2013 1:07 PM, Jingoo Han wrote:
> 
> 'rd_size' is used only in this file.
> Fix the following sparse warning:
> 
> drivers/block/brd.c:432:5: warning: symbol 'rd_size' was not declared. Should 
> it be static?
> 
> Signed-off-by: Jingoo Han 
> ---
>  drivers/block/brd.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Sorry, please ignore this patch.
It makes link error as below:

arch/arm/kernel/built-in.o: In function `parse_tag_ramdisk':
/home/jin9/mainline/linux-next_130806_sparse/arch/arm/kernel/atags_parse.c:103: 
undefined reference to `rd_size'

Best regards,
Jingoo Han

> 
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 9bf4371..650530ab 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -429,7 +429,7 @@ static const struct block_device_operations brd_fops = {
>   * And now the modules code and kernel interface.
>   */
>  static int rd_nr;
> -int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
> +static int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
>  static int max_part;
>  static int part_shift;
>  module_param(rd_nr, int, S_IRUGO);
> --
> 1.7.10.4


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


Re: [PATCH v2 2/3] ARM: dt: t114 dalmore: add dt entry for nct1008

2013-08-08 Thread Wei Ni
On 08/09/2013 01:35 AM, Stephen Warren wrote:
> On 08/08/2013 12:56 AM, Wei Ni wrote:
>> Enable thermal sensor nct1008 for t114 dalmore.
> 
> It'd be best to remove this patch from the series; send one series to
> the LM90 maintainer with just the driver and DT binding changes, and
> another series to the Tegra maintainer with the *.dts changes. You can
> tell me not to apply the *.dts changes until the driver/binding changes
> are accepted (or just wait until they are before sending the patch).

Ok, I will do it.

> 

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


[HANG] Trouble with NEC-based USB adapter in PCMCIA slot on E7110

2013-08-08 Thread Thomas Richter

Hi Alan, hi Dominik,

maybe you want me to help out a bit - I'm having trouble getting a 
Delock PCMCIA to USB-2 adapter to work under linux, with strange 
behavior in some situations. The trouble is that while I can *read* via 
fast (usb 2.0) transfers from the port, an ehci-triggered write just 
locks up (it does not Oops, though) and I'm pretty much stuck narrowing 
down the problem.


Here are some more details on the machine:

The USB 2 adapter chip is from NEC: 03:00.1 0c03: 1033:00e0 (rev 05)
and so is its ohci companion: 03:00.0 0c03: 1033:0035.

Both of them sit on a delock PMCCIA card, which hangs on a O2 Micro 
OZ6933/711E1 cardbus bridge:


02:0a.0 0607: 1217:6933 (rev 02)
02:0a.1 0607: 1217:6933 (rev 02)

The trouble is as follows: A read from a USB stick or an external 
harddisk through the scsi subsystem issues a SCSI command 28 (read 
block), and this works fine. A write (SCSI command 2A) locks up. The 
machine remains usable, but the command never completes. Some time later 
first the subsystem tries to reset the bus, does not succeed and then 
gives up. The harddisk on the USB even worse seems to "believe" to 
receive some data, and then thankfully erases the superblock of the ext2 
partition on it as soon as I try to mount it r/w. Read-only mounts work 
(no write commands involved). Happy happy joy joy!


It *also* works to disable the ehci portion of the NEC chip and just go 
through the companion. Transfer through ohci is fine (but, of course, 
slow, and besides the point since that's exactly what I need the adapter 
for).


The problem appears on various kernels, I've tested 3.10.5 (build 
myself), 3.2.0-4-686-pae (vanilly debian wheezy kernel), 2.6.32-5-686
(vanilla debian squeeze kernel). Interestingly, the chip *does* work 
under an older Knoppix (knoppix 5.0.1) with a 2.6.19.1 kernel. As far as 
I can read the notes, the ehci and cardbus interfaces have not been 
altered and are as they came with 2.6.19.1. I also checked I/O goes 
through high speed and not usb 1 (unloaded ohci, loaded ehci, inserted 
the stick - writing works!)


What is also strange (but an unrelated problem) is that I cannot make 
grub2 boot from the knoppix kernel. It just resets after having loaded 
kernel and initrd, immediately. I neither can build 2.6.19.1 manually 
unaltered as it depends on older userspace tools. After a bit of 
patching, I could get it to compile with gcc-4.7, but the kernel 
otherwise behaves as the Knoppix kernel: Just reboots after grub 2 
loaded it.


I also tried a newer knoppix with a 3.5 kernel, but this again locks up 
on writing, so something must have changed between 2.6.19.1 and 
2.6.32.5. Or something changed in knoppix or debian userland which I 
cannot test for because the 2.6.19.1 does not run here from the disk.


The system is an old Fujitsu E7110 with a debian wheezy userland with 
1GB of memory and an 80GB harddisk, with a Pentium 4-M dinosaur 
processor at 1.7Ghz featuring speedstep. Whether speedstep is enabled or 
disabled does not matter as far as the "stuck write" is concerned, the 
p4-clockmodulation module *is not* loaded and hence not the culprit.


Greetings,
Thomas

PS: Dear LKLM readers, please set me CC on any responses that would 
otherwise go through the mailing list only.


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


Re: [PATCH v6 00/10] mtd: add datasheet's ECC information to nand_chip{}

2013-08-08 Thread Brian Norris

On 08/08/2013 08:58 PM, Artem Bityutskiy wrote:

On Thu, 2013-08-08 at 16:06 -0700, Brian Norris wrote:

On Thu, Aug 08, 2013 at 04:33:35PM +0800, Huang Shijie wrote:

Hi Artem & Brian:

Hi Huang and others,

On Thu, May 16, 2013 at 8:17 PM, Huang Shijie  wrote:

1.) Why add the ECC information to the nand_chip{} ?

...

Reviewed-by: Brian Norris
Tested-by: Brian Norris

Thanks for the work Huang.


Could you please merge this patch set?


Thanks for the reminder. I haven't sorted through all the piles of
backed up stuff yet!

I made a few minor changes (for checkpatch.pl, regarding
__attribute__((packed)), and to make the style a little more
easily-read) and tested the generic stuff on my platform. I've pushed
the series to l2-mtd.git. Thanks for the patience!


I guess you can try aiaiai, I run it for all the patches I take to
l2-mtd.git. It uses also coccinelle/smatch/sparse and other tools to
verify the patches, not only checkpatch. And this git tree contains
scripts and various defconfigs for various MTD drivers - the scripts run
aiaiai.


Thanks, I actually already used it on his series :)


For example, to check Huang's patches, I run something like:

aiaiai-concat-mboxes ~/tmp/huang*.mbox | ./verify ../l2-mtd/ gpmi-nand

where "huang*.mbox" is Huang's patch set.


What's the use of 'aiai-concat-mboxes' over a simple 'cat'? Just 
inserting the extra blank line, I guess? But if I have a concatenated 
mailbox, this is better:


./verify ../l2-mtd/ gpmi-name < ~/tmp/huang.mbox


There are few minor issues in aiaiai, which I can fix if you hit them
and complain. Also, I did not invest much time in making the user
interface and experience very nice. But this can also be improved.


One issue (possibly related to the above question?) was that aiaia 
complained (via checkpatch.pl) about no sign-offs when I processed using 
the input redirection method on a multi-message mbox. I can take a 
closer look next time, but it's not a big deal, since I can verify this 
pretty easily.


Thanks again for the help and for the nice tools.

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


Re: [PATCH v9 04/16] iommu/exynos: allocate lv2 page table from own slab

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 16:00:18 +0200, Tomasz Figa wrote:
> On Thursday 08 of August 2013 18:38:04 Cho KyongHo wrote:
> > Since kmalloc() does not guarantee that the allignment of 1KiB when it
> > allocates 1KiB, it is required to allocate lv2 page table from own
> > slab that guarantees alignment of 1KiB
> > 
> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/exynos-iommu.c |   24 
> >  1 files changed, 20 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index d90e6fa..a318049 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -100,6 +100,8 @@
> >  #define REG_PB1_SADDR  0x054
> >  #define REG_PB1_EADDR  0x058
> > 
> > +static struct kmem_cache *lv2table_kmem_cache;
> > +
> >  static unsigned long *section_entry(unsigned long *pgtable, unsigned
> > long iova) {
> > return pgtable + lv1ent_offset(iova);
> > @@ -765,7 +767,8 @@ static void exynos_iommu_domain_destroy(struct
> > iommu_domain *domain)
> > 
> > for (i = 0; i < NUM_LV1ENTRIES; i++)
> > if (lv1ent_page(priv->pgtable + i))
> > -   kfree(__va(lv2table_base(priv->pgtable + i)));
> > +   kmem_cache_free(lv2table_kmem_cache,
> > +   __va(lv2table_base(priv->pgtable + i)));
> > 
> > free_pages((unsigned long)priv->pgtable, 2);
> > free_pages((unsigned long)priv->lv2entcnt, 1);
> > @@ -861,7 +864,7 @@ static unsigned long *alloc_lv2entry(unsigned long
> > *sent, unsigned long iova, if (lv1ent_fault(sent)) {
> > unsigned long *pent;
> > 
> > -   pent = kzalloc(LV2TABLE_SIZE, GFP_ATOMIC);
> > +   pent = kmem_cache_zalloc(lv2table_kmem_cache, GFP_ATOMIC);
> > BUG_ON((unsigned long)pent & (LV2TABLE_SIZE - 1));
> > if (!pent)
> > return ERR_PTR(-ENOMEM);
> > @@ -881,7 +884,7 @@ static int lv1set_section(unsigned long *sent,
> > phys_addr_t paddr, short *pgcnt)
> > 
> > if (lv1ent_page(sent)) {
> > BUG_ON(*pgcnt != NUM_LV2ENTRIES);
> > -   kfree(page_entry(sent, 0));
> > +   kmem_cache_free(lv2table_kmem_cache, page_entry(sent, 0));
> > *pgcnt = 0;
> > }
> > 
> > @@ -1082,10 +1085,23 @@ static int __init exynos_iommu_init(void)
> >  {
> > int ret;
> > 
> > +   lv2table_kmem_cache = kmem_cache_create("exynos-iommu-lv2table",
> > +   LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL);
> > +   if (!lv2table_kmem_cache) {
> > +   pr_err("%s: Failed to create kmem cache\n", __func__);
> > +   return -ENOMEM;
> > +   }
> > +
> > ret = platform_driver_register(&exynos_sysmmu_driver);
> > 
> > if (ret == 0)
> > -   bus_set_iommu(&platform_bus_type, &exynos_iommu_ops);
> > +   ret = bus_set_iommu(&platform_bus_type, &exynos_iommu_ops);
> > +
> > +   if (ret) {
> > +   pr_err("%s: Failed to register exynos-iommu driver.\n",
> > +   __func__);
> > +   kmem_cache_destroy(lv2table_kmem_cache);
> > +   }
> 
> What about making the return value handling here cleaner? For example:
> 
>   lv2table_kmem_cache = kmem_cache_create("exynos-iommu-lv2table",
>   LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL);
>   if (!lv2table_kmem_cache) {
>   ...
>   return -ENOMEM;
>   }
> 
>   ret = platform_driver_register(&exynos_sysmmu_driver);
>   if (ret) {
>   ...
>   goto err_destroy_kmem_cache;
>   }
> 
>   ret = bus_set_iommu(&platform_bus_type, &exynos_iommu_ops);
>   if (ret) {
>   ...
>   goto err_platform_unregister;
>   }
> 
>   return 0;
> 
> err_platform_unregister:
>   ...
> err_destroy_kmem_cache:
>   ...
>   return ret;
> }
> 

Thank you for suggestion.
I think you are worrying about missing the information who makes 'ret' non-zero.
Ok. I will process it separately.

thanks

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


Proposal: I2C device power (Was: hwmon: (lm90) Add power control)

2013-08-08 Thread Alexander Shiyan
Hi all.

Instead of adding the support of regulators in each device, let's think about
whether it is possible to create a global regulator for any device on the I2C 
bus.

I see it like this:
We add an extra field in the i2c_board_info structure "power_name" and handle
it in the i2c_device_{probe/remove} functions.

The question remains how to maintain such regulator in the PM functions,
but we can discuss it.

Changes like this, will remove existing regulators from drivers and allows to
use power regulator for any I2C device.
If such idea is good, such changes could be made to other devices (SPI, w1, 
etc.).
Thanks.

---


[PATCH] hwrng: pixocel - Staticize 'rng_dev'

2013-08-08 Thread Jingoo Han
'rng_dev' is used only in this file.
Fix the following sparse warning:

drivers/char/hw_random/picoxcell-rng.c:36:15: warning: symbol 'rng_dev' was not 
declared. Should it be static?

Signed-off-by: Jingoo Han 
---
 drivers/char/hw_random/picoxcell-rng.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/picoxcell-rng.c 
b/drivers/char/hw_random/picoxcell-rng.c
index 973b951..3d4c229 100644
--- a/drivers/char/hw_random/picoxcell-rng.c
+++ b/drivers/char/hw_random/picoxcell-rng.c
@@ -33,7 +33,7 @@
 
 static void __iomem *rng_base;
 static struct clk *rng_clk;
-struct device *rng_dev;
+static struct device *rng_dev;
 
 static inline u32 picoxcell_trng_read_csr(void)
 {
-- 
1.7.10.4


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


Re: [PATCH] ACPI, cpu hotplug: move try_offline_node() after acpi_unmap_lsapic()

2013-08-08 Thread Yasuaki Ishimatsu
(2013/08/09 11:43), Gu Zheng wrote:
> Hi Ishimatsu-san,
> On 08/06/2013 06:11 PM, Yasuaki Ishimatsu wrote:
> 
>> try_offline_node() checks that all cpus related with removed node have been
>> removed by using cpu_present_bits. If all cpus related with removed node have
>> been removed, try_offline_node() clears the node information.
>>
>> But try_offline_node() called from acpi_processor_remove() never clears
>> the node information. For disabling cpu_present_bits, acpi_unmap_lsapic()
>> need be called. But acpi_unmap_lsapic() is called after try_offline_node()
>> runs. So when try_offline_node() runs, the cpu's cpu_present_bits is always
>> set.
>>
>> This patch moves try_offline_node() after acpi_unmap_lsapic().
> 
> It works well.
> 
>>
>> Signed-off-by: Yasuaki Ishimatsu 
> 
> 
> Tested-by: Gu Zheng 

Thank you for testing.

Thanks,
Yasuaki Ishimatsu

> 
> Thanks,
> Gu
> 
>> ---
>>   drivers/acpi/acpi_processor.c |3 ++-
>>   1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
>> index fd6c51c..5a74a9c 100644
>> --- a/drivers/acpi/acpi_processor.c
>> +++ b/drivers/acpi/acpi_processor.c
>> @@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device 
>> *device)
>>  /* Clean up. */
>>  per_cpu(processor_device_array, pr->id) = NULL;
>>  per_cpu(processors, pr->id) = NULL;
>> -try_offline_node(cpu_to_node(pr->id));
>>
>>  /* Remove the CPU. */
>>  get_online_cpus();
>> @@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device 
>> *device)
>>  acpi_unmap_lsapic(pr->id);
>>  put_online_cpus();
>>
>> +try_offline_node(cpu_to_node(pr->id));
>> +
>>out:
>>  free_cpumask_var(pr->throttling.shared_cpu_map);
>>  kfree(pr);
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>>
> 
> 


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


Re: [PATCH] mm/hotplug: Verify hotplug memory range

2013-08-08 Thread Tang Chen

On 08/09/2013 12:47 AM, Toshi Kani wrote:

add_memory() and remove_memory() can only handle a memory range aligned
with section.  There are problems when an unaligned range is added and
then deleted as follows:

  - add_memory() with an unaligned range succeeds, but __add_pages()
called from add_memory() adds a whole section of pages even though
a given memory range is less than the section size.
  - remove_memory() to the added unaligned range hits BUG_ON() in
__remove_pages().

This patch changes add_memory() and remove_memory() to check if a given
memory range is aligned with section at the beginning.  As the result,
add_memory() fails with -EINVAL when a given range is unaligned, and
does not add such memory range.  This prevents remove_memory() to be
called with an unaligned range as well.  Note that remove_memory() has
to use BUG_ON() since this function cannot fail.

Signed-off-by: Toshi Kani
---
  mm/memory_hotplug.c |   22 ++
  1 file changed, 22 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index ca1dd3a..ac182de 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1069,6 +1069,22 @@ out:
return ret;
  }

+static int check_hotplug_memory_range(u64 start, u64 size)
+{
+   u64 start_pfn = start>>  PAGE_SHIFT;
+   u64 nr_pages = size>>  PAGE_SHIFT;
+
+   /* Memory range must be aligned with section */
+   if ((start_pfn&  ~PAGE_SECTION_MASK) ||
+   (nr_pages % PAGES_PER_SECTION) || (!nr_pages)) {
+   pr_err("Unsupported hotplug range: start 0x%llx, size 0x%llx\n",
+   start, size);


I think the message here should tell users that only support range aligned
to section. Others seems OK to me.

Reviewed-by: Tang Chen 

Thanks.


+   return -EINVAL;
+   }
+
+   return 0;
+}
+
  /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
  int __ref add_memory(int nid, u64 start, u64 size)
  {
@@ -1078,6 +1094,10 @@ int __ref add_memory(int nid, u64 start, u64 size)
struct resource *res;
int ret;

+   ret = check_hotplug_memory_range(start, size);
+   if (ret)
+   return ret;
+
lock_memory_hotplug();

res = register_memory_resource(start, size);
@@ -1786,6 +1806,8 @@ void __ref remove_memory(int nid, u64 start, u64 size)
  {
int ret;

+   BUG_ON(check_hotplug_memory_range(start, size));
+
lock_memory_hotplug();

/*


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 01/17] perf util: Save pid-cmdline mapping into tracing header

2013-08-08 Thread Namhyung Kim
Hi David,

On Wed, 07 Aug 2013 09:44:24 -0400, David Ahern wrote:
> On 8/5/13 3:17 AM, Namhyung Kim wrote:
>>> I don't think this is a problem, its in line with Ingo's suggestion of a
>>> new perf ioctl to ask the kernel to generate PERF_RECORD_MMAP events for
>>> existing threads.
>>
>> Hmm.. could you please give me a link of the thread?
>
> I believe this is the thread being referred to:
> https://lkml.org/lkml/2013/6/25/180

Thank you!
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 04/14] clk: Add set_rate_and_parent() op

2013-08-08 Thread Mike Turquette
Quoting Stephen Boyd (2013-07-25 09:45:42)
> On 07/25, Tomasz Figa wrote:
> > On Wednesday 24 of July 2013 17:43:32 Stephen Boyd wrote:
> > > Some of Qualcomm's clocks can change their parent and rate at the
> > > same time with a single register write. Add support for this
> > > hardware to the common clock framework by adding a new
> > > set_rate_and_parent() op. When the clock framework determines
> > > that both the parent and the rate are going to change during
> > > clk_set_rate() it will call the .set_rate_and_parent() op if
> > > available and fall back to calling .set_parent() followed by
> > > .set_rate() otherwise.
> > 
> > This is strange. Does you hardware support switching parent and rate 
> > separately or you always need to set both and so all the fuss here?
> 
> It supports setting the parent or setting the rate, or setting
> both at the same time.

I think that setting parent and rate at the same time is a common enough
case to merit handling it in the clock core. Probably this design will
become more common in time.

Regards,
Mike

> 
> > 
> > If the latter is the case, then maybe you can simply keep parent index and 
> > rate cached inside driver data of your clock driver and use them on any 
> > .set_rate() or .set_parent() calls?
> 
> This will not work. In fact, doing that would cause us to
> overclock hardware for a short time between switching the parent
> and the rate.
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/9] mbind: add hugepage migration code to mbind()

2013-08-08 Thread Naoya Horiguchi
This patch extends do_mbind() to handle vma with VM_HUGETLB set.
We will be able to migrate hugepage with mbind(2) after
applying the enablement patch which comes later in this series.

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - added alloc_huge_page_noerr free from ERR_VALUE

ChangeLog v2:
 - updated description and renamed patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 include/linux/hugetlb.h |  3 +++
 mm/hugetlb.c| 14 ++
 mm/mempolicy.c  |  4 +++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git v3.11-rc3.orig/include/linux/hugetlb.h 
v3.11-rc3/include/linux/hugetlb.h
index bc8d837..d1db007 100644
--- v3.11-rc3.orig/include/linux/hugetlb.h
+++ v3.11-rc3/include/linux/hugetlb.h
@@ -265,6 +265,8 @@ struct huge_bootmem_page {
 };
 
 struct page *alloc_huge_page_node(struct hstate *h, int nid);
+struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
+   unsigned long addr, int avoid_reserve);
 
 /* arch callback */
 int __init alloc_bootmem_huge_page(struct hstate *h);
@@ -378,6 +380,7 @@ static inline pgoff_t basepage_index(struct page *page)
 #else  /* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
+#define alloc_huge_page_noerr(v, a, r) NULL
 #define alloc_bootmem_huge_page(h) NULL
 #define hstate_file(f) NULL
 #define hstate_sizelog(s) NULL
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index 649771c..ee764b0 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -1195,6 +1195,20 @@ static struct page *alloc_huge_page(struct 
vm_area_struct *vma,
return page;
 }
 
+/*
+ * alloc_huge_page()'s wrapper which simply returns the page if allocation
+ * succeeds, otherwise NULL. This function is called from new_vma_page(),
+ * where no ERR_VALUE is expected to be returned.
+ */
+struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
+   unsigned long addr, int avoid_reserve)
+{
+   struct page *page = alloc_huge_page(vma, addr, avoid_reserve);
+   if (IS_ERR(page))
+   page = NULL;
+   return page;
+}
+
 int __weak alloc_bootmem_huge_page(struct hstate *h)
 {
struct huge_bootmem_page *m;
diff --git v3.11-rc3.orig/mm/mempolicy.c v3.11-rc3/mm/mempolicy.c
index d96afc1..4a03c14 100644
--- v3.11-rc3.orig/mm/mempolicy.c
+++ v3.11-rc3/mm/mempolicy.c
@@ -1183,6 +1183,8 @@ static struct page *new_vma_page(struct page *page, 
unsigned long private, int *
vma = vma->vm_next;
}
 
+   if (PageHuge(page))
+   return alloc_huge_page_noerr(vma, address, 1);
/*
 * if !vma, alloc_page_vma() will use task or system default policy
 */
@@ -1293,7 +1295,7 @@ static long do_mbind(unsigned long start, unsigned long 
len,
(unsigned long)vma,
MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
if (nr_failed)
-   putback_lru_pages(&pagelist);
+   putback_movable_pages(&pagelist);
}
 
if (nr_failed && (flags & MPOL_MF_STRICT))
-- 
1.8.3.1

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


[PATCH 8/9] migrate: check movability of hugepage in unmap_and_move_huge_page()

2013-08-08 Thread Naoya Horiguchi
Currently hugepage migration works well only for pmd-based hugepages
(mainly due to lack of testing,) so we had better not enable migration
of other levels of hugepages until we are ready for it.

Some users of hugepage migration (mbind, move_pages, and migrate_pages)
do page table walk and check pud/pmd_huge() there, so they are safe.
But the other users (softoffline and memory hotremove) don't do this,
so without this patch they can try to migrate unexpected types of hugepages.

To prevent this, we introduce hugepage_migration_support() as an architecture
dependent check of whether hugepage are implemented on a pmd basis or not.
And on some architecture multiple sizes of hugepages are available, so
hugepage_migration_support() also checks hugepage size.

Signed-off-by: Naoya Horiguchi 
---
 arch/arm/mm/hugetlbpage.c |  5 +
 arch/arm64/mm/hugetlbpage.c   |  5 +
 arch/ia64/mm/hugetlbpage.c|  5 +
 arch/metag/mm/hugetlbpage.c   |  5 +
 arch/mips/mm/hugetlbpage.c|  5 +
 arch/powerpc/mm/hugetlbpage.c | 10 ++
 arch/s390/mm/hugetlbpage.c|  5 +
 arch/sh/mm/hugetlbpage.c  |  5 +
 arch/sparc/mm/hugetlbpage.c   |  5 +
 arch/tile/mm/hugetlbpage.c|  5 +
 arch/x86/mm/hugetlbpage.c |  8 
 include/linux/hugetlb.h   | 12 
 mm/migrate.c  | 10 ++
 13 files changed, 85 insertions(+)

diff --git v3.11-rc3.orig/arch/arm/mm/hugetlbpage.c 
v3.11-rc3/arch/arm/mm/hugetlbpage.c
index 3d1e4a2..3f3b6a7 100644
--- v3.11-rc3.orig/arch/arm/mm/hugetlbpage.c
+++ v3.11-rc3/arch/arm/mm/hugetlbpage.c
@@ -99,3 +99,8 @@ int pmd_huge(pmd_t pmd)
 {
return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
 }
+
+int pmd_huge_support(void)
+{
+   return 1;
+}
diff --git v3.11-rc3.orig/arch/arm64/mm/hugetlbpage.c 
v3.11-rc3/arch/arm64/mm/hugetlbpage.c
index 2fc8258..5e9aec3 100644
--- v3.11-rc3.orig/arch/arm64/mm/hugetlbpage.c
+++ v3.11-rc3/arch/arm64/mm/hugetlbpage.c
@@ -54,6 +54,11 @@ int pud_huge(pud_t pud)
return !(pud_val(pud) & PUD_TABLE_BIT);
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 static __init int setup_hugepagesz(char *opt)
 {
unsigned long ps = memparse(opt, &opt);
diff --git v3.11-rc3.orig/arch/ia64/mm/hugetlbpage.c 
v3.11-rc3/arch/ia64/mm/hugetlbpage.c
index 76069c1..68232db 100644
--- v3.11-rc3.orig/arch/ia64/mm/hugetlbpage.c
+++ v3.11-rc3/arch/ia64/mm/hugetlbpage.c
@@ -114,6 +114,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 0;
+}
+
 struct page *
 follow_huge_pmd(struct mm_struct *mm, unsigned long address, pmd_t *pmd, int 
write)
 {
diff --git v3.11-rc3.orig/arch/metag/mm/hugetlbpage.c 
v3.11-rc3/arch/metag/mm/hugetlbpage.c
index 3c52fa6..0424315 100644
--- v3.11-rc3.orig/arch/metag/mm/hugetlbpage.c
+++ v3.11-rc3/arch/metag/mm/hugetlbpage.c
@@ -110,6 +110,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 pmd_t *pmd, int write)
 {
diff --git v3.11-rc3.orig/arch/mips/mm/hugetlbpage.c 
v3.11-rc3/arch/mips/mm/hugetlbpage.c
index a7fee0d..01fda44 100644
--- v3.11-rc3.orig/arch/mips/mm/hugetlbpage.c
+++ v3.11-rc3/arch/mips/mm/hugetlbpage.c
@@ -85,6 +85,11 @@ int pud_huge(pud_t pud)
return (pud_val(pud) & _PAGE_HUGE) != 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 struct page *
 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
pmd_t *pmd, int write)
diff --git v3.11-rc3.orig/arch/powerpc/mm/hugetlbpage.c 
v3.11-rc3/arch/powerpc/mm/hugetlbpage.c
index 834ca8e..d67db4b 100644
--- v3.11-rc3.orig/arch/powerpc/mm/hugetlbpage.c
+++ v3.11-rc3/arch/powerpc/mm/hugetlbpage.c
@@ -86,6 +86,11 @@ int pgd_huge(pgd_t pgd)
 */
return ((pgd_val(pgd) & 0x3) != 0x0);
 }
+
+int pmd_huge_support(void)
+{
+   return 1;
+}
 #else
 int pmd_huge(pmd_t pmd)
 {
@@ -101,6 +106,11 @@ int pgd_huge(pgd_t pgd)
 {
return 0;
 }
+
+int pmd_huge_support(void)
+{
+   return 0;
+}
 #endif
 
 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
diff --git v3.11-rc3.orig/arch/s390/mm/hugetlbpage.c 
v3.11-rc3/arch/s390/mm/hugetlbpage.c
index 121089d..951ee25 100644
--- v3.11-rc3.orig/arch/s390/mm/hugetlbpage.c
+++ v3.11-rc3/arch/s390/mm/hugetlbpage.c
@@ -117,6 +117,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 1;
+}
+
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 pmd_t *pmdp, int write)
 {
diff --git v3.11-rc3.orig/arch/sh/mm/hugetlbpage.c 
v3.11-rc3/arch/sh/mm/hugetlbpage.c
index d776234..0d676a4 100644
--- v3.11-rc3.orig/arch/sh/mm/hugetlbpage.c
+++ v3.11-rc3/arch/sh/mm/hugetlbpage.c
@@ -83,6 +83,11 @@ int pud_huge(pud_t pud)
return 0;
 }
 
+int pmd_huge_support(void)
+{
+   return 0;
+}

[PATCH 3/9] migrate: add hugepage migration code to migrate_pages()

2013-08-08 Thread Naoya Horiguchi
This patch extends check_range() to handle vma with VM_HUGETLB set.
We will be able to migrate hugepage with migrate_pages(2) after
applying the enablement patch which comes later in this series.

Note that for larger hugepages (covered by pud entries, 1GB for
x86_64 for example), we simply skip it now.

Note that using pmd_huge/pud_huge assumes that hugepages are pointed to
by pmd/pud. This is not true in some architectures implementing hugepage
with other mechanisms like ia64, but it's OK because pmd_huge/pud_huge
simply return 0 in such arch and page walker simply ignores such hugepages.

ChangeLog v4:
 - refactored check_hugetlb_pmd_range for better readability

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - use isolate_huge_page

ChangeLog v2:
 - remove unnecessary extern
 - fix page table lock in check_hugetlb_pmd_range
 - updated description and renamed patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 mm/mempolicy.c | 42 +-
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git v3.11-rc3.orig/mm/mempolicy.c v3.11-rc3/mm/mempolicy.c
index 7431001..d96afc1 100644
--- v3.11-rc3.orig/mm/mempolicy.c
+++ v3.11-rc3/mm/mempolicy.c
@@ -512,6 +512,30 @@ static int check_pte_range(struct vm_area_struct *vma, 
pmd_t *pmd,
return addr != end;
 }
 
+static void check_hugetlb_pmd_range(struct vm_area_struct *vma, pmd_t *pmd,
+   const nodemask_t *nodes, unsigned long flags,
+   void *private)
+{
+#ifdef CONFIG_HUGETLB_PAGE
+   int nid;
+   struct page *page;
+
+   spin_lock(&vma->vm_mm->page_table_lock);
+   page = pte_page(huge_ptep_get((pte_t *)pmd));
+   nid = page_to_nid(page);
+   if (node_isset(nid, *nodes) == !!(flags & MPOL_MF_INVERT))
+   goto unlock;
+   /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */
+   if (flags & (MPOL_MF_MOVE_ALL) ||
+   (flags & MPOL_MF_MOVE && page_mapcount(page) == 1))
+   isolate_huge_page(page, private);
+unlock:
+   spin_unlock(&vma->vm_mm->page_table_lock);
+#else
+   BUG();
+#endif
+}
+
 static inline int check_pmd_range(struct vm_area_struct *vma, pud_t *pud,
unsigned long addr, unsigned long end,
const nodemask_t *nodes, unsigned long flags,
@@ -523,6 +547,11 @@ static inline int check_pmd_range(struct vm_area_struct 
*vma, pud_t *pud,
pmd = pmd_offset(pud, addr);
do {
next = pmd_addr_end(addr, end);
+   if (pmd_huge(*pmd) && is_vm_hugetlb_page(vma)) {
+   check_hugetlb_pmd_range(vma, pmd, nodes,
+   flags, private);
+   continue;
+   }
split_huge_page_pmd(vma, addr, pmd);
if (pmd_none_or_trans_huge_or_clear_bad(pmd))
continue;
@@ -544,6 +573,8 @@ static inline int check_pud_range(struct vm_area_struct 
*vma, pgd_t *pgd,
pud = pud_offset(pgd, addr);
do {
next = pud_addr_end(addr, end);
+   if (pud_huge(*pud) && is_vm_hugetlb_page(vma))
+   continue;
if (pud_none_or_clear_bad(pud))
continue;
if (check_pmd_range(vma, pud, addr, next, nodes,
@@ -635,9 +666,6 @@ check_range(struct mm_struct *mm, unsigned long start, 
unsigned long end,
return ERR_PTR(-EFAULT);
}
 
-   if (is_vm_hugetlb_page(vma))
-   goto next;
-
if (flags & MPOL_MF_LAZY) {
change_prot_numa(vma, start, endvma);
goto next;
@@ -986,7 +1014,11 @@ static void migrate_page_add(struct page *page, struct 
list_head *pagelist,
 
 static struct page *new_node_page(struct page *page, unsigned long node, int 
**x)
 {
-   return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
+   if (PageHuge(page))
+   return alloc_huge_page_node(page_hstate(compound_head(page)),
+   node);
+   else
+   return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
 }
 
 /*
@@ -1016,7 +1048,7 @@ static int migrate_to_node(struct mm_struct *mm, int 
source, int dest,
err = migrate_pages(&pagelist, new_node_page, dest,
MIGRATE_SYNC, MR_SYSCALL);
if (err)
-   putback_lru_pages(&pagelist);
+   putback_movable_pages(&pagelist);
}
 
return err;
-- 
1.8.3.1

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

[PATCH 6/9] migrate: remove VM_HUGETLB from vma flag check in vma_migratable()

2013-08-08 Thread Naoya Horiguchi
This patch enables hugepage migration from migrate_pages(2),
move_pages(2), and mbind(2).

Signed-off-by: Naoya Horiguchi 
Acked-by: Hillf Danton 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
---
 include/linux/mempolicy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git v3.11-rc3.orig/include/linux/mempolicy.h 
v3.11-rc3/include/linux/mempolicy.h
index 0d7df39..2e475b5 100644
--- v3.11-rc3.orig/include/linux/mempolicy.h
+++ v3.11-rc3/include/linux/mempolicy.h
@@ -173,7 +173,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct 
mempolicy *pol);
 /* Check if a vma is migratable */
 static inline int vma_migratable(struct vm_area_struct *vma)
 {
-   if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP))
+   if (vma->vm_flags & (VM_IO | VM_PFNMAP))
return 0;
/*
 * Migration allocates pages in the highest zone. If we cannot
-- 
1.8.3.1

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


[PATCH 2/9] soft-offline: use migrate_pages() instead of migrate_huge_page()

2013-08-08 Thread Naoya Horiguchi
Currently migrate_huge_page() takes a pointer to a hugepage to be
migrated as an argument, instead of taking a pointer to the list of
hugepages to be migrated. This behavior was introduced in commit
189ebff28 ("hugetlb: simplify migrate_huge_page()"), and was OK
because until now hugepage migration is enabled only for soft-offlining
which migrates only one hugepage in a single call.

But the situation will change in the later patches in this series
which enable other users of page migration to support hugepage migration.
They can kick migration for both of normal pages and hugepages
in a single call, so we need to go back to original implementation
which uses linked lists to collect the hugepages to be migrated.

With this patch, soft_offline_huge_page() switches to use migrate_pages(),
and migrate_huge_page() is not used any more. So let's remove it.

ChangeLog v3:
 - Merged with another cleanup patch (4/10 in previous version)

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 include/linux/migrate.h |  5 -
 mm/memory-failure.c | 15 ---
 mm/migrate.c| 28 ++--
 3 files changed, 14 insertions(+), 34 deletions(-)

diff --git v3.11-rc3.orig/include/linux/migrate.h 
v3.11-rc3/include/linux/migrate.h
index a405d3dc..6fe5214 100644
--- v3.11-rc3.orig/include/linux/migrate.h
+++ v3.11-rc3/include/linux/migrate.h
@@ -41,8 +41,6 @@ extern int migrate_page(struct address_space *,
struct page *, struct page *, enum migrate_mode);
 extern int migrate_pages(struct list_head *l, new_page_t x,
unsigned long private, enum migrate_mode mode, int reason);
-extern int migrate_huge_page(struct page *, new_page_t x,
-   unsigned long private, enum migrate_mode mode);
 
 extern int fail_migrate_page(struct address_space *,
struct page *, struct page *);
@@ -62,9 +60,6 @@ static inline void putback_movable_pages(struct list_head *l) 
{}
 static inline int migrate_pages(struct list_head *l, new_page_t x,
unsigned long private, enum migrate_mode mode, int reason)
{ return -ENOSYS; }
-static inline int migrate_huge_page(struct page *page, new_page_t x,
-   unsigned long private, enum migrate_mode mode)
-   { return -ENOSYS; }
 
 static inline int migrate_prep(void) { return -ENOSYS; }
 static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git v3.11-rc3.orig/mm/memory-failure.c v3.11-rc3/mm/memory-failure.c
index 2c13aa7..af6f61c 100644
--- v3.11-rc3.orig/mm/memory-failure.c
+++ v3.11-rc3/mm/memory-failure.c
@@ -1467,6 +1467,7 @@ static int soft_offline_huge_page(struct page *page, int 
flags)
int ret;
unsigned long pfn = page_to_pfn(page);
struct page *hpage = compound_head(page);
+   LIST_HEAD(pagelist);
 
/*
 * This double-check of PageHWPoison is to avoid the race with
@@ -1482,12 +1483,20 @@ static int soft_offline_huge_page(struct page *page, 
int flags)
unlock_page(hpage);
 
/* Keep page count to indicate a given hugepage is isolated. */
-   ret = migrate_huge_page(hpage, new_page, MPOL_MF_MOVE_ALL,
-   MIGRATE_SYNC);
-   put_page(hpage);
+   list_move(&hpage->lru, &pagelist);
+   ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
+   MIGRATE_SYNC, MR_MEMORY_FAILURE);
if (ret) {
pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
pfn, ret, page->flags);
+   /*
+* We know that soft_offline_huge_page() tries to migrate
+* only one hugepage pointed to by hpage, so we need not
+* run through the pagelist here.
+*/
+   putback_active_hugepage(hpage);
+   if (ret > 0)
+   ret = -EIO;
} else {
set_page_hwpoison_huge_page(hpage);
dequeue_hwpoisoned_huge_page(hpage);
diff --git v3.11-rc3.orig/mm/migrate.c v3.11-rc3/mm/migrate.c
index b44a067..3ec47d3 100644
--- v3.11-rc3.orig/mm/migrate.c
+++ v3.11-rc3/mm/migrate.c
@@ -979,6 +979,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 
unlock_page(hpage);
 out:
+   if (rc != -EAGAIN)
+   putback_active_hugepage(hpage);
put_page(new_hpage);
if (result) {
if (rc)
@@ -1066,32 +1068,6 @@ int migrate_pages(struct list_head *from, new_page_t 
get_new_page,
return rc;
 }
 
-int migrate_huge_page(struct page *hpage, new_page_t get_new_page,
- unsigned long private, enum migrate_mode mode)
-{
-   int pass, rc;
-
-   for (pass = 0; pass < 10; pass++) {
-   rc = unmap_and_move_huge_page(get_new_page, private,
-   hpage, pass > 2, mode);
-   

[PATCH 7/9] memory-hotplug: enable memory hotplug to handle hugepage

2013-08-08 Thread Naoya Horiguchi
Until now we can't offline memory blocks which contain hugepages because
a hugepage is considered as an unmovable page. But now with this patch
series, a hugepage has become movable, so by using hugepage migration we
can offline such memory blocks.

What's different from other users of hugepage migration is that we need
to decompose all the hugepages inside the target memory block into free
buddy pages after hugepage migration, because otherwise free hugepages
remaining in the memory block intervene the memory offlining.
For this reason we introduce new functions dissolve_free_huge_page() and
dissolve_free_huge_pages().

Other than that, what this patch does is straightforwardly to add hugepage
migration code, that is, adding hugepage code to the functions which scan
over pfn and collect hugepages to be migrated, and adding a hugepage
allocation function to alloc_migrate_target().

As for larger hugepages (1GB for x86_64), it's not easy to do hotremove
over them because it's larger than memory block. So we now simply leave
it to fail as it is.

ChangeLog v4:
 - add comment on dequeue_huge_page_node
 - alloc_migrate_target allocates destination hugepage from the next node
   of source node

ChangeLog v3:
 - revert introducing migrate_movable_pages (the function was opened)
 - add migratetype check in dequeue_huge_page_node to close the race
   between scan and allocation
 - make is_hugepage_movable use refcount to find active hugepages
   instead of running through hugepage_activelist
 - rename is_hugepage_movable to is_hugepage_active
 - add alignment check in dissolve_free_huge_pages
 - use round_up in calculating next scanning pfn
 - use isolate_huge_page

ChangeLog v2:
 - changed return value type of is_hugepage_movable() to bool
 - is_hugepage_movable() uses list_for_each_entry() instead of *_safe()
 - moved if(PageHuge) block before get_page_unless_zero() in do_migrate_range()
 - do_migrate_range() returns -EBUSY for hugepages larger than memory block
 - dissolve_free_huge_pages() calculates scan step and sets it to minimum
   hugepage size

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
---
 include/linux/hugetlb.h |  6 +
 mm/hugetlb.c| 71 +++--
 mm/memory_hotplug.c | 42 -
 mm/page_alloc.c | 12 +
 mm/page_isolation.c | 14 ++
 5 files changed, 136 insertions(+), 9 deletions(-)

diff --git v3.11-rc3.orig/include/linux/hugetlb.h 
v3.11-rc3/include/linux/hugetlb.h
index d1db007..2e02c4e 100644
--- v3.11-rc3.orig/include/linux/hugetlb.h
+++ v3.11-rc3/include/linux/hugetlb.h
@@ -68,6 +68,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long 
offset, long freed);
 int dequeue_hwpoisoned_huge_page(struct page *page);
 bool isolate_huge_page(struct page *page, struct list_head *list);
 void putback_active_hugepage(struct page *page);
+bool is_hugepage_active(struct page *page);
 void copy_huge_page(struct page *dst, struct page *src);
 
 #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -138,6 +139,7 @@ static inline int dequeue_hwpoisoned_huge_page(struct page 
*page)
 
 #define isolate_huge_page(p, l) false
 #define putback_active_hugepage(p) do {} while (0)
+#define is_hugepage_active(x)  false
 static inline void copy_huge_page(struct page *dst, struct page *src)
 {
 }
@@ -377,6 +379,9 @@ static inline pgoff_t basepage_index(struct page *page)
return __basepage_index(page);
 }
 
+extern void dissolve_free_huge_pages(unsigned long start_pfn,
+unsigned long end_pfn);
+
 #else  /* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
@@ -403,6 +408,7 @@ static inline pgoff_t basepage_index(struct page *page)
 {
return page->index;
 }
+#define dissolve_free_huge_pages(s, e) do {} while (0)
 #endif /* CONFIG_HUGETLB_PAGE */
 
 #endif /* _LINUX_HUGETLB_H */
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index ee764b0..3121915 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -518,9 +519,15 @@ static struct page *dequeue_huge_page_node(struct hstate 
*h, int nid)
 {
struct page *page;
 
-   if (list_empty(&h->hugepage_freelists[nid]))
+   list_for_each_entry(page, &h->hugepage_freelists[nid], lru)
+   if (!is_migrate_isolate_page(page))
+   break;
+   /*
+* if 'non-isolated free hugepage' not found on the list,
+* the allocation fails.
+*/
+   if (&h->hugepage_freelists[nid] == &page->lru)
return NULL;
-   page = list_entry(h->hugepage_freelists[nid].next, struct page, lru);
list_move(&page->lru, &h->hugepage_activelist);
set_page_refcounted(page);
h->free_huge_pages--;
@@ -861,6 +868,44 @@ static int free_pool_huge_page(struct hstate *h, 
nodemask_t *nodes_allowed

[PATCH 4/9] migrate: add hugepage migration code to move_pages()

2013-08-08 Thread Naoya Horiguchi
This patch extends move_pages() to handle vma with VM_HUGETLB set.
We will be able to migrate hugepage with move_pages(2) after
applying the enablement patch which comes later in this series.

We avoid getting refcount on tail pages of hugepage, because unlike thp,
hugepage is not split and we need not care about races with splitting.

And migration of larger (1GB for x86_64) hugepage are not enabled.

ChangeLog v4:
 - use get_page instead of get_page_foll
 - add comment in follow_page_mask

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - follow_page_mask(FOLL_GET) returns NULL for tail pages
 - use isolate_huge_page

ChangeLog v2:
 - updated description and renamed patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
---
 mm/memory.c  | 17 +++--
 mm/migrate.c | 13 +++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git v3.11-rc3.orig/mm/memory.c v3.11-rc3/mm/memory.c
index 1ce2e2a..7ec1252 100644
--- v3.11-rc3.orig/mm/memory.c
+++ v3.11-rc3/mm/memory.c
@@ -1496,7 +1496,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
if (pud_none(*pud))
goto no_page_table;
if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
-   BUG_ON(flags & FOLL_GET);
+   if (flags & FOLL_GET)
+   goto out;
page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE);
goto out;
}
@@ -1507,8 +1508,20 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
if (pmd_none(*pmd))
goto no_page_table;
if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) {
-   BUG_ON(flags & FOLL_GET);
page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE);
+   if (flags & FOLL_GET) {
+   /*
+* Refcount on tail pages are not well-defined and
+* shouldn't be taken. The caller should handle a NULL
+* return when trying to follow tail pages.
+*/
+   if (PageHead(page))
+   get_page(page);
+   else {
+   page = NULL;
+   goto out;
+   }
+   }
goto out;
}
if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
diff --git v3.11-rc3.orig/mm/migrate.c v3.11-rc3/mm/migrate.c
index 3ec47d3..d313737 100644
--- v3.11-rc3.orig/mm/migrate.c
+++ v3.11-rc3/mm/migrate.c
@@ -1092,7 +1092,11 @@ static struct page *new_page_node(struct page *p, 
unsigned long private,
 
*result = &pm->status;
 
-   return alloc_pages_exact_node(pm->node,
+   if (PageHuge(p))
+   return alloc_huge_page_node(page_hstate(compound_head(p)),
+   pm->node);
+   else
+   return alloc_pages_exact_node(pm->node,
GFP_HIGHUSER_MOVABLE | GFP_THISNODE, 0);
 }
 
@@ -1152,6 +1156,11 @@ static int do_move_page_to_node_array(struct mm_struct 
*mm,
!migrate_all)
goto put_and_set;
 
+   if (PageHuge(page)) {
+   isolate_huge_page(page, &pagelist);
+   goto put_and_set;
+   }
+
err = isolate_lru_page(page);
if (!err) {
list_add_tail(&page->lru, &pagelist);
@@ -1174,7 +1183,7 @@ static int do_move_page_to_node_array(struct mm_struct 
*mm,
err = migrate_pages(&pagelist, new_page_node,
(unsigned long)pm, MIGRATE_SYNC, MR_SYSCALL);
if (err)
-   putback_lru_pages(&pagelist);
+   putback_movable_pages(&pagelist);
}
 
up_read(&mm->mmap_sem);
-- 
1.8.3.1

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


[PATCH 1/9] migrate: make core migration code aware of hugepage

2013-08-08 Thread Naoya Horiguchi
Before enabling each user of page migration to support hugepage,
this patch enables the list of pages for migration to link not only
LRU pages, but also hugepages. As a result, putback_movable_pages()
and migrate_pages() can handle both of LRU pages and hugepages.

ChangeLog v5:
 - remove putback_active_hugepages

ChangeLog v4:
 - make some macros return 'do {} while(0)'
 - use more readable variable name

ChangeLog v3:
 - revert introducing migrate_movable_pages
 - add isolate_huge_page

ChangeLog v2:
 - move code removing VM_HUGETLB from vma_migratable check into a
   separate patch
 - hold hugetlb_lock in putback_active_hugepage
 - update comment near the definition of hugetlb_lock

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
Acked-by: Hillf Danton 
---
 include/linux/hugetlb.h |  4 
 mm/hugetlb.c| 23 ++-
 mm/migrate.c| 10 +-
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git v3.11-rc3.orig/include/linux/hugetlb.h 
v3.11-rc3/include/linux/hugetlb.h
index c2b1801..bc8d837 100644
--- v3.11-rc3.orig/include/linux/hugetlb.h
+++ v3.11-rc3/include/linux/hugetlb.h
@@ -66,6 +66,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, 
long to,
vm_flags_t vm_flags);
 void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
 int dequeue_hwpoisoned_huge_page(struct page *page);
+bool isolate_huge_page(struct page *page, struct list_head *list);
+void putback_active_hugepage(struct page *page);
 void copy_huge_page(struct page *dst, struct page *src);
 
 #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -134,6 +136,8 @@ static inline int dequeue_hwpoisoned_huge_page(struct page 
*page)
return 0;
 }
 
+#define isolate_huge_page(p, l) false
+#define putback_active_hugepage(p) do {} while (0)
 static inline void copy_huge_page(struct page *dst, struct page *src)
 {
 }
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index 83aff0a..649771c 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -48,7 +48,8 @@ static unsigned long __initdata default_hstate_max_huge_pages;
 static unsigned long __initdata default_hstate_size;
 
 /*
- * Protects updates to hugepage_freelists, nr_huge_pages, and free_huge_pages
+ * Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,
+ * free_huge_pages, and surplus_huge_pages.
  */
 DEFINE_SPINLOCK(hugetlb_lock);
 
@@ -3431,3 +3432,23 @@ int dequeue_hwpoisoned_huge_page(struct page *hpage)
return ret;
 }
 #endif
+
+bool isolate_huge_page(struct page *page, struct list_head *list)
+{
+   VM_BUG_ON(!PageHead(page));
+   if (!get_page_unless_zero(page))
+   return false;
+   spin_lock(&hugetlb_lock);
+   list_move_tail(&page->lru, list);
+   spin_unlock(&hugetlb_lock);
+   return true;
+}
+
+void putback_active_hugepage(struct page *page)
+{
+   VM_BUG_ON(!PageHead(page));
+   spin_lock(&hugetlb_lock);
+   list_move_tail(&page->lru, &(page_hstate(page))->hugepage_activelist);
+   spin_unlock(&hugetlb_lock);
+   put_page(page);
+}
diff --git v3.11-rc3.orig/mm/migrate.c v3.11-rc3/mm/migrate.c
index 6f0c244..b44a067 100644
--- v3.11-rc3.orig/mm/migrate.c
+++ v3.11-rc3/mm/migrate.c
@@ -100,6 +100,10 @@ void putback_movable_pages(struct list_head *l)
struct page *page2;
 
list_for_each_entry_safe(page, page2, l, lru) {
+   if (unlikely(PageHuge(page))) {
+   putback_active_hugepage(page);
+   continue;
+   }
list_del(&page->lru);
dec_zone_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
@@ -1025,7 +1029,11 @@ int migrate_pages(struct list_head *from, new_page_t 
get_new_page,
list_for_each_entry_safe(page, page2, from, lru) {
cond_resched();
 
-   rc = unmap_and_move(get_new_page, private,
+   if (PageHuge(page))
+   rc = unmap_and_move_huge_page(get_new_page,
+   private, page, pass > 2, mode);
+   else
+   rc = unmap_and_move(get_new_page, private,
page, pass > 2, mode);
 
switch(rc) {
-- 
1.8.3.1

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


[PATCH 9/9] prepare to remove /proc/sys/vm/hugepages_treat_as_movable

2013-08-08 Thread Naoya Horiguchi
Now we have extended hugepage migration and it's opened to many users
of page migration, which is a good reason to consider hugepage as movable.
So we can go to the direction to remove this parameter. In order to
allow userspace to prepare for the removal, let's leave this sysctl handler
as noop for a while.

Note that hugepage migration is available only for the architectures
which implement hugepage on a pmd basis. On the other architectures,
allocating hugepages from MOVABLE is not a good idea because it can
break memory hotremove (which expects that all pages of ZONE_MOVABLE are
movable.) So we choose GFP flags in accordance with mobility of hugepage.

ChangeLog v5:
 - choose GFP flags in accordance with mobility of hugepage

ChangeLog v3:
 - use WARN_ON_ONCE

ChangeLog v2:
 - shift to noop function instead of completely removing the parameter
 - rename patch title

Signed-off-by: Naoya Horiguchi 
Acked-by: Andi Kleen 
Reviewed-by: Wanpeng Li 
---
 Documentation/sysctl/vm.txt | 13 ++---
 mm/hugetlb.c| 26 +++---
 2 files changed, 17 insertions(+), 22 deletions(-)

diff --git v3.11-rc3.orig/Documentation/sysctl/vm.txt 
v3.11-rc3/Documentation/sysctl/vm.txt
index 36ecc26..6e211a1 100644
--- v3.11-rc3.orig/Documentation/sysctl/vm.txt
+++ v3.11-rc3/Documentation/sysctl/vm.txt
@@ -200,17 +200,8 @@ fragmentation index is <= extfrag_threshold. The default 
value is 500.
 
 hugepages_treat_as_movable
 
-This parameter is only useful when kernelcore= is specified at boot time to
-create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
-are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
-value written to hugepages_treat_as_movable allows huge pages to be allocated
-from ZONE_MOVABLE.
-
-Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
-pages pool can easily grow or shrink within. Assuming that applications are
-not running that mlock() a lot of memory, it is likely the huge pages pool
-can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
-into nr_hugepages and triggering page reclaim.
+This parameter is obsolete and planned to be removed. The value has no effect
+on kernel's behavior.
 
 ==
 
diff --git v3.11-rc3.orig/mm/hugetlb.c v3.11-rc3/mm/hugetlb.c
index 3121915..b73 100644
--- v3.11-rc3.orig/mm/hugetlb.c
+++ v3.11-rc3/mm/hugetlb.c
@@ -34,7 +34,6 @@
 #include "internal.h"
 
 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
-static gfp_t htlb_alloc_mask = GFP_HIGHUSER;
 unsigned long hugepages_treat_as_movable;
 
 int hugetlb_max_hstate __read_mostly;
@@ -535,6 +534,15 @@ static struct page *dequeue_huge_page_node(struct hstate 
*h, int nid)
return page;
 }
 
+/* Movability of hugepages depends on migration support. */
+static inline int htlb_alloc_mask(struct hstate *h)
+{
+   if (hugepage_migration_support(h))
+   return GFP_HIGHUSER_MOVABLE;
+   else
+   return GFP_HIGHUSER;
+}
+
 static struct page *dequeue_huge_page_vma(struct hstate *h,
struct vm_area_struct *vma,
unsigned long address, int avoid_reserve)
@@ -550,7 +558,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
 retry_cpuset:
cpuset_mems_cookie = get_mems_allowed();
zonelist = huge_zonelist(vma, address,
-   htlb_alloc_mask, &mpol, &nodemask);
+   htlb_alloc_mask(h), &mpol, &nodemask);
/*
 * A child process with MAP_PRIVATE mappings created by their parent
 * have no page reserves. This check ensures that reservations are
@@ -566,7 +574,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
 
for_each_zone_zonelist_nodemask(zone, z, zonelist,
MAX_NR_ZONES - 1, nodemask) {
-   if (cpuset_zone_allowed_softwall(zone, htlb_alloc_mask)) {
+   if (cpuset_zone_allowed_softwall(zone, htlb_alloc_mask(h))) {
page = dequeue_huge_page_node(h, zone_to_nid(zone));
if (page) {
if (!avoid_reserve)
@@ -723,7 +731,7 @@ static struct page *alloc_fresh_huge_page_node(struct 
hstate *h, int nid)
return NULL;
 
page = alloc_pages_exact_node(nid,
-   htlb_alloc_mask|__GFP_COMP|__GFP_THISNODE|
+   htlb_alloc_mask(h)|__GFP_COMP|__GFP_THISNODE|
__GFP_REPEAT|__GFP_NOWARN,
huge_page_order(h));
if (page) {
@@ -948,12 +956,12 @@ static struct page *alloc_buddy_huge_page(struct hstate 
*h, int nid)
spin_unlock(&hugetlb_lock);
 
if (nid == NUMA_NO_NODE)
-   page = alloc_pages(htlb_alloc_mask|__GFP_COMP|
+   page = a

[PATCH v5 0/9] extend hugepage migration

2013-08-08 Thread Naoya Horiguchi
Here is the 5th version of hugepage migration patchset.
Changes in this version are as follows:
 - removed putback_active_hugepages() as a cleanup (1/9)
 - added code to check movability of a given hugepage (8/9)
 - set GFP MOVABLE flag depending on the movability of hugepage (9/9).

I feel that 8/9 and 9/9 contain some new things, so need reviews on them.

TODOs: (likely to be done after this work)
 - split page table lock for pmd/pud based hugepage (maybe applicable to thp)
 - improve alloc_migrate_target (especially in node choice)
 - using page walker in check_range

Thanks,
Naoya Horiguchi
---
GitHub:
  git://github.com/Naoya-Horiguchi/linux.git extend_hugepage_migration.v5

Test code:
  git://github.com/Naoya-Horiguchi/test_hugepage_migration_extension.git

Naoya Horiguchi (9):
  migrate: make core migration code aware of hugepage
  soft-offline: use migrate_pages() instead of migrate_huge_page()
  migrate: add hugepage migration code to migrate_pages()
  migrate: add hugepage migration code to move_pages()
  mbind: add hugepage migration code to mbind()
  migrate: remove VM_HUGETLB from vma flag check in vma_migratable()
  memory-hotplug: enable memory hotplug to handle hugepage
  migrate: check movability of hugepage in unmap_and_move_huge_page()
  prepare to remove /proc/sys/vm/hugepages_treat_as_movable

 Documentation/sysctl/vm.txt   |  13 +---
 arch/arm/mm/hugetlbpage.c |   5 ++
 arch/arm64/mm/hugetlbpage.c   |   5 ++
 arch/ia64/mm/hugetlbpage.c|   5 ++
 arch/metag/mm/hugetlbpage.c   |   5 ++
 arch/mips/mm/hugetlbpage.c|   5 ++
 arch/powerpc/mm/hugetlbpage.c |  10 
 arch/s390/mm/hugetlbpage.c|   5 ++
 arch/sh/mm/hugetlbpage.c  |   5 ++
 arch/sparc/mm/hugetlbpage.c   |   5 ++
 arch/tile/mm/hugetlbpage.c|   5 ++
 arch/x86/mm/hugetlbpage.c |   8 +++
 include/linux/hugetlb.h   |  25 
 include/linux/mempolicy.h |   2 +-
 include/linux/migrate.h   |   5 --
 mm/hugetlb.c  | 134 +-
 mm/memory-failure.c   |  15 -
 mm/memory.c   |  17 +-
 mm/memory_hotplug.c   |  42 ++---
 mm/mempolicy.c|  46 +--
 mm/migrate.c  |  61 ++-
 mm/page_alloc.c   |  12 
 mm/page_isolation.c   |  14 +
 23 files changed, 371 insertions(+), 78 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/1] pagemap: fix buffer overflow in add_page_map()

2013-08-08 Thread yonghua zheng
Hi,

Recently we met quite a lot of random kernel panic issues after enable
CONFIG_PROC_PAGE_MONITOR in kernel, after debuggint sometime we found
this has something to do with following bug in pagemap:

In struc pagemapread:

struct pagemapread {
int pos, len;
pagemap_entry_t *buffer;
bool v2;
};

pos is number of PM_ENTRY_BYTES in buffer, but len is the size of buffer,
it is a mistake to compare pos and len in add_page_map() for checking
buffer is full or not, and this can lead to buffer overflow and random
kernel panic issue.

Correct len to be total number of PM_ENTRY_BYTES in buffer.

Signed-off-by: Yonghua Zheng 
---
 fs/proc/task_mmu.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index dbf61f6..cb98853 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1116,8 +1116,8 @@ static ssize_t pagemap_read(struct file *file,
char __user *buf,
 goto out_task;

 pm.v2 = soft_dirty_cleared;
-pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
-pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);
+pm.len = (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
+pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_TEMPORARY);
 ret = -ENOMEM;
 if (!pm.buffer)
 goto out_task;

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


[git pull] drm fixes

2013-08-08 Thread Dave Airlie

Hi Linus

mostly radeon, more fixes for dynamic power management which is is off by 
default for this release anyways, but there are a large number of testers, 
so I'd like to keep merging the fixes,

otherwise, radeon UVD fixes affecting suspend/resume regressions, i915 
regression fixes, one for your mac mini, ast,mgag200,cirrus ttm fix and 
one regression fix in the core.

Dave.

The following changes since commit c095ba7224d8edc71dcef0d655911399a8bd4a3f:

  Linux 3.11-rc4 (2013-08-04 13:46:46 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux drm-fixes

for you to fetch changes up to e42f5814212079aecd5826dba10588a896ac0862:

  Merge tag 'drm-intel-fixes-2013-08-08' of 
git://people.freedesktop.org/~danvet/drm-intel into drm-fixes (2013-08-09 
09:09:37 +1000)



Aaron Lu (1):
  drm/i915: avoid brightness overflow when doing scale

Alex Deucher (11):
  drm/radeon: properly handle pm on gpu reset
  drm/radeon: select audio dto based on encoder id for DCE3
  drm/radeon/dpm: adjust thermal protection requirements
  drm/radeon/dpm: fix spread spectrum setup (v2)
  drm/radeon/dpm: adjust power state properly for UVD on SI
  drm/radeon/dpm: disable sclk ss on rv6xx
  drm/radeon: fix audio dto calculation on DCE3+ (v3)
  drm/radeon: always program the MC on startup
  drm/radeon/cik: use a mutex to properly lock srbm instanced registers
  drm/radeon/dpm: require rlc for dpm
  drm/radeon: make missing smc ucode non-fatal

Christian König (5):
  drm/radeon: fix halting UVD
  drm/radeon: only save UVD bo when we have open handles
  drm/radeon: stop sending invalid UVD destroy msg
  drm/radeon: add more UVD CS checking
  drm/radeon: remove unnecessary unpin

Daniel Vetter (1):
  drm/i915: fix gen4 digital port hotplug definitions

Dave Airlie (3):
  drm/ast: invalidate page tables when pinning a BO
  Merge branch 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/linux
  Merge tag 'drm-intel-fixes-2013-08-08' of 
git://people.freedesktop.org/~danvet/drm-intel into drm-fixes

Egbert Eich (1):
  drm/mgag200: Invalidate page tables when pinning a BO

Jani Nikula (1):
  drm/i915: do not disable backlight on vgaswitcheroo switch off

Michal Srb (1):
  drm/cirrus: Invalidate page tables when pinning a BO

Michel Dänzer (1):
  drm: Don't pass negative delta to ktime_sub_ns()

Paulo Zanoni (1):
  drm/i915: update last_vblank when disabling the power well

Ville Syrjälä (1):
  drm/i915: Don't call encoder's get_config unless encoder is active

 drivers/gpu/drm/ast/ast_ttm.c   |  1 +
 drivers/gpu/drm/cirrus/cirrus_ttm.c |  1 +
 drivers/gpu/drm/drm_irq.c   |  5 +-
 drivers/gpu/drm/i915/i915_reg.h | 12 +++--
 drivers/gpu/drm/i915/intel_display.c|  4 +-
 drivers/gpu/drm/i915/intel_panel.c  | 18 ++-
 drivers/gpu/drm/i915/intel_pm.c | 18 +++
 drivers/gpu/drm/mgag200/mgag200_ttm.c   |  1 +
 drivers/gpu/drm/radeon/btc_dpm.c| 17 +-
 drivers/gpu/drm/radeon/cik.c| 18 +--
 drivers/gpu/drm/radeon/cypress_dpm.c| 17 +-
 drivers/gpu/drm/radeon/evergreen.c  |  6 ++-
 drivers/gpu/drm/radeon/evergreen_hdmi.c | 26 -
 drivers/gpu/drm/radeon/evergreend.h |  3 ++
 drivers/gpu/drm/radeon/ni.c | 16 --
 drivers/gpu/drm/radeon/ni_dpm.c | 17 +-
 drivers/gpu/drm/radeon/r600.c   | 41 +++
 drivers/gpu/drm/radeon/r600_hdmi.c  | 37 +++--
 drivers/gpu/drm/radeon/r600d.h  |  3 ++
 drivers/gpu/drm/radeon/radeon.h |  4 +-
 drivers/gpu/drm/radeon/radeon_asic.h|  2 +-
 drivers/gpu/drm/radeon/radeon_device.c  |  3 ++
 drivers/gpu/drm/radeon/radeon_fence.c   |  2 +-
 drivers/gpu/drm/radeon/radeon_gart.c|  1 -
 drivers/gpu/drm/radeon/radeon_pm.c  |  9 +++-
 drivers/gpu/drm/radeon/radeon_uvd.c | 93 +
 drivers/gpu/drm/radeon/rv6xx_dpm.c  | 22 
 drivers/gpu/drm/radeon/rv770.c  |  7 ++-
 drivers/gpu/drm/radeon/rv770_dpm.c  | 33 ++--
 drivers/gpu/drm/radeon/rv770_dpm.h  |  1 +
 drivers/gpu/drm/radeon/si.c | 19 ---
 drivers/gpu/drm/radeon/si_dpm.c | 61 +++--
 32 files changed, 353 insertions(+), 165 deletions(-)

Re: [PATCH v6 0/5] clk: implement remuxing during set_rate

2013-08-08 Thread Mike Turquette
Quoting James Hogan (2013-07-29 04:24:57)
> This patchset adds support for automatic selection of the best parent
> for a clock mux, i.e. the one which can provide the closest clock rate
> to that requested. It can be disabled by a new CLK_SET_RATE_NO_REPARENT
> flag (which is set for all uses of clk_register_mux().
> 
> This works by way of adding a new op, determine_rate, similar to
> round_rate but with an extra parameter to allow the clock driver to
> optionally select a different parent clock. This is used in
> clk_calc_new_rates to decide whether to initiate a set_parent operation.

Hi James,

I'm performing some testing on this series now. If I don't spot any
regressions than I'll take it into clk-next. Thanks a lot for the rework
you've done.

I think that work on re-muxing is not yet complete. There are still
unresolved issues about picking "best parents", and likely some other
loose ends. We can fix those up later.

Regards,
Mike

> 
> Changes in v6:
> 
> * Rebased on v3.11-rc1.
> * Added changes to samsung/clk-exynos-audss.c, zynq/clkc.c.
> 
> Changes in v5:
> 
> * Rebased on latest clk-next ("clk: tegra: Use common of_clk_init
>   function")
> * Updated clock hardware characteristics table in documentation.
> 
> Changes in v4:
> 
> * rebased on clk-next ("clk: sun5i: Add compatibles for Allwinner A13").
> * replace __clk_set_parent_no_recalc with __clk_set_parent.
> * never pass NULL to determine_rate's best_parent_clk parameter, and
>   slight refactor of __clk_round_rate to use local copy of clk->parent.
> * a few new comments around use of clk::new_child.
> * new patch (patch 2) split out of patch 3 to avoid having to declare
>   static __clk_set_parent() at the top of clk.c, and to ease readability
>   of patch 3.
> 
> Changes in v3:
> 
> * rebased on v3.10-rc1.
> * remove double underscore prefix from clk_get_parent_by_index()
> * store new_parent_index in struct clk too (calculated from
>   clk_fetch_parent_index, and passed through __clk_set_parent_no_recalc
>   to __clk_set_parent).
> * allow determine_rate to satisfy recalc_rate check in __clk_init.
> * rename/invert CLK_SET_RATE_REMUX to CLK_SET_RATE_NO_REPARENT and move
>   to patch 3.
> * patch 3: add CLK_SET_RATE_NO_REPARENT flag to all callers of
>   clk_register_mux. If you don't mind your clocks being reparented in
>   response to set_rate please let me know and I'll drop the relevant
>   portion of the patch.
> 
> Changes in v2:
> 
> I've moved the mux determine_rate implementation into a core helper, but
> I haven't pushed it fully into the core, as I think it just wouldn't
> work correctly for more complex clocks, e.g. if you (theoretically) had
> a combined mux and divide, you'd want to intercept the determine_rate
> and ask for a larger rate from the parent clocks, then return the
> divided rate. This should be possible by wrapping the mux determine_rate
> helper.
> 
> Patch 1 still exports the __clk_get_parent_by_index as it seems like it
> might be a useful thing for clock implementations to have access to if
> they ever wanted to do something more fancy with changing clock parents.
> 
> I haven't made any attempt to implement the atomic set_parent+set_rate
> as I don't have hardware that could take proper advantage of it, but it
> shouldn't be too difficult for others to implement if they wanted since
> they're fairly close to one another (in clk_change_rate()).
> 
> * switched to using new determine_rate op rather than adding an argument
>   to round_rate.
> * moved mux implementation into a single helper which should be usable
>   from more complex clocks which can mux.
> * rewrite main implementation so that no changes are made until after
>   the PRE notifications have been sent, and in a way that should ensure
>   correct notifications without duplicates, and I think should be safe
>   in the event of a notification failing.
> * various tidy ups and fixes.
> 
> James Hogan (5):
>   clk: abstract parent cache
>   clk: move some parent related functions upwards
>   clk: add support for clock reparent on set_rate
>   clk: add CLK_SET_RATE_NO_REPARENT flag
>   clk: clk-mux: implement remuxing on set_rate
> 
>  Documentation/clk.txt  |  46 ++--
>  arch/arm/mach-imx/clk.h|   5 +-
>  drivers/clk/clk-mux.c  |   1 +
>  drivers/clk/clk.c  | 420 
> +
>  drivers/clk/mmp/clk-mmp2.c |  39 ++-
>  drivers/clk/mmp/clk-pxa168.c   |  40 ++--
>  drivers/clk/mmp/clk-pxa910.c   |  31 ++-
>  drivers/clk/mxs/clk.h  |   4 +-
>  drivers/clk/samsung/clk-exynos-audss.c |   6 +-
>  drivers/clk/samsung/clk.h  |   2 +-
>  drivers/clk/spear/spear1310_clock.c| 179 +++---
>  drivers/clk/spear/spear1340_clock.c|  97 
>  drivers/clk/spear/spear3xx_clock.c |  57 +++--
>  drivers/clk/spear/spear6xx_clock.c |  35 +--
>  drivers/clk/sunxi/clk-sunxi.c  |   3 +-
> 

Re: [RFC PATCH 00/12] KVM: MMU: locklessly wirte-protect

2013-08-08 Thread Xiao Guangrong
On 08/09/2013 01:38 AM, Paolo Bonzini wrote:
> Il 06/08/2013 15:16, Xiao Guangrong ha scritto:
>> Hi Gleb, Paolo, Marcelo, Takuya,
>>
>> Any comments or further comments? :)
> 
> It's not the easiest patch to review.  I've looked at it (beyond the
> small comments I have already posted), but it will take some time to
> digest it...

Thanks for your time, Paolo!

> 
> By the way, both I and Gleb will be on vacation next week.  I will read
> email, but I will not be able to apply patches or do pull requests.

Enjoy your vacation. :)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [ 008/102] ARM: make vectors page inaccessible from userspace

2013-08-08 Thread Greg Kroah-Hartman
On Fri, Aug 09, 2013 at 06:29:17AM +0200, Stefan Lippers-Hollmann wrote:
> On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> > 3.10-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Russell King 
> > 
> > commit a5463cd3435475386cbbe7b06e01292ac169d36f upstream.
> > 
> > If kuser helpers are not provided by the kernel, disable user access to
> > the vectors page.  With the kuser helpers gone, there is no reason for
> > this page to be visible to userspace.
> > 
> > Signed-off-by: Russell King 
> > Signed-off-by: Greg Kroah-Hartman 
> 
> 
> If I read Russell King's response in 
> 
>   http://www.spinics.net/lists/stable/msg16792.html
>   Message-ID: <20130804105241.gg23...@n2100.arm.linux.org.uk>
> 
> correctly, this patch might not be wanted for -stable; this only 
> affects queue-3.10 at the moment.

Yes, I know there's a build warning/error here, but it only affects no
mmu systems, right?  I'll pick up the fix that hits Linus's tree for
this when it gets there.

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: [ 00/25] 3.4.57-stable review

2013-08-08 Thread Guenter Roeck

On 08/08/2013 06:41 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.4.57 release.
There are 25 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sun Aug 11 01:33:13 UTC 2013.
Anything received after that time might be too late.

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


Cross build results:
Total builds: 62 Total build errors: 10

Details:

http://server.roeck-us.net:8010/builders/stable-queue-3.4/builds/21/steps/shell/logs/stdio/text

Same results as with previous release; reported differences are due to 
different build targets.

If anyone is interested in per-build logs, please let me know.

Thanks,
Guenter

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


Re: [ 008/102] ARM: make vectors page inaccessible from userspace

2013-08-08 Thread Stefan Lippers-Hollmann
On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> 3.10-stable review patch.  If anyone has any objections, please let me know.
> 
> --
> 
> From: Russell King 
> 
> commit a5463cd3435475386cbbe7b06e01292ac169d36f upstream.
> 
> If kuser helpers are not provided by the kernel, disable user access to
> the vectors page.  With the kuser helpers gone, there is no reason for
> this page to be visible to userspace.
> 
> Signed-off-by: Russell King 
> Signed-off-by: Greg Kroah-Hartman 


If I read Russell King's response in 

http://www.spinics.net/lists/stable/msg16792.html
Message-ID: <20130804105241.gg23...@n2100.arm.linux.org.uk>

correctly, this patch might not be wanted for -stable; this only 
affects queue-3.10 at the moment.

Regards
Stefan Lippers-Hollmann
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [ 000/102] 3.10.6-stable review

2013-08-08 Thread Greg Kroah-Hartman
On Fri, Aug 09, 2013 at 06:13:02AM +0200, Stefan Lippers-Hollmann wrote:
> Hi
> 
> On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 3.10.6 release.
> […]
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> […]
> 
> There appears to be a problem with the mirroring (not pushed?):
> 
> $ LANG= wget 
> kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> --2013-08-09 06:05:02--  
> http://kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> Resolving kernel.org (kernel.org)... 149.20.4.69, 198.145.20.140
> Connecting to kernel.org (kernel.org)|149.20.4.69|:80... connected.
> HTTP request sent, awaiting response... 301 Moved Permanently
> Location: 
> https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
>  [following]
> --2013-08-09 06:05:02--  
> https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
> Resolving www.kernel.org (www.kernel.org)... 198.145.20.140, 149.20.4.69
> Connecting to www.kernel.org (www.kernel.org)|198.145.20.140|:443... 
> connected.
> HTTP request sent, awaiting response... 404 Not Found
> 2013-08-09 06:05:06 ERROR 404: Not Found.
> 
> The other -stable patches of this round
>   kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.57-rc1.gz
> and
>   kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
> appear to be missing as well.

Yes, something up with the kernel.org backend, I have a support ticket
already opened up on this.  Due to different timezones, it might take 12
hours or so before people wake up, so please be patient.

> Using the current queue-3.10/series from 
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
> builds and works fine on x86_64 and i386.

That's good to hear, thanks for testing and letting me know.

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


Re: [PATCH V12 0/14] Paravirtualized ticket spinlocks

2013-08-08 Thread Raghavendra K T

On 08/09/2013 06:34 AM, H. Peter Anvin wrote:

The kbuild test bot is reporting some pretty serious errors for this
patchset.  I think these are serious enough that the patchset will need
to be respun.



I  am working on that.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v9 03/16] iommu/exynos: fix page table maintenance

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 15:54:50 +0200, Tomasz Figa wrote:
> On Thursday 08 of August 2013 18:37:43 Cho KyongHo wrote:
> > This prevents allocating lv2 page table for the lv1 page table entry
>   ^ What this is this this about? :)
> 
As you might indicate, 'this' means this patch :)

> > that already has 1MB page mapping. In addition, changed to BUG_ON
> > instead of returning -EADDRINUSE.
> 
> The change mentioned in last sentence should be a separate patch.
> 
Ok :)

> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/exynos-iommu.c |   68
> > - 1 files changed, 40
> > insertions(+), 28 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index d545a25..d90e6fa 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -52,11 +52,11 @@
> >  #define lv2ent_large(pent) ((*(pent) & 3) == 1)
> > 
> >  #define section_phys(sent) (*(sent) & SECT_MASK)
> > -#define section_offs(iova) ((iova) & 0xF)
> > +#define section_offs(iova) ((iova) & ~SECT_MASK)
> >  #define lpage_phys(pent) (*(pent) & LPAGE_MASK)
> > -#define lpage_offs(iova) ((iova) & 0x)
> > +#define lpage_offs(iova) ((iova) & ~LPAGE_MASK)
> >  #define spage_phys(pent) (*(pent) & SPAGE_MASK)
> > -#define spage_offs(iova) ((iova) & 0xFFF)
> > +#define spage_offs(iova) ((iova) & ~SPAGE_MASK)
> > 
> >  #define lv1ent_offset(iova) ((iova) >> SECT_ORDER)
> >  #define lv2ent_offset(iova) (((iova) & 0xFF000) >> SPAGE_ORDER)
> > @@ -856,13 +856,15 @@ finish:
> >  static unsigned long *alloc_lv2entry(unsigned long *sent, unsigned long
> > iova, short *pgcounter)
> >  {
> > +   BUG_ON(lv1ent_section(sent));
> 
> Is this condition really a critical one, to the point that the system 
> should not continue execution?
> 
Discussed with Grant. He thought that creating mapping on a valid mapping
is just a BUG and I finally agreed with him. Is there a case that the condition
in BUG_ON is true intentionally?

> > +
> > if (lv1ent_fault(sent)) {
> > unsigned long *pent;
> > 
> > pent = kzalloc(LV2TABLE_SIZE, GFP_ATOMIC);
> > BUG_ON((unsigned long)pent & (LV2TABLE_SIZE - 1));
> > if (!pent)
> > -   return NULL;
> > +   return ERR_PTR(-ENOMEM);
> > 
> > *sent = mk_lv1ent_page(__pa(pent));
> > *pgcounter = NUM_LV2ENTRIES;
> > @@ -875,15 +877,11 @@ static unsigned long *alloc_lv2entry(unsigned long
> > *sent, unsigned long iova,
> > 
> >  static int lv1set_section(unsigned long *sent, phys_addr_t paddr, short
> > *pgcnt) {
> > -   if (lv1ent_section(sent))
> > -   return -EADDRINUSE;
> > +   BUG_ON(lv1ent_section(sent));
> 
> Ditto.
> 
> > if (lv1ent_page(sent)) {
> > -   if (*pgcnt != NUM_LV2ENTRIES)
> > -   return -EADDRINUSE;
> > -
> > +   BUG_ON(*pgcnt != NUM_LV2ENTRIES);
> 
> Ditto.
> 
> > kfree(page_entry(sent, 0));
> > -
> > *pgcnt = 0;
> > }
> > 
> > @@ -894,24 +892,24 @@ static int lv1set_section(unsigned long *sent,
> > phys_addr_t paddr, short *pgcnt) return 0;
> >  }
> > 
> > +static void clear_page_table(unsigned long *ent, int n)
> > +{
> > +   if (n > 0)
> > +   memset(ent, 0, sizeof(*ent) * n);
> > +}
> 
> I don't see the point of creating this function. It seems to be used only 
> once, in addition with a constant as n, so the check for n > 0 is 
> unnecessary.
> 
> And even if there is a need for this change, it should be done in separate 
> patch, as this one is not about stylistic changes, but fixing page table 
> maintenance (at least based on your commit message).
> 

I know what you are concerning about.
It was introduced in v8 patches to recover previous fault entries before
returning -EADDRINUSE. It is still remained though "return -EADDRINUSE"
is changed into BUG_ON().
I also think that it needs to be removed.

> >  static int lv2set_page(unsigned long *pent, phys_addr_t paddr, size_t
> > size, short *pgcnt)
> >  {
> > if (size == SPAGE_SIZE) {
> > -   if (!lv2ent_fault(pent))
> > -   return -EADDRINUSE;
> > -
> > +   BUG_ON(!lv2ent_fault(pent));
> 
> Ditto.
> 
> > *pent = mk_lv2ent_spage(paddr);
> > pgtable_flush(pent, pent + 1);
> > *pgcnt -= 1;
> > } else { /* size == LPAGE_SIZE */
> > int i;
> > for (i = 0; i < SPAGES_PER_LPAGE; i++, pent++) {
> > -   if (!lv2ent_fault(pent)) {
> > -   memset(pent, 0, sizeof(*pent) * i);
> > -   return -EADDRINUSE;
> > -   }
> > -
> > +   BUG_ON(!lv2ent_fault(pent));
> 
> Ditto.
> 
> > *pent = mk_lv2ent_lpage(paddr);
> > }
> > pgtable_flush(pent - SPAGES_PER_LPAGE, pent);
> > @@ -944,17 +942,16 @@ static int exynos_iommu_map(struct iommu_domain
> > *domain, unsigne

Re: [ 000/102] 3.10.6-stable review

2013-08-08 Thread Stefan Lippers-Hollmann
Hi

On Friday 09 August 2013, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 3.10.6 release.
[…]
> The whole patch series can be found in one patch at:
>   kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
[…]

There appears to be a problem with the mirroring (not pushed?):

$ LANG= wget kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
--2013-08-09 06:05:02--  
http://kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
Resolving kernel.org (kernel.org)... 149.20.4.69, 198.145.20.140
Connecting to kernel.org (kernel.org)|149.20.4.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: 
https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz 
[following]
--2013-08-09 06:05:02--  
https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.6-rc1.gz
Resolving www.kernel.org (www.kernel.org)... 198.145.20.140, 149.20.4.69
Connecting to www.kernel.org (www.kernel.org)|198.145.20.140|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-08-09 06:05:06 ERROR 404: Not Found.

The other -stable patches of this round
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.57-rc1.gz
and
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
appear to be missing as well.

Using the current queue-3.10/series from 
git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
builds and works fine on x86_64 and i386.

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


[PATCH 3/3] block: brd: Staticize 'rd_size'

2013-08-08 Thread Jingoo Han
'rd_size' is used only in this file.
Fix the following sparse warning:

drivers/block/brd.c:432:5: warning: symbol 'rd_size' was not declared. Should 
it be static?

Signed-off-by: Jingoo Han 
---
 drivers/block/brd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 9bf4371..650530ab 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -429,7 +429,7 @@ static const struct block_device_operations brd_fops = {
  * And now the modules code and kernel interface.
  */
 static int rd_nr;
-int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
+static int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
 static int max_part;
 static int part_shift;
 module_param(rd_nr, int, S_IRUGO);
-- 
1.7.10.4


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


Re: [PATCH 35/35] cpufreq: tegra: use cpufreq_table_validate_and_show()

2013-08-08 Thread Viresh Kumar
On 8 August 2013 21:37, Viresh Kumar  wrote:
> Its useless and the correct routine isn't called at all :) .. I will add that
> additional patch and send it to you and will get this change out of this
> commit.

The two commits look like this now attached too in case you want
to test:

commit 9abdc9127b9f7f1e00c75694d15345843a60ff99
Author: Viresh Kumar 
Date:   Thu Aug 8 16:40:32 2013 +0530

cpufreq: tegra: use cpufreq_table_validate_and_show()

Lets use cpufreq_table_validate_and_show() instead of calling
cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr().

Cc: Stephen Warren 
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/tegra-cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
index cd66b85..51752b3 100644
--- a/drivers/cpufreq/tegra-cpufreq.c
+++ b/drivers/cpufreq/tegra-cpufreq.c
@@ -215,8 +215,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
clk_prepare_enable(emc_clk);
clk_prepare_enable(cpu_clk);

-   cpufreq_frequency_table_cpuinfo(policy, freq_table);
-   cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
+   cpufreq_table_validate_and_show(policy, freq_table);
policy->cur = tegra_getspeed(policy->cpu);
target_cpu_speed[policy->cpu] = policy->cur;


commit f1bb1cab6130501251eee616280b88c0b49d96d7
Author: Viresh Kumar 
Date:   Fri Aug 9 09:29:19 2013 +0530

cpufreq: tegra: fix implementation of ->exit()

->exit() of drivers should call cpufreq_frequency_table_put_attr()
if they have
called cpufreq_frequency_table_get_attr() earlier in init() and they aren't
required to validate their cpufreq table in exit by calling
cpufreq_frequency_table_cpuinfo(). Tegra's driver wasn't calling
cpufreq_frequency_table_put_attr() and was calling
cpufreq_frequency_table_cpuinfo() in exit.

Fix both these issues in it.

Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/tegra-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
index 51752b3..faf1ce5 100644
--- a/drivers/cpufreq/tegra-cpufreq.c
+++ b/drivers/cpufreq/tegra-cpufreq.c
@@ -232,7 +232,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)

 static int tegra_cpu_exit(struct cpufreq_policy *policy)
 {
-   cpufreq_frequency_table_cpuinfo(policy, freq_table);
+   cpufreq_frequency_table_put_attr(policy->cpu);
clk_disable_unprepare(emc_clk);
return 0;
 }


0001-cpufreq-Add-new-helper-cpufreq_table_validate_and_sh.patch
Description: Binary data


0035-cpufreq-tegra-use-cpufreq_table_validate_and_show.patch
Description: Binary data


0036-cpufreq-tegra-fix-implementation-of-exit.patch
Description: Binary data


[PATCH 2/3] block: mg_disk: Staticize mg_times_out()

2013-08-08 Thread Jingoo Han
mg_times_out() is used only in this file.
Fix the following sparse warning:

drivers/block/mg_disk.c:639:6: warning: symbol 'mg_times_out' was not declared. 
Should it be static?

Signed-off-by: Jingoo Han 
---
 drivers/block/mg_disk.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index a56cfcd..77a60be 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -636,7 +636,7 @@ ok_to_write:
mg_request(host->breq);
 }
 
-void mg_times_out(unsigned long data)
+static void mg_times_out(unsigned long data)
 {
struct mg_host *host = (struct mg_host *)data;
char *name;
-- 
1.7.10.4


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


[PATCH 1/3] block: rbd: use NULL instead of 0

2013-08-08 Thread Jingoo Han
The local variables such as 'bio_list', and 'pages' are pointers;
thus, use NULL instead of 0 to fix the following sparse warnings.

drivers/block/rbd.c:2166:32: warning: Using plain integer as NULL pointer
drivers/block/rbd.c:2168:31: warning: Using plain integer as NULL pointer

Signed-off-by: Jingoo Han 
---
 drivers/block/rbd.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 9e00010..fa198de 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2163,9 +2163,9 @@ static int rbd_img_request_fill(struct rbd_img_request 
*img_request,
struct rbd_obj_request *obj_request = NULL;
struct rbd_obj_request *next_obj_request;
bool write_request = img_request_write_test(img_request);
-   struct bio *bio_list = 0;
+   struct bio *bio_list = NULL;
unsigned int bio_offset = 0;
-   struct page **pages = 0;
+   struct page **pages = NULL;
u64 img_offset;
u64 resid;
u16 opcode;
-- 
1.7.10.4


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


Re: [PATCH v9 01/16] iommu/exynos: do not include removed header

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 15:42:24 +0200, Tomasz Figa wrote:
> Hi KyongHo,
> 
> On Thursday 08 of August 2013 18:37:25 Cho KyongHo wrote:
> > This commit remove  which is removed.
> 
> I would prefer a more meaningful commit message, something among following 
> lines:
> 
> 8<---
> Commit 25e9d28d92 (ARM: EXYNOS: remove system mmu initialization from 
> exynos tree) removed arch/arm/mach-exynos/mach/sysmmu.h header without 
> removing remaining use of it from exynos-iommu driver, thus causing a 
> compilation error.
> 
> This patch fixes the error by removing respective include line from exynos-
> iommu.c.
> --->8
> 

Ok.

> Also a sentence explaining why linux/kernel.h header must be included would 
> be nice.
> 
> > Signed-off-by: Cho KyongHo 
> 
> Please note that as far as I'm aware of, tags should be made using western 
> name writing convention, i.e. starting with first name.
> 

Oh, I didn't think that the order of family/given names are the matter.
I don't care about changing the order.

Thanks.

KyongHo.

> Best regards,
> Tomasz
> 
> > ---
> >  drivers/iommu/exynos-iommu.c |3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 3f32d64..233f382 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -12,6 +12,7 @@
> >  #define DEBUG
> >  #endif
> > 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -29,8 +30,6 @@
> >  #include 
> >  #include 
> > 
> > -#include 
> > -
> >  /* We does not consider super section mapping (16MB) */
> >  #define SECT_ORDER 20
> >  #define LPAGE_ORDER 16
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v9 02/16] iommu/exynos: add missing cache flush for removed page table entries

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 15:44:09 +0200, Tomasz Figa wrote:
> On Thursday 08 of August 2013 18:37:34 Cho KyongHo wrote:
> > This commit adds cache flush for removed small and large page entries
> > in exynos_iommu_unmap(). Missing cache flush of removed page table
> > entries can cause missing page fault interrupt when a master IP
> > accesses an unmapped area.
> > 
> > Tested-by: Grant Grundler 
> > Signed-off-by: Cho KyongHo 
> > ---
> >  drivers/iommu/exynos-iommu.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> > index 233f382..d545a25 100644
> > --- a/drivers/iommu/exynos-iommu.c
> > +++ b/drivers/iommu/exynos-iommu.c
> > @@ -1002,6 +1002,7 @@ static size_t exynos_iommu_unmap(struct
> > iommu_domain *domain, if (lv2ent_small(ent)) {
> > *ent = 0;
> > size = SPAGE_SIZE;
> > +   pgtable_flush(ent, ent + 1);
> > priv->lv2entcnt[lv1ent_offset(iova)] += 1;
> > goto done;
> > }
> > @@ -1010,6 +1011,7 @@ static size_t exynos_iommu_unmap(struct
> > iommu_domain *domain, BUG_ON(size < LPAGE_SIZE);
> > 
> > memset(ent, 0, sizeof(*ent) * SPAGES_PER_LPAGE);
> > +   pgtable_flush(ent, ent + SPAGES_PER_LPAGE);
> > 
> > size = LPAGE_SIZE;
> > priv->lv2entcnt[lv1ent_offset(iova)] += SPAGES_PER_LPAGE;
> 
> Looks reasonable.
> 
> Reviewed-by: Tomasz Figa 
> 

Thanks.

KyongHo.
> Best regards,
> Tomasz
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [ 00/22] 3.0.90-stable review

2013-08-08 Thread Greg Kroah-Hartman
On Thu, Aug 08, 2013 at 08:42:12PM -0700, Guenter Roeck wrote:
> On 08/08/2013 06:41 PM, Greg Kroah-Hartman wrote:
> >This is the start of the stable review cycle for the 3.0.90 release.
> >There are 22 patches in this series, all will be posted as a response
> >to this one.  If anyone has any issues with these being applied, please
> >let me know.
> >
> >Responses should be made by Sun Aug 11 01:37:07 UTC 2013.
> >Anything received after that time might be too late.
> >
> >The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.90-rc1.gz
> >and the diffstat can be found below.
> >
> 
> Cross build results:
>   Total builds: 58 Total build errors: 14
> 
> Same result as with previous release, except I got the m68k builds to work on 
> 3.0,
> added some new builds, and removed others which were failing on all branches.

Thanks for testing and letting me know.

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


Re: [PATCH v6 00/10] mtd: add datasheet's ECC information to nand_chip{}

2013-08-08 Thread Artem Bityutskiy
On Thu, 2013-08-08 at 16:06 -0700, Brian Norris wrote:
> On Thu, Aug 08, 2013 at 04:33:35PM +0800, Huang Shijie wrote:
> > Hi Artem & Brian:
> > >Hi Huang and others,
> > >
> > >On Thu, May 16, 2013 at 8:17 PM, Huang Shijie  wrote:
> > >>1.) Why add the ECC information to the nand_chip{} ?
> ...
> > >Reviewed-by: Brian Norris
> > >Tested-by: Brian Norris
> > >
> > >Thanks for the work Huang.
> > >
> > Could you please merge this patch set?
> 
> Thanks for the reminder. I haven't sorted through all the piles of
> backed up stuff yet!
> 
> I made a few minor changes (for checkpatch.pl, regarding
> __attribute__((packed)), and to make the style a little more
> easily-read) and tested the generic stuff on my platform. I've pushed
> the series to l2-mtd.git. Thanks for the patience!

I guess you can try aiaiai, I run it for all the patches I take to
l2-mtd.git. It uses also coccinelle/smatch/sparse and other tools to
verify the patches, not only checkpatch. And this git tree contains
scripts and various defconfigs for various MTD drivers - the scripts run
aiaiai.

For example, to check Huang's patches, I run something like:

aiaiai-concat-mboxes ~/tmp/huang*.mbox | ./verify ../l2-mtd/ gpmi-nand

where "huang*.mbox" is Huang's patch set.

There are aliases for verious drivers. There is a 'gen' alias which I
use for general changes like changes in nand_base.c.

Read about the tool here:
http://git.infradead.org/users/dedekind/aiaiai.git/blob/HEAD:/doc/README.announcement
http://git.infradead.org/users/dedekind/aiaiai.git/blob/HEAD:/doc/README

The mtd maintenance helpers:
http://git.infradead.org/users/dedekind/maintaining.git

There are few minor issues in aiaiai, which I can fix if you hit them
and complain. Also, I did not invest much time in making the user
interface and experience very nice. But this can also be improved.

-- 
Best Regards,
Artem Bityutskiy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [ 00/22] 3.0.90-stable review

2013-08-08 Thread Guenter Roeck

On 08/08/2013 06:41 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.0.90 release.
There are 22 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sun Aug 11 01:37:07 UTC 2013.
Anything received after that time might be too late.

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



Cross build results:
Total builds: 58 Total build errors: 14

Same result as with previous release, except I got the m68k builds to work on 
3.0,
added some new builds, and removed others which were failing on all branches.

Details:

http://server.roeck-us.net:8010/builders/stable-queue-3.0/builds/29/steps/shell/logs/stdio/text

If anyone is interested in detailed per-build logs, please let me know.

Guenter

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


Re: [PATCH]arch:avr32:kernel:time.c: Removed IRQF_DISABLED

2013-08-08 Thread Joe Perches
On Fri, 2013-08-09 at 08:49 +0530, Kumar Gaurav wrote:
> Please ignore the below patch. I'll be resending this with 0 instead of 
> IRQF_TRIGGER_NONE

Hey again Kumar.

This is one of those patches that should just have
IRQF_DISABLED completely elided.

> On Friday 09 August 2013 08:47 AM, Kumar Gaurav wrote:
[]
> > diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
[]
> > @@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
[]
> > -   .flags  = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
> > +   .flags  = IRQF_TIMER | IRQF_TRIGGER_NONE | IRQF_SHARED,

.flags  = IRQF_TIMER | IRQF_SHARED,


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


Re: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver

2013-08-08 Thread Viresh Kumar
On 9 August 2013 00:20, Stephen Warren  wrote:
> I don't think so. I think it's reasonable to have a per-SoC cpufreq
> driver whose primary content is the parameterization data and/or custom
> hooks for a unified core cpufreq driver. The duplicate parts of each
> cpufreq driver can be moved into the core cpufreq driver, but the
> non-duplicate parts remain. That's how many other subsystems work (MMC,
> USB, ASoC spring to mind).

Guys in the --to list:

Please shout before its too late...

I can understand why Stephen is asking not to implement a virtual clock
driver for cpu as there is no clock corresponding to that.. We are just playing
with existing clocks there..

But I thought these clock APIs can be considered as hooks that we were
looking for and so shouldn't be a problem..

But yes, different people see things differently..

So, if I take Stephen's suggestions then I need to implement hooks into
cpufreq-cpu0 driver for taking freq-table/ setting clk rates, etc...

Let me know if anybody has a issue with that before we actually implement
that..

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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]arch:avr32:kernel:time.c: Removed IRQF_DISABLED

2013-08-08 Thread Kumar Gaurav
Please ignore the below patch. I'll be resending this with 0 instead of 
IRQF_TRIGGER_NONE

On Friday 09 August 2013 08:47 AM, Kumar Gaurav wrote:

Removed IRQF_DISABLED as it's no-op and should be removed

Signed-off-by: Kumar Gaurav 
---
  arch/avr32/kernel/time.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 869a1c6..0566c81 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
  static struct irqaction timer_irqaction = {
.handler= timer_interrupt,
/* Oprofile uses the same irq as the timer, so allow it to be shared */
-   .flags  = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_TIMER | IRQF_TRIGGER_NONE | IRQF_SHARED,
.name   = "avr32_comparator",
  };
  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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]arch:avr32:kernel:time.c: Removed IRQF_DISABLED

2013-08-08 Thread Kumar Gaurav
Removed IRQF_DISABLED as it's no-op and should be removed

Signed-off-by: Kumar Gaurav 
---
 arch/avr32/kernel/time.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 869a1c6..0566c81 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 static struct irqaction timer_irqaction = {
.handler= timer_interrupt,
/* Oprofile uses the same irq as the timer, so allow it to be shared */
-   .flags  = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
+   .flags  = IRQF_TIMER | IRQF_TRIGGER_NONE | IRQF_SHARED,
.name   = "avr32_comparator",
 };
 
-- 
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: dw_mmc: Does anyone use multiple slots?

2013-08-08 Thread Seungwon Jeon
On Fri, August 09, 2013, Chris Ball wrote:
> On Fri, Aug 09 2013, Olof Johansson wrote:
> > On Thu, Aug 8, 2013 at 5:16 PM, Doug Anderson  wrote:
> >
> >> I guess my overall question is: if there are no actual implementations
> >> of multislot, shouldn't we kill it and simplify the code a whole lot?
> >> If someone out there has a real multislot device they can step back in
> >> and do it more correctly?
> >>
> >> Of course we need to find someone to actually go through and do the
> >> killing of multislot, but finding that person might be easier if there
> >> was some agreement that it was good to do.
> >
> > There clearly seems to be no in-tree users of multislot. If someone
> > new comes in, we have the code in the history and can revert the
> > removal (or at least use it as reference for re-introduction).
> >
> > I vote for removing it. It adds really annoying complexity for
> > something that nobody uses.
> 
> I agree with Olof, for what it's worth.  (The maintainers of the
> driver are Jaehoon and Seungwon, though.)

I feel like there is no actual use case for that though origin Synopsys IP 
supports.
Multi-slot  might be not useful in terms of performance because shared bus 
should be allowed.
(At least this is the way I see it, though)
As Exynos's host does so, other hosts which are introduced in Linux seems use 
one card per host.
If it's really not found now, I could agree on this topic.

Thanks,
Seungwon Jeon

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] perf tests: Fix compile failure on do_sort_something

2013-08-08 Thread David Ahern

On 8/8/13 1:58 AM, Adrian Hunter wrote:

On 08/08/13 00:59, David Ahern wrote:

Commit b55ae0a9 added code-reading.c which fails to compile on Fedora 16
with compiler version:
$ gcc --version
gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

Failure message is:

tests/code-reading.c: In function ‘do_sort_something’:
tests/code-reading.c:305:13: error: stack protector not protecting local 
variables: variable length buffer [-Werror=stack-protector]
cc1: all warnings being treated as errors
make: *** [/tmp/junk/tests/code-reading.o] Error 1
make: *** Waiting for unfinished jobs

Signed-off-by: David Ahern 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
---
  tools/perf/tests/code-reading.c |   11 +--
  1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 8e0943b..4bde8be 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -304,15 +304,14 @@ static int comp(const void *a, const void *b)

  static void do_sort_something(void)
  {
-   size_t sz = 40960;
-   int buf[sz], i;
+   int buf[40960], i;

-   for (i = 0; i < (int)sz; i++)
-   buf[i] = sz - i - 1;
+   for (i = 0; i < (int)sizeof(buf); i++)



Should that be ARRAY_SIZE not sizeof


oops, yes it should.

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


Re: [PATCH 2/2] ext4: improve mount/remount error handling

2013-08-08 Thread Theodore Ts'o
On Fri, Aug 02, 2013 at 02:03:47PM +0200, Piotr Sarna wrote:
> Commit 5688978 ("ext4: improve handling of conflicting mount options")
> introduced incorrect messages shown while choosing wrong mount options.
> 
> Firstly, both cases of incorrect mount options, "data=journal,delalloc"
> and "data=journal,dioread_nolock" result in the same error message.
> 
> Secondly, the problem above isn't solved for remount option: the mismatched
> parameter is simply ignored. Moreover, ext4_msg states that remount
> with options "data=journal,delalloc" succeeded, which is not true.
> 
> To fix it up, I added a simple check after parse_options() call to ensure
> that data=journal and delalloc/dioread_nolock parameters are not present
> at the same time.
> 
> Signed-off-by: Piotr Sarna 
> Acked-by: Bartlomiej Zolnierkiewicz 
> Signed-off-by: Kyungmin Park 

Applied, thanks.

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


Re: [PATCH 1/3 v5] usb: phy-samsung-usb: Simplify PMU register handling

2013-08-08 Thread Julius Werner
> Sorry, I don't understand what is not implemented. Without your patch, the
> PHY driver handles both PMU registers of Exynos4.

I don't have an Exynos4 to actually test this, so please let me know
if I'm missing something here... but in order to hit the right HOST
PHY register in the current upstream code, the Exynos4 code would need
to have a hostphy_reg_offset of 4 somewhere in its
samsung_usbphy_drvdata. In my latest checkout of Linus' tree (6c2580c)
it does not (only Exynos5 sets that attribute), so it would default to
0 (thereby actually hitting the DEVICE register).

If you want I can gladly provide another change on top of my patchset
to fix that in the future... but it looks to me like it had been
broken anyway for now.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 08/19] perf symbol: Save vmlinux or kallsyms path loaded

2013-08-08 Thread David Ahern

On 8/8/13 11:08 AM, Arnaldo Carvalho de Melo wrote:

Em Wed, Aug 07, 2013 at 10:50:50PM -0400, David Ahern escreveu:

Save vmlinux or kallsyms path loaded using embedded default lookup (ie.,
not a user specified path). Upcoming perf sched timehist command requires
kernel symbols for properly computing idle times and prints a warning
if the kernel symbols are not loaded.


With this we will not know if the user passed something to set those
variables or if internally we did it, doesn't this break any existing
code assumption?


I believe this only affects code paths that go to default locations.

I am not aware of any code that looks at the path once the syms are 
loaded. AFAIK the timehist command is the first.


David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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/19] perf top: Use new idle_sym check

2013-08-08 Thread David Ahern

On 8/8/13 11:06 AM, Arnaldo Carvalho de Melo wrote:

Em Wed, Aug 07, 2013 at 10:50:49PM -0400, David Ahern escreveu:

Avoids strcmp processing each sample.


How so? This is done just when loading a DSO, when then each symbol is
checked against this list.


hmmm see that now, yes. The timehist command wants to know idle 
times, not just filter them out like perf-top does.


David



Tangentially, Frédéric, wasn't there a patchset from you that marks the
context of idle samples, in perf_event_header->misc, additiotally to
PERF_RECORD_MISC_KERNEL, etc? I think there were some for IRQ context as
well, right?

- Arnaldo


Signed-off-by: David Ahern 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Frederic Weisbecker 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
---
  tools/perf/builtin-top.c |   25 ++---
  1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 440c3b3..8eb0e3a 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -634,26 +634,9 @@ repeat:
return NULL;
  }

-/* Tag samples to be skipped. */
-static const char *skip_symbols[] = {
-   "intel_idle",
-   "default_idle",
-   "native_safe_halt",
-   "cpu_idle",
-   "enter_idle",
-   "exit_idle",
-   "mwait_idle",
-   "mwait_idle_with_hints",
-   "poll_idle",
-   "ppc64_runlatch_off",
-   "pseries_dedicated_idle_sleep",
-   NULL
-};
-
  static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym)
  {
const char *name = sym->name;
-   int i;

/*
 * ppc64 uses function descriptors and appends a '.' to the
@@ -671,12 +654,8 @@ static int symbol_filter(struct map *map __maybe_unused, 
struct symbol *sym)
strstr(name, "_text_end"))
return 1;

-   for (i = 0; skip_symbols[i]; i++) {
-   if (!strcmp(skip_symbols[i], name)) {
-   sym->ignore = true;
-   break;
-   }
-   }
+   if (symbol__is_idle(sym))
+   sym->ignore = true;

return 0;
  }
--
1.7.10.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] ACPI, cpu hotplug: move try_offline_node() after acpi_unmap_lsapic()

2013-08-08 Thread Gu Zheng
Hi Ishimatsu-san,
On 08/06/2013 06:11 PM, Yasuaki Ishimatsu wrote:

> try_offline_node() checks that all cpus related with removed node have been
> removed by using cpu_present_bits. If all cpus related with removed node have
> been removed, try_offline_node() clears the node information.
> 
> But try_offline_node() called from acpi_processor_remove() never clears
> the node information. For disabling cpu_present_bits, acpi_unmap_lsapic()
> need be called. But acpi_unmap_lsapic() is called after try_offline_node()
> runs. So when try_offline_node() runs, the cpu's cpu_present_bits is always
> set.
> 
> This patch moves try_offline_node() after acpi_unmap_lsapic().

It works well.

> 
> Signed-off-by: Yasuaki Ishimatsu 


Tested-by: Gu Zheng 

Thanks,
Gu

> ---
>  drivers/acpi/acpi_processor.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index fd6c51c..5a74a9c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device 
> *device)
>   /* Clean up. */
>   per_cpu(processor_device_array, pr->id) = NULL;
>   per_cpu(processors, pr->id) = NULL;
> - try_offline_node(cpu_to_node(pr->id));
> 
>   /* Remove the CPU. */
>   get_online_cpus();
> @@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device 
> *device)
>   acpi_unmap_lsapic(pr->id);
>   put_online_cpus();
> 
> + try_offline_node(cpu_to_node(pr->id));
> +
>   out:
>   free_cpumask_var(pr->throttling.shared_cpu_map);
>   kfree(pr);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v2 3/7] dmaengine: enhance dmaengine to support DMA device hotplug

2013-08-08 Thread Wang, Rui Y
> -Original Message-
> From: Jon Mason [mailto:jdma...@kudzu.us]
> Sent: Friday, August 09, 2013 8:04 AM
> To: Wang, Rui Y
> Cc: liu...@gmail.com; Sosnowski, Maciej; Koul, Vinod;
> chenkep...@huawei.com; linux-kernel@vger.kernel.org;
> linux-...@vger.kernel.org; Luck, Tony; Guo, Chaohong; Dan Williams; Jiang,
> Dave
> Subject: Re: [RFC PATCH v2 3/7] dmaengine: enhance dmaengine to support
> DMA device hotplug
> 
> On Thu, Aug 8, 2013 at 3:59 AM, Wang, Rui Y  wrote:
> > (resend adding cc list)
> 
> The e-mail you are responding to is over a year old, but doesn't appear to 
> have
> been accepted.  I suppose late is better than never...
> 

Yes agreed. We eventually have to fix it.

I recently encountered the same problem (dma_async_device_unregister() hung my 
machine). I was looking for people who cared about it and found this thread.

Thanks
Rui

> Adding Dan Williams new e-mail address and Dave Jiang.
> 
> Thanks,
> Jon
> 
> >
> > Hi Jiang,
> > See my comments inline.
> >
> >> -Original Message-
> >> From: Jiang Liu 
> >> Date: Mon, 14 May 2012 21:47:05 +0800
> >> Subject: [RFC PATCH v2 3/7] dmaengine: enhance dmaengine to support
> >> DMA device hotplug
> >> To: Dan Williams , Maciej Sosnowski
> >> , Vinod Koul 
> >> Cc: Jiang Liu , Keping Chen
> >> , linux-kernel@vger.kernel.org,
> >> linux-...@vger.kernel.org
> >>
> >> From: Jiang Liu 
> >>
> >> From: Jiang Liu 
> >>
> >> To support DMA device hotplug, dmaengine must correctly manage
> >> reference count for DMA channels. On the other hand, DMA hot path is
> >> performance critical, reference count management code should avoid
> >> polluting global shared cachelines, otherwise it may cause heavy
> performance penalty.
> >>
> >> This patch introduces a lightweight DMA channel reference count
> >> management mechanism by using percpu counter. When DMA device
> hotplug
> >> is disabled, there's no performance penalty. When hotplug is enabled,
> >> a
> >> dma_find_channel()/dma_put_channel() pair adds two local memory
> >> accesses to the hot path.
> >>
> >> Signed-off-by: Jiang Liu 
> >> ---
> >>  drivers/dma/dmaengine.c   |  112
> >> +
> >>  include/linux/dmaengine.h |   29 +++-
> >>  2 files changed, 129 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index
> >> d3b1c48..eca45c0 100644
> >> --- a/drivers/dma/dmaengine.c
> >> +++ b/drivers/dma/dmaengine.c
> >> @@ -61,12 +61,20 @@
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#include 
> >>
> >>  static DEFINE_MUTEX(dma_list_mutex);  static DEFINE_IDR(dma_idr);
> >> static LIST_HEAD(dma_device_list);  static long
> >> dmaengine_client_count;
> >>
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> +static atomic_t dmaengine_dirty;
> >> +static struct static_key dmaengine_quiesce = STATIC_KEY_INIT_FALSE;
> >> +static DECLARE_WAIT_QUEUE_HEAD(dmaengine_wait_queue);
> >> +DEFINE_PER_CPU(long, dmaengine_chan_ref_count);
> >> +#endif   /* CONFIG_DMA_ENGINE_HOTPLUG */
> >> +
> >>  /* --- sysfs implementation --- */
> >>
> >>  /**
> >> @@ -305,10 +313,40 @@ arch_initcall(dma_channel_table_init);
> >>   */
> >>  struct dma_chan *dma_find_channel(enum dma_transaction_type
> tx_type)
> >> {
> >> - return this_cpu_read(channel_table[tx_type]->chan);
> >> + struct dma_chan *chan =
> >> + this_cpu_read(channel_table[tx_type]->chan);
> >> +
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> + this_cpu_inc(dmaengine_chan_ref_count);
> >> + if (static_key_false(&dmaengine_quiesce))
> >> + chan = NULL;
> >> +#endif
> >> +
> >> + return chan;
> >>  }
> >>  EXPORT_SYMBOL(dma_find_channel);
> >>
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> +struct dma_chan *dma_get_channel(struct dma_chan *chan) {
> >> + if (static_key_false(&dmaengine_quiesce))
> >> + atomic_inc(&dmaengine_dirty);
> >> + this_cpu_inc(dmaengine_chan_ref_count);
> >> +
> >> + return chan;
> >> +}
> >> +EXPORT_SYMBOL(dma_get_channel);
> >> +#endif
> >> +
> >> +/**
> >> + * dma_has_capability - check whether any channel supports tx_type
> >> + * @tx_type: transaction type
> >> + */
> >> +bool dma_has_capability(enum dma_transaction_type tx_type) {
> >> + return !!this_cpu_read(channel_table[tx_type]->chan);
> >> +}
> >> +EXPORT_SYMBOL(dma_has_capability);
> >> +
> >>  /*
> >>   * net_dma_find_channel - find a channel for net_dma
> >>   * net_dma has alignment requirements @@ -316,10 +354,15 @@
> >> EXPORT_SYMBOL(dma_find_channel);  struct dma_chan
> >> *net_dma_find_channel(void)  {
> >>   struct dma_chan *chan = dma_find_channel(DMA_MEMCPY);
> >> - if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1))
> >> - return NULL;
> >>
> >> - return chan;
> >> + if (chan && is_dma_copy_aligned(chan->device, 1, 1, 1))
> >> + return chan;
> >> +
> >> +#ifdef   CONFIG_DMA_ENGINE_HOTPLUG
> >> + this_cpu_dec(dmaengine_chan_ref_cou

Re: [PATCH v8 06/12] ARM: dts: Add description of System MMU of Exynos SoCs

2013-08-08 Thread Cho KyongHo
On Thu, 08 Aug 2013 22:43:43 +0100, Will Deacon wrote:
> On Thu, Aug 08, 2013 at 10:38:10PM +0100, Tomasz Figa wrote:
> > On Thursday 08 of August 2013 08:09:49 Rob Herring wrote:
> > > On Thu, Aug 1, 2013 at 8:05 AM, Cho KyongHo  
> > wrote:
> > > > Should this align with ARM System MMU bindings?
> > > > System MMU in Exynos SoC is different from ARM System MMU.
> > > > It does not follows the specifications of ARM System MMU.
> > > 
> > > I'm not saying the h/w is the same or even the same spec, but how you
> > > describe a master to iommu connection needs to be done in the same
> > > way. This should be done in the same way for ALL iommu's. And if what
> > > is defined does not work for you, then we need to understand that and
> > > fix the binding now.
> > 
> > +1
> > 
> > All IOMMUs should use a generic IOMMU Device Tree bindings (and in 
> > general, the same should be true for all Device Tree bindings).
> > 
> > This means that if we already have some bindings for IOMMU, then they 
> > should be reused if possible or extended if there is anything missing.
> > 
> > Of course there might be things that such generic bindings can't specify. 
> > In this case device-specific properties can be introduced, but this is 
> > last resort.
> 
> I'm also happy to discuss and/or review bindings in light of what we did for
> the ARM SMMU.
> 
> Will

Rob, I now understood what you are talking about.
Do you mean the binding description is lack of details about connection
betwen  System MMU and its master?

thanks.

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


[ 003/102] ARM: move vector stubs

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 19accfd373847ac3d10623c5d20f948846299741 upstream.

Move the machine vector stubs into the page above the vector page,
which we can prevent from being visible to userspace.  Also move
the reset stub, and place the swi vector at a location that the
'ldr' can get to it.

This hides pointers into the kernel which could give valuable
information to attackers, and reduces the number of exploitable
instructions at a fixed address.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/Kconfig |3 +-
 arch/arm/kernel/entry-armv.S |   50 ---
 arch/arm/kernel/traps.c  |4 +--
 arch/arm/mm/mmu.c|   10 +++-
 4 files changed, 37 insertions(+), 30 deletions(-)

--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -213,7 +213,8 @@ config VECTORS_BASE
default DRAM_BASE if REMAP_VECTORS_TO_RAM
default 0x
help
- The base address of exception vectors.
+ The base address of exception vectors.  This must be two pages
+ in size.
 
 config ARM_PATCH_PHYS_VIRT
bool "Patch physical to virtual translations at runtime" if EMBEDDED
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -943,9 +943,9 @@ __kuser_helper_end:
 /*
  * Vector stubs.
  *
- * This code is copied to 0x0200 so we can use branches in the
- * vectors, rather than ldr's.  Note that this code must not
- * exceed 0x300 bytes.
+ * This code is copied to 0x1000 so we can use branches in the
+ * vectors, rather than ldr's.  Note that this code must not exceed
+ * a page size.
  *
  * Common stub entry macro:
  *   Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
@@ -994,6 +994,15 @@ ENDPROC(vector_\name)
 
.globl  __stubs_start
 __stubs_start:
+   @ This must be the first word
+   .word   vector_swi
+
+vector_rst:
+ ARM(  swi SYS_ERROR0  )
+ THUMB(svc #0  )
+ THUMB(nop )
+   b   vector_und
+
 /*
  * Interrupt dispatcher
  */
@@ -1088,6 +1097,16 @@ __stubs_start:
.align  5
 
 /*=
+ * Address exception handler
+ *-
+ * These aren't too critical.
+ * (they're not supposed to happen, and won't happen in 32-bit data mode).
+ */
+
+vector_addrexcptn:
+   b   vector_addrexcptn
+
+/*=
  * Undefined FIQs
  *-
  * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC
@@ -1100,35 +1119,14 @@ __stubs_start:
 vector_fiq:
subspc, lr, #4
 
-/*=
- * Address exception handler
- *-
- * These aren't too critical.
- * (they're not supposed to happen, and won't happen in 32-bit data mode).
- */
-
-vector_addrexcptn:
-   b   vector_addrexcptn
-
-/*
- * We group all the following data together to optimise
- * for CPUs with separate I & D caches.
- */
-   .align  5
-
-.LCvswi:
-   .word   vector_swi
-
.globl  __stubs_end
 __stubs_end:
 
-   .equstubs_offset, __vectors_start + 0x200 - __stubs_start
+   .equstubs_offset, __vectors_start + 0x1000 - __stubs_start
 
.globl  __vectors_start
 __vectors_start:
- ARM(  swi SYS_ERROR0  )
- THUMB(svc #0  )
- THUMB(nop )
+   W(b)vector_rst + stubs_offset
W(b)vector_und + stubs_offset
W(ldr)  pc, .LCvswi + stubs_offset
W(b)vector_pabt + stubs_offset
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -836,7 +836,7 @@ void __init early_trap_init(void *vector
 * are visible to the instruction stream.
 */
memcpy((void *)vectors, __vectors_start, __vectors_end - 
__vectors_start);
-   memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - 
__stubs_start);
+   memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - 
__stubs_start);
memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, 
kuser_sz);
 
/*
@@ -851,6 +851,6 @@ void __init early_trap_init(void *vector
memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE),
   sigreturn_codes, sizeof(sigreturn_codes));
 
-   flush_icache_range(vectors, vectors + PAGE_SIZE);
+   flush_icache_range(vectors, vectors + PAGE_SIZE * 2);
modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
 }
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1175,7 +1175,7 @@ stat

[ 002/102] ARM: poison memory between kuser helpers

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 5b43e7a383d69381ffe53423e46dd0fafae07da3 upstream.

Poison the memory between each kuser helper.  This ensures that any
branch between the kuser helpers will be appropriately trapped.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/entry-armv.S |   25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -741,6 +741,17 @@ ENDPROC(__switch_to)
 #endif
.endm
 
+   .macro  kuser_pad, sym, size
+   .if (. - \sym) & 3
+   .rept   4 - (. - \sym) & 3
+   .byte   0
+   .endr
+   .endif
+   .rept   (\size - (. - \sym)) / 4
+   .word   0xe7fddef1
+   .endr
+   .endm
+
.align  5
.globl  __kuser_helper_start
 __kuser_helper_start:
@@ -831,18 +842,13 @@ kuser_cmpxchg64_fixup:
 #error "incoherent kernel configuration"
 #endif
 
-   /* pad to next slot */
-   .rept   (16 - (. - __kuser_cmpxchg64)/4)
-   .word   0
-   .endr
-
-   .align  5
+   kuser_pad __kuser_cmpxchg64, 64
 
 __kuser_memory_barrier:@ 0x0fa0
smp_dmb arm
usr_ret lr
 
-   .align  5
+   kuser_pad __kuser_memory_barrier, 32
 
 __kuser_cmpxchg:   @ 0x0fc0
 
@@ -915,13 +921,14 @@ kuser_cmpxchg32_fixup:
 
 #endif
 
-   .align  5
+   kuser_pad __kuser_cmpxchg, 32
 
 __kuser_get_tls:   @ 0x0fe0
ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init
usr_ret lr
mrc p15, 0, r0, c13, c0, 3  @ 0x0fe8 hardware TLS code
-   .rep4
+   kuser_pad __kuser_get_tls, 16
+   .rep3
.word   0   @ 0x0ff0 software TLS value, then
.endr   @ pad up to __kuser_helper_version
 


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


[ 000/102] 3.10.6-stable review

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

Responses should be made by Sun Aug 11 01:46:31 UTC 2013.
Anything received after that time might be too late.

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

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 3.10.6-rc1

Johannes Berg 
iwlwifi: dvm: don't send BT_CONFIG on devices w/o Bluetooth

David Spinadel 
iwlwifi: mvm: set SSID bits for passive channels

Jack Morgenstein 
net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param

Or Gerlitz 
net/mlx4_core: Don't give VFs MAC addresses which are derived from the PF 
MAC

Neil Horman 
8139cp: Add dma_mapping_error checking

Joe Perches 
ndisc: Add missing inline to ndisc_addr_option_pad

Dan Carpenter 
net_sched: info leak in atm_tc_dump_class()

Eric Dumazet 
atl1c: use custom skb allocator

Dan Carpenter 
af_key: more info leaks in pfkey messages

David S. Miller 
net_sched: Fix stack info leak in cbq_dump_wrr().

Stanislaw Gruszka 
genetlink: release cb_lock before requesting additional module

Eric Dumazet 
usbnet: do not pretend to support SG/TSO

Hannes Frederic Sowa 
ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup

Ben Hutchings 
sfc: Enable RX scatter for flows steered by RFS

Michal Tesar 
sysctl net: Keep tcp_syn_retries inside the boundary

Dan Carpenter 
arcnet: cleanup sizeof parameter

Christian Eggers 
spi: spi-davinci: Fix direction in dma_map_single()

Neil Horman 
x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset

Oleg Nesterov 
userns: unshare_userns(&cred) should not populate cred on failure

Shaohua Li 
workqueue: copy workqueue_attrs with all fields

Martin Schwidefsky 
s390/bitops: fix find_next_bit_left

Heiko Carstens 
s390: add support for IBM zBC12 machine

Daniel Vetter 
drm/i915: make SDVO TV-out work for multifunction devices

Liu Bo 
Btrfs: fix crash regarding to ulist_add_merge

H.J. Lu 
x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz

Christian König 
drm/radeon: never unpin UVD bo v3

Li Zefan 
cgroup: fix umount vs cgroup_cfts_commit() race

Dan Carpenter 
fanotify: info leak in copy_event_to_user()

Stéphane Marchesin 
drm/i915: Preserve the DDI_A_4_LANES bit from the bios

Roger Pau Monne 
xen-blkfront: use a different scatterlist for each request

Alex Deucher 
drm/radeon: Disable dma rings for bo moves on r6xx

Yinghai Lu 
PCI: Retry allocation of only the resource type that failed

Yinghai Lu 
PCI: pciehp: Fix null pointer deref when hot-removing SR-IOV device

Rafael J. Wysocki 
Revert "cpuidle: Quickly notice prediction failure for repeat mode"

Rafael J. Wysocki 
cpufreq: Fix cpufreq driver module refcount balance after suspend/resume

Rafael J. Wysocki 
Revert "cpuidle: Quickly notice prediction failure in general case"

Lan Tianyu 
ACPI / battery: Fix parsing _BIX return value

Jiang Liu 
zram: protect sysfs handler from invalid memory access

Jiang Liu 
zram: avoid access beyond the zram device

Jiang Liu 
zram: avoid double free in function zram_bvec_write()

Jiang Liu 
zram: destroy all devices on error recovery path in zram_init()

Jiang Liu 
zram: use zram->lock to protect zram_free_page() in swap free notify path

Jiang Liu 
zram: avoid invalid memory access in zram_exit()

Avinash Patil 
mwifiex: fix wrong data rates in P2P client

Avinash Patil 
mwifiex: check for bss_role instead of bss_mode for STA operations

Tomasz Moń 
mwifiex: Add missing endian conversion.

Stanislaw Gruszka 
rt2x00: fix stop queue

J. Bruce Fields 
svcrpc: fix kfree oops in gss-proxy code

J. Bruce Fields 
svcrpc: fix gss_rpc_upcall create error

J. Bruce Fields 
svcrpc: fix gss-proxy xdr decoding oops

Adam Lee 
Bluetooth: fix wrong use of PTR_ERR() in btusb

Cho, Yu-Chen 
Bluetooth: Add support for Mediatek Bluetooth device [0e8d:763f]

AceLan Kao 
Bluetooth: Add support for Atheros [0cf3:e003]

AceLan Kao 
Bluetooth: Add support for Atheros [0cf3:3121]

Sujith Manoharan 
Bluetooth: ath3k: Add support for ID 0x13d3/0x3402

Stanislaw Gruszka 
Bluetooth: ath3k: don't use stack memory for DMA

Thomas Loo 
Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330]

Jaganath Kanakkassery 
Bluetooth: Fix invalid length check in l2cap_information_rsp()

Larry Finger 
ath: wil6210: Fix build error

Jacob Keller 
ixgbe: Fix Tx Hang issue with lldpad on 82598EB

Stanislaw Gruszka 
mac80211: fix monitor interface suspend crash regressi

[ 011/102] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31)

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Aaro Koskinen 

commit fe956a1d4081ce1a959f87df397a15e252201f10 upstream.

slots-fan on G5 Xserve is always running at full speed with windfarm_rm31
driver, resulting in a very high acoustic noise level. It seems the fan
parameters are incorrect, and have been copied from the Drive Bay fan
(RPM, not present on rm31) of the legacy therm_pm72 driver. This patch
changes the parameters to match the Slots fan (PWM) of therm_pm72. With
the patch, slots-fan speed drops from 99% to 19% during normal use,
and slots-temp settle to ~42'C.

Signed-off-by: Aaro Koskinen 
Signed-off-by: Benjamin Herrenschmidt 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/macintosh/windfarm_rm31.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/macintosh/windfarm_rm31.c
+++ b/drivers/macintosh/windfarm_rm31.c
@@ -439,15 +439,15 @@ static void backside_setup_pid(void)
 
 /* Slots fan */
 static const struct wf_pid_param slots_param = {
-   .interval   = 5,
-   .history_len= 2,
-   .gd = 30 << 20,
-   .gp = 5 << 20,
-   .gr = 0,
-   .itarget= 40 << 16,
-   .additive   = 1,
-   .min= 300,
-   .max= 4000,
+   .interval   = 1,
+   .history_len= 20,
+   .gd = 0,
+   .gp = 0,
+   .gr = 0x0010,
+   .itarget= 320,
+   .additive   = 0,
+   .min= 20,
+   .max= 100,
 };
 
 static void slots_fan_tick(void)


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


[ 007/102] ARM: move signal handlers into a vdso-like page

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 48be69a026b2c17350a5ef18a1959a919f60be7d upstream.

Move the signal handlers into a VDSO page rather than keeping them in
the vectors page.  This allows us to place them randomly within this
page, and also map the page at a random location within userspace
further protecting these code fragments from ROP attacks.  The new
VDSO page is also poisoned in the same way as the vector page.

Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/elf.h |4 +++
 arch/arm/include/asm/mmu.h |1 
 arch/arm/kernel/process.c  |   40 +---
 arch/arm/kernel/signal.c   |   50 +++--
 arch/arm/kernel/signal.h   |   12 --
 arch/arm/kernel/traps.c|9 
 6 files changed, 86 insertions(+), 30 deletions(-)

--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -130,4 +130,8 @@ struct mm_struct;
 extern unsigned long arch_randomize_brk(struct mm_struct *mm);
 #define arch_randomize_brk arch_randomize_brk
 
+#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
+struct linux_binprm;
+int arch_setup_additional_pages(struct linux_binprm *, int);
+
 #endif
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -8,6 +8,7 @@ typedef struct {
atomic64_t  id;
 #endif
unsigned intvmalloc_seq;
+   unsigned long   sigpage;
 } mm_context_t;
 
 #ifdef CONFIG_CPU_HAS_ASID
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -435,8 +435,8 @@ unsigned long arch_randomize_brk(struct
 #ifdef CONFIG_MMU
 /*
  * The vectors page is always readable from user space for the
- * atomic helpers and the signal restart code. Insert it into the
- * gate_vma so that it is visible through ptrace and /proc//mem.
+ * atomic helpers. Insert it into the gate_vma so that it is visible
+ * through ptrace and /proc//mem.
  */
 static struct vm_area_struct gate_vma = {
.vm_start   = 0x,
@@ -468,6 +468,40 @@ int in_gate_area_no_mm(unsigned long add
 
 const char *arch_vma_name(struct vm_area_struct *vma)
 {
-   return (vma == &gate_vma) ? "[vectors]" : NULL;
+   return (vma == &gate_vma) ? "[vectors]" :
+   (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ?
+"[sigpage]" : NULL;
+}
+
+extern struct page *get_signal_page(void);
+
+int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+{
+   struct mm_struct *mm = current->mm;
+   struct page *page;
+   unsigned long addr;
+   int ret;
+
+   page = get_signal_page();
+   if (!page)
+   return -ENOMEM;
+
+   down_write(&mm->mmap_sem);
+   addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
+   if (IS_ERR_VALUE(addr)) {
+   ret = addr;
+   goto up_fail;
+   }
+
+   ret = install_special_mapping(mm, addr, PAGE_SIZE,
+   VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
+   &page);
+
+   if (ret == 0)
+   mm->context.sigpage = addr;
+
+ up_fail:
+   up_write(&mm->mmap_sem);
+   return ret;
 }
 #endif
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -15,12 +16,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-#include "signal.h"
-
 /*
  * For ARM syscalls, we encode the syscall number into the instruction.
  */
@@ -40,11 +40,13 @@
 #define SWI_THUMB_SIGRETURN(0xdf00 << 16 | 0x2700 | (__NR_sigreturn - 
__NR_SYSCALL_BASE))
 #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - 
__NR_SYSCALL_BASE))
 
-const unsigned long sigreturn_codes[7] = {
+static const unsigned long sigreturn_codes[7] = {
MOV_R7_NR_SIGRETURN,SWI_SYS_SIGRETURN,SWI_THUMB_SIGRETURN,
MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
 };
 
+static unsigned long signal_return_offset;
+
 #ifdef CONFIG_CRUNCH
 static int preserve_crunch_context(struct crunch_sigframe __user *frame)
 {
@@ -397,11 +399,14 @@ setup_return(struct pt_regs *regs, struc
return 1;
 
if (cpsr & MODE32_BIT) {
+   struct mm_struct *mm = current->mm;
/*
-* 32-bit code can use the new high-page
-* signal return code support.
+* 32-bit code can use the signal return page
+* except when the MPU has protected the vectors
+* page from PL0
 */
-   retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb;
+   retcode = mm->context.sigpage + signal_return_offset +
+   

[ 004/102] ARM: use linker magic for vectors and vector stubs

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit b9b32bf70f2fb710b07c94e13afbc729afe221da upstream.

Use linker magic to create the vectors and vector stubs: we can tell the
linker to place them at an appropriate VMA, but keep the LMA within the
kernel.  This gets rid of some unnecessary symbol manipulation, and
have the linker calculate the relocations appropriately.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/entry-armv.S  |   28 ++--
 arch/arm/kernel/vmlinux.lds.S |   17 +
 2 files changed, 27 insertions(+), 18 deletions(-)

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -992,7 +992,7 @@ ENDPROC(vector_\name)
 1:
.endm
 
-   .globl  __stubs_start
+   .section .stubs, "ax", %progbits
 __stubs_start:
@ This must be the first word
.word   vector_swi
@@ -1119,24 +1119,16 @@ vector_addrexcptn:
 vector_fiq:
subspc, lr, #4
 
-   .globl  __stubs_end
-__stubs_end:
-
-   .equstubs_offset, __vectors_start + 0x1000 - __stubs_start
-
-   .globl  __vectors_start
+   .section .vectors, "ax", %progbits
 __vectors_start:
-   W(b)vector_rst + stubs_offset
-   W(b)vector_und + stubs_offset
-   W(ldr)  pc, .LCvswi + stubs_offset
-   W(b)vector_pabt + stubs_offset
-   W(b)vector_dabt + stubs_offset
-   W(b)vector_addrexcptn + stubs_offset
-   W(b)vector_irq + stubs_offset
-   W(b)vector_fiq + stubs_offset
-
-   .globl  __vectors_end
-__vectors_end:
+   W(b)vector_rst
+   W(b)vector_und
+   W(ldr)  pc, __vectors_start + 0x1000
+   W(b)vector_pabt
+   W(b)vector_dabt
+   W(b)vector_addrexcptn
+   W(b)vector_irq
+   W(b)vector_fiq
 
.data
 
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -152,6 +152,23 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
__init_begin = .;
 #endif
+   /*
+* The vectors and stubs are relocatable code, and the
+* only thing that matters is their relative offsets
+*/
+   __vectors_start = .;
+   .vectors 0 : AT(__vectors_start) {
+   *(.vectors)
+   }
+   . = __vectors_start + SIZEOF(.vectors);
+   __vectors_end = .;
+
+   __stubs_start = .;
+   .stubs 0x1000 : AT(__stubs_start) {
+   *(.stubs)
+   }
+   . = __stubs_start + SIZEOF(.stubs);
+   __stubs_end = .;
 
INIT_TEXT_SECTION(8)
.exit.text : {


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


[ 006/102] ARM: allow kuser helpers to be removed from the vector page

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit f6f91b0d9fd971c630cef908dde8fe8795aefbf8 upstream.

Provide a kernel configuration option to allow the kernel user helpers
to be removed from the vector page, thereby preventing their use with
ROP (return orientated programming) attacks.  This option is only
visible for CPU architectures which natively support all the operations
which kernel user helpers would normally provide, and must be enabled
with caution.

Acked-by: Nicolas Pitre 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/entry-armv.S |3 +++
 arch/arm/kernel/traps.c  |   23 ++-
 arch/arm/mm/Kconfig  |   34 ++
 3 files changed, 51 insertions(+), 9 deletions(-)

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -752,6 +752,7 @@ ENDPROC(__switch_to)
.endr
.endm
 
+#ifdef CONFIG_KUSER_HELPERS
.align  5
.globl  __kuser_helper_start
 __kuser_helper_start:
@@ -938,6 +939,8 @@ __kuser_helper_version: @ 
0x0ffc
.globl  __kuser_helper_end
 __kuser_helper_end:
 
+#endif
+
  THUMB(.thumb  )
 
 /*
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -800,23 +800,32 @@ void __init trap_init(void)
return;
 }
 
-static void __init kuser_get_tls_init(unsigned long vectors)
+#ifdef CONFIG_KUSER_HELPERS
+static void __init kuser_init(void *vectors)
 {
+   extern char __kuser_helper_start[], __kuser_helper_end[];
+   int kuser_sz = __kuser_helper_end - __kuser_helper_start;
+
+   memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
+
/*
 * vectors + 0xfe0 = __kuser_get_tls
 * vectors + 0xfe8 = hardware TLS instruction at 0x0fe8
 */
if (tls_emu || has_tls_reg)
-   memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4);
+   memcpy(vectors + 0xfe0, vectors + 0xfe8, 4);
+}
+#else
+static void __init kuser_init(void *vectors)
+{
 }
+#endif
 
 void __init early_trap_init(void *vectors_base)
 {
unsigned long vectors = (unsigned long)vectors_base;
extern char __stubs_start[], __stubs_end[];
extern char __vectors_start[], __vectors_end[];
-   extern char __kuser_helper_start[], __kuser_helper_end[];
-   int kuser_sz = __kuser_helper_end - __kuser_helper_start;
unsigned i;
 
vectors_page = vectors_base;
@@ -837,12 +846,8 @@ void __init early_trap_init(void *vector
 */
memcpy((void *)vectors, __vectors_start, __vectors_end - 
__vectors_start);
memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - 
__stubs_start);
-   memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, 
kuser_sz);
 
-   /*
-* Do processor specific fixups for the kuser helpers
-*/
-   kuser_get_tls_init(vectors);
+   kuser_init(vectors_base);
 
/*
 * Copy signal return handlers into the vector page, and
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -411,24 +411,28 @@ config CPU_32v3
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v4
bool
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v4T
bool
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v5
bool
select CPU_USE_DOMAINS if MMU
select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
select TLS_REG_EMUL if SMP || !MMU
+   select NEED_KUSER_HELPERS
 
 config CPU_32v6
bool
@@ -756,6 +760,7 @@ config CPU_BPREDICT_DISABLE
 
 config TLS_REG_EMUL
bool
+   select NEED_KUSER_HELPERS
help
  An SMP system using a pre-ARMv6 processor (there are apparently
  a few prototypes like that in existence) and therefore access to
@@ -763,11 +768,40 @@ config TLS_REG_EMUL
 
 config NEEDS_SYSCALL_FOR_CMPXCHG
bool
+   select NEED_KUSER_HELPERS
help
  SMP on a pre-ARMv6 processor?  Well OK then.
  Forget about fast user space cmpxchg support.
  It is just not possible.
 
+config NEED_KUSER_HELPERS
+   bool
+
+config KUSER_HELPERS
+   bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS
+   default y
+   help
+ Warning: disabling this option may break user programs.
+
+ Provide kuser helpers in the vector page.  The kernel provides
+ helper code to userspace in read only form at a fixed location
+ in the high vector page to a

[ 013/102] ARM: 7790/1: Fix deferred mm switch on VIVT processors

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Catalin Marinas 

commit bdae73cd374e28db544fdd9b77de689a36e3c129 upstream.

As of commit b9d4d42ad9 (ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on
pre-ARMv6 CPUs), the mm switching on VIVT processors is done in the
finish_arch_post_lock_switch() function to avoid whole cache flushing
with interrupts disabled. The need for deferred mm switch is stored as a
thread flag (TIF_SWITCH_MM). However, with preemption enabled, we can
have another thread switch before finish_arch_post_lock_switch(). If the
new thread has the same mm as the previous 'next' thread, the scheduler
will not call switch_mm() and the TIF_SWITCH_MM flag won't be set for
the new thread.

This patch moves the switch pending flag to the mm_context_t structure
since this is specific to the mm rather than thread.

Signed-off-by: Catalin Marinas 
Reported-by: Marc Kleine-Budde 
Tested-by: Marc Kleine-Budde 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/mmu.h |2 ++
 arch/arm/include/asm/mmu_context.h |   20 
 arch/arm/include/asm/thread_info.h |1 -
 3 files changed, 18 insertions(+), 5 deletions(-)

--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -6,6 +6,8 @@
 typedef struct {
 #ifdef CONFIG_CPU_HAS_ASID
atomic64_t  id;
+#else
+   int switch_pending;
 #endif
unsigned intvmalloc_seq;
unsigned long   sigpage;
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -55,7 +55,7 @@ static inline void check_and_switch_cont
 * on non-ASID CPUs, the old mm will remain valid until the
 * finish_arch_post_lock_switch() call.
 */
-   set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
+   mm->context.switch_pending = 1;
else
cpu_switch_mm(mm->pgd, mm);
 }
@@ -64,9 +64,21 @@ static inline void check_and_switch_cont
finish_arch_post_lock_switch
 static inline void finish_arch_post_lock_switch(void)
 {
-   if (test_and_clear_thread_flag(TIF_SWITCH_MM)) {
-   struct mm_struct *mm = current->mm;
-   cpu_switch_mm(mm->pgd, mm);
+   struct mm_struct *mm = current->mm;
+
+   if (mm && mm->context.switch_pending) {
+   /*
+* Preemption must be disabled during cpu_switch_mm() as we
+* have some stateful cache flush implementations. Check
+* switch_pending again in case we were preempted and the
+* switch to this mm was already done.
+*/
+   preempt_disable();
+   if (mm->context.switch_pending) {
+   mm->context.switch_pending = 0;
+   cpu_switch_mm(mm->pgd, mm);
+   }
+   preempt_enable_no_resched();
}
 }
 
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -156,7 +156,6 @@ extern int vfp_restore_user_hwstate(stru
 #define TIF_USING_IWMMXT   17
 #define TIF_MEMDIE 18  /* is terminating due to OOM killer */
 #define TIF_RESTORE_SIGMASK20
-#define TIF_SWITCH_MM  22  /* deferred switch_mm */
 
 #define _TIF_SIGPENDING(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED  (1 << TIF_NEED_RESCHED)


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


[ 014/102] ARM: 7791/1: a.out: remove partial a.out support

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Will Deacon 

commit acfdd4b1f7590d02e9bae3b73bdbbc4a31b05d38 upstream.

a.out support on ARM requires that argc, argv and envp are passed in
r0-r2 respectively, which requires hacking load_aout_binary to
prevent argc being clobbered by the return code. Whilst mainline kernels
do set the registers up in start_thread, the aout loader has never
carried the hack in mainline.

Initialising the registers in this way actually goes against the libc
expectations for ELF binaries, where argc, argv and envp are passed on
the stack, with r0 being used to hold a pointer to an exit function for
cleaning up after the dynamic linker if required. If the pointer is
NULL, then it is ignored. When execing an ELF binary, Linux currently
zeroes r0, then sets it to argc and then finally clobbers it with the
return value of the execve syscall, so we actually end up with:

r0 = 0
stack[0] = argc
r1 = stack[1] = argv
r2 = stack[2] = envp

libc treats r1 and r2 as undefined. The clobbering of r0 by sys_execve
works for user-spawned threads, but when executing an ELF binary from a
kernel thread (via call_usermodehelper), the execve is performed on the
ret_from_fork path, which restores r0 from the saved pt_regs, resulting
in argc being presented to the C library. This has horrible consequences
when the application exits, since we have an exit function registered
using argc, resulting in a jump to hyperspace.

This patch solves the problem by removing the partial a.out support from
arch/arm/ altogether.

Signed-off-by: Will Deacon 
Cc: Ashish Sangwan 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/Kconfig  |1 
 arch/arm/include/asm/a.out-core.h |   45 --
 arch/arm/include/asm/processor.h  |4 ---
 arch/arm/include/uapi/asm/Kbuild  |1 
 arch/arm/include/uapi/asm/a.out.h |   34 
 5 files changed, 85 deletions(-)

--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -19,7 +19,6 @@ config ARM
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
select HARDIRQS_SW_RESEND
-   select HAVE_AOUT
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_KGDB
select HAVE_ARCH_SECCOMP_FILTER
--- a/arch/arm/include/asm/a.out-core.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* a.out coredump register dumper
- *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowe...@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licence
- * as published by the Free Software Foundation; either version
- * 2 of the Licence, or (at your option) any later version.
- */
-
-#ifndef _ASM_A_OUT_CORE_H
-#define _ASM_A_OUT_CORE_H
-
-#ifdef __KERNEL__
-
-#include 
-#include 
-
-/*
- * fill in the user structure for an a.out core dump
- */
-static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
-{
-   struct task_struct *tsk = current;
-
-   dump->magic = CMAGIC;
-   dump->start_code = tsk->mm->start_code;
-   dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
-
-   dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
-   dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> 
PAGE_SHIFT;
-   dump->u_ssize = 0;
-
-   memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg));
-
-   if (dump->start_stack < 0x0400)
-   dump->u_ssize = (0x0400 - dump->start_stack) >> PAGE_SHIFT;
-
-   dump->regs = *regs;
-   dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
-}
-
-#endif /* __KERNEL__ */
-#endif /* _ASM_A_OUT_CORE_H */
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -54,7 +54,6 @@ struct thread_struct {
 
 #define start_thread(regs,pc,sp)   \
 ({ \
-   unsigned long *stack = (unsigned long *)sp; \
memset(regs->uregs, 0, sizeof(regs->uregs));\
if (current->personality & ADDR_LIMIT_32BIT)\
regs->ARM_cpsr = USR_MODE;  \
@@ -65,9 +64,6 @@ struct thread_struct {
regs->ARM_cpsr |= PSR_ENDSTATE; \
regs->ARM_pc = pc & ~1; /* pc */\
regs->ARM_sp = sp;  /* sp */\
-   regs->ARM_r2 = stack[2];/* r2 (envp) */ \
-   regs->ARM_r1 = stack[1];/* r1 (argv) */ \
-   regs->ARM_r0 = stack[0];/* r0 (argc) */ \
nommu_start_thread(regs);   \
 })
 
--- a/

[ 015/102] powerpc: VPHN topology change updates all siblings

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Robert Jennings 

commit 3be7db6ab45b21345386d1a466da133b19cde5e4 upstream.

When an associativity level change is found for one thread, the
siblings threads need to be updated as well.  This is done today
for PRRN in stage_topology_update() but is missing for VPHN in
update_cpu_associativity_changes_mask().  This patch will correctly
update all thread siblings during a topology change.

Without this patch a topology update can result in a CPU in
init_sched_groups_power() getting stuck indefinitely in a loop.

This loop is built in build_sched_groups(). As a result of the thread
moving to a node separate from its siblings the struct sched_group will
have its next pointer set to point to itself rather than the sched_group
struct of the next thread.  This happens because we have a domain without
the SD_OVERLAP flag, which is correct, and a topology that doesn't conform
with reality (threads on the same core assigned to different numa nodes).
When this list is traversed by init_sched_groups_power() it will reach
the thread's sched_group structure and loop indefinitely; the cpu will
be stuck at this point.

The bug was exposed when VPHN was enabled in commit b7abef0 (v3.9).

Reported-by: Jan Stancek 
Signed-off-by: Robert Jennings 
Signed-off-by: Benjamin Herrenschmidt 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/powerpc/include/asm/smp.h |4 ++
 arch/powerpc/mm/numa.c |   59 ++---
 2 files changed, 48 insertions(+), 15 deletions(-)

--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -145,6 +145,10 @@ extern void __cpu_die(unsigned int cpu);
 #define smp_setup_cpu_maps()
 static inline void inhibit_secondary_onlining(void) {}
 static inline void uninhibit_secondary_onlining(void) {}
+static inline const struct cpumask *cpu_sibling_mask(int cpu)
+{
+   return cpumask_of(cpu);
+}
 
 #endif /* CONFIG_SMP */
 
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1319,7 +1320,8 @@ static int update_cpu_associativity_chan
}
}
if (changed) {
-   cpumask_set_cpu(cpu, changes);
+   cpumask_or(changes, changes, cpu_sibling_mask(cpu));
+   cpu = cpu_last_thread_sibling(cpu);
}
}
 
@@ -1427,7 +1429,7 @@ static int update_cpu_topology(void *dat
if (!data)
return -EINVAL;
 
-   cpu = get_cpu();
+   cpu = smp_processor_id();
 
for (update = data; update; update = update->next) {
if (cpu != update->cpu)
@@ -1447,12 +1449,12 @@ static int update_cpu_topology(void *dat
  */
 int arch_update_cpu_topology(void)
 {
-   unsigned int cpu, changed = 0;
+   unsigned int cpu, sibling, changed = 0;
struct topology_update_data *updates, *ud;
unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
cpumask_t updated_cpus;
struct device *dev;
-   int weight, i = 0;
+   int weight, new_nid, i = 0;
 
weight = cpumask_weight(&cpu_associativity_changes_mask);
if (!weight)
@@ -1465,19 +1467,46 @@ int arch_update_cpu_topology(void)
cpumask_clear(&updated_cpus);
 
for_each_cpu(cpu, &cpu_associativity_changes_mask) {
-   ud = &updates[i++];
-   ud->cpu = cpu;
-   vphn_get_associativity(cpu, associativity);
-   ud->new_nid = associativity_to_nid(associativity);
-
-   if (ud->new_nid < 0 || !node_online(ud->new_nid))
-   ud->new_nid = first_online_node;
+   /*
+* If siblings aren't flagged for changes, updates list
+* will be too short. Skip on this update and set for next
+* update.
+*/
+   if (!cpumask_subset(cpu_sibling_mask(cpu),
+   &cpu_associativity_changes_mask)) {
+   pr_info("Sibling bits not set for associativity "
+   "change, cpu%d\n", cpu);
+   cpumask_or(&cpu_associativity_changes_mask,
+   &cpu_associativity_changes_mask,
+   cpu_sibling_mask(cpu));
+   cpu = cpu_last_thread_sibling(cpu);
+   continue;
+   }
 
-   ud->old_nid = numa_cpu_lookup_table[cpu];
-   cpumask_set_cpu(cpu, &updated_cpus);
+   /* Use associativity from first thread for all siblings */
+   vphn_get_associativity(cpu, associativity);
+   new_nid = associativity_to_nid(associativity);
+   if (new_nid < 0 || !node_online(new_nid))
+ 

[ 016/102] parisc: agp/parisc-agp: allow binding of user memory to the AGP GART

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Ivanov 

commit 06f0cce43a32bd2357cea1d8733bba48693d556b upstream.

Allow binding of user memory to the AGP GART on systems with HP
Quicksilver AGP bus. This resolves 'bind memory failed' error seen in
dmesg:

 [29.365973] [TTM] AGP Bind memory failed.
 …
 [29.367030] [drm] Forcing AGP to PCI mode

The system doesn't more fail to bind the memory, and hence not falling
back to the PCI mode (if other failures aren't detected).

This is just a simple write down from the following patches:
agp/amd-k7: Allow binding user memory to the AGP GART
agp/hp-agp: Allow binding user memory to the AGP GART

Signed-off-by: Alex Ivanov 
Signed-off-by: Helge Deller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/char/agp/parisc-agp.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -129,7 +129,8 @@ parisc_agp_insert_memory(struct agp_memo
off_t j, io_pg_start;
int io_pg_count;
 
-   if (type != 0 || mem->type != 0) {
+   if (type != mem->type ||
+   agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) {
return -EINVAL;
}
 
@@ -175,7 +176,8 @@ parisc_agp_remove_memory(struct agp_memo
struct _parisc_agp_info *info = &parisc_agp_info;
int i, io_pg_start, io_pg_count;
 
-   if (type != 0 || mem->type != 0) {
+   if (type != mem->type ||
+   agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) {
return -EINVAL;
}
 


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


[ 010/102] ARM: fix nommu builds with 48be69a02 (ARM: move signal handlers into a vdso-like page)

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit 8c0cc8a5d90bc7373a7a9e7f7a40eb41f51e03fc upstream.

Olof reports that noMMU builds error out with:

arch/arm/kernel/signal.c: In function 'setup_return':
arch/arm/kernel/signal.c:413:25: error: 'mm_context_t' has no member named 
'sigpage'

This shows one of the evilnesses of IS_ENABLED().  Get rid of it here
and replace it with #ifdef's - and as no noMMU platform can make use
of sigpage, depend on CONIFG_MMU not CONFIG_ARM_MPU.

Reported-by: Olof Johansson 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/include/asm/elf.h |2 ++
 arch/arm/kernel/signal.c   |5 -
 2 files changed, 6 insertions(+), 1 deletion(-)

--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -130,8 +130,10 @@ struct mm_struct;
 extern unsigned long arch_randomize_brk(struct mm_struct *mm);
 #define arch_randomize_brk arch_randomize_brk
 
+#ifdef CONFIG_MMU
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
 struct linux_binprm;
 int arch_setup_additional_pages(struct linux_binprm *, int);
+#endif
 
 #endif
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -398,6 +398,7 @@ setup_return(struct pt_regs *regs, struc
__put_user(sigreturn_codes[idx+1], rc+1))
return 1;
 
+#ifdef CONFIG_MMU
if (cpsr & MODE32_BIT) {
struct mm_struct *mm = current->mm;
/*
@@ -407,7 +408,9 @@ setup_return(struct pt_regs *regs, struc
 */
retcode = mm->context.sigpage + signal_return_offset +
  (idx << 2) + thumb;
-   } else {
+   } else
+#endif
+   {
/*
 * Ensure that the instruction cache sees
 * the return code written onto the stack.


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


[ 018/102] parisc: Fix interrupt routing for C8000 serial ports

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Thomas Bogendoerfer 

commit dd5e6d6a3db09b16b7c222943977865eead88cc3 upstream.

We can't use dev->mod_index for selecting the interrupt routing entry,
because it's not an index into interrupt routing table. It will be even
wrong on a machine with 2 CPUs (4 cores). But all needed information is
contained in the PAT entries for the serial ports. mod[0] contains the
iosapic address and mod_info has some indications for the interrupt
input (at least it looks like it). This patch implements the searching
for the right iosapic and uses this interrupt input information.

Signed-off-by: Thomas Bogendoerfer 
Signed-off-by: Helge Deller 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/parisc/include/asm/parisc-device.h |3 ++
 arch/parisc/kernel/inventory.c  |1 
 drivers/parisc/iosapic.c|   38 ++--
 drivers/tty/serial/8250/8250_gsc.c  |3 --
 4 files changed, 32 insertions(+), 13 deletions(-)

--- a/arch/parisc/include/asm/parisc-device.h
+++ b/arch/parisc/include/asm/parisc-device.h
@@ -23,6 +23,7 @@ struct parisc_device {
/* generic info returned from pdc_pat_cell_module() */
unsigned long   mod_info;   /* PAT specific - Misc Module info */
unsigned long   pmod_loc;   /* physical Module location */
+   unsigned long   mod0;
 #endif
u64 dma_mask;   /* DMA mask for I/O */
struct device   dev;
@@ -61,4 +62,6 @@ parisc_get_drvdata(struct parisc_device
 
 extern struct bus_type parisc_bus_type;
 
+int iosapic_serial_irq(struct parisc_device *dev);
+
 #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -211,6 +211,7 @@ pat_query_module(ulong pcell_loc, ulong
/* REVISIT: who is the consumer of this? not sure yet... */
dev->mod_info = pa_pdc_cell->mod_info;  /* pass to PAT_GET_ENTITY() */
dev->pmod_loc = pa_pdc_cell->mod_location;
+   dev->mod0 = pa_pdc_cell->mod[0];
 
register_parisc_device(dev);/* advertise device */
 
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -811,18 +811,28 @@ int iosapic_fixup_irq(void *isi_obj, str
return pcidev->irq;
 }
 
-static struct iosapic_info *first_isi = NULL;
+static struct iosapic_info *iosapic_list;
 
 #ifdef CONFIG_64BIT
-int iosapic_serial_irq(int num)
+int iosapic_serial_irq(struct parisc_device *dev)
 {
-   struct iosapic_info *isi = first_isi;
-   struct irt_entry *irte = NULL;  /* only used if PAT PDC */
+   struct iosapic_info *isi;
+   struct irt_entry *irte;
struct vector_info *vi;
-   int isi_line;   /* line used by device */
+   int cnt;
+   int intin;
+
+   intin = (dev->mod_info >> 24) & 15;
 
/* lookup IRT entry for isi/slot/pin set */
-   irte = &irt_cell[num];
+   for (cnt = 0; cnt < irt_num_entry; cnt++) {
+   irte = &irt_cell[cnt];
+   if (COMPARE_IRTE_ADDR(irte, dev->mod0) &&
+   irte->dest_iosapic_intin == intin)
+   break;
+   }
+   if (cnt >= irt_num_entry)
+   return 0; /* no irq found, force polling */
 
DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n",
irte,
@@ -834,11 +844,17 @@ int iosapic_serial_irq(int num)
irte->src_seg_id,
irte->dest_iosapic_intin,
(u32) irte->dest_iosapic_addr);
-   isi_line = irte->dest_iosapic_intin;
+
+   /* search for iosapic */
+   for (isi = iosapic_list; isi; isi = isi->isi_next)
+   if (isi->isi_hpa == dev->mod0)
+   break;
+   if (!isi)
+   return 0; /* no iosapic found, force polling */
 
/* get vector info for this input line */
-   vi = isi->isi_vector + isi_line;
-   DBG_IRT("iosapic_serial_irq:  line %d vi 0x%p\n", isi_line, vi);
+   vi = isi->isi_vector + intin;
+   DBG_IRT("iosapic_serial_irq:  line %d vi 0x%p\n", iosapic_intin, vi);
 
/* If this IRQ line has already been setup, skip it */
if (vi->irte)
@@ -941,8 +957,8 @@ void *iosapic_register(unsigned long hpa
vip->irqline = (unsigned char) cnt;
vip->iosapic = isi;
}
-   if (!first_isi)
-   first_isi = isi;
+   isi->isi_next = iosapic_list;
+   iosapic_list = isi;
return isi;
 }
 
--- a/drivers/tty/serial/8250/8250_gsc.c
+++ b/drivers/tty/serial/8250/8250_gsc.c
@@ -31,9 +31,8 @@ static int __init serial_init_chip(struc
int err;
 
 #ifdef CONFIG_64BIT
-   extern int iosapic_serial_irq(int cellnum);
if (!dev->irq && (dev->id.sversion == 0xad))
-   dev->irq = iosapic_serial_irq(dev->mod_index-1);
+   dev->irq = iosapic_serial_irq(dev);
 #endif
 
if (!dev->irq) {


--

[ 019/102] hwmon: (max6697) fix MAX6581 ideality

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Vivien Didelot 

commit 5c52add19733eb36d8619713312f5604efef3502 upstream.

Without this patch, the values for ideality (register 0x4b) and ideality
selection mask (register 0x4c) are inverted.

Signed-off-by: Vivien Didelot 
Signed-off-by: Guenter Roeck 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/hwmon/max6697.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/hwmon/max6697.c
+++ b/drivers/hwmon/max6697.c
@@ -605,12 +605,12 @@ static int max6697_init_chip(struct i2c_
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY,
-   pdata->ideality_mask >> 1);
+   pdata->ideality_value);
if (ret < 0)
return ret;
ret = i2c_smbus_write_byte_data(client,
MAX6581_REG_IDEALITY_SELECT,
-   pdata->ideality_value);
+   pdata->ideality_mask >> 1);
if (ret < 0)
return ret;
}


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


[ 009/102] ARM: fix a cockup in 48be69a02 (ARM: move signal handlers into a vdso-like page)

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Russell King 

commit e0d407564b532d978b03ceccebd224a05d02f111 upstream.

Unfortunately, I never committed the fix to a nasty oops which can
occur as a result of that commit:

[ cut here ]
kernel BUG at /home/olof/work/batch/include/linux/mm.h:414!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 490 Comm: killall5 Not tainted 3.11.0-rc3-00288-gabe0308 #53
task: e90acac0 ti: e9be8000 task.ti: e9be8000
PC is at special_mapping_fault+0xa4/0xc4
LR is at __do_fault+0x68/0x48c

This doesn't show up unless you do quite a bit of testing; a simple
boot test does not do this, so all my nightly tests were passing fine.

The reason for this is that install_special_mapping() expects the
page array to stick around, and as this was only inserting one page
which was stored on the kernel stack, that's why this was blowing up.

Reported-by: Olof Johansson 
Tested-by: Olof Johansson 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/kernel/process.c |9 +
 arch/arm/kernel/signal.c  |   41 +++--
 2 files changed, 24 insertions(+), 26 deletions(-)

--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -478,17 +478,18 @@ const char *arch_vma_name(struct vm_area
 "[sigpage]" : NULL;
 }
 
+static struct page *signal_page;
 extern struct page *get_signal_page(void);
 
 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 {
struct mm_struct *mm = current->mm;
-   struct page *page;
unsigned long addr;
int ret;
 
-   page = get_signal_page();
-   if (!page)
+   if (!signal_page)
+   signal_page = get_signal_page();
+   if (!signal_page)
return -ENOMEM;
 
down_write(&mm->mmap_sem);
@@ -500,7 +501,7 @@ int arch_setup_additional_pages(struct l
 
ret = install_special_mapping(mm, addr, PAGE_SIZE,
VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
-   &page);
+   &signal_page);
 
if (ret == 0)
mm->context.sigpage = addr;
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -609,35 +609,32 @@ do_work_pending(struct pt_regs *regs, un
return 0;
 }
 
-static struct page *signal_page;
-
 struct page *get_signal_page(void)
 {
-   if (!signal_page) {
-   unsigned long ptr;
-   unsigned offset;
-   void *addr;
+   unsigned long ptr;
+   unsigned offset;
+   struct page *page;
+   void *addr;
 
-   signal_page = alloc_pages(GFP_KERNEL, 0);
+   page = alloc_pages(GFP_KERNEL, 0);
 
-   if (!signal_page)
-   return NULL;
+   if (!page)
+   return NULL;
 
-   addr = page_address(signal_page);
+   addr = page_address(page);
 
-   /* Give the signal return code some randomness */
-   offset = 0x200 + (get_random_int() & 0x7fc);
-   signal_return_offset = offset;
+   /* Give the signal return code some randomness */
+   offset = 0x200 + (get_random_int() & 0x7fc);
+   signal_return_offset = offset;
 
-   /*
-* Copy signal return handlers into the vector page, and
-* set sigreturn to be a pointer to these.
-*/
-   memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
+   /*
+* Copy signal return handlers into the vector page, and
+* set sigreturn to be a pointer to these.
+*/
+   memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
 
-   ptr = (unsigned long)addr + offset;
-   flush_icache_range(ptr, ptr + sizeof(sigreturn_codes));
-   }
+   ptr = (unsigned long)addr + offset;
+   flush_icache_range(ptr, ptr + sizeof(sigreturn_codes));
 
-   return signal_page;
+   return page;
 }


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


[ 023/102] serial: arc_uart: Fix module alias

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Axel Lin 

commit d5a12ea7a9e58d9e5c19d25cb668aadb396423ec upstream.

Platform drivers use "platform:" prefix in module alias.
Also use DRIVER_NAME in MODULE_ALIAS to make module autoloading work.

Signed-off-by: Axel Lin 
Acked-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/tty/serial/arc_uart.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -773,6 +773,6 @@ module_init(arc_serial_init);
 module_exit(arc_serial_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("plat-arcfpga/uart");
+MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_AUTHOR("Vineet Gupta");
 MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver");


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


[ 012/102] ARM: 7784/1: mm: ensure SMP alternates assemble to exactly 4 bytes with Thumb-2

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Will Deacon 

commit bf3f0f332f76a85ff3a0b393aaded5a8533769c0 upstream.

Commit ae8a8b9553bd ("ARM: 7691/1: mm: kill unused TLB_CAN_READ_FROM_L1_CACHE
and use ALT_SMP instead") added early function returns for page table
cache flushing operations on ARMv7 SMP CPUs.

Unfortunately, when targetting Thumb-2, these `mov pc, lr' sequences
assemble to 2 bytes which can lead to corruption of the instruction
stream after code patching.

This patch fixes the alternates to use wide (32-bit) instructions for
Thumb-2, therefore ensuring that the patching code works correctly.

Signed-off-by: Will Deacon 
Signed-off-by: Russell King 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mm/proc-v7-2level.S |2 +-
 arch/arm/mm/proc-v7-3level.S |2 +-
 arch/arm/mm/proc-v7.S|   11 ++-
 3 files changed, 8 insertions(+), 7 deletions(-)

--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -110,7 +110,7 @@ ENTRY(cpu_v7_set_pte_ext)
  ARM(  str r3, [r0, #2048]! )
  THUMB(add r0, r0, #2048 )
  THUMB(str r3, [r0] )
-   ALT_SMP(mov pc,lr)
+   ALT_SMP(W(nop))
ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
 #endif
mov pc, lr
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -73,7 +73,7 @@ ENTRY(cpu_v7_set_pte_ext)
tst r3, #1 << (55 - 32) @ L_PTE_DIRTY
orreq   r2, #L_PTE_RDONLY
 1: strdr2, r3, [r0]
-   ALT_SMP(mov pc, lr)
+   ALT_SMP(W(nop))
ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
 #endif
mov pc, lr
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -75,13 +75,14 @@ ENTRY(cpu_v7_do_idle)
 ENDPROC(cpu_v7_do_idle)
 
 ENTRY(cpu_v7_dcache_clean_area)
-   ALT_SMP(mov pc, lr) @ MP extensions imply L1 PTW
-   ALT_UP(W(nop))
-   dcache_line_size r2, r3
-1: mcr p15, 0, r0, c7, c10, 1  @ clean D entry
+   ALT_SMP(W(nop)) @ MP extensions imply L1 PTW
+   ALT_UP_B(1f)
+   mov pc, lr
+1: dcache_line_size r2, r3
+2: mcr p15, 0, r0, c7, c10, 1  @ clean D entry
add r0, r0, r2
subsr1, r1, r2
-   bhi 1b
+   bhi 2b
dsb
mov pc, lr
 ENDPROC(cpu_v7_dcache_clean_area)


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


[ 021/102] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION

2013-08-08 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Vinod Koul 

commit a8d30608eaed6cc759b8e2e8a842591f797f upstream.

the return value of SNDRV_COMPRESS_VERSION always return default -ENOTTY as the
return value was never updated for this call
assign return value from put_user()

Reported-by: Haynes 
Signed-off-by: Vinod Koul 
Signed-off-by: Takashi Iwai 
Signed-off-by: Greg Kroah-Hartman 

---
 sound/core/compress_offload.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -743,7 +743,7 @@ static long snd_compr_ioctl(struct file
mutex_lock(&stream->device->lock);
switch (_IOC_NR(cmd)) {
case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION):
-   put_user(SNDRV_COMPRESS_VERSION,
+   retval = put_user(SNDRV_COMPRESS_VERSION,
(int __user *)arg) ? -EFAULT : 0;
break;
case _IOC_NR(SNDRV_COMPRESS_GET_CAPS):


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


  1   2   3   4   5   6   7   8   9   >