[patch]smp: make smp_call_function_many use the similar logic like smp_call_function_single

2012-12-23 Thread Shaohua Li

I'm testing swapout workload in a two-socket Xeon machine. The workload has 10
threads, each thread sequentially accesses separate memory region. TLB flush
overhead is very big in the workload. For each page, page reclaim need move it
from active lru list and then unmap it. Both need a TLB flush. And this is a
multthread workload, TLB flush happens in 10 CPUs. In X86, TLB flush uses
generic smp_call)function. So this workload stress smp_call_function_many
heavily.

Without patch, perf shows:
+  24.49%  [k] generic_smp_call_function_interrupt
-  21.72%  [k] _raw_spin_lock 
   - _raw_spin_lock 
  + 79.80% __page_check_address 
  + 6.42% generic_smp_call_function_interrupt
  + 3.31% get_swap_page   
  + 2.37% free_pcppages_bulk  
  + 1.75% handle_pte_fault
  + 1.54% put_super   
  + 1.41% grab_super_passive  
  + 1.36% __swap_duplicate
  + 0.68% blk_flush_plug_list 
  + 0.62% swap_info_get   
+   6.55%  [k] flush_tlb_func 
+   6.46%  [k] smp_call_function_many 
+   5.09%  [k] call_function_interrupt
+   4.75%  [k] default_send_IPI_mask_sequence_phys
+   2.18%  [k] find_next_bit

swapout throughput is around 1300M/s.

With the patch, perf shows:
-  27.23%  [k] _raw_spin_lock   
   - _raw_spin_lock 
  + 80.53% __page_check_address 
  + 8.39% generic_smp_call_function_single_interrupt
  + 2.44% get_swap_page 
  + 1.76% free_pcppages_bulk
  + 1.40% handle_pte_fault  
  + 1.15% __swap_duplicate  
  + 1.05% put_super 
  + 0.98% grab_super_passive
  + 0.86% blk_flush_plug_list   
  + 0.57% swap_info_get 
+   8.25%  [k] default_send_IPI_mask_sequence_phys  
+   7.55%  [k] call_function_interrupt  
+   7.47%  [k] smp_call_function_many   
+   7.25%  [k] flush_tlb_func   
+   3.81%  [k] _raw_spin_lock_irqsave   
+   3.78%  [k] generic_smp_call_function_single_interrupt

swapout throughput is around 1400M/s. So there is around a 7% improvement, and
total cpu utilization doesn't change.

Without the patch, cfd_data is shared by all CPUs.
generic_smp_call_function_interrupt does read/write cfd_data several times
which will create a lot of cache ping-pong. With the patch, the data becomes
per-cpu. The ping-pong is avoided. And from the perf data, this doesn't make
call_single_queue lock contend.

Next step is to remove generic_smp_call_function_interrupt from arch code.

Signed-off-by: Shaohua Li 
---
 include/linux/smp.h |3 
 kernel/smp.c|  184 
 2 files changed, 32 insertions(+), 155 deletions(-)

Index: linux/kernel/smp.c
===
--- linux.orig/kernel/smp.c 2012-12-24 11:37:28.150604463 +0800
+++ linux/kernel/smp.c  2012-12-24 14:57:11.807949527 +0800
@@ -16,22 +16,12 @@
 #include "smpboot.h"
 
 #ifdef CONFIG_USE_GENERIC_SMP_HELPERS
-static struct {
-   struct list_headqueue;
-   raw_spinlock_t  lock;
-} call_function __cacheline_aligned_in_smp =
-   {
-   .queue  = LIST_HEAD_INIT(call_function.queue),
-   .lock   = __RAW_SPIN_LOCK_UNLOCKED(call_function.lock),
-   };
-
 enum {
CSD_FLAG_LOCK   = 0x01,
 };
 
 struct call_function_data {
-   struct call_single_data csd;
-   atomic_trefs;
+   struct call_single_data __percpu *csd;
cpumask_var_t   cpumask;
 };
 
@@ -56,6 +46,11 @@ hotplug_cfd(struct notifier_block *nfb,
if (!zalloc_cpumask_var_node(>cpumask, GFP_KERNEL,
cpu_to_node(cpu)))
return notifier_from_errno(-ENOMEM);
+   cfd->csd = alloc_percpu(struct call_single_data);
+   if (!cfd->csd) {
+   free_cpumask_var(cfd->cpumask);
+   return notifier_from_errno(-ENOMEM);
+   }
break;
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -65,6 +60,7 @@ hotplug_cfd(struct notifier_block *nfb,
case CPU_DEAD:
case CPU_DEAD_FROZEN:
free_cpumask_var(cfd->cpumask);
+   free_percpu(cfd->csd);
break;
 #endif
};
@@ -166,85 +162,6 @@ void generic_exec_single(int cpu, struct
 }
 
 /*
- * Invoked by arch to handle an IPI for call function. Must be called with
- * interrupts disabled.
- */
-void generic_smp_call_function_interrupt(void)
-{
-   

Re: [PATCH v2 0/5] Multiqueue virtio-scsi, and API for piecewise buffer submission

2012-12-23 Thread Wanlong Gao
On 12/18/2012 09:42 PM, Michael S. Tsirkin wrote:
> On Tue, Dec 18, 2012 at 01:32:47PM +0100, Paolo Bonzini wrote:
>> Hi all,
>>
>> this series adds multiqueue support to the virtio-scsi driver, based
>> on Jason Wang's work on virtio-net.  It uses a simple queue steering
>> algorithm that expects one queue per CPU.  LUNs in the same target always
>> use the same queue (so that commands are not reordered); queue switching
>> occurs when the request being queued is the only one for the target.
>> Also based on Jason's patches, the virtqueue affinity is set so that
>> each CPU is associated to one virtqueue.
>>
>> I tested the patches with fio, using up to 32 virtio-scsi disks backed
>> by tmpfs on the host.  These numbers are with 1 LUN per target.
>>
>> FIO configuration
>> -
>> [global]
>> rw=read
>> bsrange=4k-64k
>> ioengine=libaio
>> direct=1
>> iodepth=4
>> loops=20
>>
>> overall bandwidth (MB/s)
>> 
>>
>> # of targetssingle-queuemulti-queue, 4 VCPUsmulti-queue, 8 VCPUs
>> 1  540   626 599
>> 2  795   965 925
>> 4  997  13761500
>> 8 1136  21302060
>> 161440  22692474
>> 241408  21792436
>> 321515  19782319
>>
>> (These numbers for single-queue are with 4 VCPUs, but the impact of adding
>> more VCPUs is very limited).
>>
>> avg bandwidth per LUN (MB/s)
>> 
>>
>> # of targetssingle-queuemulti-queue, 4 VCPUsmulti-queue, 8 VCPUs
>> 1  540   626 599
>> 2  397   482 462
>> 4  249   344 375
>> 8  142   266 257
>> 16  90   141 154
>> 24  5890 101
>> 32  4761  72
> 
> 
> Could you please try and measure host CPU utilization?

I measured and didn't see any CPU utilization regression here.

> Without this data it is possible that your host
> is undersubscribed and you are drinking up more host CPU.
> 
> Another thing to note is that ATM you might need to
> test with idle=poll on host otherwise we have strange interaction
> with power management where reducing the overhead
> switches to lower power so gives you a worse IOPS.

Yeah, I measured with host cpu idle=poll and saw that the performance
improved about 68%.

Thanks,
Wanlong Gao

> 
> 
>> Patch 1 adds a new API to add functions for piecewise addition for buffers,
>> which enables various simplifications in virtio-scsi (patches 2-3) and a
>> small performance improvement of 2-6%.  Patches 4 and 5 add multiqueuing.
>>
>> I'm mostly looking for comments on the new API of patch 1 for inclusion
>> into the 3.9 kernel.
>>
>> Thanks to Wao Ganlong for help rebasing and benchmarking these patches.
>>
>> Paolo Bonzini (5):
>>   virtio: add functions for piecewise addition of buffers
>>   virtio-scsi: use functions for piecewise composition of buffers
>>   virtio-scsi: redo allocation of target data
>>   virtio-scsi: pass struct virtio_scsi to virtqueue completion function
>>   virtio-scsi: introduce multiqueue support
>>
>>  drivers/scsi/virtio_scsi.c   |  374 
>> +-
>>  drivers/virtio/virtio_ring.c |  205 
>>  include/linux/virtio.h   |   21 +++
>>  3 files changed, 485 insertions(+), 115 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] iio: (max1363) Fix probe error path

2012-12-23 Thread Guenter Roeck
Instantiating the driver with no available regulator results in:

[39711.686393] i2c i2c-7: new_device: Instantiated device max1139 at 0x35
[39711.688687] BUG: unable to handle kernel paging request at fe13
[39711.688734] IP: [] regulator_disable+0x1b/0x80
[39711.688788] PGD 1c0e067 PUD 1c0f067 PMD 0
[39711.688835] Oops:  [#1] SMP

Caused by bad probe error path. Fix it.

Driver should also not attempt to free the interrupt in its error path if
none was allocated. Fix that problem as well.

Finally, testing if the regulator was allocated is not necessary in the
remove function, since the probe function bails out if this is the case.
Remove that check.

Signed-off-by: Guenter Roeck 
---
 drivers/iio/adc/max1363.c |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index 1e84b5b..31f3485 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -1605,19 +1605,20 @@ static int __devinit max1363_probe(struct i2c_client 
*client,
 
return 0;
 error_free_irq:
-   free_irq(st->client->irq, indio_dev);
+   if (client->irq)
+   free_irq(st->client->irq, indio_dev);
 error_uninit_buffer:
iio_buffer_unregister(indio_dev);
 error_cleanup_buffer:
max1363_buffer_cleanup(indio_dev);
 error_free_available_scan_masks:
kfree(indio_dev->available_scan_masks);
-error_unregister_map:
-   iio_map_array_unregister(indio_dev, client->dev.platform_data);
 error_disable_reg:
regulator_disable(st->reg);
 error_put_reg:
regulator_put(st->reg);
+error_unregister_map:
+   iio_map_array_unregister(indio_dev, client->dev.platform_data);
 error_free_device:
iio_device_free(indio_dev);
 error_out:
@@ -1635,10 +1636,8 @@ static int __devexit max1363_remove(struct i2c_client 
*client)
iio_buffer_unregister(indio_dev);
max1363_buffer_cleanup(indio_dev);
kfree(indio_dev->available_scan_masks);
-   if (!IS_ERR(st->reg)) {
-   regulator_disable(st->reg);
-   regulator_put(st->reg);
-   }
+   regulator_disable(st->reg);
+   regulator_put(st->reg);
iio_map_array_unregister(indio_dev, client->dev.platform_data);
iio_device_free(indio_dev);
 
-- 
1.7.9.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 6/6] perf annotate: Add --gtk option

2012-12-23 Thread Namhyung Kim
On Sat, Dec 22, 2012 at 12:44 AM, Borislav Petkov  wrote:
> On Fri, Dec 21, 2012 at 06:16:46PM +0900, Namhyung Kim wrote:
>> Current setup_browser() code checks the stdin to be a tty and if
>> not it assumes piping to other commands so set the use_browser to 0
>> (stdio) and disables GTK output.
>>
>> Maybe we can change this behavior for --gtk case.
>
> Change it in the sense that for the --gtk case stdin doesn't have to
> be a tty? So that with --gtk you can still pipe perf output to other
> commands?
>
> I can't imagine a sensible --gtk use case with output piped to other
> commands. Hmm.

Right.  I also have no idea what's the best way to handle --gtk option
with the piped output.  I can think of 3 options for this:

1) exit with a error message
2) honor --gtk option and launch a gui browser
3) honor piped output and print to stdout (thus ignore --gtk) like
this patch does

Any thoughts?

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


[PATCH 3/7] MFD:rtsx: Declare that the DMA address limitation is 32bit explicitly

2012-12-23 Thread wei_wang
From: Wei WANG 

Signed-off-by: Wei WANG 
---
 drivers/mfd/rtsx_pcr.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index fa2c2bc..2ee6be5 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -1084,6 +1084,10 @@ static int __devinit rtsx_pci_probe(struct pci_dev 
*pcidev,
pci_set_master(pcidev);
synchronize_irq(pcr->irq);
 
+   ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));
+   if (ret < 0)
+   goto disable_irq;
+
ret = rtsx_pci_init_chip(pcr);
if (ret < 0)
goto disable_irq;
-- 
1.7.9.5

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


[PATCH 5/7] MMC:rtsx: Using callback function to switch output voltage

2012-12-23 Thread wei_wang
From: Wei WANG 

Different card reader has different method to switch output voltage, so
we have to use the callback function provided by MFD driver to switch
output pad voltage.

Signed-off-by: Wei WANG 
---
 drivers/mmc/host/rtsx_pci_sdmmc.c |   30 +-
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 571915d..f74b5ad 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1060,26 +1060,6 @@ static int sd_wait_voltage_stable_2(struct 
realtek_pci_sdmmc *host)
return 0;
 }
 
-static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage)
-{
-   struct rtsx_pcr *pcr = host->pcr;
-   int err;
-
-   if (voltage == SD_IO_3V3) {
-   err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
-   if (err < 0)
-   return err;
-   } else if (voltage == SD_IO_1V8) {
-   err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
-   if (err < 0)
-   return err;
-   } else {
-   return -EINVAL;
-   }
-
-   return 0;
-}
-
 static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
 {
struct realtek_pci_sdmmc *host = mmc_priv(mmc);
@@ -1098,11 +1078,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, 
struct mmc_ios *ios)
rtsx_pci_start_run(pcr);
 
if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
-   voltage = SD_IO_3V3;
+   voltage = OUTPUT_3V3;
else
-   voltage = SD_IO_1V8;
+   voltage = OUTPUT_1V8;
 
-   if (voltage == SD_IO_1V8) {
+   if (voltage == OUTPUT_1V8) {
err = rtsx_pci_write_register(pcr,
SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
if (err < 0)
@@ -1113,11 +1093,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, 
struct mmc_ios *ios)
goto out;
}
 
-   err = sd_change_bank_voltage(host, voltage);
+   err = rtsx_pci_switch_output_voltage(pcr, voltage);
if (err < 0)
goto out;
 
-   if (voltage == SD_IO_1V8) {
+   if (voltage == OUTPUT_1V8) {
err = sd_wait_voltage_stable_2(host);
if (err < 0)
goto out;
-- 
1.7.9.5

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


[PATCH 0/7] rtsx patchset for MFD and MMC tree

2012-12-23 Thread wei_wang
From: Wei WANG 

Wei WANG (7):
  MFD:rtsx: Fix typo in comment
  MFD:rtsx: Remove redundant code
  MFD:rtsx: Declare that the DMA address limitation is 32bit explicitly
  MFD:rtsx: Add callback function switch_output_voltage
  MMC:rtsx: Using callback function to switch output voltage
  MFD:rtsx: Add callback function conv_clk_and_div_n
  MFD:rtsx: Fix checkpatch warning

 drivers/mfd/rtl8411.c |   29 
 drivers/mfd/rts5209.c |   21 ++
 drivers/mfd/rts5229.c |   21 ++
 drivers/mfd/rtsx_pcr.c|   44 +++--
 drivers/mmc/host/rtsx_pci_sdmmc.c |   30 +
 include/linux/mfd/rtsx_common.h   |3 +++
 include/linux/mfd/rtsx_pci.h  |   27 ++-
 7 files changed, 134 insertions(+), 41 deletions(-)

-- 
1.7.9.5

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


[PATCH 2/7] MFD:rtsx: Remove redundant code

2012-12-23 Thread wei_wang
From: Wei WANG 

Signed-off-by: Wei WANG 
---
 drivers/mfd/rtsx_pcr.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 3a44efa..fa2c2bc 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -325,7 +325,6 @@ static void rtsx_pci_add_sg_tbl(struct rtsx_pcr *pcr,
val = ((u64)addr << 32) | ((u64)len << 12) | option;
 
put_unaligned_le64(val, ptr);
-   ptr++;
pcr->sgi++;
 }
 
-- 
1.7.9.5

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


[PATCH 6/7] MFD:rtsx: Add callback function conv_clk_and_div_n

2012-12-23 Thread wei_wang
From: Wei WANG 

Add callback function conv_clk_and_div_n to convert between SSC clock
and its divider N.
For rtl8411, the formula to calculate SSC clock divider N is different
with the other card reader models.

Signed-off-by: Wei WANG 
---
 drivers/mfd/rtl8411.c   |   13 +
 drivers/mfd/rts5209.c   |1 +
 drivers/mfd/rts5229.c   |1 +
 drivers/mfd/rtsx_pcr.c  |   14 --
 include/linux/mfd/rtsx_common.h |3 +++
 include/linux/mfd/rtsx_pci.h|1 +
 6 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index 5058ba8..3d3b4ad 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -178,6 +178,18 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr 
*pcr)
return card_exist;
 }
 
+static int rtl8411_conv_clk_and_div_n(int input, int dir)
+{
+   int output;
+
+   if (dir == CLK_TO_DIV_N)
+   output = input * 4 / 5 - 2;
+   else
+   output = (input + 2) * 5 / 4;
+
+   return output;
+}
+
 static const struct pcr_ops rtl8411_pcr_ops = {
.extra_init_hw = rtl8411_extra_init_hw,
.optimize_phy = NULL,
@@ -189,6 +201,7 @@ static const struct pcr_ops rtl8411_pcr_ops = {
.card_power_off = rtl8411_card_power_off,
.switch_output_voltage = rtl8411_switch_output_voltage,
.cd_deglitch = rtl8411_cd_deglitch,
+   .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
 };
 
 /* SD Pull Control Enable:
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index ba74de8..98fe0f3 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -174,6 +174,7 @@ static const struct pcr_ops rts5209_pcr_ops = {
.card_power_off = rts5209_card_power_off,
.switch_output_voltage = rts5209_switch_output_voltage,
.cd_deglitch = NULL,
+   .conv_clk_and_div_n = NULL,
 };
 
 /* SD Pull Control Enable:
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index ec1747a..29d889c 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -144,6 +144,7 @@ static const struct pcr_ops rts5229_pcr_ops = {
.card_power_off = rts5229_card_power_off,
.switch_output_voltage = rts5229_switch_output_voltage,
.cd_deglitch = NULL,
+   .conv_clk_and_div_n = NULL,
 };
 
 /* SD Pull Control Enable:
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 0c640b5..cc28f17 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -629,7 +629,10 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned 
int card_clock,
if (clk == pcr->cur_clock)
return 0;
 
-   N = (u8)(clk - 2);
+   if (pcr->ops->conv_clk_and_div_n)
+   N = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N);
+   else
+   N = (u8)(clk - 2);
if ((clk <= 2) || (N > max_N))
return -EINVAL;
 
@@ -640,7 +643,14 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned 
int card_clock,
/* Make sure that the SSC clock div_n is equal or greater than min_N */
div = CLK_DIV_1;
while ((N < min_N) && (div < max_div)) {
-   N = (N + 2) * 2 - 2;
+   if (pcr->ops->conv_clk_and_div_n) {
+   int dbl_clk = pcr->ops->conv_clk_and_div_n(N,
+   DIV_N_TO_CLK) * 2;
+   N = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk,
+   CLK_TO_DIV_N);
+   } else {
+   N = (N + 2) * 2 - 2;
+   }
div++;
}
dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div);
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index a8d393e..2b13970 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -38,6 +38,9 @@
 #define RTSX_SD_CARD   0
 #define RTSX_MS_CARD   1
 
+#define CLK_TO_DIV_N   0
+#define DIV_N_TO_CLK   1
+
 struct platform_device;
 
 struct rtsx_slot {
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 2e3e2e0..3f2bf26 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -704,6 +704,7 @@ struct pcr_ops {
int (*switch_output_voltage)(struct rtsx_pcr *pcr,
u8 voltage);
unsigned int(*cd_deglitch)(struct rtsx_pcr *pcr);
+   int (*conv_clk_and_div_n)(int clk, int dir);
 };
 
 enum PDEV_STAT  {PDEV_STAT_IDLE, PDEV_STAT_RUN};
-- 
1.7.9.5

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


[PATCH 4/7] MFD:rtsx: Add callback function switch_output_voltage

2012-12-23 Thread wei_wang
From: Wei WANG 

Different card reader has different method to switch output voltage,
add this callback to let the card reader implement its individual switch
function.

Signed-off-by: Wei WANG 
---
 drivers/mfd/rtl8411.c|   16 
 drivers/mfd/rts5209.c|   20 
 drivers/mfd/rts5229.c|   20 
 drivers/mfd/rtsx_pcr.c   |9 +
 include/linux/mfd/rtsx_pci.h |   24 
 5 files changed, 85 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index 89f046c..5058ba8 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -112,6 +112,21 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, 
int card)
BPP_LDO_POWB, BPP_LDO_SUSPEND);
 }
 
+static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+   u8 mask, val;
+
+   mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK;
+   if (voltage == OUTPUT_3V3)
+   val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3;
+   else if (voltage == OUTPUT_1V8)
+   val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8;
+   else
+   return -EINVAL;
+
+   return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
+}
+
 static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
 {
unsigned int card_exist;
@@ -172,6 +187,7 @@ static const struct pcr_ops rtl8411_pcr_ops = {
.disable_auto_blink = rtl8411_disable_auto_blink,
.card_power_on = rtl8411_card_power_on,
.card_power_off = rtl8411_card_power_off,
+   .switch_output_voltage = rtl8411_switch_output_voltage,
.cd_deglitch = rtl8411_cd_deglitch,
 };
 
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index 283a4f1..ba74de8 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -144,6 +144,25 @@ static int rts5209_card_power_off(struct rtsx_pcr *pcr, 
int card)
return rtsx_pci_send_cmd(pcr, 100);
 }
 
+static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+   int err;
+
+   if (voltage == OUTPUT_3V3) {
+   err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
+   if (err < 0)
+   return err;
+   } else if (voltage == OUTPUT_1V8) {
+   err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
+   if (err < 0)
+   return err;
+   } else {
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
 static const struct pcr_ops rts5209_pcr_ops = {
.extra_init_hw = rts5209_extra_init_hw,
.optimize_phy = rts5209_optimize_phy,
@@ -153,6 +172,7 @@ static const struct pcr_ops rts5209_pcr_ops = {
.disable_auto_blink = rts5209_disable_auto_blink,
.card_power_on = rts5209_card_power_on,
.card_power_off = rts5209_card_power_off,
+   .switch_output_voltage = rts5209_switch_output_voltage,
.cd_deglitch = NULL,
 };
 
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index b9dbab2..ec1747a 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -114,6 +114,25 @@ static int rts5229_card_power_off(struct rtsx_pcr *pcr, 
int card)
return rtsx_pci_send_cmd(pcr, 100);
 }
 
+static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+   int err;
+
+   if (voltage == OUTPUT_3V3) {
+   err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
+   if (err < 0)
+   return err;
+   } else if (voltage == OUTPUT_1V8) {
+   err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
+   if (err < 0)
+   return err;
+   } else {
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
 static const struct pcr_ops rts5229_pcr_ops = {
.extra_init_hw = rts5229_extra_init_hw,
.optimize_phy = rts5229_optimize_phy,
@@ -123,6 +142,7 @@ static const struct pcr_ops rts5229_pcr_ops = {
.disable_auto_blink = rts5229_disable_auto_blink,
.card_power_on = rts5229_card_power_on,
.card_power_off = rts5229_card_power_off,
+   .switch_output_voltage = rts5229_switch_output_voltage,
.cd_deglitch = NULL,
 };
 
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 2ee6be5..0c640b5 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -702,6 +702,15 @@ int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card)
 }
 EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off);
 
+int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+   if (pcr->ops->switch_output_voltage)
+   return pcr->ops->switch_output_voltage(pcr, voltage);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(rtsx_pci_switch_output_voltage);
+
 unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr)
 {
unsigned 

[PATCH 7/7] MFD:rtsx: Fix checkpatch warning

2012-12-23 Thread wei_wang
From: Wei WANG 

WARNING: Avoid CamelCase: 
+   u8 N, min_N, max_N, clk_divider;

WARNING: Avoid CamelCase: 
+   u8 N, min_N, max_N, clk_divider;

Signed-off-by: Wei WANG 
---
 drivers/mfd/rtsx_pcr.c |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index cc28f17..f843c73 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -590,7 +590,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned 
int card_clock,
u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk)
 {
int err, clk;
-   u8 N, min_N, max_N, clk_divider;
+   u8 n, min_n, max_n, clk_divider;
u8 mcu_cnt, div, max_div;
u8 depth[] = {
[RTSX_SSC_DEPTH_4M] = SSC_DEPTH_4M,
@@ -615,8 +615,8 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned 
int card_clock,
card_clock /= 100;
dev_dbg(&(pcr->pci->dev), "Switch card clock to %dMHz\n", card_clock);
 
-   min_N = 80;
-   max_N = 208;
+   min_n = 80;
+   max_n = 208;
max_div = CLK_DIV_8;
 
clk = card_clock;
@@ -630,30 +630,30 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned 
int card_clock,
return 0;
 
if (pcr->ops->conv_clk_and_div_n)
-   N = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N);
+   n = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N);
else
-   N = (u8)(clk - 2);
-   if ((clk <= 2) || (N > max_N))
+   n = (u8)(clk - 2);
+   if ((clk <= 2) || (n > max_n))
return -EINVAL;
 
mcu_cnt = (u8)(125/clk + 3);
if (mcu_cnt > 15)
mcu_cnt = 15;
 
-   /* Make sure that the SSC clock div_n is equal or greater than min_N */
+   /* Make sure that the SSC clock div_n is equal or greater than min_n */
div = CLK_DIV_1;
-   while ((N < min_N) && (div < max_div)) {
+   while ((n < min_n) && (div < max_div)) {
if (pcr->ops->conv_clk_and_div_n) {
-   int dbl_clk = pcr->ops->conv_clk_and_div_n(N,
+   int dbl_clk = pcr->ops->conv_clk_and_div_n(n,
DIV_N_TO_CLK) * 2;
-   N = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk,
+   n = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk,
CLK_TO_DIV_N);
} else {
-   N = (N + 2) * 2 - 2;
+   n = (n + 2) * 2 - 2;
}
div++;
}
-   dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div);
+   dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", n, div);
 
ssc_depth = depth[ssc_depth];
if (double_clk)
@@ -670,7 +670,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned 
int card_clock,
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1, SSC_RSTB, 0);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL2,
SSC_DEPTH_MASK, ssc_depth);
-   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_DIV_N_0, 0xFF, N);
+   rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_DIV_N_0, 0xFF, n);
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1, SSC_RSTB, SSC_RSTB);
if (vpclk) {
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_VPCLK0_CTL,
-- 
1.7.9.5

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


[PATCH 1/7] MFD:rtsx: Fix typo in comment

2012-12-23 Thread wei_wang
From: Wei WANG 

Fix a misspelling word in comment

Signed-off-by: Wei WANG 
---
 include/linux/mfd/rtsx_pci.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 060b721..bebe9f9 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -452,7 +452,7 @@
 #defineSD_RSP_TYPE_R6  0x01
 #defineSD_RSP_TYPE_R7  0x01
 
-/* SD_CONFIURE3 */
+/* SD_CONFIGURE3 */
 #defineSD_RSP_80CLK_TIMEOUT_EN 0x01
 
 /* Card Transfer Reset Register */
-- 
1.7.9.5

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


Re: [PATCH 3/6] perf ui/gtk: Implement basic GTK2 annotation browser

2012-12-23 Thread Namhyung Kim
Hi all,

Merry Christmas!

On Fri, Dec 21, 2012 at 11:51 PM, Arnaldo Carvalho de Melo
 wrote:
> Em Fri, Dec 21, 2012 at 05:20:15PM +0900, Namhyung Kim escreveu:
>> Basic implementation of perf annotate on GTK2.  Currently only
>> shows first symbol.
>
> I merged the first two patches in this series, but this one needs to be
> merged with the sixth patch, so that we can try it at this point, then
> you can add more features (patches 4 and 5) that can be tested as we
> merge them.

You can apply patch 6 before 4 and 5 since it's not depends on them.
But if you want, I'll resend a squashed patch for 3 + 6.


> Just pushed my perf/core branch with the 2 first patches.

Thanks a lot! :)

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


kernel panic when running /etc/init.d/iptables restart

2012-12-23 Thread canqun zhang
Hi Patrick,
If i start  one lxc container instance, and then in the system there
will be two net namespaces,one is init_net namespace, the other is
created by lxc.If running "/etc/init.d/iptables restart",the system
will be panic. I find iptables restarting will clean init_net
namespace firstly,then clean the net namespace created by lxc,buf
related functions about cleaning up init_net namespace will destroy
global variables such as nf_ct_destroy,ip_ct_attach,etc.So,funtions
cleaning up  the other net namespace will be panic.

I fixed it up (see below) .If the system need cleaning init_net
namespace, Ip conntrack belonging to other namespaces will be cleaned
up firstly.

diff -r 7884e663ef6f -r 57fd45b8a144 net/netfilter/nf_conntrack_
core.c
--- a/net/netfilter/nf_conntrack_core.c Sun Dec 09 21:41:08 2012 +0800
+++ b/net/netfilter/nf_conntrack_core.c Sun Dec 23 16:28:15 2012 +0800
@@ -1122,7 +1122,22 @@
diff -r 7884e663ef6f -r 57fd45b8a144 net/netfilter/nf_conntrack_core.c
--- a/net/netfilter/nf_conntrack_core.c Sun Dec 09 21:41:08 2012 +0800
+++ b/net/netfilter/nf_conntrack_core.c Sun Dec 23 16:28:15 2012 +0800
@@ -1122,7 +1122,22 @@

 static void nf_conntrack_cleanup_net(struct net *net)
 {
- i_see_dead_people:
+   if (net == _net) {
+   struct net *net_poll;
+   rcu_read_lock();
+   for_each_net_rcu(net_poll) {
+   synchronize_net();
+   again:
+   nf_ct_iterate_cleanup(net_poll, kill_all, NULL);
+   nf_ct_release_dying_list(net_poll);
+   if (atomic_read(_poll->ct.count) != 0) {
+   schedule();
+   goto again;
+   }
+   }
+   rcu_read_unlock();
+   }
+i_see_dead_people:
nf_ct_iterate_cleanup(net, kill_all, NULL);
nf_ct_release_dying_list(net);
if (atomic_read(>ct.count) != 0) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] asm-generic: uaccess: allow arch to over-ride __get_user_fn()

2012-12-23 Thread Vineet Gupta
On Saturday 22 December 2012 01:13 AM, Arnd Bergmann wrote:
> On Tuesday 20 November 2012, vineet.gup...@synopsys.com wrote:
>> From: Vineet Gupta 
>>
>> Signed-off-by: Vineet Gupta 
> Acked-by: Arnd Bergmann 

Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] CONFIG_GENERIC_SIGALTSTACK build breakage with asm-generic/syscalls.h

2012-12-23 Thread Vineet Gupta
For arches which include asm-generic/syscalls.h as well as newly
introduced CONFIG_GENERIC_SIGALTSTACK, there's a build breakage due to
conflicting prototypes of sys_sigaltstack(), due to removal of struct
pt_regs from latter based code.

--->8-
In file included from
/home/vineetg/arc/upstream-kernel/arch/arc/include/asm/syscalls.h:25,
 from arch/arc/kernel/sys.c:6:
include/asm-generic/syscalls.h:26: error: conflicting types for
'sys_sigaltstack'
include/linux/syscalls.h:304: note: previous declaration of
'sys_sigaltstack' was here
make[2]: *** [arch/arc/kernel/sys.o] Error 1
--->8-

Signed-off-by: Vineet Gupta 
Cc: james.ho...@imgtec.com
Cc: a...@arndb.de
Cc: torva...@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-a...@vger.kernel.org
---
 include/asm-generic/syscalls.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index 58f466f..1db51b8 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long 
len,
unsigned long fd, off_t pgoff);
 #endif
 
+#ifndef CONFIG_GENERIC_SIGALTSTACK
 #ifndef sys_sigaltstack
 asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
struct pt_regs *);
 #endif
+#endif
 
 #ifndef sys_rt_sigreturn
 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
-- 
1.7.4.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] mfd, TWL4030: TWL4030 need select REGMAP_I2C

2012-12-23 Thread Chuansheng Liu


This patch fix the below build error:
drivers/built-in.o: In function `twl_probe':
drivers/mfd/twl-core.c:1256: undefined reference to `devm_regmap_init_i2c'
make: *** [vmlinux] Error 1

Signed-off-by: liu chuansheng 
---
 drivers/mfd/Kconfig |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1c0abd4..47ad4e2 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -292,6 +292,7 @@ config TWL4030_CORE
bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support"
depends on I2C=y && GENERIC_HARDIRQS
select IRQ_DOMAIN
+   select REGMAP_I2C
help
  Say yes here if you have TWL4030 / TWL6030 family chip on your board.
  This core driver provides register access and IRQ handling
-- 
1.7.0.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 v6] KSM: numa awareness sysfs knob

2012-12-23 Thread Greg KH
On Mon, Dec 24, 2012 at 04:22:54AM +0100, Petr Holasek wrote:
> Introduces new sysfs boolean knob /sys/kernel/mm/ksm/merge_across_nodes
> which control merging pages across different numa nodes.

All sysfs files must be documented in Documentation/ABI, please update
the files there as well (subsystem documentation, like you did, is also
nice, but the ABI files are the required ones.)

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/


[PATCH V2] output the cpu number when printking.

2012-12-23 Thread he, bo
From: "he, bo" 

We often hit kernel panic issues on SMP machines because processes race
on multiple cpu. By adding a new parameter printk.cpu, kernel prints
cpu number at printk information line. It’s useful to debug what cpus
are racing.

Signed-off-by: he, bo 
---
 Documentation/kernel-parameters.txt |4 
 kernel/printk.c |   18 --
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index ddd84d6..3387a7f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2378,6 +2378,10 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
printk.time=Show timing data prefixed to each printk message line
Format:   (1/Y/y=enable, 0/N/n=disable)
 
+   printk.cpu= Show cpu data prefixed to each printk message line
+   Format:   (1/Y/y=enable, 0/N/n=disable)
+   printk.cpu takes effect only when printk.time=y.
+
processor.max_cstate=   [HW,ACPI]
Limit processor to maximum C-state
max_cstate=9 overrides any DMI blacklist limit.
diff --git a/kernel/printk.c b/kernel/printk.c
index 19c0d7b..873a226 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -863,9 +863,14 @@ static bool printk_time;
 #endif
 module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
+static bool printk_cpu = 1;
+module_param_named(cpu, printk_cpu, bool, S_IRUGO | S_IWUSR);
+
 static size_t print_time(u64 ts, char *buf)
 {
unsigned long rem_nsec;
+   size_t len = 0;
+   int this_cpu;
 
if (!printk_time)
return 0;
@@ -874,8 +879,17 @@ static size_t print_time(u64 ts, char *buf)
return 15;
 
rem_nsec = do_div(ts, 10);
-   return sprintf(buf, "[%5lu.%06lu] ",
-  (unsigned long)ts, rem_nsec / 1000);
+
+   if (printk_cpu) {
+   this_cpu = raw_smp_processor_id();
+   len = sprintf(buf, "[%5lu.%06lu,%u] ",
+  (unsigned long)ts, rem_nsec / 1000, this_cpu);
+   } else {
+   len = sprintf(buf, "[%5lu.%06lu] ",
+  (unsigned long)ts, rem_nsec / 1000);
+   }
+
+   return len;
 }
 
 static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
-- 
1.7.6



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v7 00/27] x86, boot, 64bit: Add support for loading ramdisk and bzImage above 4G

2012-12-23 Thread H. Peter Anvin
Makes sense.  Ljmpq it is.  A comment might be useful.

Borislav Petkov  wrote:

>On Sun, Dec 23, 2012 at 10:00:26AM -0800, Yinghai Lu wrote:
>> On Sun, Dec 23, 2012 at 6:33 AM, H. Peter Anvin 
>wrote:
>> > Explanation please?
>>
>> you have following change in the patch
>> 
>> /* Finally jump to run C code and to be on real kernel
>address
>>  * Since we are running on identity-mapped space we have to
>jump
>>  * to the full 64bit address, this is only possible as
>indirect
>>  * jump.  In addition we need to ensure %cs is set so we make
>this
>> -* a far return.
>> +* a far jump.
>>  */
>> -   movqinitial_code(%rip),%rax
>> pushq   $0  # fake return address to stop
>unwinder
>> -   pushq   $__KERNEL_CS# set correct cs
>> -   pushq   %rax# target address in negative space
>> -   lretq
>> +   /* gas 2.22 is buggy and mis-assembles ljmpq */
>> +   rex64 ljmp *initial_code(%rip)
>> 
>>  #ifdef CONFIG_HOTPLUG_CPU
>>  /*
>> 
>> remove that change, AMD systems works again.
>
>Right, the original code did a RET FAR by popping CS and rIP from the
>stack. And we did prepare the stack properly before that so it worked.
>
>Now, the ljmp translates to a JMP FAR:
>
>8100016e:   48 ff 2d ab a5 7f 00rex.W ljmpq
>*0x7fa5ab(%rip)# 817fa720 
>81000175:   66 66 2e 0f 1f 84 00data32 nopw
>%cs:0x0(%rax,%rax,1)
>8100017c:   00 00 00 00 
>
>and in 64-bit mode it has for an operand a 16-bit selector followed by
>a
>32-bit offset.
>
>Now, Intel SDM says also this:
>
>REX.W + FF /5 JMP m16:64 A Valid N.E. Jump far, absolute indirect,
>address given in m16:64.
>
>And I don't think AMD supports a 64-bit offset. At least I don't see it
>in the APM where it has only:
>
>JMP FAR mem16:16 FF /5 Far jump indirect, with the target specified by
>a far
>  pointer in memory.
>JMP FAR mem16:32 FF /5 Far jump indirect, with the target specified by
>a far
>pointer in memory.
>
>This is at least what I can see at a quick scan. I could ask around if
>AMD actually supports that FF /5 with a REX.W prefix and it is not only
>a documentation omission.
>
>HTH.

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v7 00/27] x86, boot, 64bit: Add support for loading ramdisk and bzImage above 4G

2012-12-23 Thread H. Peter Anvin
Err, lretq it is.

Borislav Petkov  wrote:

>On Sun, Dec 23, 2012 at 10:00:26AM -0800, Yinghai Lu wrote:
>> On Sun, Dec 23, 2012 at 6:33 AM, H. Peter Anvin 
>wrote:
>> > Explanation please?
>>
>> you have following change in the patch
>> 
>> /* Finally jump to run C code and to be on real kernel
>address
>>  * Since we are running on identity-mapped space we have to
>jump
>>  * to the full 64bit address, this is only possible as
>indirect
>>  * jump.  In addition we need to ensure %cs is set so we make
>this
>> -* a far return.
>> +* a far jump.
>>  */
>> -   movqinitial_code(%rip),%rax
>> pushq   $0  # fake return address to stop
>unwinder
>> -   pushq   $__KERNEL_CS# set correct cs
>> -   pushq   %rax# target address in negative space
>> -   lretq
>> +   /* gas 2.22 is buggy and mis-assembles ljmpq */
>> +   rex64 ljmp *initial_code(%rip)
>> 
>>  #ifdef CONFIG_HOTPLUG_CPU
>>  /*
>> 
>> remove that change, AMD systems works again.
>
>Right, the original code did a RET FAR by popping CS and rIP from the
>stack. And we did prepare the stack properly before that so it worked.
>
>Now, the ljmp translates to a JMP FAR:
>
>8100016e:   48 ff 2d ab a5 7f 00rex.W ljmpq
>*0x7fa5ab(%rip)# 817fa720 
>81000175:   66 66 2e 0f 1f 84 00data32 nopw
>%cs:0x0(%rax,%rax,1)
>8100017c:   00 00 00 00 
>
>and in 64-bit mode it has for an operand a 16-bit selector followed by
>a
>32-bit offset.
>
>Now, Intel SDM says also this:
>
>REX.W + FF /5 JMP m16:64 A Valid N.E. Jump far, absolute indirect,
>address given in m16:64.
>
>And I don't think AMD supports a 64-bit offset. At least I don't see it
>in the APM where it has only:
>
>JMP FAR mem16:16 FF /5 Far jump indirect, with the target specified by
>a far
>  pointer in memory.
>JMP FAR mem16:32 FF /5 Far jump indirect, with the target specified by
>a far
>pointer in memory.
>
>This is at least what I can see at a quick scan. I could ask around if
>AMD actually supports that FF /5 with a REX.W prefix and it is not only
>a documentation omission.
>
>HTH.

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] kconfig:lxdialog: remove duplicate code

2012-12-23 Thread Wang YanQing
On Mon, Dec 17, 2012 at 07:19:07PM +0100, Yann E. MORIN wrote:
> Wang, All,
> 
> On Monday 17 December 2012 Wang YanQing wrote:
> > dialog.h has two line the same below:
> > extern char dialog_input_result[];
> > This patch remove one of them.
> > 
> > Signed-off-by: Wang YanQing 
> 
> Reviewed-by: "Yann E. MORIN" 
> Tested-by: "Yann E. MORIN" 
Michal, All.

Hi Michal, could you consider pick up this obvious right
patch, and consider others' three patch I sented one week
ago? I just don't want delay them to 2013, and they can get
more test when they appear in next tree.
https://patchwork.kernel.org/patch/1887361/
https://patchwork.kernel.org/patch/1894341/
https://patchwork.kernel.org/patch/1887441/

Happy christmas!

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


RE: [PATCH] usb: tegra: Removing dependency on PHY instance number

2012-12-23 Thread Venu Byravarasu
> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> Sent: Saturday, December 22, 2012 2:32 AM
> To: Venu Byravarasu
> Cc: st...@rowland.harvard.edu; gre...@linuxfoundation.org;
> ba...@ti.com; linux-...@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] usb: tegra: Removing dependency on PHY instance
> number
> 
> On 12/20/2012 11:58 PM, Venu Byravarasu wrote:
> > Tegra2 has two varieties of USB PHYs:
> > Instance 0 - legacy PHY interface and
> > Instace 1 & 2 - non-legacy standard PHY interfaces.
> >
> > PHY driver is using instance numbers to identify the
> > interface type.
> >
> > With this patch Modified PHY driver to make use of
> > DT property for handling this.
> >
> > ULPI PHY is used on USB PHY instance 1 & UTMI is
> > used on other two instances. Hence modified PHY type
> > detection also from instance number to the parameter
> > passed from host driver.
> 
> Mostly seems fine to me; just a couple more things I noticed inline
> below. For the record, I'd like to take this through the Tegra tree with
> all the other Tegra-related USB patches in order to manage any
> dependencies, with the USB maintainers' Acks. Thanks.
> 
> > diff --git a/drivers/usb/phy/tegra_usb_phy.c
> b/drivers/usb/phy/tegra_usb_phy.c
> 
> > +struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev,
> > +   bool is_legacy_mode, void __iomem *regs, void *config,
> > +   enum tegra_usb_phy_mode phy_mode)
> 
> > +   u8 index = is_legacy_mode ? 0 : 2;
> 
> I know this looks slightly icky, but I discussed earlier with Venu that
> this will be replaced by reading all the parameters out of device tree,
> as soon as this code becomes a true driver. I think the patch for that
> is up next, or at most after a few more cleanup patches.

Thanks Stephen.
As we discussed already, I'll use DT params in upcoming patches.

> 
> > +   phy->is_ulpi_phy = config ? true : false;
> >
> > if (!phy->config) {
> > -   if (phy_is_ulpi(phy)) {
> > +   if (phy->is_ulpi_phy) {
> > pr_err("%s: ulpi phy configuration missing",
> __func__);
> > err = -EINVAL;
> > goto err0;
> 
> That check will never fire now, since phy->is_ulpi_phy is calculated
> based on whether phy->config is set. I think it's fine for now to rely
> on the EHCI driver correctly passing config or NULL, and hence you could
> simply delete some of this error-checking code. I imagine that when the
> PHY driver is reworked to be an actual device rather than a utility
> module, phy->is_ulpi_phy will be determined by the compatible value of
> the PHY node in device tree.
 
Correct, Stephen.
Will use DT param for determining the PHY type.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: dire state of rtl driver in 3.7

2012-12-23 Thread Mike Galbraith
On Sun, 2012-12-23 at 13:10 -0600, Larry Finger wrote:

> Note, the RTL8188CE uses rtl8192ce, while the RTL8191SE uses rtl8192se. They 
> share the underlying plumbing in driver rtlwifi, but the rest is completely 
> different.

Driver here is rtl8192se.

08:00.0 0280: 10ec:8172 (rev 10)
Subsystem: 10ec:8181
Flags: bus master, fast devsel, latency 0, IRQ 17
I/O ports at 4000 [size=256]
Memory at c090 (32-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Legacy Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number 88-55-22-fe-ff-4c-e0-00
Kernel driver in use: rtl8192se

Point was, driver state may still be dire for some hardware, but here,
the same driver for very similar looking hardware went from useless to
works fine.

My desktop box has this thing in it, which also used to be completely
useless with the in kernel driver, but now works (it's still useless,
router sits on top of that box;).  Both devices now seem to work just
fine, whereas both used to be a PITA if I wanted to use them.

Bus 001 Device 004: ID 13d3:3247 IMC Networks 802.11 n/g/b Wireless LAN Adapter
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0 
  bDeviceProtocol 0 
  bMaxPacketSize064
  idVendor   0x13d3 IMC Networks
  idProduct  0x3247 802.11 n/g/b Wireless LAN Adapter
  bcdDevice8.01
  iManufacturer   1 Ralink
  iProduct2 802.11 n WLAN
  iSerial 3 1.0




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


RE: [PATCH v3] usb: phy: use kzalloc to allocate struct tegra_usb_phy

2012-12-23 Thread Venu Byravarasu
Thanks Stephen.
Venu


> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> Sent: Saturday, December 22, 2012 2:25 AM
> To: Venu Byravarasu
> Cc: ba...@ti.com; gre...@linuxfoundation.org; sshtyl...@mvista.com;
> linux-kernel@vger.kernel.org; linux-...@vger.kernel.org
> Subject: Re: [PATCH v3] usb: phy: use kzalloc to allocate struct tegra_usb_phy
> 
> On 12/20/2012 11:34 PM, Venu Byravarasu wrote:
> > Use kzalloc instead of kmalloc to allocate struct tegra_usb_phy.
> > This ensures that all function pointers in member u_phy are
> > initialized to NULL.
> 
> Seems fine to me. For the record, I'd like to take this through the
> Tegra tree with all the other Tegra-related USB patches in order to
> manage any dependencies, with the USB maintainers' Acks. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


MIPS: MSP71xx: Indicate new location of source files in Platform file

2012-12-23 Thread Shane McDonald
The source files for the MSP71xx support code have been moved
in commit 13a347ef60c68e490809dad8fcf79c25eabc4d58,
"MIPS: MSP71xx: Move code." Update the Platform file
to indicate the new location.

Signed-off-by: Shane McDonald 
---
 arch/mips/pmcs-msp71xx/Platform |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/pmcs-msp71xx/Platform b/arch/mips/pmcs-msp71xx/Platform
index 17299f9..9a86e29 100644
--- a/arch/mips/pmcs-msp71xx/Platform
+++ b/arch/mips/pmcs-msp71xx/Platform
@@ -1,7 +1,7 @@
 #
 # PMC-Sierra MSP SOCs
 #
-platform-$(CONFIG_PMC_MSP) += pmc-sierra/
-cflags-$(CONFIG_PMC_MSP)   += 
-I$(srctree)/arch/mips/include/asm/pmc-sierra \
+platform-$(CONFIG_PMC_MSP) += pmcs-msp71xx/
+cflags-$(CONFIG_PMC_MSP)   += 
-I$(srctree)/arch/mips/include/asm/pmc-sierra/msp71xx \
-mno-branch-likely
 load-$(CONFIG_PMC_MSP) += 0x8010
-- 
1.7.2.5

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


Re: [PATCH] output the cpu number when printking.

2012-12-23 Thread he, bo
Thanks randy's comments, I will modifiy it.

On Sun, 2012-12-23 at 19:37 -0800, Randy Dunlap wrote:
> On 12/23/12 18:31, he, bo wrote:
> > From: "he, bo" 
> > 
> > We often hit kernel panic issues on SMP machines because processes race
> > on multiple cpu. By adding a new parameter printk.cpu, kernel prints
> > cpu number at printk information line. It’s useful to debug what cpus
> > are racing.
> > 
> > Signed-off-by: he, bo 
> > ---
> >  Documentation/kernel-parameters.txt |4 
> >  kernel/printk.c |   18 --
> >  2 files changed, 20 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/kernel-parameters.txt 
> > b/Documentation/kernel-parameters.txt
> > index ddd84d6..ccd5266 100644
> > --- a/Documentation/kernel-parameters.txt
> > +++ b/Documentation/kernel-parameters.txt
> > @@ -2378,6 +2378,10 @@ bytes respectively. Such letter suffixes can also be 
> > entirely omitted.
> > printk.time=Show timing data prefixed to each printk message line
> > Format:   (1/Y/y=enable, 0/N/n=disable)
> >  
> > +   printk.cpu= Show cpu data prefixed to each printk message line
> > +   Format:   (1/Y/y=enable, 0/N/n=disable)
> > +   printk.cpu takes effect only when printk.time=y.
> 
> Above line needs to be indented more (beginning under "Format:").
> 
> > +
> > processor.max_cstate=   [HW,ACPI]
> > Limit processor to maximum C-state
> > max_cstate=9 overrides any DMI blacklist limit.
> > diff --git a/kernel/printk.c b/kernel/printk.c
> > index 19c0d7b..873a226 100644
> > --- a/kernel/printk.c
> > +++ b/kernel/printk.c
> > @@ -863,9 +863,14 @@ static bool printk_time;
> >  #endif
> >  module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
> >  
> > +static bool printk_cpu = 1;
> > +module_param_named(cpu, printk_cpu, bool, S_IRUGO | S_IWUSR);
> > +
> >  static size_t print_time(u64 ts, char *buf)
> >  {
> > unsigned long rem_nsec;
> > +   size_t len = 0;
> > +   int this_cpu;
> >  
> > if (!printk_time)
> > return 0;
> > @@ -874,8 +879,17 @@ static size_t print_time(u64 ts, char *buf)
> > return 15;
> >  
> > rem_nsec = do_div(ts, 10);
> > -   return sprintf(buf, "[%5lu.%06lu] ",
> > -  (unsigned long)ts, rem_nsec / 1000);
> > +
> > +   if (printk_cpu) {
> > +   this_cpu = raw_smp_processor_id();
> > +   len = sprintf(buf, "[%5lu.%06lu,%u] ",
> > +  (unsigned long)ts, rem_nsec / 1000, this_cpu);
> > +   } else {
> > +   len = sprintf(buf, "[%5lu.%06lu] ",
> > +  (unsigned long)ts, rem_nsec / 1000);
> > +   }
> > +
> > +   return len;
> >  }
> >  
> >  static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
> > 
> 
> 


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


Re: Linux 3.8-rc1 - another regression on USB :-(

2012-12-23 Thread Woody Suwalski

Greg Kroah-Hartman wrote:

On Sun, Dec 23, 2012 at 02:35:49PM -0800, Linus Torvalds wrote:

Woody,
  Any chance you can bisect this? It's not going to be hugely pleasant
(with 11k+ commits in between 3.7 and 3.8-rc1 you'll have to compile
and test at least 14 kernels), but it would help enormously. Of
course, maybe some USB person can guess what would cause the device to
go offline..

Added Greg and the linux-usb mailing list to the participants list:
the images are in the original email on lkml, but there isn't anything
particularly interesting there, it really just seems to be an
unexpected and spurious USB disconnect, resulting in "USB disconnect,
device number 2" followed by "Rejecting I/O to offline device".

I don't see any images on lkml, sorry.

The kernel log for when the disconnect happened would be great to get.

The kernel can't cause a device to disconnect, that's an electrical
thing usually, is this perchance a flaky device/connection?  Or has it
always worked on older kernels?

What host controller is being used here (xhci, ehci, etc.?)

thanks,

greg k-h

I backtrack - it is not directly a USB problem.
If I boot the image into a single mode, and then verify reading the 
squashfs as a compressed file or the files in the mounted uncompressed 
image - there are no errors on read.
Yet if i let it boot into X - it does not - gets bogged with disk access 
errors.

And then there is no access to a USB key anymore.
Will need to investigate further..

Sorry for the alarm, Greg...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] output the cpu number when printking.

2012-12-23 Thread Randy Dunlap
On 12/23/12 18:31, he, bo wrote:
> From: "he, bo" 
> 
> We often hit kernel panic issues on SMP machines because processes race
> on multiple cpu. By adding a new parameter printk.cpu, kernel prints
> cpu number at printk information line. It’s useful to debug what cpus
> are racing.
> 
> Signed-off-by: he, bo 
> ---
>  Documentation/kernel-parameters.txt |4 
>  kernel/printk.c |   18 --
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt 
> b/Documentation/kernel-parameters.txt
> index ddd84d6..ccd5266 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -2378,6 +2378,10 @@ bytes respectively. Such letter suffixes can also be 
> entirely omitted.
>   printk.time=Show timing data prefixed to each printk message line
>   Format:   (1/Y/y=enable, 0/N/n=disable)
>  
> + printk.cpu= Show cpu data prefixed to each printk message line
> + Format:   (1/Y/y=enable, 0/N/n=disable)
> + printk.cpu takes effect only when printk.time=y.

Above line needs to be indented more (beginning under "Format:").

> +
>   processor.max_cstate=   [HW,ACPI]
>   Limit processor to maximum C-state
>   max_cstate=9 overrides any DMI blacklist limit.
> diff --git a/kernel/printk.c b/kernel/printk.c
> index 19c0d7b..873a226 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -863,9 +863,14 @@ static bool printk_time;
>  #endif
>  module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
>  
> +static bool printk_cpu = 1;
> +module_param_named(cpu, printk_cpu, bool, S_IRUGO | S_IWUSR);
> +
>  static size_t print_time(u64 ts, char *buf)
>  {
>   unsigned long rem_nsec;
> + size_t len = 0;
> + int this_cpu;
>  
>   if (!printk_time)
>   return 0;
> @@ -874,8 +879,17 @@ static size_t print_time(u64 ts, char *buf)
>   return 15;
>  
>   rem_nsec = do_div(ts, 10);
> - return sprintf(buf, "[%5lu.%06lu] ",
> -(unsigned long)ts, rem_nsec / 1000);
> +
> + if (printk_cpu) {
> + this_cpu = raw_smp_processor_id();
> + len = sprintf(buf, "[%5lu.%06lu,%u] ",
> +(unsigned long)ts, rem_nsec / 1000, this_cpu);
> + } else {
> + len = sprintf(buf, "[%5lu.%06lu] ",
> +(unsigned long)ts, rem_nsec / 1000);
> + }
> +
> + return len;
>  }
>  
>  static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
> 


-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 v6] KSM: numa awareness sysfs knob

2012-12-23 Thread Petr Holasek
Introduces new sysfs boolean knob /sys/kernel/mm/ksm/merge_across_nodes
which control merging pages across different numa nodes.
When it is set to zero only pages from the same node are merged,
otherwise pages from all nodes can be merged together (default behavior).

Typical use-case could be a lot of KVM guests on NUMA machine
and cpus from more distant nodes would have significant increase
of access latency to the merged ksm page. Sysfs knob was choosen
for higher variability when some users still prefers higher amount
of saved physical memory regardless of access latency.

Every numa node has its own stable & unstable trees because of faster
searching and inserting. Changing of merge_across_nodes value is possible
only when there are not any ksm shared pages in system.

I've tested this patch on numa machines with 2, 4 and 8 nodes and
measured speed of memory access inside of KVM guests with memory pinned
to one of nodes with this benchmark:

http://pholasek.fedorapeople.org/alloc_pg.c

Population standard deviations of access times in percentage of average
were following:

merge_across_nodes=1
2 nodes 1.4%
4 nodes 1.6%
8 nodes 1.7%

merge_across_nodes=0
2 nodes 1%
4 nodes 0.32%
8 nodes 0.018%

RFC: https://lkml.org/lkml/2011/11/30/91
v1: https://lkml.org/lkml/2012/1/23/46
v2: https://lkml.org/lkml/2012/6/29/105
v3: https://lkml.org/lkml/2012/9/14/550
v4: https://lkml.org/lkml/2012/9/23/137
v5: https://lkml.org/lkml/2012/12/10/540

Changelog:

v2: Andrew's objections were reflected:
- value of merge_nodes can't be changed while there are some ksm
pages in system
- merge_nodes sysfs entry appearance depends on CONFIG_NUMA
- more verbose documentation
- added some performance testing results

v3: - more verbose documentation
- fixed race in merge_nodes store function
- introduced share_all debugging knob proposed by Andrew
- minor cleanups

v4: - merge_nodes was renamed to merge_across_nodes
- share_all debug knob was dropped
- get_kpfn_nid helper
- fixed page migration behaviour

v5: - unstable node's nid presence depends on CONFIG_NUMA
- fixed oops appearing when stable nodes were removed from tree
- roots of stable trees are initialized properly
- fixed unstable page migration issue

v6: - fixed oops caused by stable_nodes appended to wrong tree
- KSM_RUN_MERGE test removed

Signed-off-by: Petr Holasek 
Signed-off-by: Hugh Dickins 
Acked-by: Rik van Riel 
---
 Documentation/vm/ksm.txt |   7 +++
 mm/ksm.c | 151 +--
 2 files changed, 139 insertions(+), 19 deletions(-)

diff --git a/Documentation/vm/ksm.txt b/Documentation/vm/ksm.txt
index b392e49..25cc89b 100644
--- a/Documentation/vm/ksm.txt
+++ b/Documentation/vm/ksm.txt
@@ -58,6 +58,13 @@ sleep_millisecs  - how many milliseconds ksmd should sleep 
before next scan
e.g. "echo 20 > /sys/kernel/mm/ksm/sleep_millisecs"
Default: 20 (chosen for demonstration purposes)
 
+merge_across_nodes - specifies if pages from different numa nodes can be 
merged.
+   When set to 0, ksm merges only pages which physically
+   reside in the memory area of same NUMA node. It brings
+   lower latency to access to shared page. Value can be
+   changed only when there is no ksm shared pages in system.
+   Default: 1
+
 run  - set 0 to stop ksmd from running but keep merged pages,
set 1 to run ksmd e.g. "echo 1 > /sys/kernel/mm/ksm/run",
set 2 to stop ksmd and unmerge all pages currently merged,
diff --git a/mm/ksm.c b/mm/ksm.c
index 5157385..d1e1041 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "internal.h"
@@ -139,6 +140,9 @@ struct rmap_item {
struct mm_struct *mm;
unsigned long address;  /* + low bits used for flags below */
unsigned int oldchecksum;   /* when unstable */
+#ifdef CONFIG_NUMA
+   unsigned int nid;
+#endif
union {
struct rb_node node;/* when node of unstable tree */
struct {/* when listed from stable tree */
@@ -153,8 +157,8 @@ struct rmap_item {
 #define STABLE_FLAG0x200   /* is listed from the stable tree */
 
 /* The stable and unstable tree heads */
-static struct rb_root root_stable_tree = RB_ROOT;
-static struct rb_root root_unstable_tree = RB_ROOT;
+static struct rb_root root_unstable_tree[MAX_NUMNODES];
+static struct rb_root root_stable_tree[MAX_NUMNODES];
 
 #define MM_SLOTS_HASH_SHIFT 10
 #define MM_SLOTS_HASH_HEADS (1 << MM_SLOTS_HASH_SHIFT)
@@ -189,6 +193,9 @@ static unsigned int ksm_thread_pages_to_scan = 100;
 /* Milliseconds ksmd should sleep between batches */
 static unsigned int 

linux-next: Tree for Dec 24

2012-12-23 Thread Stephen Rothwell
Hi all,

Merry  to you all!

Changes since 20121221:

The driver-core.current tree gained conflicts against Linus' tree.

The slave-dma tree gained a conflict against the driver-core.current tree.

The pinctl tree gained a conflict against the driver-core.current tree.

The akpm tree gained a conflict against the driver-core.current tree and
lost a patch that turned up elsewhere.



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 213 trees (counting Linus' and 28 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 (637704c Merge branch 'i2c-embedded/for-next' of 
git://git.pengutronix.de/git/wsa/linux)
Merging fixes/master (3b095f2 disable the SB105X driver)
Merging kbuild-current/rc-fixes (bad9955 menuconfig: Replace CIRCLEQ by 
list_head-style lists.)
Merging arm-current/fixes (e6ee4b2 ARM: 7607/1: realview: fix private 
peripheral memory base for EB rev. B boards)
Merging m68k-current/for-linus (5fec45a m68k/sun3: Fix instruction faults)
Merging powerpc-merge/merge (e716e01 powerpc/eeh: Do not invalidate PE properly)
Merging sparc/master (c4271c6 NFS: Kill fscache warnings when mounting without 
-ofsc)
Merging net/master (9b1536c bridge: call br_netpoll_disable in br_add_if)
Merging sound-current/for-linus (d846b17 ALSA: hda - Fix build without 
CONFIG_PM)
Merging pci-current/for-linus (ff8e59b PCI/portdrv: Don't create hotplug slots 
unless port supports hotplug)
Merging wireless/master (009b969 wireless: fix Atheros drivers compilation)
Merging driver-core.current/driver-core-linus (8ba0c47 Drivers: rtc: rtc-twl.c: 
fix build error.)
CONFLICT (content): Merge conflict in drivers/i2c/muxes/i2c-mux-gpio.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/scx200_acb.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-xiic.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-viapro.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-sis96x.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-pxa-pci.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-powermac.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-piix4.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-pasemi.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-omap.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-nforce2.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-mv64xxx.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-mpc.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-intel-mid.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-ibm_iic.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-i801.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-hydra.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-eg20t.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-designware-pcidrv.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-au1550.c
CONFLICT (content): Merge conflict in drivers/i2c/busses/i2c-ali1563.c
Merging tty.current/tty-linus (a49f0d1 Linux 3.8-rc1)
Merging usb.current/usb-linus (a49f0d1 Linux 3.8-rc1)
Merging 

[PATCH] output the cpu number when printking.

2012-12-23 Thread he, bo
From: "he, bo" 

We often hit kernel panic issues on SMP machines because processes race
on multiple cpu. By adding a new parameter printk.cpu, kernel prints
cpu number at printk information line. It’s useful to debug what cpus
are racing.

Signed-off-by: he, bo 
---
 Documentation/kernel-parameters.txt |4 
 kernel/printk.c |   18 --
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index ddd84d6..ccd5266 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2378,6 +2378,10 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
printk.time=Show timing data prefixed to each printk message line
Format:   (1/Y/y=enable, 0/N/n=disable)
 
+   printk.cpu= Show cpu data prefixed to each printk message line
+   Format:   (1/Y/y=enable, 0/N/n=disable)
+   printk.cpu takes effect only when printk.time=y.
+
processor.max_cstate=   [HW,ACPI]
Limit processor to maximum C-state
max_cstate=9 overrides any DMI blacklist limit.
diff --git a/kernel/printk.c b/kernel/printk.c
index 19c0d7b..873a226 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -863,9 +863,14 @@ static bool printk_time;
 #endif
 module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
+static bool printk_cpu = 1;
+module_param_named(cpu, printk_cpu, bool, S_IRUGO | S_IWUSR);
+
 static size_t print_time(u64 ts, char *buf)
 {
unsigned long rem_nsec;
+   size_t len = 0;
+   int this_cpu;
 
if (!printk_time)
return 0;
@@ -874,8 +879,17 @@ static size_t print_time(u64 ts, char *buf)
return 15;
 
rem_nsec = do_div(ts, 10);
-   return sprintf(buf, "[%5lu.%06lu] ",
-  (unsigned long)ts, rem_nsec / 1000);
+
+   if (printk_cpu) {
+   this_cpu = raw_smp_processor_id();
+   len = sprintf(buf, "[%5lu.%06lu,%u] ",
+  (unsigned long)ts, rem_nsec / 1000, this_cpu);
+   } else {
+   len = sprintf(buf, "[%5lu.%06lu] ",
+  (unsigned long)ts, rem_nsec / 1000);
+   }
+
+   return len;
 }
 
 static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
-- 
1.7.6



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


[PATCH 18/29] drivers/net: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: "David S. Miller" 
Cc: Michael Chan 
Cc: Thomas Sailer 
Cc: Jean-Paul Roubelat 
Cc: Bing Zhao 
Cc: net...@vger.kernel.org
Cc: linux-h...@vger.kernel.org
Cc: linux-wirel...@vger.kernel.org
---
 drivers/net/ethernet/broadcom/cnic.c| 4 ++--
 drivers/net/hamradio/baycom_epp.c   | 2 +-
 drivers/net/hamradio/hdlcdrv.c  | 2 +-
 drivers/net/hamradio/yam.c  | 2 +-
 drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c 
b/drivers/net/ethernet/broadcom/cnic.c
index df8c30d..27d7a32 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -4085,7 +4085,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
if (!cp->csk_tbl)
return -ENOMEM;
 
-   port_id = random32();
+   port_id = prandom_u32();
port_id %= CNIC_LOCAL_PORT_RANGE;
if (cnic_init_id_tbl(>csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
 CNIC_LOCAL_PORT_MIN, port_id)) {
@@ -4145,7 +4145,7 @@ static int cnic_cm_init_bnx2_hw(struct cnic_dev *dev)
 {
u32 seed;
 
-   seed = random32();
+   seed = prandom_u32();
cnic_ctx_wr(dev, 45, 0, seed);
return 0;
 }
diff --git a/drivers/net/hamradio/baycom_epp.c 
b/drivers/net/hamradio/baycom_epp.c
index 49b8b58..484f77e 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -449,7 +449,7 @@ static int transmit(struct baycom_state *bc, int cnt, 
unsigned char stat)
if ((--bc->hdlctx.slotcnt) > 0)
return 0;
bc->hdlctx.slotcnt = bc->ch_params.slottime;
-   if ((random32() % 256) > bc->ch_params.ppersist)
+   if ((prandom_u32() % 256) > bc->ch_params.ppersist)
return 0;
}
}
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index a4a3516..3169252 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -389,7 +389,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct 
hdlcdrv_state *s)
if ((--s->hdlctx.slotcnt) > 0)
return;
s->hdlctx.slotcnt = s->ch_params.slottime;
-   if ((random32() % 256) > s->ch_params.ppersist)
+   if ((prandom_u32() % 256) > s->ch_params.ppersist)
return;
start_tx(dev, s);
 }
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index c6645f1..21f231a 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -638,7 +638,7 @@ static void yam_arbitrate(struct net_device *dev)
yp->slotcnt = yp->slot / 10;
 
/* is random > persist ? */
-   if ((random32() % 256) > yp->pers)
+   if ((prandom_u32() % 256) > yp->pers)
return;
 
yam_start_tx(dev, yp);
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index a875499..78dbc18 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -216,7 +216,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
mwifiex_form_mgmt_frame(skb, buf, len);
mwifiex_queue_tx_pkt(priv, skb);
 
-   *cookie = random32() | 1;
+   *cookie = prandom_u32() | 1;
cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, GFP_ATOMIC);
 
wiphy_dbg(wiphy, "info: management frame transmitted\n");
@@ -271,7 +271,7 @@ mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy,
 duration);
 
if (!ret) {
-   *cookie = random32() | 1;
+   *cookie = prandom_u32() | 1;
priv->roc_cfg.cookie = *cookie;
priv->roc_cfg.chan = *chan;
 
-- 
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 19/29] batman-adv: fix random jitter calculation

2012-12-23 Thread Akinobu Mita
batadv_iv_ogm_emit_send_time() attempts to calculates a random integer
in the range of 'orig_interval +- BATADV_JITTER' by the below lines.

msecs = atomic_read(_priv->orig_interval) - BATADV_JITTER;
msecs += (random32() % 2 * BATADV_JITTER);

But it actually gets 'orig_interval' or 'orig_interval - BATADV_JITTER'
because '%' and '*' have same precedence and associativity is
left-to-right.

This adds the parentheses at the appropriate position so that it matches
original intension.

Signed-off-by: Akinobu Mita 
Cc: Marek Lindner 
Cc: Simon Wunderlich 
Cc: Antonio Quartulli 
Cc: b.a.t.m@lists.open-mesh.org
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 net/batman-adv/bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 9f3925a..7d02ebd 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv 
*bat_priv)
unsigned int msecs;
 
msecs = atomic_read(_priv->orig_interval) - BATADV_JITTER;
-   msecs += (random32() % 2 * BATADV_JITTER);
+   msecs += random32() % (2 * BATADV_JITTER);
 
return jiffies + msecs_to_jiffies(msecs);
 }
-- 
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 17/29] mtd: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: David Woodhouse 
Cc: Artem Bityutskiy 
Cc: linux-...@lists.infradead.org
---
 drivers/mtd/nand/nandsim.c  |  6 +++---
 drivers/mtd/tests/mtd_nandecctest.c | 10 +-
 drivers/mtd/tests/mtd_stresstest.c  |  8 
 drivers/mtd/ubi/debug.h |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 818b65c..4c31798 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -1476,12 +1476,12 @@ int do_read_error(struct nandsim *ns, int num)
 
 void do_bit_flips(struct nandsim *ns, int num)
 {
-   if (bitflips && random32() < (1 << 22)) {
+   if (bitflips && prandom_u32() < (1 << 22)) {
int flips = 1;
if (bitflips > 1)
-   flips = (random32() % (int) bitflips) + 1;
+   flips = (prandom_u32() % (int) bitflips) + 1;
while (flips--) {
-   int pos = random32() % (num * 8);
+   int pos = prandom_u32() % (num * 8);
ns->buf.byte[pos / 8] ^= (1 << (pos % 8));
NS_WARN("read_page: flipping bit %d in page %d "
"reading from %d ecc: corrected=%u failed=%u\n",
diff --git a/drivers/mtd/tests/mtd_nandecctest.c 
b/drivers/mtd/tests/mtd_nandecctest.c
index ceb261f..2e6b41e 100644
--- a/drivers/mtd/tests/mtd_nandecctest.c
+++ b/drivers/mtd/tests/mtd_nandecctest.c
@@ -43,7 +43,7 @@ struct nand_ecc_test {
 static void single_bit_error_data(void *error_data, void *correct_data,
size_t size)
 {
-   unsigned int offset = random32() % (size * BITS_PER_BYTE);
+   unsigned int offset = prandom_u32() % (size * BITS_PER_BYTE);
 
memcpy(error_data, correct_data, size);
__change_bit_le(offset, error_data);
@@ -54,9 +54,9 @@ static void double_bit_error_data(void *error_data, void 
*correct_data,
 {
unsigned int offset[2];
 
-   offset[0] = random32() % (size * BITS_PER_BYTE);
+   offset[0] = prandom_u32() % (size * BITS_PER_BYTE);
do {
-   offset[1] = random32() % (size * BITS_PER_BYTE);
+   offset[1] = prandom_u32() % (size * BITS_PER_BYTE);
} while (offset[0] == offset[1]);
 
memcpy(error_data, correct_data, size);
@@ -67,7 +67,7 @@ static void double_bit_error_data(void *error_data, void 
*correct_data,
 
 static unsigned int random_ecc_bit(size_t size)
 {
-   unsigned int offset = random32() % (3 * BITS_PER_BYTE);
+   unsigned int offset = prandom_u32() % (3 * BITS_PER_BYTE);
 
if (size == 256) {
/*
@@ -75,7 +75,7 @@ static unsigned int random_ecc_bit(size_t size)
 * and 17th bit) in ECC code for 256 byte data block
 */
while (offset == 16 || offset == 17)
-   offset = random32() % (3 * BITS_PER_BYTE);
+   offset = prandom_u32() % (3 * BITS_PER_BYTE);
}
 
return offset;
diff --git a/drivers/mtd/tests/mtd_stresstest.c 
b/drivers/mtd/tests/mtd_stresstest.c
index dc89e32..4e9fc1f 100644
--- a/drivers/mtd/tests/mtd_stresstest.c
+++ b/drivers/mtd/tests/mtd_stresstest.c
@@ -57,7 +57,7 @@ static int rand_eb(void)
unsigned int eb;
 
 again:
-   eb = random32();
+   eb = prandom_u32();
/* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */
eb %= (ebcnt - 1);
if (bbt[eb])
@@ -69,7 +69,7 @@ static int rand_offs(void)
 {
unsigned int offs;
 
-   offs = random32();
+   offs = prandom_u32();
offs %= bufsize;
return offs;
 }
@@ -78,7 +78,7 @@ static int rand_len(int offs)
 {
unsigned int len;
 
-   len = random32();
+   len = prandom_u32();
len %= (bufsize - offs);
return len;
 }
@@ -148,7 +148,7 @@ static int do_write(void)
 
 static int do_operation(void)
 {
-   if (random32() & 1)
+   if (prandom_u32() & 1)
return do_read();
else
return do_write();
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 33f8f3b..cba89fc 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -86,7 +86,7 @@ static inline int ubi_dbg_is_bgt_disabled(const struct 
ubi_device *ubi)
 static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi)
 {
if (ubi->dbg.emulate_bitflips)
-   return !(random32() % 200);
+   return !(prandom_u32() % 200);
return 0;
 }
 
@@ -100,7 +100,7 @@ static inline int ubi_dbg_is_bitflip(const struct 
ubi_device *ubi)
 static inline int ubi_dbg_is_write_failure(const struct ubi_device *ubi)
 {
if (ubi->dbg.emulate_io_failures)
-   return !(random32() % 500);
+   return 

[PATCH 26/29] net/core: rename random32() and net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 net/core/neighbour.c |  4 ++--
 net/core/pktgen.c| 29 +++--
 net/core/stream.c|  2 +-
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index c815f28..6818badb 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -123,7 +123,7 @@ static void neigh_cleanup_and_release(struct neighbour 
*neigh)
 
 unsigned long neigh_rand_reach_time(unsigned long base)
 {
-   return base ? (net_random() % base) + (base >> 1) : 0;
+   return base ? (prandom_u32() % base) + (base >> 1) : 0;
 }
 EXPORT_SYMBOL(neigh_rand_reach_time);
 
@@ -1402,7 +1402,7 @@ void pneigh_enqueue(struct neigh_table *tbl, struct 
neigh_parms *p,
struct sk_buff *skb)
 {
unsigned long now = jiffies;
-   unsigned long sched_next = now + (net_random() % p->proxy_delay);
+   unsigned long sched_next = now + (prandom_u32() % p->proxy_delay);
 
if (tbl->proxy_queue.qlen > p->proxy_qlen) {
kfree_skb(skb);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b29dacf..d23ec86 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2182,7 +2182,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
pkt_dev->curfl = 0; /*reset */
}
} else {
-   flow = random32() % pkt_dev->cflows;
+   flow = prandom_u32() % pkt_dev->cflows;
pkt_dev->curfl = flow;
 
if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
@@ -2229,7 +2229,7 @@ static void set_cur_queue_map(struct pktgen_dev *pkt_dev)
else if (pkt_dev->queue_map_min <= pkt_dev->queue_map_max) {
__u16 t;
if (pkt_dev->flags & F_QUEUE_MAP_RND) {
-   t = random32() %
+   t = prandom_u32() %
(pkt_dev->queue_map_max -
 pkt_dev->queue_map_min + 1)
+ pkt_dev->queue_map_min;
@@ -2261,7 +2261,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__u32 tmp;
 
if (pkt_dev->flags & F_MACSRC_RND)
-   mc = random32() % pkt_dev->src_mac_count;
+   mc = prandom_u32() % pkt_dev->src_mac_count;
else {
mc = pkt_dev->cur_src_mac_offset++;
if (pkt_dev->cur_src_mac_offset >=
@@ -2287,7 +2287,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__u32 tmp;
 
if (pkt_dev->flags & F_MACDST_RND)
-   mc = random32() % pkt_dev->dst_mac_count;
+   mc = prandom_u32() % pkt_dev->dst_mac_count;
 
else {
mc = pkt_dev->cur_dst_mac_offset++;
@@ -2314,21 +2314,21 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
for (i = 0; i < pkt_dev->nr_labels; i++)
if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM)
pkt_dev->labels[i] = MPLS_STACK_BOTTOM |
-((__force __be32)random32() &
+((__force __be32)prandom_u32() &
  htonl(0x000f));
}
 
if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0x)) {
-   pkt_dev->vlan_id = random32() & (4096-1);
+   pkt_dev->vlan_id = prandom_u32() & (4096 - 1);
}
 
if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0x)) {
-   pkt_dev->svlan_id = random32() & (4096 - 1);
+   pkt_dev->svlan_id = prandom_u32() & (4096 - 1);
}
 
if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) {
if (pkt_dev->flags & F_UDPSRC_RND)
-   pkt_dev->cur_udp_src = random32() %
+   pkt_dev->cur_udp_src = prandom_u32() %
(pkt_dev->udp_src_max - pkt_dev->udp_src_min)
+ pkt_dev->udp_src_min;
 
@@ -2341,7 +2341,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 
if (pkt_dev->udp_dst_min < pkt_dev->udp_dst_max) {
if (pkt_dev->flags & F_UDPDST_RND) {
-   pkt_dev->cur_udp_dst = random32() %
+   pkt_dev->cur_udp_dst = prandom_u32() %
(pkt_dev->udp_dst_max - pkt_dev->udp_dst_min)
+ pkt_dev->udp_dst_min;
} else {
@@ -2358,7 +2358,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (imn < imx) {
__u32 t;
if 

[PATCH 13/29] ubifs: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Artem Bityutskiy 
Cc: Adrian Hunter 
Cc: linux-...@lists.infradead.org
---
 fs/ubifs/debug.c  |  8 
 fs/ubifs/lpt_commit.c | 14 +++---
 fs/ubifs/tnc_commit.c |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 12817ff..7f60e90 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -2459,7 +2459,7 @@ error_dump:
 
 static inline int chance(unsigned int n, unsigned int out_of)
 {
-   return !!((random32() % out_of) + 1 <= n);
+   return !!((prandom_u32() % out_of) + 1 <= n);
 
 }
 
@@ -2477,13 +2477,13 @@ static int power_cut_emulated(struct ubifs_info *c, int 
lnum, int write)
if (chance(1, 2)) {
d->pc_delay = 1;
/* Fail withing 1 minute */
-   delay = random32() % 6;
+   delay = prandom_u32() % 6;
d->pc_timeout = jiffies;
d->pc_timeout += msecs_to_jiffies(delay);
ubifs_warn("failing after %lums", delay);
} else {
d->pc_delay = 2;
-   delay = random32() % 1;
+   delay = prandom_u32() % 1;
/* Fail within 1 operations */
d->pc_cnt_max = delay;
ubifs_warn("failing after %lu calls", delay);
@@ -2563,7 +2563,7 @@ static int corrupt_data(const struct ubifs_info *c, const 
void *buf,
unsigned int from, to, ffs = chance(1, 2);
unsigned char *p = (void *)buf;
 
-   from = random32() % (len + 1);
+   from = prandom_u32() % (len + 1);
/* Corruption may only span one max. write unit */
to = min(len, ALIGN(from, c->max_write_size));
 
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 9daaeef..4b826ab 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -2007,28 +2007,28 @@ static int dbg_populate_lsave(struct ubifs_info *c)
 
if (!dbg_is_chk_gen(c))
return 0;
-   if (random32() & 3)
+   if (prandom_u32() & 3)
return 0;
 
for (i = 0; i < c->lsave_cnt; i++)
c->lsave[i] = c->main_first;
 
list_for_each_entry(lprops, >empty_list, list)
-   c->lsave[random32() % c->lsave_cnt] = lprops->lnum;
+   c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
list_for_each_entry(lprops, >freeable_list, list)
-   c->lsave[random32() % c->lsave_cnt] = lprops->lnum;
+   c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
list_for_each_entry(lprops, >frdi_idx_list, list)
-   c->lsave[random32() % c->lsave_cnt] = lprops->lnum;
+   c->lsave[prandom_u32() % c->lsave_cnt] = lprops->lnum;
 
heap = >lpt_heap[LPROPS_DIRTY_IDX - 1];
for (i = 0; i < heap->cnt; i++)
-   c->lsave[random32() % c->lsave_cnt] = heap->arr[i]->lnum;
+   c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
heap = >lpt_heap[LPROPS_DIRTY - 1];
for (i = 0; i < heap->cnt; i++)
-   c->lsave[random32() % c->lsave_cnt] = heap->arr[i]->lnum;
+   c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
heap = >lpt_heap[LPROPS_FREE - 1];
for (i = 0; i < heap->cnt; i++)
-   c->lsave[random32() % c->lsave_cnt] = heap->arr[i]->lnum;
+   c->lsave[prandom_u32() % c->lsave_cnt] = heap->arr[i]->lnum;
 
return 1;
 }
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 523bbad..52a6559 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -683,7 +683,7 @@ static int alloc_idx_lebs(struct ubifs_info *c, int cnt)
c->ilebs[c->ileb_cnt++] = lnum;
dbg_cmt("LEB %d", lnum);
}
-   if (dbg_is_chk_index(c) && !(random32() & 7))
+   if (dbg_is_chk_index(c) && !(prandom_u32() & 7))
return -ENOSPC;
return 0;
 }
-- 
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 16/29] scsi: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Robert Love 
Cc: de...@open-fcoe.org
Cc: James Smart 
Cc: Andrew Vasquez 
Cc: linux-dri...@qlogic.com
Cc: linux-s...@vger.kernel.org
---
 drivers/scsi/fcoe/fcoe_ctlr.c| 4 ++--
 drivers/scsi/lpfc/lpfc_hbadisc.c | 6 +++---
 drivers/scsi/qla2xxx/qla_attr.c  | 7 +--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 4a909d7..d870ccc 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -2153,7 +2153,7 @@ static void fcoe_ctlr_vn_restart(struct fcoe_ctlr *fip)
 
if (fip->probe_tries < FIP_VN_RLIM_COUNT) {
fip->probe_tries++;
-   wait = random32() % FIP_VN_PROBE_WAIT;
+   wait = prandom_u32() % FIP_VN_PROBE_WAIT;
} else
wait = FIP_VN_RLIM_INT;
mod_timer(>timer, jiffies + msecs_to_jiffies(wait));
@@ -2786,7 +2786,7 @@ static void fcoe_ctlr_vn_timeout(struct fcoe_ctlr *fip)
  fcoe_all_vn2vn, 0);
fip->port_ka_time = jiffies +
 msecs_to_jiffies(FIP_VN_BEACON_INT +
-   (random32() % FIP_VN_BEACON_FUZZ));
+   (prandom_u32() % FIP_VN_BEACON_FUZZ));
}
if (time_before(fip->port_ka_time, next_time))
next_time = fip->port_ka_time;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index d7096ad..bfda184 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1732,7 +1732,7 @@ lpfc_check_pending_fcoe_event(struct lpfc_hba *phba, 
uint8_t unreg_fcf)
  * use through a sequence of @fcf_cnt eligible FCF records with equal
  * probability. To perform integer manunipulation of random numbers with
  * size unit32_t, the lower 16 bits of the 32-bit random number returned
- * from random32() are taken as the random random number generated.
+ * from prandom_u32() are taken as the random random number generated.
  *
  * Returns true when outcome is for the newly read FCF record should be
  * chosen; otherwise, return false when outcome is for keeping the previously
@@ -1744,7 +1744,7 @@ lpfc_sli4_new_fcf_random_select(struct lpfc_hba *phba, 
uint32_t fcf_cnt)
uint32_t rand_num;
 
/* Get 16-bit uniform random number */
-   rand_num = (0x & random32());
+   rand_num = 0x & prandom_u32();
 
/* Decision with probability 1/fcf_cnt */
if ((fcf_cnt * rand_num) < 0x)
@@ -2380,7 +2380,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba 
*phba, LPFC_MBOXQ_t *mboxq)
phba->fcf.eligible_fcf_cnt = 1;
/* Seeding the random number generator for random selection */
seed = (uint32_t)(0x & jiffies);
-   srandom32(seed);
+   prandom_seed(seed);
}
spin_unlock_irq(>hbalock);
goto read_next_fcf;
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 83d7984..3658e9f 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1933,8 +1933,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 
/* No pending activities shall be there on the vha now */
if (ql2xextended_error_logging & ql_dbg_user)
-   msleep(random32()%10);  /* Just to see if something falls on
-   * the net we have placed below */
+   msleep(prandom_u32() % 10);
+   /*
+* Just to see if something falls on the net we have placed
+* below
+*/
 
BUG_ON(atomic_read(>vref_count));
 
-- 
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 05/29] lib/: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
---
 lib/fault-inject.c | 2 +-
 lib/list_sort.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index f7210ad..c5c7a76 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -122,7 +122,7 @@ bool should_fail(struct fault_attr *attr, ssize_t size)
return false;
}
 
-   if (attr->probability <= random32() % 100)
+   if (attr->probability <= prandom_u32() % 100)
return false;
 
if (!fail_stacktrace(attr))
diff --git a/lib/list_sort.c b/lib/list_sort.c
index d7325c6..1183fa7 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -229,7 +229,7 @@ static int __init list_sort_test(void)
goto exit;
}
 /* force some equivalencies */
-   el->value = random32() % (TEST_LIST_LEN/3);
+   el->value = prandom_u32() % (TEST_LIST_LEN / 3);
el->serial = i;
el->poison1 = TEST_POISON1;
el->poison2 = TEST_POISON2;
-- 
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 09/29] infiniband: rename random32() and net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Roland Dreier 
Cc: Sean Hefty 
Cc: Hal Rosenstock 
Cc: Steve Wise 
Cc: linux-r...@vger.kernel.org
---
 drivers/infiniband/core/cma.c   | 2 +-
 drivers/infiniband/hw/cxgb3/cxio_resource.c | 4 ++--
 drivers/infiniband/hw/cxgb4/id_table.c  | 4 ++--
 drivers/infiniband/hw/mlx4/mad.c| 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d789eea..ddeac735 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2180,7 +2180,7 @@ static int cma_alloc_any_port(struct idr *ps, struct 
rdma_id_private *id_priv)
 
inet_get_local_port_range(, );
remaining = (high - low) + 1;
-   rover = net_random() % remaining + low;
+   rover = prandom_u32() % remaining + low;
 retry:
if (last_used_port != rover &&
!idr_find(ps, (unsigned short) rover)) {
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c 
b/drivers/infiniband/hw/cxgb3/cxio_resource.c
index 31f9201..c40088e 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_resource.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c
@@ -62,13 +62,13 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo,
kfifo_in(fifo, (unsigned char *) , sizeof(u32));
if (random) {
j = 0;
-   random_bytes = random32();
+   random_bytes = prandom_u32();
for (i = 0; i < RANDOM_SIZE; i++)
rarray[i] = i + skip_low;
for (i = skip_low + RANDOM_SIZE; i < nr - skip_high; i++) {
if (j >= RANDOM_SIZE) {
j = 0;
-   random_bytes = random32();
+   random_bytes = prandom_u32();
}
idx = (random_bytes >> (j * 2)) & 0xF;
kfifo_in(fifo,
diff --git a/drivers/infiniband/hw/cxgb4/id_table.c 
b/drivers/infiniband/hw/cxgb4/id_table.c
index f95e5df..0161ae6 100644
--- a/drivers/infiniband/hw/cxgb4/id_table.c
+++ b/drivers/infiniband/hw/cxgb4/id_table.c
@@ -54,7 +54,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc)
 
if (obj < alloc->max) {
if (alloc->flags & C4IW_ID_TABLE_F_RANDOM)
-   alloc->last += random32() % RANDOM_SKIP;
+   alloc->last += prandom_u32() % RANDOM_SKIP;
else
alloc->last = obj + 1;
if (alloc->last >= alloc->max)
@@ -88,7 +88,7 @@ int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 
start, u32 num,
alloc->start = start;
alloc->flags = flags;
if (flags & C4IW_ID_TABLE_F_RANDOM)
-   alloc->last = random32() % RANDOM_SKIP;
+   alloc->last = prandom_u32() % RANDOM_SKIP;
else
alloc->last = 0;
alloc->max  = num;
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 0a903c1..b247c5b 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -93,7 +93,7 @@ static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int 
port_num,
 __be64 mlx4_ib_gen_node_guid(void)
 {
 #define NODE_GUID_HI   ((u64) (((u64)IB_OPENIB_OUI) << 40))
-   return cpu_to_be64(NODE_GUID_HI | random32());
+   return cpu_to_be64(NODE_GUID_HI | prandom_u32());
 }
 
 __be64 mlx4_ib_get_new_demux_tid(struct mlx4_ib_demux_ctx *ctx)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c 
b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 03103d2..0e0016d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -460,7 +460,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, 
struct ib_cm_event *even
goto err_qp;
}
 
-   psn = random32() & 0xff;
+   psn = prandom_u32() & 0xff;
ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn);
if (ret)
goto err_modify;
-- 
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 06/29] mm/: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: linux...@kvack.org
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index e97a0e5..3af83bf 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2044,7 +2044,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, 
int, swap_flags)
if (p->bdev) {
if (blk_queue_nonrot(bdev_get_queue(p->bdev))) {
p->flags |= SWP_SOLIDSTATE;
-   p->cluster_next = 1 + (random32() % p->highest_bit);
+   p->cluster_next = 1 + (prandom_u32() % p->highest_bit);
}
if ((swap_flags & SWAP_FLAG_DISCARD) && discard_swap(p) == 0)
p->flags |= SWP_DISCARDABLE;
-- 
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 03/29] x86: pageattr-test: remove srandom32 call

2012-12-23 Thread Akinobu Mita
pageattr-test calls srandom32() once every test iteration.
But calling srandom32() after late_initcalls is not meaningfull.
Because the random states for random32() is mixed by good random numbers
in late_initcall prandom_reseed().

So this removes the call to srandom32().

Signed-off-by: Akinobu Mita 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: "H. Peter Anvin" 
Cc: x...@kernel.org
---
 arch/x86/mm/pageattr-test.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index b008656..8b8c381 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -130,7 +130,6 @@ static int pageattr_test(void)
}
 
failed += print_split();
-   srandom32(100);
 
for (i = 0; i < NTEST; i++) {
unsigned long pfn = random32() % max_pfn_mapped;
-- 
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 10/29] mmc: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Chris Ball 
Cc: linux-...@vger.kernel.org
---
 drivers/mmc/core/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index aaed768..4b05da5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -120,8 +120,8 @@ static void mmc_should_fail_request(struct mmc_host *host,
!should_fail(>fail_mmc_request, data->blksz * data->blocks))
return;
 
-   data->error = data_errors[random32() % ARRAY_SIZE(data_errors)];
-   data->bytes_xfered = (random32() % (data->bytes_xfered >> 9)) << 9;
+   data->error = data_errors[prandom_u32() % ARRAY_SIZE(data_errors)];
+   data->bytes_xfered = (prandom_u32() % (data->bytes_xfered >> 9)) << 9;
 }
 
 #else /* CONFIG_FAIL_MMC_REQUEST */
-- 
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 23/29] net/ipv4: rename net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 net/ipv4/devinet.c  | 2 +-
 net/ipv4/igmp.c | 6 +++---
 net/ipv4/inet_connection_sock.c | 2 +-
 net/ipv4/udp.c  | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cc06a47..e849a5e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -453,7 +453,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct 
nlmsghdr *nlh,
}
 
if (!(ifa->ifa_flags & IFA_F_SECONDARY)) {
-   net_srandom(ifa->ifa_local);
+   prandom_seed((__force u32)ifa->ifa_local);
ifap = last_primary;
}
 
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 736ab70..8506a7c 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -186,7 +186,7 @@ static void igmp_stop_timer(struct ip_mc_list *im)
 /* It must be called with locked im->lock */
 static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
 {
-   int tv = net_random() % max_delay;
+   int tv = prandom_u32() % max_delay;
 
im->tm_running = 1;
if (!mod_timer(>timer, jiffies+tv+2))
@@ -195,7 +195,7 @@ static void igmp_start_timer(struct ip_mc_list *im, int 
max_delay)
 
 static void igmp_gq_start_timer(struct in_device *in_dev)
 {
-   int tv = net_random() % in_dev->mr_maxdelay;
+   int tv = prandom_u32() % in_dev->mr_maxdelay;
 
in_dev->mr_gq_running = 1;
if (!mod_timer(_dev->mr_gq_timer, jiffies+tv+2))
@@ -204,7 +204,7 @@ static void igmp_gq_start_timer(struct in_device *in_dev)
 
 static void igmp_ifc_start_timer(struct in_device *in_dev, int delay)
 {
-   int tv = net_random() % delay;
+   int tv = prandom_u32() % delay;
 
if (!mod_timer(_dev->mr_ifc_timer, jiffies+tv+2))
in_dev_hold(in_dev);
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index d0670f0..f43fc82 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -114,7 +114,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
 again:
inet_get_local_port_range(, );
remaining = (high - low) + 1;
-   smallest_rover = rover = net_random() % remaining + low;
+   smallest_rover = rover = prandom_u32() % remaining + low;
 
smallest_size = -1;
do {
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 79c8dbe..ca6cfbb 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -215,7 +215,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
inet_get_local_port_range(, );
remaining = (high - low) + 1;
 
-   rand = net_random();
+   rand = prandom_u32();
first = (((u64)rand * remaining) >> 32) + low;
/*
 * force rand to be an odd multiple of UDP_HTABLE_SIZE
-- 
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 22/29] net/sched: rename random32() and net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Stephen Hemminger 
Cc: Jamal Hadi Salim 
Cc: "David S. Miller" 
Cc: ne...@lists.linux-foundation.org
Cc: net...@vger.kernel.org
Cc: net...@vger.kernel.org
---
 net/sched/act_gact.c |  2 +-
 net/sched/sch_choke.c|  2 +-
 net/sched/sch_fq_codel.c |  2 +-
 net/sched/sch_netem.c| 19 ++-
 net/sched/sch_sfb.c  |  4 ++--
 net/sched/sch_sfq.c  |  6 +++---
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 05d60859..d3ceed8 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -37,7 +37,7 @@ static struct tcf_hashinfo gact_hash_info = {
 #ifdef CONFIG_GACT_PROB
 static int gact_net_rand(struct tcf_gact *gact)
 {
-   if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
+   if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval)
return gact->tcf_action;
return gact->tcfg_paction;
 }
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index cc37dd5..ef53ab8 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -80,7 +80,7 @@ struct choke_sched_data {
 /* deliver a random number between 0 and N - 1 */
 static u32 random_N(unsigned int N)
 {
-   return reciprocal_divide(random32(), N);
+   return reciprocal_divide(prandom_u32(), N);
 }
 
 /* number of elements in queue including holes */
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 4e606fc..93d7f41 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -390,7 +390,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr 
*opt)
sch->limit = 10*1024;
q->flows_cnt = 1024;
q->quantum = psched_mtu(qdisc_dev(sch));
-   q->perturbation = net_random();
+   q->perturbation = prandom_u32();
INIT_LIST_HEAD(>new_flows);
INIT_LIST_HEAD(>old_flows);
codel_params_init(>cparams);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 298c0dd..e3126e2 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -142,7 +142,7 @@ static inline struct netem_skb_cb *netem_skb_cb(struct 
sk_buff *skb)
 static void init_crandom(struct crndstate *state, unsigned long rho)
 {
state->rho = rho;
-   state->last = net_random();
+   state->last = prandom_u32();
 }
 
 /* get_crandom - correlated random number generator
@@ -155,9 +155,9 @@ static u32 get_crandom(struct crndstate *state)
unsigned long answer;
 
if (state->rho == 0)/* no correlation */
-   return net_random();
+   return prandom_u32();
 
-   value = net_random();
+   value = prandom_u32();
rho = (u64)state->rho + 1;
answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32;
state->last = answer;
@@ -171,7 +171,7 @@ static u32 get_crandom(struct crndstate *state)
 static bool loss_4state(struct netem_sched_data *q)
 {
struct clgstate *clg = >clg;
-   u32 rnd = net_random();
+   u32 rnd = prandom_u32();
 
/*
 * Makes a comparison between rnd and the transition
@@ -238,14 +238,14 @@ static bool loss_gilb_ell(struct netem_sched_data *q)
 
switch (clg->state) {
case 1:
-   if (net_random() < clg->a1)
+   if (prandom_u32() < clg->a1)
clg->state = 2;
-   if (net_random() < clg->a4)
+   if (prandom_u32() < clg->a4)
return true;
case 2:
-   if (net_random() < clg->a2)
+   if (prandom_u32() < clg->a2)
clg->state = 1;
-   if (clg->a3 > net_random())
+   if (clg->a3 > prandom_u32())
return true;
}
 
@@ -415,7 +415,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc 
*sch)
 skb_checksum_help(skb)))
return qdisc_drop(skb, sch);
 
-   skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() 
% 8);
+   skb->data[prandom_u32() % skb_headlen(skb)] ^=
+   1 << (prandom_u32() % 8);
}
 
if (unlikely(skb_queue_len(>q) >= sch->limit))
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 30ea467..9b0f709 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -220,7 +220,7 @@ static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, 
const struct sfb_sched_da
 
 static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q)
 {
-   q->bins[slot].perturbation = net_random();
+   q->bins[slot].perturbation = prandom_u32();
 }
 
 static void sfb_swap_slot(struct sfb_sched_data *q)
@@ -381,7 +381,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc 
*sch)
goto enqueue;
}
 
-   r = net_random() & SFB_MAX_PROB;
+   r = 

[PATCH 12/29] xfs: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Ben Myers 
Cc: Alex Elder 
Cc: x...@oss.sgi.com
---
 fs/xfs/xfs_alloc.c  | 2 +-
 fs/xfs/xfs_error.c  | 2 +-
 fs/xfs/xfs_ialloc.c | 2 +-
 fs/xfs/xfs_log.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 393055f..d2dd19d 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -842,7 +842,7 @@ xfs_alloc_ag_vextent_near(
 */
int dofirst;/* set to do first algorithm */
 
-   dofirst = random32() & 1;
+   dofirst = prandom_u32() & 1;
 #endif
 
 restart:
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 6104560..07bf3b9 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -66,7 +66,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
int i;
int64_t fsid;
 
-   if (random32() % randfactor)
+   if (prandom_u32() % randfactor)
return 0;
 
memcpy(, fsidp, sizeof(xfs_fsid_t));
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index a815412..6c75865 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -373,7 +373,7 @@ xfs_ialloc_ag_alloc(
 * number from being easily guessable.
 */
error = xfs_ialloc_inode_init(args.mp, tp, agno, args.agbno,
-   args.len, random32());
+   args.len, prandom_u32());
 
if (error)
return error;
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 46bd9d5..92e036b 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3485,7 +3485,7 @@ xlog_ticket_alloc(
tic->t_curr_res = unit_bytes;
tic->t_cnt  = cnt;
tic->t_ocnt = cnt;
-   tic->t_tid  = random32();
+   tic->t_tid  = prandom_u32();
tic->t_clientid = client;
tic->t_flags= XLOG_TIC_INITED;
tic->t_trans_type   = 0;
-- 
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 15/29] lguest: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Rusty Russell 
Cc: lgu...@lists.ozlabs.org
---
 drivers/lguest/page_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 3b62be16..864baab 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -686,7 +686,7 @@ static unsigned int new_pgdir(struct lg_cpu *cpu,
 * We pick one entry at random to throw out.  Choosing the Least
 * Recently Used might be better, but this is easy.
 */
-   next = random32() % ARRAY_SIZE(cpu->lg->pgdirs);
+   next = prandom_u32() % ARRAY_SIZE(cpu->lg->pgdirs);
/* If it's never been allocated at all before, try now. */
if (!cpu->lg->pgdirs[next].pgdir) {
cpu->lg->pgdirs[next].pgdir =
-- 
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 20/29] batman-adv: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Marek Lindner 
Cc: Simon Wunderlich 
Cc: Antonio Quartulli 
Cc: b.a.t.m@lists.open-mesh.org
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 net/batman-adv/bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 7d02ebd..bc434c4 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv 
*bat_priv)
unsigned int msecs;
 
msecs = atomic_read(_priv->orig_interval) - BATADV_JITTER;
-   msecs += random32() % (2 * BATADV_JITTER);
+   msecs += prandom_u32() % (2 * BATADV_JITTER);
 
return jiffies + msecs_to_jiffies(msecs);
 }
@@ -131,7 +131,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv 
*bat_priv)
 /* when do we schedule a ogm packet to be sent */
 static unsigned long batadv_iv_ogm_fwd_send_time(void)
 {
-   return jiffies + msecs_to_jiffies(random32() % (BATADV_JITTER / 2));
+   return jiffies + msecs_to_jiffies(prandom_u32() % (BATADV_JITTER / 2));
 }
 
 /* apply hop penalty for a normal link */
-- 
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 24/29] net/ipv6: rename net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 net/ipv6/addrconf.c  | 4 ++--
 net/ipv6/ip6_flowlabel.c | 2 +-
 net/ipv6/mcast.c | 8 
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 408cac4a..314b134 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3038,7 +3038,7 @@ static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
if (ifp->flags & IFA_F_OPTIMISTIC)
rand_num = 0;
else
-   rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
+   rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
 
ifp->probes = idev->cnf.dad_transmits;
addrconf_mod_timer(ifp, AC_DAD, rand_num);
@@ -3051,7 +3051,7 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp)
 
addrconf_join_solict(dev, >addr);
 
-   net_srandom(ifp->addr.s6_addr32[3]);
+   prandom_seed((__force u32)ifp->addr.s6_addr32[3]);
 
read_lock_bh(>lock);
spin_lock(>lock);
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 29124b7..313f8bf 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -191,7 +191,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net,
write_lock_bh(_fl_lock);
if (label == 0) {
for (;;) {
-   fl->label = htonl(net_random())_FLOWLABEL_MASK;
+   fl->label = htonl(prandom_u32()) & IPV6_FLOWLABEL_MASK;
if (fl->label) {
lfl = __fl_lookup(net, fl->label);
if (lfl == NULL)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 28dfa5f..71af892 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1006,7 +1006,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const 
struct in6_addr *group,
 
 static void mld_gq_start_timer(struct inet6_dev *idev)
 {
-   int tv = net_random() % idev->mc_maxdelay;
+   int tv = prandom_u32() % idev->mc_maxdelay;
 
idev->mc_gq_running = 1;
if (!mod_timer(>mc_gq_timer, jiffies+tv+2))
@@ -1015,7 +1015,7 @@ static void mld_gq_start_timer(struct inet6_dev *idev)
 
 static void mld_ifc_start_timer(struct inet6_dev *idev, int delay)
 {
-   int tv = net_random() % delay;
+   int tv = prandom_u32() % delay;
 
if (!mod_timer(>mc_ifc_timer, jiffies+tv+2))
in6_dev_hold(idev);
@@ -1041,7 +1041,7 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, 
unsigned long resptime)
 
if (delay >= resptime) {
if (resptime)
-   delay = net_random() % resptime;
+   delay = prandom_u32() % resptime;
else
delay = 1;
}
@@ -2102,7 +2102,7 @@ static void igmp6_join_group(struct ifmcaddr6 *ma)
 
igmp6_send(>mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT);
 
-   delay = net_random() % IGMP6_UNSOLICITED_IVAL;
+   delay = prandom_u32() % IGMP6_UNSOLICITED_IVAL;
 
spin_lock_bh(>mca_lock);
if (del_timer(>mca_timer)) {
-- 
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 04/29] x86: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: "H. Peter Anvin" 
Cc: x...@kernel.org
---
 arch/x86/mm/pageattr-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 8b8c381..9346108 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -132,10 +132,10 @@ static int pageattr_test(void)
failed += print_split();
 
for (i = 0; i < NTEST; i++) {
-   unsigned long pfn = random32() % max_pfn_mapped;
+   unsigned long pfn = prandom_u32() % max_pfn_mapped;
 
addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT);
-   len[i] = random32() % 100;
+   len[i] = prandom_u32() % 100;
len[i] = min_t(unsigned long, len[i], max_pfn_mapped - pfn - 1);
 
if (len[i] == 0)
-- 
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 07/29] kernel/: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
---
 kernel/rcutree.c  | 2 +-
 kernel/test_kprobes.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index e441b77..5b88db8 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1206,7 +1206,7 @@ static int rcu_gp_init(struct rcu_state *rsp)
rnp->grphi, rnp->qsmask);
raw_spin_unlock_irq(>lock);
 #ifdef CONFIG_PROVE_RCU_DELAY
-   if ((random32() % (rcu_num_nodes * 8)) == 0)
+   if ((prandom_u32() % (rcu_num_nodes * 8)) == 0)
schedule_timeout_uninterruptible(2);
 #endif /* #ifdef CONFIG_PROVE_RCU_DELAY */
cond_resched();
diff --git a/kernel/test_kprobes.c b/kernel/test_kprobes.c
index f8b11a2..12d6ebb 100644
--- a/kernel/test_kprobes.c
+++ b/kernel/test_kprobes.c
@@ -365,7 +365,7 @@ int init_test_probes(void)
target2 = kprobe_target2;
 
do {
-   rand1 = random32();
+   rand1 = prandom_u32();
} while (rand1 <= div_factor);
 
printk(KERN_INFO "Kprobe smoke test started\n");
-- 
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 28/29] net/: rename net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Jesse Gross 
Cc: Venkat Venkatsubra 
Cc: Vlad Yasevich 
Cc: Sridhar Samudrala 
Cc: Neil Horman 
Cc: Steffen Klassert 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-s...@vger.kernel.org
Cc: d...@openvswitch.org
Cc: net...@vger.kernel.org
---
 include/net/red.h | 2 +-
 net/802/garp.c| 2 +-
 net/openvswitch/actions.c | 2 +-
 net/rds/bind.c| 2 +-
 net/sctp/socket.c | 2 +-
 net/xfrm/xfrm_state.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/net/red.h b/include/net/red.h
index ef46058..168bb2f 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -303,7 +303,7 @@ static inline unsigned long red_calc_qavg(const struct 
red_parms *p,
 
 static inline u32 red_random(const struct red_parms *p)
 {
-   return reciprocal_divide(net_random(), p->max_P_reciprocal);
+   return reciprocal_divide(prandom_u32(), p->max_P_reciprocal);
 }
 
 static inline int red_mark_probability(const struct red_parms *p,
diff --git a/net/802/garp.c b/net/802/garp.c
index 8456f5d..cf7410d 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
 {
unsigned long delay;
 
-   delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32;
+   delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
mod_timer(>join_timer, jiffies + delay);
 }
 
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index ac2defe..257bc36 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -404,7 +404,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
 a = nla_next(a, )) {
switch (nla_type(a)) {
case OVS_SAMPLE_ATTR_PROBABILITY:
-   if (net_random() >= nla_get_u32(a))
+   if (prandom_u32() >= nla_get_u32(a))
return 0;
break;
 
diff --git a/net/rds/bind.c b/net/rds/bind.c
index 637bde5..7f95f4b 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -118,7 +118,7 @@ static int rds_add_bound(struct rds_sock *rs, __be32 addr, 
__be16 *port)
rover = be16_to_cpu(*port);
last = rover;
} else {
-   rover = max_t(u16, net_random(), 2);
+   rover = max_t(u16, prandom_u32(), 2);
last = rover - 1;
}
 
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9e65758..95860aa 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5899,7 +5899,7 @@ static long sctp_get_port_local(struct sock *sk, union 
sctp_addr *addr)
 
inet_get_local_port_range(, );
remaining = (high - low) + 1;
-   rover = net_random() % remaining + low;
+   rover = prandom_u32() % remaining + low;
 
do {
rover++;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 3459692..35ddaab 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1546,7 +1546,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 
high)
} else {
u32 spi = 0;
for (h=0; hid.daddr, 
htonl(spi), x->id.proto, x->props.family);
if (x0 == NULL) {
x->id.spi = htonl(spi);
-- 
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 29/29] remove unused net_random(), net_srandom(), random32(), and srandom32()

2012-12-23 Thread Akinobu Mita
After finishing a naming transition, remove unused backward
compatibility wrapper macros

Signed-off-by: Akinobu Mita 
Cc: "Theodore Ts'o" 
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 include/linux/net.h| 3 ---
 include/linux/random.h | 7 ---
 2 files changed, 10 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index aa16731..937e2bf 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -240,9 +240,6 @@ do {
\
 #define net_dbg_ratelimited(fmt, ...)  \
net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
 
-#define net_random()   random32()
-#define net_srandom(seed)  srandom32((__force u32)seed)
-
 extern int  kernel_sendmsg(struct socket *sock, struct msghdr *msg,
struct kvec *vec, size_t num, size_t len);
 extern int  kernel_recvmsg(struct socket *sock, struct msghdr *msg,
diff --git a/include/linux/random.h b/include/linux/random.h
index d984608..2ae2840 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -29,13 +29,6 @@ u32 prandom_u32(void);
 void prandom_bytes(void *buf, int nbytes);
 void prandom_seed(u32 seed);
 
-/*
- * These macros are preserved for backward compatibility and should be
- * removed as soon as a transition is finished.
- */
-#define random32() prandom_u32()
-#define srandom32(seed) prandom_seed(seed)
-
 u32 prandom_u32_state(struct rnd_state *);
 void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
 
-- 
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 21/29] net/sunrpc: rename random32() and net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: "J. Bruce Fields" 
Cc: Trond Myklebust 
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
 net/sunrpc/cache.c  | 2 +-
 net/sunrpc/xprt.c   | 2 +-
 net/sunrpc/xprtsock.c   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c 
b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 107c452..daf301f 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -130,8 +130,8 @@ gss_krb5_make_confounder(char *p, u32 conflen)
 
/* initialize to random value */
if (i == 0) {
-   i = random32();
-   i = (i << 32) | random32();
+   i = prandom_u32();
+   i = (i << 32) | prandom_u32();
}
 
switch (conflen) {
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9afa439..0f85674 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -629,7 +629,7 @@ static void cache_limit_defers(void)
 
/* Consider removing either the first or the last */
if (cache_defer_cnt > DFR_MAX) {
-   if (net_random() & 1)
+   if (prandom_u32() & 1)
discard = list_entry(cache_defer_list.next,
 struct cache_deferred_req, recent);
else
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index bd462a5..0b51154 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1109,7 +1109,7 @@ static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
 
 static inline void xprt_init_xid(struct rpc_xprt *xprt)
 {
-   xprt->xid = net_random();
+   xprt->xid = prandom_u32();
 }
 
 static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 68b0a81..3b126ae 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1654,7 +1654,7 @@ static void xs_udp_timer(struct rpc_task *task)
 static unsigned short xs_get_random_port(void)
 {
unsigned short range = xprt_max_resvport - xprt_min_resvport;
-   unsigned short rand = (unsigned short) net_random() % range;
+   unsigned short rand = (unsigned short) prandom_u32() % range;
return rand + xprt_min_resvport;
 }
 
-- 
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 25/29] net/netfilter: rename random32() and net_random() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Pablo Neira Ayuso 
Cc: Patrick McHardy 
Cc: netfilter-de...@vger.kernel.org
Cc: netfil...@vger.kernel.org
Cc: coret...@netfilter.org
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 net/netfilter/ipvs/ip_vs_conn.c   | 2 +-
 net/netfilter/nf_conntrack_core.c | 4 ++--
 net/netfilter/xt_statistic.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 30e764a..870dff6 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1200,7 +1200,7 @@ void ip_vs_random_dropentry(struct net *net)
 * Randomly scan 1/32 of the whole table every second
 */
for (idx = 0; idx < (ip_vs_conn_tab_size>>5); idx++) {
-   unsigned int hash = net_random() & ip_vs_conn_tab_mask;
+   unsigned int hash = prandom_u32() & ip_vs_conn_tab_mask;
struct hlist_node *n;
 
/*
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 08cdc71..a8f5c7a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -263,7 +263,7 @@ static void death_by_event(unsigned long ul_conntrack)
if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) {
/* bad luck, let's retry again */
ecache->timeout.expires = jiffies +
-   (random32() % net->ct.sysctl_events_retry_timeout);
+   (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(>timeout);
return;
}
@@ -282,7 +282,7 @@ void nf_ct_dying_timeout(struct nf_conn *ct)
/* set a new timer to retry event delivery */
setup_timer(>timeout, death_by_event, (unsigned long)ct);
ecache->timeout.expires = jiffies +
-   (random32() % net->ct.sysctl_events_retry_timeout);
+   (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(>timeout);
 }
 EXPORT_SYMBOL_GPL(nf_ct_dying_timeout);
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c
index 4fe4fb4..11de55e 100644
--- a/net/netfilter/xt_statistic.c
+++ b/net/netfilter/xt_statistic.c
@@ -37,7 +37,7 @@ statistic_mt(const struct sk_buff *skb, struct 
xt_action_param *par)
 
switch (info->mode) {
case XT_STATISTIC_MODE_RANDOM:
-   if ((net_random() & 0x7FFF) < info->u.random.probability)
+   if ((prandom_u32() & 0x7FFF) < info->u.random.probability)
ret = !ret;
break;
case XT_STATISTIC_MODE_NTH:
-- 
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 27/29] net/core: remove duplicate statements by do-while loop

2012-12-23 Thread Akinobu Mita
Remove duplicate statements by using do-while loop instead of while loop.

- A;
- while (e) {
+ do {
A;
- }
+ } while (e);

Signed-off-by: Akinobu Mita 
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 net/core/pktgen.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d23ec86..48a3a29 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2379,18 +2379,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__be32 s;
if (pkt_dev->flags & F_IPDST_RND) {
 
-   t = prandom_u32() % (imx - imn) + imn;
-   s = htonl(t);
-
-   while (ipv4_is_loopback(s) ||
-  ipv4_is_multicast(s) ||
-  ipv4_is_lbcast(s) ||
-  ipv4_is_zeronet(s) ||
-  ipv4_is_local_multicast(s)) {
+   do {
t = prandom_u32() %
(imx - imn) + imn;
s = htonl(t);
-   }
+   } while (ipv4_is_loopback(s) ||
+   ipv4_is_multicast(s) ||
+   ipv4_is_lbcast(s) ||
+   ipv4_is_zeronet(s) ||
+   ipv4_is_local_multicast(s));
pkt_dev->cur_daddr = s;
} else {
t = ntohl(pkt_dev->cur_daddr);
-- 
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 11/29] video/uvesafb: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: Michal Januszewski 
Cc: Florian Tobias Schandinat 
Cc: linux-fb...@vger.kernel.org
---
 drivers/video/uvesafb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 2f8f82d..d120b11 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -166,7 +166,7 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
memcpy(>id, _cn_id, sizeof(m->id));
m->seq = seq;
m->len = len;
-   m->ack = random32();
+   m->ack = prandom_u32();
 
/* uvesafb_task structure */
memcpy(m + 1, >t, sizeof(task->t));
-- 
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 14/29] uwb: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: linux-...@vger.kernel.org
---
 drivers/uwb/rsv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/uwb/rsv.c b/drivers/uwb/rsv.c
index 0b0d8bc..f4ae05f 100644
--- a/drivers/uwb/rsv.c
+++ b/drivers/uwb/rsv.c
@@ -231,7 +231,7 @@ void uwb_rsv_backoff_win_increment(struct uwb_rc *rc)
return;
 
bow->window <<= 1;
-   bow->n = random32() & (bow->window - 1);
+   bow->n = prandom_u32() & (bow->window - 1);
dev_dbg(dev, "new_window=%d, n=%d\n: ", bow->window, bow->n);
 
/* reset the timer associated variables */
@@ -557,7 +557,7 @@ int uwb_rsv_establish(struct uwb_rsv *rsv)
if (ret)
goto out;
 
-   rsv->tiebreaker = random32() & 1;
+   rsv->tiebreaker = prandom_u32() & 1;
/* get available mas bitmap */
uwb_drp_available(rc, );
 
-- 
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 08/29] drbd: rename random32() to prandom_u32()

2012-12-23 Thread Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita 
Cc: drbd-...@lists.linbit.com
Cc: Jens Axboe 
---
 drivers/block/drbd/drbd_receiver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index a9eccfc..83c5ae0 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -757,7 +757,8 @@ static struct socket *drbd_wait_for_connect(struct 
drbd_tconn *tconn, struct acc
rcu_read_unlock();
 
timeo = connect_int * HZ;
-   timeo += (random32() & 1) ? timeo / 7 : -timeo / 7; /* 28.5% random 
jitter */
+   /* 28.5% random jitter */
+   timeo += (prandom_u32() & 1) ? timeo / 7 : -timeo / 7;
 
err = wait_for_completion_interruptible_timeout(>door_bell, timeo);
if (err <= 0)
@@ -953,7 +954,7 @@ retry:
conn_warn(tconn, "Error receiving initial 
packet\n");
sock_release(s);
 randomize:
-   if (random32() & 1)
+   if (prandom_u32() & 1)
goto retry;
}
}
-- 
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 02/29] uuid: use prandom_bytes()

2012-12-23 Thread Akinobu Mita
Use prandom_bytes() to generate 16 bytes of pseudo-random bytes.

Signed-off-by: Akinobu Mita 
Cc: "Theodore Ts'o" 
Cc: Huang Ying 
---
 lib/uuid.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/uuid.c b/lib/uuid.c
index 52a6fe6..398821e 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -25,13 +25,7 @@
 
 static void __uuid_gen_common(__u8 b[16])
 {
-   int i;
-   u32 r;
-
-   for (i = 0; i < 4; i++) {
-   r = random32();
-   memcpy(b + i * 4, , 4);
-   }
+   prandom_bytes(b, 16);
/* reversion 0b10 */
b[8] = (b[8] & 0x3F) | 0x80;
 }
-- 
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 01/29] raid6test: use prandom_bytes()

2012-12-23 Thread Akinobu Mita
Use prandom_bytes() to generate random bytes for test data.

Signed-off-by: Akinobu Mita 
Cc: Dan Williams 
Cc: Vinod Koul 
---
 crypto/async_tx/raid6test.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/crypto/async_tx/raid6test.c b/crypto/async_tx/raid6test.c
index aa2b027..4a92bac 100644
--- a/crypto/async_tx/raid6test.c
+++ b/crypto/async_tx/raid6test.c
@@ -46,15 +46,10 @@ static void callback(void *param)
 
 static void makedata(int disks)
 {
-   int i, j;
+   int i;
 
for (i = 0; i < disks; i++) {
-   for (j = 0; j < PAGE_SIZE/sizeof(u32); j += sizeof(u32)) {
-   u32 *p = page_address(data[i]) + j;
-
-   *p = random32();
-   }
-
+   prandom_bytes(page_address(data[i]), PAGE_SIZE);
dataptrs[i] = data[i];
}
 }
-- 
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 00/29] rename random32 and net_random to prandom

2012-12-23 Thread Akinobu Mita
Commit 496f2f93b1cc286f5a4f4f9acdc1e5314978683f ("random32: rename random32
to prandom") renamed random32() and srandom32() to prandom_u32() and
prandom_seed() respectively.  Due to the volume of existing random32()
callers, they were preserved as backword compatibility wrapper macros.

This patch series aims for finishing the naming transition and removing
the backword compatibility wrapper macros.

The naming transition is mainly simple substitution work for random32()
and srandom32().  Furthermore, net_random() and net_srandom() are another
wrapper macros for random32() and srandom32().  They also should be
renamed to prandom_* while I'm at it.

This patch series also includes minor cleanup and bugfix which were found
while I was working on the substitution.

Akinobu Mita (29):
  raid6test: use prandom_bytes()
  uuid: use prandom_bytes()
  x86: pageattr-test: remove srandom32 call
  x86: rename random32() to prandom_u32()
  lib/: rename random32() to prandom_u32()
  mm/: rename random32() to prandom_u32()
  kernel/: rename random32() to prandom_u32()
  drbd: rename random32() to prandom_u32()
  infiniband: rename random32() and net_random() to prandom_u32()
  mmc: rename random32() to prandom_u32()
  video/uvesafb: rename random32() to prandom_u32()
  xfs: rename random32() to prandom_u32()
  ubifs: rename random32() to prandom_u32()
  uwb: rename random32() to prandom_u32()
  lguest: rename random32() to prandom_u32()
  scsi: rename random32() to prandom_u32()
  mtd: rename random32() to prandom_u32()
  drivers/net: rename random32() to prandom_u32()
  batman-adv: fix random jitter calculation
  batman-adv: rename random32() to prandom_u32()
  net/sunrpc: rename random32() and net_random() to prandom_u32()
  net/sched: rename random32() and net_random() to prandom_u32()
  net/ipv4: rename net_random() to prandom_u32()
  net/ipv6: rename net_random() to prandom_u32()
  net/netfilter: rename random32() and net_random() to prandom_u32()
  net/core:  rename random32() and net_random() to prandom_u32()
  net/core: remove duplicate statements by do-while loop
  net/: rename net_random() to prandom_u32()
  remove unused net_random(), net_srandom(), random32(), and
srandom32()

 arch/x86/mm/pageattr-test.c |  5 ++--
 crypto/async_tx/raid6test.c |  9 ++-
 drivers/block/drbd/drbd_receiver.c  |  5 ++--
 drivers/infiniband/core/cma.c   |  2 +-
 drivers/infiniband/hw/cxgb3/cxio_resource.c |  4 +--
 drivers/infiniband/hw/cxgb4/id_table.c  |  4 +--
 drivers/infiniband/hw/mlx4/mad.c|  2 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c |  2 +-
 drivers/lguest/page_tables.c|  2 +-
 drivers/mmc/core/core.c |  4 +--
 drivers/mtd/nand/nandsim.c  |  6 ++---
 drivers/mtd/tests/mtd_nandecctest.c | 10 +++
 drivers/mtd/tests/mtd_stresstest.c  |  8 +++---
 drivers/mtd/ubi/debug.h |  6 ++---
 drivers/net/ethernet/broadcom/cnic.c|  4 +--
 drivers/net/hamradio/baycom_epp.c   |  2 +-
 drivers/net/hamradio/hdlcdrv.c  |  2 +-
 drivers/net/hamradio/yam.c  |  2 +-
 drivers/net/wireless/mwifiex/cfg80211.c |  4 +--
 drivers/scsi/fcoe/fcoe_ctlr.c   |  4 +--
 drivers/scsi/lpfc/lpfc_hbadisc.c|  6 ++---
 drivers/scsi/qla2xxx/qla_attr.c |  7 +++--
 drivers/uwb/rsv.c   |  4 +--
 drivers/video/uvesafb.c |  2 +-
 fs/ubifs/debug.c|  8 +++---
 fs/ubifs/lpt_commit.c   | 14 +-
 fs/ubifs/tnc_commit.c   |  2 +-
 fs/xfs/xfs_alloc.c  |  2 +-
 fs/xfs/xfs_error.c  |  2 +-
 fs/xfs/xfs_ialloc.c |  2 +-
 fs/xfs/xfs_log.c|  2 +-
 include/linux/net.h |  3 ---
 include/linux/random.h  |  7 -
 include/net/red.h   |  2 +-
 kernel/rcutree.c|  2 +-
 kernel/test_kprobes.c   |  2 +-
 lib/fault-inject.c  |  2 +-
 lib/list_sort.c |  2 +-
 lib/uuid.c  |  8 +-
 mm/swapfile.c   |  2 +-
 net/802/garp.c  |  2 +-
 net/batman-adv/bat_iv_ogm.c |  4 +--
 net/core/neighbour.c|  4 +--
 net/core/pktgen.c   | 42 ++---
 net/core/stream.c   |  2 +-
 net/ipv4/devinet.c  |  2 +-
 net/ipv4/igmp.c |  6 ++---
 net/ipv4/inet_connection_sock.c |  2 +-
 net/ipv4/udp.c  |  2 +-
 net/ipv6/addrconf.c |  4 +--
 net/ipv6/ip6_flowlabel.c 

linux-next: manual merge of the akpm tree with the driver-core.current tree

2012-12-23 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm tree got a conflict in
drivers/rtc/rtc-tegra.c between commit 9889589ba308 ("Drivers: rtc:
remove __dev* attributes") from the driver-core.current tree and commit
"drivers/rtc/rtc-tegra.c: convert to DT driver" from the akpm tree.

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

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

diff --cc drivers/rtc/rtc-tegra.c
index 5ba2f75,fb62808..000
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@@ -303,7 -303,13 +303,13 @@@ static struct rtc_class_ops tegra_rtc_o
.alarm_irq_enable = tegra_rtc_alarm_irq_enable,
  };
  
+ static const struct of_device_id tegra_rtc_dt_match[] = {
+   { .compatible = "nvidia,tegra20-rtc", },
+   {}
+ };
+ MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match);
+ 
 -static int __devinit tegra_rtc_probe(struct platform_device *pdev)
 +static int tegra_rtc_probe(struct platform_device *pdev)
  {
struct tegra_rtc_info *info;
struct resource *res;


pgpaTj7RqibdA.pgp
Description: PGP signature


RE: mvsas regression since 3.5

2012-12-23 Thread Jack Wang


[Jack Wang] 
Do you see bug51881, which may relate to what you see
https://bugzilla.kernel.org/show_bug.cgi?id=51881

btw: also correct Dan's mail address.


I'm using Asus PIKE 6480 SAS card, whose chipset is "RAID bus
controller: Marvell Technology Group Ltd. MV64460/64461/64462 System 
Controller, Revision B", with latest stable branch 3.7.1 only 1 of 8 ports 
works, to get others works I got to pull & plug back. While with
3.5.7 it's all good, so it must be a regression.

Here's corresponding boot time dmesg of 3.7.1 with debug compiled:

[5.967302] udevd[1212]: starting version 171
[6.568908] mvsas :04:00.0: mvsas: driver version 0.8.16
[6.569431] mvsas :04:00.0: mvsas: PCI-E x4, Bandwidth Usage: 2.5 Gbps
[   10.980331] drivers/scsi/mvsas/mv_sas.c 1174:phy 0 attach dev info is 0
[   10.980334] drivers/scsi/mvsas/mv_sas.c 1176:phy 0 attach sas addr is 0
[   11.180909] drivers/scsi/mvsas/mv_sas.c 1174:phy 1 attach dev info is 0
[   11.180912] drivers/scsi/mvsas/mv_sas.c 1176:phy 1 attach sas addr is 1
[   11.381501] drivers/scsi/mvsas/mv_sas.c 1174:phy 2 attach dev info is 0
[   11.381503] drivers/scsi/mvsas/mv_sas.c 1176:phy 2 attach sas addr is 2
[   11.582085] drivers/scsi/mvsas/mv_sas.c 1174:phy 3 attach dev info is 0
[   11.582088] drivers/scsi/mvsas/mv_sas.c 1176:phy 3 attach sas addr is 3
[   11.782673] drivers/scsi/mvsas/mv_sas.c 1174:phy 4 attach dev info is 0
[   11.782676] drivers/scsi/mvsas/mv_sas.c 1176:phy 4 attach sas addr is 4
[   11.983262] drivers/scsi/mvsas/mv_sas.c 1174:phy 5 attach dev info is 800
[   11.983265] drivers/scsi/mvsas/mv_sas.c 1176:phy 5 attach sas addr is 5
[   12.183856] drivers/scsi/mvsas/mv_sas.c 1174:phy 6 attach dev info is 4
[   12.183858] drivers/scsi/mvsas/mv_sas.c 1176:phy 6 attach sas addr is 6
[   12.384438] drivers/scsi/mvsas/mv_sas.c 1174:phy 7 attach dev info is 0
[   12.384441] drivers/scsi/mvsas/mv_sas.c 1176:phy 7 attach sas addr is 7
[   12.384447] scsi6 : mvsas
[   12.385479] drivers/scsi/mvsas/mv_sas.c 277:phy 0 byte dmaded.
[   12.385482] drivers/scsi/mvsas/mv_sas.c 277:phy 1 byte dmaded.
[   12.385488] drivers/scsi/mvsas/mv_sas.c 277:phy 2 byte dmaded.
[   12.385491] drivers/scsi/mvsas/mv_sas.c 277:phy 3 byte dmaded.
[   12.385494] drivers/scsi/mvsas/mv_sas.c 277:phy 4 byte dmaded.
[   12.385497] drivers/scsi/mvsas/mv_sas.c 277:phy 5 byte dmaded.
[   12.385500] drivers/scsi/mvsas/mv_sas.c 277:phy 6 byte dmaded.
[   12.385503] drivers/scsi/mvsas/mv_sas.c 277:phy 7 byte dmaded.
[   12.385614] sas: phy-6:0 added to port-6:0, phy_mask:0x1 (   0)
[   12.385667] sas: phy-6:1 added to port-6:1, phy_mask:0x2 ( 100)
[   12.385716] sas: phy-6:2 added to port-6:2, phy_mask:0x4 ( 200)
[   12.385759] sas: phy-6:3 added to port-6:3, phy_mask:0x8 ( 300)
[   12.385801] sas: phy-6:4 added to port-6:4, phy_mask:0x10 ( 400)
[   12.385851] sas: phy-6:5 added to port-6:5, phy_mask:0x20 ( 500)
[   12.385895] sas: phy-6:6 added to port-6:6, phy_mask:0x40 ( 600)
[   12.385942] sas: phy-6:7 added to port-6:7, phy_mask:0x80 ( 700)
[   12.385967] sas: DOING DISCOVERY on port 0, pid:847
[   12.385974] sas: DONE DISCOVERY on port 0, pid:847, result:0
[   12.385986] sas: DOING DISCOVERY on port 1, pid:847
[   12.385991] sas: DONE DISCOVERY on port 1, pid:847, result:0
[   12.386003] sas: DOING DISCOVERY on port 2, pid:847
[   12.386009] sas: DONE DISCOVERY on port 2, pid:847, result:0
[   12.386020] sas: DOING DISCOVERY on port 3, pid:847
[   12.386029] sas: DONE DISCOVERY on port 3, pid:847, result:0
[   12.386041] sas: DOING DISCOVERY on port 4, pid:847
[   12.386048] sas: DONE DISCOVERY on port 4, pid:847, result:0
[   12.386060] sas: DOING DISCOVERY on port 5, pid:847
[   12.386066] sas: DONE DISCOVERY on port 5, pid:847, result:0
[   12.386077] sas: DOING DISCOVERY on port 6, pid:847
[   12.386083] sas: DONE DISCOVERY on port 6, pid:847, result:0
[   12.386095] sas: DOING DISCOVERY on port 7, pid:847
[   12.386101] sas: DONE DISCOVERY on port 7, pid:847, result:0
[   12.386188] sas: Enter sas_scsi_recover_host busy: 0 failed: 0
[   12.386281] sas: ata7: end_device-6:0: dev error handler
[   12.537987] ata7.00: ATA-8: ST33000650NS, 0004, max UDMA/133
[   12.537992] ata7.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   12.538227] drivers/scsi/mvsas/mv_sas.c 1857:port 0 slot 0 rx_desc
2 has error info8100.
[   12.538256] ata7.00: failed to get Identify Device Data, Emask 0x1
[   12.539467] drivers/scsi/mvsas/mv_sas.c 1857:port 0 slot 0 rx_desc
2 has error info8100.
[   12.539496] ata7.00: failed to get Identify Device Data, Emask 0x1
[   12.539504] ata7.00: configured for UDMA/133
[   12.539611] sas: --- Exit sas_scsi_recover_host: busy: 0 failed: 0 tries: 1
[   12.550707] scsi 6:0:0:0: Direct-Access ATA  ST33000650NS
  0004 PQ: 0 ANSI: 5
[   12.550800] sas: Enter sas_scsi_recover_host busy: 0 failed: 0
[   

[PATCH 1/1] linux/audit.h: move ptrace.h include to kernel header

2012-12-23 Thread Mike Frysinger
While the kernel internals want pt_regs (and so it includes
linux/ptrace.h), the user version of audit.h does not need
it.  So move the include out of the uapi version.

This avoids issues where people want the audit defines and
userland ptrace api.  Including both the kernel ptrace and
the userland ptrace headers can easily lead to failure.

Signed-off-by: Mike Frysinger 
---
 include/linux/audit.h  | 1 +
 include/uapi/linux/audit.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index bce729a..9929785 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -24,6 +24,7 @@
 #define _LINUX_AUDIT_H_
 
 #include 
+#include 
 #include 
 
 struct audit_sig_info {
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 76352ac..ab8663f 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -26,7 +26,6 @@
 
 #include 
 #include 
-#include 
 
 /* The netlink messages for the audit system is divided into blocks:
  * 1000 - 1099 are for commanding the audit system
-- 
1.8.0

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


linux-next: manual merge of the pinctrl tree with the driver-core.current tree

2012-12-23 Thread Stephen Rothwell
Hi Linus,

Today's linux-next merge of the pinctrl tree got a conflict in
drivers/pinctrl/pinctrl-sirf.c between commit c2c57b329c7b ("Drivers:
pinctrl: remove __dev* attributes") from the driver-core.current tree and
commit 19d601d8e0a7 ("pinctrl: sirf: enable GPIO pullup/down
configuration from dts") from the pinctrl tree.

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

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff --cc drivers/pinctrl/pinctrl-sirf.c
index c776046,30e1a38..000
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@@ -1663,7 -1663,45 +1663,45 @@@ const struct irq_domain_ops sirfsoc_gpi
.xlate = irq_domain_xlate_twocell,
  };
  
+ static void sirfsoc_gpio_set_pullup(const u32 *pullups)
+ {
+   int i, n;
+   const unsigned long *p = (const unsigned long *)pullups;
+ 
+   for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
+   n = find_first_bit(p + i, BITS_PER_LONG);
+   while (n < BITS_PER_LONG) {
+   u32 offset = SIRFSOC_GPIO_CTRL(i, n);
+   u32 val = readl(sgpio_bank[i].chip.regs + offset);
+   val |= SIRFSOC_GPIO_CTL_PULL_MASK;
+   val |= SIRFSOC_GPIO_CTL_PULL_HIGH;
+   writel(val, sgpio_bank[i].chip.regs + offset);
+ 
+   n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
+   }
+   }
+ }
+ 
+ static void sirfsoc_gpio_set_pulldown(const u32 *pulldowns)
+ {
+   int i, n;
+   const unsigned long *p = (const unsigned long *)pulldowns;
+ 
+   for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
+   n = find_first_bit(p + i, BITS_PER_LONG);
+   while (n < BITS_PER_LONG) {
+   u32 offset = SIRFSOC_GPIO_CTRL(i, n);
+   u32 val = readl(sgpio_bank[i].chip.regs + offset);
+   val |= SIRFSOC_GPIO_CTL_PULL_MASK;
+   val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH;
+   writel(val, sgpio_bank[i].chip.regs + offset);
+ 
+   n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
+   }
+   }
+ }
+ 
 -static int __devinit sirfsoc_gpio_probe(struct device_node *np)
 +static int sirfsoc_gpio_probe(struct device_node *np)
  {
int i, err = 0;
struct sirfsoc_gpio_bank *bank;


pgpVojbTA6Cpb.pgp
Description: PGP signature


RE: [PATCH] mmc:core:if detect mmc card remove,don't wait for req done

2012-12-23 Thread zhenpeng.qian
OK, Thanks .

Brs,
Qian Zhenpeng


-Original Message-
From: Chris Ball [mailto:c...@laptop.org] 
Sent: 2012年12月22日 5:32
To: Linus Torvalds
Cc: Qian Zhenpeng; Greg KH; Linux Kernel Mailing List; Linux Driver Project; 
linux-...@vger.kernel.org
Subject: Re: [PATCH] mmc:core:if detect mmc card remove,don't wait for req done

Hi,

On Thu, Dec 20 2012, Linus Torvalds wrote:
> On Thu, Dec 20, 2012 at 1:32 AM,   wrote:
>>
>> I find a bug about mmc/core/core.c, and send you a patch 
>> which I fix this bug.
>>
>> In fact, the bug is a low probability of occurrence.
>>
>> Hope you help me to analyze it and discuss with me.
>
> I've added the proper people - Chris Ball and linux-mmc - to the 
> participants list.
>
> I also wanted to check with you: the commit message implies that this 
> can cause an IO timeout and then a call to
> msmsdcc_start_command_deferred() with a NULL cmd->mrq. Which I assume 
> results in a NULL pointer dereference and Oops, but that wasn't 
> spelled out.
>
> Chris, please give it a look, and perhaps edit the commit message a bit.

Thanks, I've queued the patch for 3.8.  I edited the commit message and 
modified the patch: adding a check in the host driver to avoid any other blind 
dereferences of cmd->mrq, and skipping the unnecessary assignment to "err".  
Here's the updated patch -- Qian, does it look okay to you?

- Chris.


From: Zhenpeng Qian 
Date: Thu, 20 Dec 2012 16:20:12 +0800
Subject: [PATCH] mmc: core: If card was removed, don't wait for request to  
finish.

mmc_wait_for_req() calls __mmc_start_req().  If __mmc_start_req() detects that 
the card's been removed, it will return -ENOMEDIUM and not wait for the request 
to be finished.  In this way, it can reduce io_schedule once.

And if io_schedule times out and mmc_card_remove() fails, it will call
host->ops->request (sometimes this occurs by insmod and rmmod fast), 
host->ops->then
will get through to msmsdcc_start_command_deferred() finally.  cmd->mrq will be 
NULL -- it's created in mmc_start_request() -- and a NULL deref of 
cmd->mrq->stop will result.

This was seen in msm_sdcc.c, which dereferenced cmd->mrq blindly; also add a 
check to that host driver to stop this happening again in other potential cases.

10 [] (__dabt_svc) from []
11 [] (msmsdcc_start_command_deferred) from []
12 [] (msmsdcc_start_command) from []
13 [] (msmsdcc_request) from []
14 [] (mmc_wait_for_req_done) from []
15 [] (mmc_wait_for_cmd) from []
16 [] (get_card_status) from []
17 [] (mmc_blk_err_check) from []
18 [] (mmc_start_req) from []
19 [] (mmc_blk_issue_rw_rq) from []
20 [] (mmc_blk_issue_rq) from []
21 [] (mmc_queue_thread) from []
22 [] (kthread) from []

Signed-off-by: Zhenpeng Qian 
[cjb: Rewrite commit message, add msm_sdcc.c test]
Signed-off-by: Chris Ball 
---
 drivers/mmc/core/core.c |5 +++--
 drivers/mmc/host/msm_sdcc.c |4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 
aaed768..87edbc0 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -470,8 +470,9 @@ EXPORT_SYMBOL(mmc_start_req);
  */
 void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)  {
-   __mmc_start_req(host, mrq);
-   mmc_wait_for_req_done(host, mrq);
+   /* If the card's been removed, don't wait for the request. */
+   if (!__mmc_start_req(host, mrq))
+   mmc_wait_for_req_done(host, mrq);
 }
 EXPORT_SYMBOL(mmc_wait_for_req);
 
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 
7c0af0e..056ccd0 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -468,7 +468,7 @@ msmsdcc_start_command_deferred(struct msmsdcc_host *host,
host->prog_enable = true;
}
 
-   if (cmd == cmd->mrq->stop)
+   if (cmd->mrq && (cmd == cmd->mrq->stop))
*c |= MCI_CSPM_MCIABORT;
 
if (snoop_cccr_abort(cmd))
@@ -559,7 +559,7 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct 
mmc_data *data,  static void  msmsdcc_start_command(struct msmsdcc_host *host, 
struct mmc_command *cmd, u32 c)  {
-   if (cmd == cmd->mrq->stop)
+   if (cmd->mrq && (cmd == cmd->mrq->stop))
c |= MCI_CSPM_MCIABORT;
 
host->stats.cmds++;
-- 
Chris Ball  
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/2] regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations

2012-12-23 Thread Axel Lin
Signed-off-by: Axel Lin 
---
 drivers/regulator/88pm8607.c |   38 ++
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 5c4879a..a957e8c 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -30,8 +30,6 @@ struct pm8607_regulator_info {
unsigned int*vol_table;
unsigned int*vol_suspend;
 
-   int update_reg;
-   int update_bit;
int slope_double;
 };
 
@@ -222,30 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, 
unsigned index)
return ret;
 }
 
-static int pm8607_set_voltage_sel(struct regulator_dev *rdev, unsigned 
selector)
-{
-   struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
-   uint8_t val;
-   int ret;
-
-   val = (uint8_t)(selector << (ffs(rdev->desc->vsel_mask) - 1));
-
-   ret = pm860x_set_bits(info->i2c, rdev->desc->vsel_reg,
- rdev->desc->vsel_mask, val);
-   if (ret)
-   return ret;
-   switch (info->desc.id) {
-   case PM8607_ID_BUCK1:
-   case PM8607_ID_BUCK2:
-   case PM8607_ID_BUCK3:
-   ret = pm860x_set_bits(info->i2c, info->update_reg,
- 1 << info->update_bit,
- 1 << info->update_bit);
-   break;
-   }
-   return ret;
-}
-
 static int pm8606_preg_enable(struct regulator_dev *rdev)
 {
struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
@@ -277,7 +251,7 @@ static int pm8606_preg_is_enabled(struct regulator_dev 
*rdev)
 
 static struct regulator_ops pm8607_regulator_ops = {
.list_voltage   = pm8607_list_voltage,
-   .set_voltage_sel = pm8607_set_voltage_sel,
+   .set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@@ -314,11 +288,11 @@ static struct regulator_ops pm8606_preg_ops = {
.n_voltages = ARRAY_SIZE(vreg##_table), \
.vsel_reg = PM8607_##vreg,  \
.vsel_mask = ARRAY_SIZE(vreg##_table) - 1,  \
+   .apply_reg = PM8607_##ureg, \
+   .apply_bit = (ubit),\
.enable_reg = PM8607_##ereg,\
.enable_mask = 1 << (ebit), \
},  \
-   .update_reg = PM8607_##ureg,\
-   .update_bit = (ubit),   \
.slope_double   = (0),  \
.vol_table  = (unsigned int *)##_table,\
.vol_suspend= (unsigned int *)##_suspend_table,\
@@ -344,9 +318,9 @@ static struct regulator_ops pm8606_preg_ops = {
 }
 
 static struct pm8607_regulator_info pm8607_regulator_info[] = {
-   PM8607_DVC(BUCK1, GO, 0, SUPPLIES_EN11, 0),
-   PM8607_DVC(BUCK2, GO, 1, SUPPLIES_EN11, 1),
-   PM8607_DVC(BUCK3, GO, 2, SUPPLIES_EN11, 2),
+   PM8607_DVC(BUCK1, GO, BIT(0), SUPPLIES_EN11, 0),
+   PM8607_DVC(BUCK2, GO, BIT(1), SUPPLIES_EN11, 1),
+   PM8607_DVC(BUCK3, GO, BIT(2), SUPPLIES_EN11, 2),
 
PM8607_LDO(1, LDO1, 0, SUPPLIES_EN11, 3),
PM8607_LDO(2, LDO2, 0, SUPPLIES_EN11, 4),
-- 
1.7.9.5



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


[PATCH 1/2] [PATCH] regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel

2012-12-23 Thread Axel Lin
BUCK2 has the update_bit setting, but current code does not set update_bit
in pm8607_set_voltage_sel.

Signed-off-by: Axel Lin 
---
hi Haojian,
I prefer no behavior change during API conversion.
So I send this fix first, next patch is on top of this patch.

Regards,
Axel
 drivers/regulator/88pm8607.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 2b55711..5c4879a 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -236,6 +236,7 @@ static int pm8607_set_voltage_sel(struct regulator_dev 
*rdev, unsigned selector)
return ret;
switch (info->desc.id) {
case PM8607_ID_BUCK1:
+   case PM8607_ID_BUCK2:
case PM8607_ID_BUCK3:
ret = pm860x_set_bits(info->i2c, info->update_reg,
  1 << info->update_bit,
-- 
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/


linux-next: manual merge of the slave-dma tree with the driver-core.current tree

2012-12-23 Thread Stephen Rothwell
Hi Vinod,

Today's linux-next merge of the slave-dma tree got a conflict in
drivers/dma/ioat/dma_v3.c between commit b9016739011f ("Drivers: dma:
remove __dev* attributes") from the driver-core.current tree and commit
370e97b07d80 ("ioat: Add alignment workaround for IVB platforms") from
the slave-dma tree.

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

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

diff --cc drivers/dma/ioat/dma_v3.c
index e5fc944,e52cf1e..000
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@@ -1187,7 -1224,27 +1224,27 @@@ static bool is_snb_ioat(struct pci_dev 
}
  }
  
+ static bool is_ivb_ioat(struct pci_dev *pdev)
+ {
+   switch (pdev->device) {
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB0:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB1:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB2:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB3:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB4:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB5:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB6:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB7:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB8:
+   case PCI_DEVICE_ID_INTEL_IOAT_IVB9:
+   return true;
+   default:
+   return false;
+   }
+ 
+ }
+ 
 -int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
 +int ioat3_dma_probe(struct ioatdma_device *device, int dca)
  {
struct pci_dev *pdev = device->pdev;
int dca_en = system_has_dca_enabled(pdev);


pgpr3fr6Tn1Tj.pgp
Description: PGP signature


Re: [ANNOUNCE] 3.7-nohz1

2012-12-23 Thread Frederic Weisbecker
2012/12/21 Steven Rostedt :
> On Thu, 2012-12-20 at 19:32 +0100, Frederic Weisbecker wrote:
>> Let's imagine you have 4 CPUs. We keep the CPU 0 to offline RCU callbacks 
>> there and to
>> handle the timekeeping. We set the rest as full dynticks. So you need the 
>> following kernel
>> parameters:
>>
>>   rcu_nocbs=1-3 full_nohz=1-3
>>
>> (Note rcu_nocbs value must always be the same as full_nohz).
>
> Why? You can't have: rcu_nocbs=1-4 full_nohz=1-3

That should be allowed.

>   or: rcu_nocbs=1-3 full_nohz=1-4 ?

But that not.

You need to have: rcu_nocbs & full_nohz == full_nohz. This is because
the tick is not there to maintain the local RCU callbacks anymore. So
this must be offloaded to the rcu_nocb threads.

I just have a doubt with rcu_nocb. Do we still need the tick to
complete the grace period for local rcu callbacks? I need to discuss
that with Paul.

>
> That needs to be fixed. Either with a warning, and/or to force the two
> to be the same. That is, if they specify:
>
>   rcu_nocbs=1-3 full_nohz=1-4
>
> Then set rcu_nocbs=1-4 with a warning about it. Or simply set
>  full_nohz=1-3.

Yep, will do.

Thanks!

>
> -- Steve
>
>>
>> Now if you want proper isolation you need to:
>>
>> * Migrate your processes adequately
>> * Migrate your irqs to CPU 0
>> * Migrate the RCU nocb threads to CPU 0. Example with the above 
>> configuration:
>>
>>   for p in $(ps -o pid= -C rcuo1,rcuo2,rcuo3)
>>   do
>>   taskset -cp 0 $p
>>   done
>>
>> Then run what you want on the full dynticks CPUs. For best results, run 1 
>> task
>> per CPU, mostly in userspace and mostly CPU bound (otherwise more IO = more 
>> kernel
>> mode execution = more chances to get IPIs, tick restarted, workqueues, 
>> kthreads, etc...)
>>
>> This page contains a good reminder for those interested in CPU isolation: 
>> https://github.com/gby/linux/wiki
>>
>> But keep in mind that my tree is not yet ready for serious production.
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] ACPI / power: Remove useless message from device registering routine

2012-12-23 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

After commit 71fbad6 (PCI/ACPI: Notify PCI devices when their power
resource is turned on) made acpi_pci_bind() call
acpi_power_resource_register_device(), the debug message at the end
of the latter appears in the kernel log for every PCI device that
doesn't happen to have power resources assigned (which is the vast
majority of them).  However, this message is totally useless, because
it doesn't even say which device it is about.  Moreover, it is
misleading, because it only means that the given device has no power
resources, which isn't exceptional at all.

Remove that useless message altogether and simplify
acpi_power_resource_register_device() slightly.

Signed-off-by: Rafael J. Wysocki 
---
 drivers/acpi/power.c |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

Index: linux/drivers/acpi/power.c
===
--- linux.orig/drivers/acpi/power.c
+++ linux/drivers/acpi/power.c
@@ -445,11 +445,8 @@ int acpi_power_resource_register_device(
return -ENODEV;
 
ret = acpi_bus_get_device(handle, _dev);
-   if (ret)
-   goto no_power_resource;
-
-   if (!acpi_dev->power.flags.power_resources)
-   goto no_power_resource;
+   if (ret || !acpi_dev->power.flags.power_resources)
+   return -ENODEV;
 
powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL);
if (!powered_device)
@@ -471,10 +468,6 @@ int acpi_power_resource_register_device(
}
 
return ret;
-
-no_power_resource:
-   printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!\n");
-   return -ENODEV;
 }
 EXPORT_SYMBOL_GPL(acpi_power_resource_register_device);
 

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


Re: [2.6.32.y, 2.6.34.y] Re: [PATCH] x86: Don't use the EFI reboot method by default

2012-12-23 Thread Willy Tarreau
On Sun, Dec 23, 2012 at 09:11:36PM +, Ben Hutchings wrote:
(...)
> In 2.6.32 the relevant code is in arch/x86/kernel/efi.c.  With the
> filename changed, the patch applies cleanly and works for me.

OK, thanks Ben, I had not looked at it yet.

Best regards,
Willy

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


Re: linux-next: manual merge of the driver-core.current tree with Linus' tree

2012-12-23 Thread Greg KH
On Mon, Dec 24, 2012 at 09:56:14AM +1100, Stephen Rothwell wrote:
> Hi Greg,
> 
> On Mon, 24 Dec 2012 09:52:00 +1100 Stephen Rothwell  
> wrote:
> >
> > Today's linux-next merge of the driver-core.current tree got conflicts
> > in 21 files in drivers/i2c between commit 0b255e927d47 ("i2c: remove
> > __dev* attributes from subsystem") from Linus' tree and commit
> > eeb30d064414 ("Drivers: i2c: remove __dev* attributes") from the
> > driver-core.current tree.
> > 
> > I fixed it up (taking a mixture of both commits) and can carry the fix as
> > necessary (no action is required).
> 
> BTW, Greg, the patch in your tree to drivers/i2c/busses/i2c-au1550.c is
> incorrect and would not build.

Ugh, that's a horrible merge error on my part, thanks for pointing it
out.  My 'make allmodconfig' doesn't happen to build that module.

And sorry about the merge issues, I wasn't aware that Wolfram was going
to be sending these to Linus after 3.8-rc1 was out, sorry about that.
The merge issues are due to me trying to get the coding style correct,
which Bill's sed script didn't always do.

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: [PATCH] mm: compare MIGRATE_ISOLATE selectively

2012-12-23 Thread Minchan Kim
On Fri, Dec 21, 2012 at 01:46:23PM +0100, Michal Nazarewicz wrote:
> > On Thu, Dec 20, 2012 at 04:49:44PM +0100, Michal Nazarewicz wrote:
> >> Perhaps “is_migrate_isolate” to match already existing “is_migrate_cma”?
> 
> On Fri, Dec 21 2012, Minchan Kim wrote:
> > Good poking. In fact, while I made this patch, I was very tempted by 
> > renaming
> > is_migrate_cma to cma_pageblock.
> >
> > is_migrate_cma(mt)
> >
> > I don't know who start to use "mt" instead of "migratetype" but anyway, it's
> > not a good idea.
> >
> > is_migrate_cma(migratetype)
> >
> > It's very clear for me because migratetype is per pageblock, we can know the
> > function works per pageblock unit.
> >
> >> Especially as the “mt_isolated_pageblock” sound confusing to me, it
> >> implies that it works on pageblocks which it does not.
> >
> > -ENOPARSE.
> >
> > migratetype works on pageblock.
> 
> migratetype is a number, which can be assigned to a pageblock.  In some
> transitional cases, the migratetype associated with a page can differ
> from the migratetype associated with the pageblock the page is in.  As
> such, I think it's confusing to add “pageblock” to the name of the
> function which does not read migratetype from pageblock but rather
> operates on the number it is provided.

Fair enough.

> 
> > I admit mt is really dirty but I used page_alloc.c already has lots of
> > mt, SIGH.
> 
> I don't really have an issue with “mt” myself, especially since the few
> times “mt” is used in page_alloc.c it is a local variable which I don't
> think needs a long descriptive name since context is all there.
> 
> > How about this?
> >
> > 1. Let's change all "mt" with "migratetype" again.
> > 2. use is_migrate_isolate and is_migrate_cma for "migratetype".
> > 3. use is_migrate_isolate_page instead of page_isolated_pageblock for
> >"page".
> 
> Like I've said.  Personally I don't really think 1 is needed, but 2 and
> 3 look good to me.

Okay. It would be a first patch in New Year.
Thanks for the review, Michal.

> 
> -- 
> Best regards, _ _
> .o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
> ..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
> ooo +--ooO--(_)--Ooo--





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


Re: Linux 3.8-rc1 - another regression on USB :-(

2012-12-23 Thread Greg Kroah-Hartman
On Sun, Dec 23, 2012 at 02:35:49PM -0800, Linus Torvalds wrote:
> Woody,
>  Any chance you can bisect this? It's not going to be hugely pleasant
> (with 11k+ commits in between 3.7 and 3.8-rc1 you'll have to compile
> and test at least 14 kernels), but it would help enormously. Of
> course, maybe some USB person can guess what would cause the device to
> go offline..
> 
> Added Greg and the linux-usb mailing list to the participants list:
> the images are in the original email on lkml, but there isn't anything
> particularly interesting there, it really just seems to be an
> unexpected and spurious USB disconnect, resulting in "USB disconnect,
> device number 2" followed by "Rejecting I/O to offline device".

I don't see any images on lkml, sorry.

The kernel log for when the disconnect happened would be great to get.

The kernel can't cause a device to disconnect, that's an electrical
thing usually, is this perchance a flaky device/connection?  Or has it
always worked on older kernels?

What host controller is being used here (xhci, ehci, etc.?)

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: [GIT PULL] perf changes for v3.8

2012-12-23 Thread David Ahern

On 12/23/12 2:23 AM, Gleb Natapov wrote:

Your patch alone was not enough. Start here:
  https://lkml.org/lkml/2012/7/12/3


I cannot reproduce this failure. I reverted 20b279ddb38c and ran "perf
record -e cycles:ppG" while guest was running. Admittedly I ran the test
for a short time, but without disabling PEBS during the guest entry this
was enough to crash a guest.


In the beginning (without any patches) VMs crashed fairly quickly. With 
your patch it took longer, but I was able to consistently crash VMs. The 
thread notes server info (processor, OS) and VM versions as well as load 
used for the tests -- a cpu bound process (openssl), disk bound (dd) and 
network (netperf).




What about forcing exclude_guest on an event that
has precise flag set without reporting error to userspace?


That's up to the perf maintainers -- Ingo, Peter, Arnaldo. Personally, I 
don't like it since kernel side is changing the user request.


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: [RFC PATCH 3/3] x86,smp: auto tune spinlock backoff delay factor

2012-12-23 Thread Rafael Aquini
On Fri, Dec 21, 2012 at 10:58:48PM -0500, Rik van Riel wrote:
> On 12/21/2012 10:49 PM, Steven Rostedt wrote:
> >On Fri, Dec 21, 2012 at 09:51:35PM -0500, Rik van Riel wrote:
> 
> >>However, since spinlock contention should not be the
> >>usual state, and all a scalable lock does is make sure
> >>that N+1 CPUs does not perform worse than N CPUs, using
> >>scalable locks is a stop-gap measure.
> >>
> >>I believe a stop-gap measure should be kept as simple as
> >>we can. I am willing to consider moving to a per-lock
> >>delay factor if we can figure out an easy way to do it,
> >>but I would like to avoid too much extra complexity...
> >
> >Rik,
> >
> >I like your solution. It's rather simple and simple solutions tend to
> >end up being the closest to optimal. The more complex a solution gets,
> >the more it starts chasing fireflies.
> 
> >Anyway, I'd like to see this code tested, and more benchmarks run
> >against it.
> 
> Absolutely.  I would love to see if this code actually
> causes regressions anywhere.
> 
> It is simple enough that I suspect it will not, but there
> really is only one way to find out.
> 
> The more people test this with different workloads on
> different SMP systems, the better.
>

Great work Rik,

I have a couple of small SMP systems I'll start to test with your patches, also
I might be able to test this work after new year's eve on a big SMP box that 
seems to be facing a severe lock starvation issue due to the BUS saturation 
your work is aiming to reduce.

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


Re: linux-next: manual merge of the driver-core.current tree with Linus' tree

2012-12-23 Thread Stephen Rothwell
Hi Greg,

On Mon, 24 Dec 2012 09:52:00 +1100 Stephen Rothwell  
wrote:
>
> Today's linux-next merge of the driver-core.current tree got conflicts
> in 21 files in drivers/i2c between commit 0b255e927d47 ("i2c: remove
> __dev* attributes from subsystem") from Linus' tree and commit
> eeb30d064414 ("Drivers: i2c: remove __dev* attributes") from the
> driver-core.current tree.
> 
> I fixed it up (taking a mixture of both commits) and can carry the fix as
> necessary (no action is required).

BTW, Greg, the patch in your tree to drivers/i2c/busses/i2c-au1550.c is
incorrect and would not build.

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


pgpBxlIhE6NVN.pgp
Description: PGP signature


Re: [RFC PATCH 2/3] x86,smp: proportional backoff for ticket spinlocks

2012-12-23 Thread Rafael Aquini
On Fri, Dec 21, 2012 at 06:51:15PM -0500, Rik van Riel wrote:
> Subject: x86,smp: proportional backoff for ticket spinlocks
> 
> Simple fixed value proportional backoff for ticket spinlocks.
> By pounding on the cacheline with the spin lock less often,
> bus traffic is reduced. In cases of a data structure with
> embedded spinlock, the lock holder has a better chance of
> making progress.
> 
> Signed-off-by: Rik van Riel 
> ---

Reviewed-by: Rafael Aquini 

>  arch/x86/kernel/smp.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
> index 20da354..4e44840 100644
> --- a/arch/x86/kernel/smp.c
> +++ b/arch/x86/kernel/smp.c
> @@ -118,9 +118,11 @@ static bool smp_no_nmi_ipi = false;
>  void ticket_spin_lock_wait(arch_spinlock_t *lock, struct __raw_tickets inc)
>  {
>   for (;;) {
> - cpu_relax();
> - inc.head = ACCESS_ONCE(lock->tickets.head);
> + int loops = 50 * (__ticket_t)(inc.tail - inc.head);
> + while (loops--)
> + cpu_relax();
>  
> + inc.head = ACCESS_ONCE(lock->tickets.head);
>   if (inc.head == inc.tail)
>   break;
>   }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the driver-core.current tree with Linus' tree

2012-12-23 Thread Stephen Rothwell
Hi Greg,

Today's linux-next merge of the driver-core.current tree got conflicts
in 21 files in drivers/i2c between commit 0b255e927d47 ("i2c: remove
__dev* attributes from subsystem") from Linus' tree and commit
eeb30d064414 ("Drivers: i2c: remove __dev* attributes") from the
driver-core.current tree.

I fixed it up (taking a mixture of both commits) and can carry the fix as
necessary (no action is required).

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


pgp8rPrxgYNe1.pgp
Description: PGP signature


Re: [RFC PATCH 1/3] x86,smp: move waiting on contended lock out of line

2012-12-23 Thread Rafael Aquini
On Fri, Dec 21, 2012 at 06:50:38PM -0500, Rik van Riel wrote:
> Subject: x86,smp: move waiting on contended ticket lock out of line
> 
> Moving the wait loop for congested loops to its own function allows
> us to add things to that wait loop, without growing the size of the
> kernel text appreciably.
> 
> Signed-off-by: Rik van Riel 
> ---

Reviewed-by: Rafael Aquini 


>  arch/x86/include/asm/spinlock.h |   13 +++--
>  arch/x86/kernel/smp.c   |   14 ++
>  2 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
> index 33692ea..2a45eb0 100644
> --- a/arch/x86/include/asm/spinlock.h
> +++ b/arch/x86/include/asm/spinlock.h
> @@ -34,6 +34,8 @@
>  # define UNLOCK_LOCK_PREFIX
>  #endif
>  
> +extern void ticket_spin_lock_wait(arch_spinlock_t *, struct __raw_tickets);
> +
>  /*
>   * Ticket locks are conceptually two parts, one indicating the current head 
> of
>   * the queue, and the other indicating the current tail. The lock is acquired
> @@ -53,12 +55,11 @@ static __always_inline void 
> __ticket_spin_lock(arch_spinlock_t *lock)
>  
>   inc = xadd(>tickets, inc);
>  
> - for (;;) {
> - if (inc.head == inc.tail)
> - break;
> - cpu_relax();
> - inc.head = ACCESS_ONCE(lock->tickets.head);
> - }
> + if (inc.head == inc.tail)
> + goto out;
> +
> + ticket_spin_lock_wait(lock, inc);
> + out:
>   barrier();  /* make sure nothing creeps before the lock is 
> taken */
>  }
>  
> diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
> index 48d2b7d..20da354 100644
> --- a/arch/x86/kernel/smp.c
> +++ b/arch/x86/kernel/smp.c
> @@ -113,6 +113,20 @@ static atomic_t stopping_cpu = ATOMIC_INIT(-1);
>  static bool smp_no_nmi_ipi = false;
>  
>  /*
> + * Wait on a congested ticket spinlock.
> + */
> +void ticket_spin_lock_wait(arch_spinlock_t *lock, struct __raw_tickets inc)
> +{
> + for (;;) {
> + cpu_relax();
> + inc.head = ACCESS_ONCE(lock->tickets.head);
> +
> + if (inc.head == inc.tail)
> + break;
> + }
> +}
> +
> +/*
>   * this function sends a 'reschedule' IPI to another CPU.
>   * it goes straight through and wastes no time serializing
>   * anything. Worst case is that we lose a reschedule ...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Linux 3.8-rc1 - another regression on USB :-(

2012-12-23 Thread Linus Torvalds
Woody,
 Any chance you can bisect this? It's not going to be hugely pleasant
(with 11k+ commits in between 3.7 and 3.8-rc1 you'll have to compile
and test at least 14 kernels), but it would help enormously. Of
course, maybe some USB person can guess what would cause the device to
go offline..

Added Greg and the linux-usb mailing list to the participants list:
the images are in the original email on lkml, but there isn't anything
particularly interesting there, it really just seems to be an
unexpected and spurious USB disconnect, resulting in "USB disconnect,
device number 2" followed by "Rejecting I/O to offline device".

  Linus

On Sun, Dec 23, 2012 at 12:08 PM, Woody Suwalski  wrote:
> I see a regression with USB subsystem when reading from a USB key.
> I have a live squashfs image, which suddenly has stopped working.
> It seems that USB prints this sequence:
>
> rejecting I/O to offline device
> killing request
> Unhandled error code
>
> I could not safe an actual dmesg - USB was dead...
> So I attach snapshots in place...
>
> The same squashfs seems OK with 3.7.1
> The same squashfs seems OK when run from ATAPIIX with 3.8-rc1
> So it looks like USB...
>
> Woody
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Regression w/ patch] Media commit causes user space to misbahave (was: Re: Linux 3.8-rc1)

2012-12-23 Thread Linus Torvalds
On Sun, Dec 23, 2012 at 12:21 PM, Mauro Carvalho Chehab
 wrote:
>
> Agreed: ENOENT was a bad choice, and it should be reverted.

Well, *any* other error value is likely a bad choice.

> What I'm trying to understand is why pulseaudio is complaining.
> Is it because it only accepts EINVAL error code for media controls?

What I am trying to understand is why you even care, and how you could
*possibly* ever even consider this to be a user-space bug.

Applications *do* care about error return values. There's no way in
hell you can willy-nilly just change them. And if you do change them,
and applications break, there is no way in hell you can then blame the
application.

Yes, I'm upset. Very upset. Why was the error value changed in the
first place? There was no reason given, and it was changed to a
completely idiotic value. And when applications - understandably -
broke, you start asking "why?"

If applications didn't care about specific error values, then it
wouldn't make sense to have more than one to begin with, and you
shouldn't care which one that was. But since applications *do* care,
and since we *do* have multiple error values, we stick to the old
ones, unless there are some *very* good reasons not to.

And those reasons really need to be very good, and spelled out and
explained. In this case, none of that was even remotely the case.

So your question "why would pulseaudio care" is totally *irrelevant*,
senseless, and has nothing to do with anything. Pulseaudio cares, and
caring fundamentally makes sense. It's questioning that obvious fact
that does not make sense!

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


linux-next stats (Was: Linux 3.8-rc1)

2012-12-23 Thread Stephen Rothwell
On Fri, 21 Dec 2012 18:00:58 -0800 Linus Torvalds 
 wrote:
>
> The longest night of the year is upon us (*), and what better thing to
> do than get yourself some nice mulled wine, sit back, relax, and play
> with the most recent rc kernel?
> 
> This has been a big merge window: we've got more commits than any
> other kernel in the v3.x kernel series (although v3.2-rc1 was *almost*
> as big). It's been a rather busy merge window, in other words.

Well here are this merge windows' stats:

(No merge commits counted, next-20121211 is the last linux-next before
v3.7)

Commits in v3.8-rc1 (relative to v3.7): 10901
Commits in next-20121211:   11857
Commits with the same SHA1:  9322
Commits with the same patch_id:   492   (1)
Commits with the same subject line:99   (1)

(1) not counting those in the lines above.

So commits in -rc1 that were "in" next-20121211:991390.9%
(up from 83.5% last time)
Commits in -rc1 that were not in next-20120722: 988 9.1%

Pretty good, but it would be still nice to figure out where the last lot
came from.  I have the "git log --oneline --no-walk" list if someone wants them.

Some break down of the onelines list:
grep for drm gives 100
 btrfs gives 117
Quite a few of the rest appear to be bug fixes.

As for the 1944 commits left in linux-next ... 1303 are in the kvmtool
tree (most of these are in the tip tree as well - this has been pending a
merge to Linus since before 3.2 ...).  There are another 254 commits in
the tip tree (maybe pending fixes), 118 in the xen-two tree and 81 in the
drop-experimental tree.

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


pgplUAAj0TL8x.pgp
Description: PGP signature


Re: [PATCH] brd: enable diskstats

2012-12-23 Thread Ryo Onodera
Hi,

I'm Ryo Onodera.

This is a resend for my earlier patch. Because I got no reply, I've
added other people as CC, picking from the commit history of the
relevant file.

I created this very tiny patch to enable /proc/diskstats for /dev/ramX.

I'm contacting Nick Piggin as the maintainer of ramdisk ram block. As
mentioned above, I'm also contacting some related people to get more
attention.

This is my first patch to the Linux kernel. Sorry if this is not the
expected way of submitting patches.

Regards

On Mon, 2012-12-24 at 06:41 +0900, Ryo Onodera wrote:
> Signed-off-by: Ryo Onodera 
> ---
>  drivers/block/brd.c |7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 531ceb3..181b2d7 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, 
> struct bio *bio)
>   sector_t sector;
>   int i;
>   int err = -EIO;
> + int cpu;
>  
>   sector = bio->bi_sector;
>   if (sector + (bio->bi_size >> SECTOR_SHIFT) >
> @@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, 
> struct bio *bio)
>   if (rw == READA)
>   rw = READ;
>  
> + cpu = part_stat_lock();
> + part_stat_inc(cpu, >brd_disk->part0, ios[rw]);
> + part_stat_add(cpu, >brd_disk->part0, sectors[rw],
> + bio_sectors(bio));
> + part_stat_unlock();
> +
>   bio_for_each_segment(bvec, bio, i) {
>   unsigned int len = bvec->bv_len;
>   err = brd_do_bvec(brd, bvec->bv_page, len,


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

2012-12-23 Thread Ryo Onodera
Signed-off-by: Ryo Onodera 
---
 drivers/block/brd.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, 
struct bio *bio)
sector_t sector;
int i;
int err = -EIO;
+   int cpu;
 
sector = bio->bi_sector;
if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, 
struct bio *bio)
if (rw == READA)
rw = READ;
 
+   cpu = part_stat_lock();
+   part_stat_inc(cpu, >brd_disk->part0, ios[rw]);
+   part_stat_add(cpu, >brd_disk->part0, sectors[rw],
+   bio_sectors(bio));
+   part_stat_unlock();
+
bio_for_each_segment(bvec, bio, i) {
unsigned int len = bvec->bv_len;
err = brd_do_bvec(brd, bvec->bv_page, len,
-- 
1.7.9.5

On Mon, 2012-11-19 at 16:26 +0900, Ryo Onodera wrote:
> Hi,
> 
> I'm Ryo Onodera. I created this very tiny patch to enable /proc/diskstats for
> /dev/ramX.
> 
> I'm contacting Nick Piggin as the maintainer of ramdisk ram block.
> 
> This is my first patch to the Linux kernel. Sorry if this is not the expected
> way of submitting patches.
> 
> Regards
> 
> Ryo Onodera
> 
> On Mon, Nov 19, 2012 at 4:16 PM, Ryo Onodera  wrote:
> > Signed-off-by: Ryo Onodera 
> > ---
> >  drivers/block/brd.c |7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> > index 531ceb3..181b2d7 100644
> > --- a/drivers/block/brd.c
> > +++ b/drivers/block/brd.c
> > @@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, 
> > struct bio *bio)
> > sector_t sector;
> > int i;
> > int err = -EIO;
> > +   int cpu;
> >
> > sector = bio->bi_sector;
> > if (sector + (bio->bi_size >> SECTOR_SHIFT) >
> > @@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, 
> > struct bio *bio)
> > if (rw == READA)
> > rw = READ;
> >
> > +   cpu = part_stat_lock();
> > +   part_stat_inc(cpu, >brd_disk->part0, ios[rw]);
> > +   part_stat_add(cpu, >brd_disk->part0, sectors[rw],
> > +   bio_sectors(bio));
> > +   part_stat_unlock();
> > +
> > bio_for_each_segment(bvec, bio, i) {
> > unsigned int len = bvec->bv_len;
> > err = brd_do_bvec(brd, bvec->bv_page, len,
> > --
> > 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: [REGRESSION][3.8.-rc1][ INFO: possible circular locking dependency detected ]

2012-12-23 Thread Christian Kujau
On Sat, 22 Dec 2012 at 16:28, Maciej Rutecki wrote:
> Got during suspend to disk:

I got a similar message on a powerpc G4 system, right after bootup (no 
suspend involved):

http://nerdbynature.de/bits/3.8.0-rc1/

[   97.803049] ==
[   97.803051] [ INFO: possible circular locking dependency detected ]
[   97.803059] 3.8.0-rc1-dirty #2 Not tainted
[   97.803060] ---
[   97.803066] kworker/0:1/235 is trying to acquire lock:
[   97.803097]  ((fb_notifier_list).rwsem){.+.+.+}, at: [] 
__blocking_notifier_call_chain+0x44/0x88
[   97.803099] 
[   97.803099] but task is already holding lock:
[   97.803110]  (console_lock){+.+.+.}, at: [] 
console_callback+0x20/0x194
[   97.803112] 
[   97.803112] which lock already depends on the new lock.

...and on it goes. Please see the URL above for the whole dmesg and 
.config.

@Li Zhong: I have applied your fix for the "MAX_STACK_TRACE_ENTRIES too 
   low" warning[0] to 3.8-rc1 (hence the -dirty flag), but in the 
   backtrace "ret_from_kernel_thread" shows up again. FWIW, your
   patch helped to make the "MAX_STACK_TRACE_ENTRIES too low" 
   warning go away in 3.7.0-rc7 and it did not re-appear ever 
   since.

Thanks,
Christian.

[0] http://lkml.indiana.edu/hypermail/linux/kernel/1211.3/01917.html

> [  269.784867] [ INFO: possible circular locking dependency detected ]
> [  269.784869] 3.8.0-rc1 #1 Not tainted
> [  269.784870] ---
> [  269.784871] kworker/u:3/56 is trying to acquire lock:
> [  269.784878]  ((fb_notifier_list).rwsem){.+.+.+}, at: [] 
> __blocking_notifier_call_chain+0x49/0x80
> [  269.784879] 
> [  269.784879] but task is already holding lock:
> [  269.784884]  (console_lock){+.+.+.}, at: [] 
> i915_drm_freeze+0x9e/0xbb
> [  269.784884] 
> [  269.784884] which lock already depends on the new lock.
> [  269.784884] 
> [  269.784885] 
> [  269.784885] the existing dependency chain (in reverse order) is:
> [  269.784887] 
> [  269.784887] -> #1 (console_lock){+.+.+.}:
> [  269.784890][] lock_acquire+0x95/0x105
> [  269.784893][] console_lock+0x59/0x5b
> [  269.784897][] register_con_driver+0x36/0x128
> [  269.784899][] take_over_console+0x1e/0x45
> [  269.784903][] fbcon_takeover+0x56/0x98
> [  269.784906][] fbcon_event_notify+0x2c1/0x5ea
> [  269.784909][] notifier_call_chain+0x67/0x92
> [  269.784911][] 
> __blocking_notifier_call_chain+0x5f/0x80
> [  269.784912][] 
> blocking_notifier_call_chain+0xf/0x11
> [  269.784915][] fb_notifier_call_chain+0x16/0x18
> [  269.784917][] register_framebuffer+0x20a/0x26e
> [  269.784920][] 
> drm_fb_helper_single_fb_probe+0x1ce/0x297
> [  269.784922][] 
> drm_fb_helper_initial_config+0x1d7/0x1ef
> [  269.784924][] intel_fbdev_init+0x6f/0x82
> [  269.784927][] i915_driver_load+0xa9e/0xc78
> [  269.784929][] drm_get_pci_dev+0x165/0x26d
> [  269.784931][] i915_pci_probe+0x60/0x69
> [  269.784933][] local_pci_probe+0x39/0x61
> [  269.784935][] pci_device_probe+0xba/0xe0
> [  269.784938][] driver_probe_device+0x99/0x1c4
> [  269.784940][] __driver_attach+0x4e/0x6f
> [  269.784942][] bus_for_each_dev+0x52/0x84
> [  269.784944][] driver_attach+0x19/0x1b
> [  269.784946][] bus_add_driver+0xdf/0x203
> [  269.784948][] driver_register+0x8e/0x114
> [  269.784952][] __pci_register_driver+0x5d/0x62
> [  269.784953][] drm_pci_init+0x81/0xe6
> [  269.784957][] i915_init+0x66/0x68
> [  269.784959][] do_one_initcall+0x7a/0x136
> [  269.784962][] kernel_init+0x141/0x296
> [  269.784964][] ret_from_fork+0x7c/0xb0
> [  269.784966] 
> [  269.784966] -> #0 ((fb_notifier_list).rwsem){.+.+.+}:
> [  269.784967][] __lock_acquire+0xa7e/0xddd
> [  269.784969][] lock_acquire+0x95/0x105
> [  269.784971][] down_read+0x34/0x43
> [  269.784973][] 
> __blocking_notifier_call_chain+0x49/0x80
> [  269.784975][] 
> blocking_notifier_call_chain+0xf/0x11
> [  269.784977][] fb_notifier_call_chain+0x16/0x18
> [  269.784979][] fb_set_suspend+0x22/0x4d
> [  269.784981][] intel_fbdev_set_suspend+0x20/0x22
> [  269.784983][] i915_drm_freeze+0xab/0xbb
> [  269.784985][] i915_pm_freeze+0x3d/0x41
> [  269.784987][] pci_pm_freeze+0x65/0x8d
> [  269.784990][] dpm_run_callback.isra.3+0x27/0x56
> [  269.784993][] __device_suspend+0x136/0x1b1
> [  269.784995][] async_suspend+0x1a/0x58
> [  269.784997][] async_run_entry_fn+0xa4/0x17c
> [  269.785000][] process_one_work+0x1cf/0x38e
> [  269.785002][] worker_thread+0x12e/0x1cc
> [  269.785004][] kthread+0xac/0xb4
> [  269.785006][] 

Segfault in perf tool

2012-12-23 Thread Stefan Beller
Hi,

I get segmentation faults when running one of these commands:
perf report -g --sort symbol_to
perf report -g --sort symbol_from
perf report -g --sort dso_from
perf report -g --sort dso_to

I am running uname -a
Linux sb 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC 2012 x86_64 
x86_64 x86_64 GNU/Linux

The perf utility crashes in both the version installed perf version 3.5.7.1
and as well in the self compiled version from the kernel repository v3.8-rc1

gdb output from the perf version included at kernel v3.8-rc1

gdb ../linux/tools/perf/perf 
GNU gdb (GDB) 7.5-ubuntu
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/sb/OSS/linux/tools/perf/perf...done.
(gdb) r report -g --sort dso_to
Starting program: /home/sb/OSS/linux/tools/perf/perf report -g --sort dso_to
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
# 
# captured on: Sun Dec 23 20:57:02 2012
# hostname : sb
# os release : 3.5.0-21-generic
# perf version : 3.5.7.1
# arch : x86_64
# nrcpus online : 8
# nrcpus avail : 8
# cpudesc : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
# cpuid : GenuineIntel,6,42,7
# total memory : 8133288 kB
# cmdline : /usr/bin/perf_3.5.0-21 record -g ./flare 
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, 
excl_usr = 0, excl_kern = 0, excl_host = 0, excl_guest = 1, precise_
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# 
#
[kernel.kallsyms] with build id 4d9cff231d947ccf8f1cd1cf504a682cad29cae4 not 
found, continuing without symbols

Program received signal SIGSEGV, Segmentation fault.
sort__dso_to_cmp (left=0x7fffcd70, right=0x24a3320) at util/sort.c:372
372 return _sort__dso_cmp(left->branch_info->to.map,
(gdb) bt
#0  sort__dso_to_cmp (left=0x7fffcd70, right=0x24a3320) at util/sort.c:372
#1  0x0047bc22 in hist_entry__cmp (right=0x24a3320, 
left=0x7fffcd70) at util/hist.c:386
#2  add_hist_entry (hists=hists@entry=0x79eac0, 
entry=entry@entry=0x7fffcd70, period=1, al=) at 
util/hist.c:288
#3  0x0047cbd6 in __hists__add_entry (self=self@entry=0x79eac0, 
al=al@entry=0x7fffceb0, sym_parent=, 
period=) at util/hist.c:376
#4  0x00429d6f in perf_evsel__add_hist_entry (machine=, 
sample=0x7fffcff0, al=0x7fffceb0, evsel=0x79ea20)
at builtin-report.c:149
#5  process_sample_event (tool=0x7fffd3d0, event=0x7fffed436e08, 
sample=0x7fffcff0, evsel=0x79ea20, machine=)
at builtin-report.c:216
#6  0x0046a331 in perf_session_deliver_event 
(session=session@entry=0x79cd60, event=, 
sample=sample@entry=0x7fffcff0, 
tool=tool@entry=0x7fffd3d0, file_offset=) at 
util/session.c:1075
#7  0x0046a93f in flush_sample_queue (s=s@entry=0x79cd60, 
tool=tool@entry=0x7fffd3d0) at util/session.c:729
#8  0x0046c059 in __perf_session__process_events 
(session=session@entry=0x79cd60, data_offset=, 
data_size=, 
file_size=63901304, tool=tool@entry=0x7fffd3d0) at util/session.c:1459
#9  0x0046c56e in perf_session__process_events 
(self=self@entry=0x79cd60, tool=tool@entry=0x7fffd3d0) at 
util/session.c:1476
#10 0x0042aee0 in __cmd_report (rep=0x7fffd3d0) at 
builtin-report.c:371
#11 cmd_report (argc=, argv=, prefix=) at builtin-report.c:765
#12 0x00412c23 in run_builtin (p=p@entry=0x6cb9c8 , 
argc=argc@entry=4, argv=argv@entry=0x7fffe140) at perf.c:318
#13 0x004123bb in handle_internal_command (argv=0x7fffe140, argc=4) 
at perf.c:366
#14 run_argv (argv=0x7fffdf30, argcp=0x7fffdf3c) at perf.c:410
#15 main (argc=4, argv=0x7fffe140) at perf.c:515
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [2.6.32.y, 2.6.34.y] Re: [PATCH] x86: Don't use the EFI reboot method by default

2012-12-23 Thread Ben Hutchings
On Sun, 2012-12-23 at 22:03 +0100, Willy Tarreau wrote:
> Hi Jonathan,
> 
> [ccing Paul for 2.6.34]
> 
> On Sun, Dec 23, 2012 at 12:59:50PM -0800, Jonathan Nieder wrote:
> > Hi Willy et al,
> > 
> > Please consider
> > 
> >   f70e957cda22 x86: Don't use the EFI reboot method by default,
> >2011-07-06
> > 
> > for application to the 2.6.32.y and 2.6.34.y trees.  The patch was
> > applied upstream late in the 3.0 cycle, so newer kernels don't need
> > it.
> > 
> > In 2011, Keith Ward wrote[1]:
> > 
> > > When attempting to reboot my my UEFI enabled system, the system hangs when
> > > calling reboot requiring me to manually reset the system via the reset 
> > > switch.
> > >
> > > Screenshot: http://twitgoo.com/29bq1c
> > 
> > Ben Hutchings writes[1]:
> > 
> > > Version: 3.0.0-1
> > >
> > > I also had this problem on my own system, but it is fixed now.
> > > I bisected the fix to:
> > >
> > > commit f70e957cda22d309c769805cbb932407a5232219
> > > Author: Matthew Garrett 
> > > Date:   Wed Jul 6 16:52:37 2011 -0400
> > >
> > > x86: Don't use the EFI reboot method by default
> > >
> > > which is basically equivalent to the workaround!
> > >
> > > I'll also apply this fix to squeeze as it's so simple.
> > 
> > Keith Ward also wrote[1]:
> > 
> > > It seems as if this has recently been reported at Ubuntu's Launchpad as 
> > > well:
> > > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/721576
> > 
> > There are a variety of reports of the same panic at that bug on
> > 2.6.32.y-, 2.6.38.y-, and 2.6.39-based kernels.  Passing "reboot=a,w"
> > on the kernel command line avoids trouble for reporters.
> > 
> > Regards,
> > Jonathan
> > 
> > [1] http://bugs.debian.org/626022
> 
> Thanks for the detailed report. I'm queuing it now.

In 2.6.32 the relevant code is in arch/x86/kernel/efi.c.  With the
filename changed, the patch applies cleanly and works for me.

Ben.

-- 
Ben Hutchings
One of the nice things about standards is that there are so many of them.


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


Re: [2.6.32.y, 2.6.34.y] Re: [PATCH] x86: Don't use the EFI reboot method by default

2012-12-23 Thread Willy Tarreau
Hi Jonathan,

[ccing Paul for 2.6.34]

On Sun, Dec 23, 2012 at 12:59:50PM -0800, Jonathan Nieder wrote:
> Hi Willy et al,
> 
> Please consider
> 
>   f70e957cda22 x86: Don't use the EFI reboot method by default,
>2011-07-06
> 
> for application to the 2.6.32.y and 2.6.34.y trees.  The patch was
> applied upstream late in the 3.0 cycle, so newer kernels don't need
> it.
> 
> In 2011, Keith Ward wrote[1]:
> 
> > When attempting to reboot my my UEFI enabled system, the system hangs when
> > calling reboot requiring me to manually reset the system via the reset 
> > switch.
> >
> > Screenshot: http://twitgoo.com/29bq1c
> 
> Ben Hutchings writes[1]:
> 
> > Version: 3.0.0-1
> >
> > I also had this problem on my own system, but it is fixed now.
> > I bisected the fix to:
> >
> > commit f70e957cda22d309c769805cbb932407a5232219
> > Author: Matthew Garrett 
> > Date:   Wed Jul 6 16:52:37 2011 -0400
> >
> > x86: Don't use the EFI reboot method by default
> >
> > which is basically equivalent to the workaround!
> >
> > I'll also apply this fix to squeeze as it's so simple.
> 
> Keith Ward also wrote[1]:
> 
> > It seems as if this has recently been reported at Ubuntu's Launchpad as 
> > well:
> > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/721576
> 
> There are a variety of reports of the same panic at that bug on
> 2.6.32.y-, 2.6.38.y-, and 2.6.39-based kernels.  Passing "reboot=a,w"
> on the kernel command line avoids trouble for reporters.
> 
> Regards,
> Jonathan
> 
> [1] http://bugs.debian.org/626022

Thanks for the detailed report. I'm queuing it now.

Best regards,
Willy

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


[2.6.32.y, 2.6.34.y] Re: [PATCH] x86: Don't use the EFI reboot method by default

2012-12-23 Thread Jonathan Nieder
Hi Willy et al,

Please consider

  f70e957cda22 x86: Don't use the EFI reboot method by default,
   2011-07-06

for application to the 2.6.32.y and 2.6.34.y trees.  The patch was
applied upstream late in the 3.0 cycle, so newer kernels don't need
it.

In 2011, Keith Ward wrote[1]:

> When attempting to reboot my my UEFI enabled system, the system hangs when
> calling reboot requiring me to manually reset the system via the reset switch.
>
> Screenshot: http://twitgoo.com/29bq1c

Ben Hutchings writes[1]:

> Version: 3.0.0-1
>
> I also had this problem on my own system, but it is fixed now.
> I bisected the fix to:
>
> commit f70e957cda22d309c769805cbb932407a5232219
> Author: Matthew Garrett 
> Date:   Wed Jul 6 16:52:37 2011 -0400
>
> x86: Don't use the EFI reboot method by default
>
> which is basically equivalent to the workaround!
>
> I'll also apply this fix to squeeze as it's so simple.

Keith Ward also wrote[1]:

> It seems as if this has recently been reported at Ubuntu's Launchpad as well:
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/721576

There are a variety of reports of the same panic at that bug on
2.6.32.y-, 2.6.38.y-, and 2.6.39-based kernels.  Passing "reboot=a,w"
on the kernel command line avoids trouble for reporters.

Regards,
Jonathan

[1] http://bugs.debian.org/626022
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [v3.8-rc1] Multimedia regression, ioctl(17,..)-API changed ?

2012-12-23 Thread Mauro Carvalho Chehab
Hi Jörg,

Em Sun, 23 Dec 2012 17:46:07 +0100
Jörg Otte  escreveu:

> With kernel v3.8 all multimedia programs under KDE4 don't work (Kubuntu 
> 12.04).
> They alltogether ( at least Dragonplayer (Mediaplayer), Knotify4
> (system-sound),
> System-Settings-Multimedia,..) are looping forever producing 100% CPU-usage
> and must be killed.
> 
> With kernel 3.7 there are no problems.

Do you have any other non-uvc device to test?

> I compared an strace of Dragonplayer under 3.7 and 3.8 kernels. The
> main difference
> of both traces are the following corresponding outputs just before
> looping in v3.8
> begins:
> 
> v3.7:
> ioctl(17, VIDIOC_ENUMSTD, 0x7fff6cce66a0) = -1 EINVAL (Invalid argument)

This ioctl returns -ENOTTY already with other media drivers on v3.7.

> ioctl(17, VIDIOC_QUERYCTRL, 0x7fff6cce66f0) = -1 EINVAL (Invalid argument)

This change is new, and, AFAIKT, only UVC returns -ENOENT on 3.8-rc1.

This is likely the source of the troubles.

> 
> v3.8:
> ioctl(17, VIDIOC_ENUMSTD, 0x7fffc3be6990) = -1 ENOTTY (Inappropriate
> ioctl for device)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> 
> So error number EINVAL was changed to ENOTTY/ENOENT
> 
> When Dragonplayer under v3.8 comes to ioctl(17, VIDIOC_QUERYCTRL,...)
> and sees error
> number ENOENT instead of EINVAL it loops forever producing 100% CPU
> usage like so:
> 
>   .
>   .
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)
> ioctl(17, VIDIOC_QUERYCTRL, 0x7fffc3be69e0) = -1 ENOENT (No such file
> or directory)

Yeah, it started an endless loop here, likely because kde4 seems to be
expecting either 0 or -EINVAL error code for VIDIOC_QUERYCTRL.

It should be noticed that there are other valid error codes here. For
example, if this ioctl is not implemented, -ENOTTY may also be returned.
Fortunately, almost all drivers do implement this ioctl.

The expected return error codes for this ioctl are described at:
http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-queryctrl.html

In practice, except for the uvc driver, the current return codes are
EINVAL/EACCES/ENOTTY.

>   .
>   and so on
>   .
> 
> For me it looks like that KDE4 multimedia is not aware of the new error 
> numbers.
> 
> Looking through the commits I found driver uvcvideo producing the changed
> error numbers.
> 
> commit f0ed2ce840b3a59b587e8aa398538141a86e9588
> Author: Laurent Pinchart 
> [media] uvcvideo: Set error_idx properly for extended controls API failures
> 
> To verify this I built a v3.8-kernel without uvcvideo (USB_VIDEO_CLASS=n)
> and the problem disappeared!
> 
> Simply reverting the commit is not an option for me because then I am left
> with merge conflicts and I don't know how to resolve.
> 
> Unfortunately without uvcvideo I lost my usb-camera support.

Rafael made a patch fixing it, and Linus should be applying it.

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


Re: [Regression w/ patch] Media commit causes user space to misbahave (was: Re: Linux 3.8-rc1)

2012-12-23 Thread Laurent Pinchart
Hi Linus,

On Sunday 23 December 2012 09:36:15 Linus Torvalds wrote:
> On Sun, Dec 23, 2012 at 6:08 AM, Mauro Carvalho Chehab wrote:
> > Are you saying that pulseaudio is entering on some weird loop if the
> > returned value is not -EINVAL? That seems a bug at pulseaudio.
> 
> Mauro, SHUT THE FUCK UP!
> 
> It's a bug alright - in the kernel. How long have you been a
> maintainer? And you *still* haven't learnt the first rule of kernel
> maintenance?
> 
> If a change results in user programs breaking, it's a bug in the
> kernel. We never EVER blame the user programs. How hard can this be to
> understand?

This is certainly a kernel side regression, there's no doubt about that, and 
as such it needs to be fixed on the kernel side. There's likely a userspace 
bug as well here, but that's irrelevant from a kernel side point of view.

> To make matters worse, commit f0ed2ce840b3 is clearly total and utter
> CRAP even if it didn't break applications. ENOENT is not a valid error
> return from an ioctl. Never has been, never will be. ENOENT means "No
> such file and directory", and is for path operations. ioctl's are done
> on files that have already been opened, there's no way in hell that
> ENOENT would ever be valid.
> 
> > So, on a first glance, this doesn't sound like a regression,
> > but, instead, it looks tha pulseaudio/tumbleweed has some serious
> > bugs and/or regressions.
> 
> Shut up, Mauro. And I don't _ever_ want to hear that kind of obvious
> garbage and idiocy from a kernel maintainer again. Seriously.
> 
> I'd wait for Rafael's patch to go through you, but I have another
> error report in my mailbox of all KDE media applications being broken
> by v3.8-rc1, and I bet it's the same kernel bug. And you've shown
> yourself to not be competent in this issue, so I'll apply it directly
> and immediately myself.
> 
> WE DO NOT BREAK USERSPACE!
> 
> Seriously. How hard is this rule to understand? We particularly don't
> break user space with TOTAL CRAP. I'm angry, because your whole email
> was so _horribly_ wrong, and the patch that broke things was so
> obviously crap. The whole patch is incredibly broken shit. It adds an
> insane error code (ENOENT), and then because it's so insane, it adds a
> few places to fix it up ("ret == -ENOENT ? -EINVAL : ret").

The patch uses the -ENOENT error code internally in the uvcvideo driver to 
inform the caller function (internal to the driver) that the requested control 
doesn't exist. It was never meant to be returned out of the driver, and 
definitely not to userspace. This is clearly a bug.

> The fact that you then try to make *excuses* for breaking user space,
> and blaming some external program that *used* to work, is just
> shameful. It's not how we work.
> 
> Fix your f*cking "compliance tool", because it is obviously broken.

The "compliance tool" doesn't mandate -ENOENT. It has detected a V4L2 non-
compliance issue in the uvcvideo driver not related to error codes, and the 
fix had the very unfortunate side effect of breaking userspace.

I've tested the patch back then and apparently failed to notice the erroneous 
error code being pushed all the way to userspace. Sorry about that. I'll add a 
test case to the V4L2 compliance tool to catch such regressions in the future.

> And fix your approach to kernel programming.

-- 
Regards,

Laurent Pinchart

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


Re: [Regression w/ patch] Media commit causes user space to misbahave (was: Re: Linux 3.8-rc1)

2012-12-23 Thread Mauro Carvalho Chehab
Linus,

Em Sun, 23 Dec 2012 09:36:15 -0800
Linus Torvalds  escreveu:

> To make matters worse, commit f0ed2ce840b3 is clearly total and utter
> CRAP even if it didn't break applications. ENOENT is not a valid error
> return from an ioctl. Never has been, never will be. ENOENT means "No
> such file and directory", and is for path operations. ioctl's are done
> on files that have already been opened, there's no way in hell that
> ENOENT would ever be valid.

Agreed: ENOENT was a bad choice, and it should be reverted.

What I'm trying to understand is why pulseaudio is complaining.
Is it because it only accepts EINVAL error code for media controls?

I'm asking it to Rafael because I'm pretty sure that other drivers
don't return EINVAL when a media control is not available. So, the bug
may already be there, and probably got noticed on 3.8-rc1 because most
notebooks come with UVC cameras installed internally.

> > So, on a first glance, this doesn't sound like a regression,
> > but, instead, it looks tha pulseaudio/tumbleweed has some serious
> > bugs and/or regressions.
> 
> Shut up, Mauro. And I don't _ever_ want to hear that kind of obvious
> garbage and idiocy from a kernel maintainer again. Seriously.

OK.

> I'd wait for Rafael's patch to go through you, but I have another
> error report in my mailbox of all KDE media applications being broken
> by v3.8-rc1, and I bet it's the same kernel bug.

Ouch!

> And you've shown
> yourself to not be competent in this issue, so I'll apply it directly
> and immediately myself.

OK, please apply it.

I suspect however that just applying Rafael's patch may not be enough,
as the bug may still be there affecting all other drivers.

> WE DO NOT BREAK USERSPACE!

I know and I'm doing my best rejecting patches that could potentially
break userspace in advance.

Sometimes shit happens. Sorry for that.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] mm, sparse: allocate bootmem without panicing in sparse_mem_maps_populate_node

2012-12-23 Thread Sasha Levin
__alloc_bootmem_node_high() would panic if it failed allocating, so the fallback
would never get reached. Switch to using __alloc_bootmem_node_high_nopanic().

Signed-off-by: Sasha Levin 
---
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 6b5fb76..72a0db6 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -401,7 +401,7 @@ void __init sparse_mem_maps_populate_node(struct page 
**map_map,
}
 
size = PAGE_ALIGN(size);
-   map = __alloc_bootmem_node_high(NODE_DATA(nodeid), size * map_count,
+   map = __alloc_bootmem_node_high_nopanic(NODE_DATA(nodeid), size * 
map_count,
 PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
if (map) {
for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
-- 
1.8.0

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


[PATCH 3/3] mm, sparse: don't check return value of alloc_bootmem calls

2012-12-23 Thread Sasha Levin
There's no need to check the result of alloc_bootmem() functions since
they'll panic if allocation fails.

Signed-off-by: Sasha Levin 
---
 mm/sparse.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 72a0db6..949fb38 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -497,8 +497,6 @@ void __init sparse_init(void)
 */
size = sizeof(unsigned long *) * NR_MEM_SECTIONS;
usemap_map = alloc_bootmem(size);
-   if (!usemap_map)
-   panic("can not allocate usemap_map\n");
 
for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
struct mem_section *ms;
@@ -538,8 +536,6 @@ void __init sparse_init(void)
 #ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
size2 = sizeof(struct page *) * NR_MEM_SECTIONS;
map_map = alloc_bootmem(size2);
-   if (!map_map)
-   panic("can not allocate map_map\n");
 
for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
struct mem_section *ms;
-- 
1.8.0

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


[PATCH 2/3] mm, bootmem: panic in bootmem alloc functions even if slab is available

2012-12-23 Thread Sasha Levin
Bootmem alloc functions are supposed to panic if allocation fails unless a
*_nopanic() function is used. However, if slab is available this is not the
case currently, and the function might return a NULL.

Currect it to panic on failed allocations even if slab is available.

Signed-off-by: Sasha Levin 
---
 mm/bootmem.c   | 9 -
 mm/nobootmem.c | 6 --
 2 files changed, 15 deletions(-)

diff --git a/mm/bootmem.c b/mm/bootmem.c
index 1324cd7..198a92f 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -763,9 +763,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
unsigned long size,
 void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
   unsigned long align, unsigned long goal)
 {
-   if (WARN_ON_ONCE(slab_is_available()))
-   return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
-
return  ___alloc_bootmem_node(pgdat, size, align, goal, 0);
 }
 
@@ -775,9 +772,6 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, 
unsigned long size,
 #ifdef MAX_DMA32_PFN
unsigned long end_pfn;
 
-   if (WARN_ON_ONCE(slab_is_available()))
-   return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
-
/* update goal according ...MAX_DMA32_PFN */
end_pfn = pgdat->node_start_pfn + pgdat->node_spanned_pages;
 
@@ -839,9 +833,6 @@ void * __init __alloc_bootmem_low(unsigned long size, 
unsigned long align,
 void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
   unsigned long align, unsigned long goal)
 {
-   if (WARN_ON_ONCE(slab_is_available()))
-   return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
-
return ___alloc_bootmem_node(pgdat, size, align,
 goal, ARCH_LOW_ADDRESS_LIMIT);
 }
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index b8294fc..7c4c608 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -371,9 +371,6 @@ void * __init ___alloc_bootmem_node(pg_data_t *pgdat, 
unsigned long size,
 void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
   unsigned long align, unsigned long goal)
 {
-   if (WARN_ON_ONCE(slab_is_available()))
-   return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
-
return ___alloc_bootmem_node(pgdat, size, align, goal, 0);
 }
 
@@ -424,9 +421,6 @@ void * __init __alloc_bootmem_low(unsigned long size, 
unsigned long align,
 void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
   unsigned long align, unsigned long goal)
 {
-   if (WARN_ON_ONCE(slab_is_available()))
-   return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
-
return ___alloc_bootmem_node(pgdat, size, align, goal,
 ARCH_LOW_ADDRESS_LIMIT);
 }
-- 
1.8.0

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


Re: dire state of rtl driver in 3.7

2012-12-23 Thread Larry Finger

On 12/23/2012 07:21 AM, Borislav Petkov wrote:

On Sun, Dec 23, 2012 at 06:49:55AM +0100, Mike Galbraith wrote:

Looks a lot like my driver experience with older kernels, I had to use
the external driver in the rare event that I needed wireless to work.
The in tree driver works peachy these days (needed it recently, was
pleasantly surprised when it _just worked_, not even a hiccup), so
somebody cared, gave at least the 10ec:8181 bits some serious love.


Good for you.

I have a [10ec:8176] in my laptop and while I don't have the issues
Norbert is reporting, I can't say the thing just worked.

I had to use the wireless recently in a bunch of networks and what it
would do, is associate properly, connection gets established and traffic
is fine for a minute or so. Then, after a minute traffic would cease and
I'd need to re-associate. And it worked sporadically, sometimes fine,
sometimes with constant connection interruptions. And this observation
was the case with almost all wireless networks I'd use.

FWIW, the wifi adapter is:

01:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8188CE 
802.11b/g/n WiFi Adapter [10ec:8176] (rev 01)
 Subsystem: Realtek Semiconductor Co., Ltd. Device [10ec:8195]
 Flags: fast devsel, IRQ 17
 I/O ports at 3000 [size=256]
 Memory at f020 (64-bit, non-prefetchable) [size=16K]
 Capabilities: [40] Power Management version 3
 Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
 Capabilities: [70] Express Endpoint, MSI 00
 Capabilities: [100] Advanced Error Reporting
 Capabilities: [140] Virtual Channel
 Capabilities: [160] Device Serial Number 01-91-81-fe-ff-4c-e0-00

using rtl8192ce.


Again a different driver! What do you mean "in a bunch of networks"? How am I 
supposed to duplicate the conditions with descriptions like this?


Larry


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] uprobes: Kill uprobe_events, use RB_EMPTY_ROOT() instead

2012-12-23 Thread Oleg Nesterov
On 12/13, Srikar Dronamraju wrote:
>
> * Oleg Nesterov  [2012-11-25 23:33:44]:

almost month ago ;)

> Acked-by: Srikar Dronamraju 

Thanks!

but what about 2/3 and 3/3?

I'd like to send the final (and technically trivial) series which
actually turns the filtering on.

Oleg.

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


  1   2   3   4   >