[PATCHv2] ASoC: fsl: imx-ssi: omit ssi counter to avoid harm in unbalanced situation

2013-11-15 Thread Oskar Schirmer
Unbalanced calls to imx_ssi_trigger() may result in endless
SSI activity and thus provoke eternal sound. While on the first glance,
the switch statement looks pretty symmetric, the SUSPEND/RESUME
pair is not: the suspend case comes along snd_pcm_suspend_all(),
which for fsl/imx-pcm-fiq is called only at snd_soc_suspend(),
but the resume case originates straight from the SNDRV_PCM_IOCTL_RESUME.
This way userland may provoke an unbalanced resume, which might cause
the ssi->enabled counter to increase and never return to zero again,
so eventually SSI_SCR_SSIEN is never disabled.

As the information on whether to enable the SSI or not is contained
in the two bits for TE/RE, we save all the software mirroring of
hardware state here and simply use the hardware register itself
to keep the state of whether someone is currently playing or capturing.

This is essentially the same stuff as in sound/soc/fsl/imx-pcm-fiq.c
which I send a patch for three days ago. Astonishing enough this
highly fragile scheme is used twice in parallel to serve the very
same control function, synchronously: Once out of sync you are lost
until reboot.

Note, that these fixes wont prevent state machine distortion on alsa
level to cut sound or the like. It just makes sure we have a chance
to synchronise again later on.

Signed-off-by: Oskar Schirmer 
---
v2: drop all software flag handling in favour of hardware registers

 sound/soc/fsl/imx-ssi.c |5 ++---
 sound/soc/fsl/imx-ssi.h |1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index f5f248c..2eb2691 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -304,8 +304,7 @@ static int imx_ssi_trigger(struct snd_pcm_substream 
*substream, int cmd,
scr |= SSI_SCR_RE;
sier |= sier_bits;
 
-   if (++ssi->enabled == 1)
-   scr |= SSI_SCR_SSIEN;
+   scr |= SSI_SCR_SSIEN;
 
break;
 
@@ -318,7 +317,7 @@ static int imx_ssi_trigger(struct snd_pcm_substream 
*substream, int cmd,
scr &= ~SSI_SCR_RE;
sier &= ~sier_bits;
 
-   if (--ssi->enabled == 0)
+   if (!(scr & (SSI_SCR_TE | SSI_SCR_RE)))
scr &= ~SSI_SCR_SSIEN;
 
break;
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index 560c40f..be65623 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -213,7 +213,6 @@ struct imx_ssi {
 
int fiq_init;
int dma_init;
-   int enabled;
 };
 
 #endif /* _IMX_SSI_H */
-- 
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] mmc: disable UHS on broadcom sdhci

2013-11-15 Thread Olof Johansson
Hi,

On Fri, Nov 15, 2013 at 03:56:22PM -0800, Grant Grundler wrote:
> From: Stephen Hurd 
> 
> Add two new quirks needed by BCM57785 card reader:
> SDHCI_QUIRK2_BROKEN_UHS:
> Disables all UHS modes.

This seems appropriate. You _could_ use SDHCI_QUIRK_MISSING_CAPS and
hardcode them instead, but it doesn't seem to be an improvement really.

> SDHCI_QUIRK2_BCM57785_CR:
> Bit twiddles some Broadcom-specific registers and supresses an error
> about the 64k bar0.

I think this can be done without spending a global SDHCI quirk bit. This
is just a one-time setup that needs to be done, isn't it? It's hard
to tell since there's no official errata described, but if it is, then
overriding the probe function is the way to go instead, flipping these
bits there and then call the regular probe.


[...]

> index 7a7fb4f..cf26c0f 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1144,6 +1144,27 @@ static void sdhci_set_clock(struct sdhci_host *host, 
> unsigned int clock)
>   return;
>   }
>  
> + if (host->quirks2 & SDHCI_QUIRK2_BCM57785_CR) {
> + u32 tmp;
> +
> + /*
> +  * Register descriptions from:
> +  * http://www.broadcom.com/collateral/pg/57785-PG103-R.pdf
> +  */

That's a 661 page document, that unfortunately doesn't really help decode any
of the bits below because they are all touching reserved or marked-internal
bits of registers. :-)

Still, good to see a doc link.

> + tmp = sdhci_readl(host, BCM57785_CR_MUX_CTL);
> + tmp &= ~0x3000; /* bits 12:15 are reserved */
> + sdhci_writel(host, tmp, BCM57785_CR_MUX_CTL);
> + tmp = sdhci_readl(host, BCM57785_CR_CLK_CTL);
> + tmp &= ~(0x01a03f30);   /* Internal debug for SD3.0 */
> + tmp |= (0x0050);
> +
> + if ((sdhci_readw(host, SDHCI_HOST_CONTROL2) &
> + SDHCI_CTRL_VDD_180) && (clock >= 2))
> + tmp |= (1<<24);
> + sdhci_writel(host, tmp, BCM57785_CR_CLK_CTL);
> + }
> +
>   sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
>  
>   if (clock == 0)
[...]
> diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
> index 3e781b8..664003a 100644
> --- a/include/linux/mmc/sdhci.h
> +++ b/include/linux/mmc/sdhci.h
> @@ -98,6 +98,12 @@ struct sdhci_host {
>  #define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON(1<<4)
>  /* Controller has a non-standard host control register */
>  #define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
> +/* UHS modes do not work */
> +#define SDHCI_QUIRK2_BROKEN_UHS  (1<<6)
> +/* hacks for Broadcom-specific card reader bugs */
> +#define SDHCI_QUIRK2_BCM57785_CR (1<<7)
> +#defineBCM57785_CR_MUX_CTL 0x198  /* Card Reader MUX control */
> +#defineBCM57785_CR_CLK_CTL 0x19c  /* Card Reader Clock Status/Ctl */

These two defines should not be in a global include file; they should likely go
in the c file instead.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 dmaengine tree with the slave-dma tree

2013-11-15 Thread Vinod Koul
On Fri, Nov 15, 2013 at 12:56:04PM +1100, Stephen Rothwell wrote:
> Hi Dan,
> 
> Today's linux-next merge of the dmaengine tree got a conflict in
> drivers/dma/dmatest.c between commit 19e9f99f273b ("dmaengine: dmatest:
> use DMA_COMPLETE for dma completion status") from the slave-dma tree and
> commit 872f05c6e9a3 ("dmatest: replace stored results mechanism, with
> uniform messages") from the dmaengine tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).
Thanks, we are sending single PULL to linus so I am merging Dan's tree to mine
so this should vanish

--
~Vinod
> 
> -- 
> Cheers,
> Stephen Rothwells...@canb.auug.org.au
> 
> diff --cc drivers/dma/dmatest.c
> index 59e287f56dfc,329b7cf02f8e..
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@@ -735,17 -633,17 +633,17 @@@ static int dmatest_func(void *data
>* free it this time?" dancing.  For now, just
>* leave it dangling.
>*/
> - thread_result_add(info, result, DMATEST_ET_TIMEOUT,
> -   total_tests, src_off, dst_off,
> -   len, 0);
> + dmaengine_unmap_put(um);
> + result("test timed out", total_tests, src_off, dst_off,
> +len, 0);
>   failed_tests++;
>   continue;
>  -} else if (status != DMA_SUCCESS) {
>  +} else if (status != DMA_COMPLETE) {
> - enum dmatest_error_type type = (status == DMA_ERROR) ?
> - DMATEST_ET_DMA_ERROR : 
> DMATEST_ET_DMA_IN_PROGRESS;
> - thread_result_add(info, result, type,
> -   total_tests, src_off, dst_off,
> -   len, status);
> + dmaengine_unmap_put(um);
> + result(status == DMA_ERROR ?
> +"completion error status" :
> +"completion busy status", total_tests, src_off,
> +dst_off, len, ret);
>   failed_tests++;
>   continue;
>   }



-- 


signature.asc
Description: Digital signature


Re: [PATCH RFC] timekeeping: Fix clock stability with nohz

2013-11-15 Thread Richard Cochran
On Thu, Nov 14, 2013 at 03:50:40PM +0100, Miroslav Lichvar wrote:

>  include/linux/timekeeper_internal.h |   4 +
>  kernel/time/timekeeping.c   | 209 
> +---
>  2 files changed, 31 insertions(+), 182 deletions(-)

This looks like an impressive simplification...

> -  * So the following can be confusing.

Yep.

So I really have no idea how the deleted code worked (or didn't work
for nohz), but I can confirm that nohz time keeping is broken under
light system load. Running a high load (like recompiling the kernel on
all cores for CONFIG_HZ_PERIODIC=y ;) hides the issue, but that is
obviously not the right solution.

Out of my ignorance, two questions spring to mind.

1. Considering the simplicity of Miroslav's patch, what was the
   benefit of the much more complicated code in the first place?

2. Does this patch work in the CONFIG_HZ_PERIODIC case just as well as
   the deleted code?

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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-storage: scsiglue: Changing the command result

2013-11-15 Thread Vishal Annapurve
Hi,

[PATCH 3/3] usb: storage: uas: Proper cmd result assignment

This change replaces DID_ABORT with DID_TIMEOUT as a command result
whenever US_FLIDX_TIMED_OUT bit is set.

This change is made to bring USB storage inline with a recent change:

commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8

[SCSI] Handle disk devices which can not process medium access commands
We have experienced several devices which fail in a fashion we do not
currently handle gracefully in SCSI. After a failure these devices will
respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
but any command accessing the storage medium will time out.

As the USB storage was setting command result as aborted rather than
timed out, SCSI layer was not recognizing the above mentioned failure
pattern.

Signed-off-by: Vishal Annapurve 
---
 drivers/usb/storage/uas.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index d966b59..3a4a44e 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -271,7 +271,10 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const 
char *caller)
usb_free_urb(cmdinfo->data_out_urb);
if (cmdinfo->state & COMMAND_ABORTED) {
scmd_printk(KERN_INFO, cmnd, "abort completed\n");
-   cmnd->result = DID_ABORT << 16;
+   /* Better to check for US_FLIDX_TIMED_OUT
+* bit settings.
+*/
+   cmnd->result = DID_TIME_OUT << 16;
}
cmnd->scsi_done(cmnd);
return 0;
-- 
1.8.4.2

Regards,
Vishal

-Original Message-
From: Vishal Annapurve 
Sent: Saturday, November 16, 2013 12:25 PM
To: 'Alan Stern'
Cc: 'Ming Lei'; 'Linux Kernel Mailing List'; 'linux-usb'
Subject: RE: [PATCH] usb-storage: scsiglue: Changing the command result

Hi,

[PATCH 2/3] keucr: Proper cmd result assignment

This change replaces DID_ABORT with DID_TIMEOUT as a command result whenever 
US_FLIDX_TIMED_OUT bit is set.

This change is made to bring USB storage inline with a recent change:

commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8

[SCSI] Handle disk devices which can not process medium access commands We have 
experienced several devices which fail in a fashion we do not currently handle 
gracefully in SCSI. After a failure these devices will respond to the SCSI 
primary command set (INQUIRY, TEST UNIT READY, etc.) but any command accessing 
the storage medium will time out.

As the USB storage was setting command result as aborted rather than timed out, 
SCSI layer was not recognizing the above mentioned failure pattern.

Signed-off-by: Vishal Annapurve 
---
 drivers/staging/keucr/transport.c | 6 +++---
 drivers/staging/keucr/usb.c   | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/keucr/transport.c 
b/drivers/staging/keucr/transport.c
index aeb2186..6f61c20 100644
--- a/drivers/staging/keucr/transport.c
+++ b/drivers/staging/keucr/transport.c
@@ -353,7 +353,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
we need to short-circuit all other processing */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- command was aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
@@ -412,7 +412,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
 
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- auto-sense aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
if (temp_result != USB_STOR_TRANSPORT_GOOD) { @@ -488,7 +488,7 
@@ void ENE_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
we need to short-circuit all other processing */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- command was aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index 
a84ee63..26ec64c 100644
--- a/drivers/staging/keucr/usb.c
+++ b/drivers/staging/keucr/usb.c
@@ -181,7 +181,7 @@ static int usb_stor_control_thread(void *__us)
 
/* has the command timed out *already* ? */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
-   us->srb->result = DID_ABORT << 16;
+   us->srb->result = DID_TIME_OUT << 16;
goto SkipForAbort;
}
 
@@ -209,7 +209,8 @@ static int usb_stor_control_thread(void *__us)
scsi_lock(host);
 
/* 

RE: [PATCH] usb-storage: scsiglue: Changing the command result

2013-11-15 Thread Vishal Annapurve
Hi,

[PATCH 2/3] keucr: Proper cmd result assignment

This change replaces DID_ABORT with DID_TIMEOUT as a command result
whenever US_FLIDX_TIMED_OUT bit is set.

This change is made to bring USB storage inline with a recent change:

commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8

[SCSI] Handle disk devices which can not process medium access commands
We have experienced several devices which fail in a fashion we do not
currently handle gracefully in SCSI. After a failure these devices will
respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
but any command accessing the storage medium will time out.

As the USB storage was setting command result as aborted rather than
timed out, SCSI layer was not recognizing the above mentioned failure
pattern.

Signed-off-by: Vishal Annapurve 
---
 drivers/staging/keucr/transport.c | 6 +++---
 drivers/staging/keucr/usb.c   | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/keucr/transport.c 
b/drivers/staging/keucr/transport.c
index aeb2186..6f61c20 100644
--- a/drivers/staging/keucr/transport.c
+++ b/drivers/staging/keucr/transport.c
@@ -353,7 +353,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
we need to short-circuit all other processing */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- command was aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
@@ -412,7 +412,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
 
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- auto-sense aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
if (temp_result != USB_STOR_TRANSPORT_GOOD) {
@@ -488,7 +488,7 @@ void ENE_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
we need to short-circuit all other processing */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
/* pr_info("-- command was aborted\n"); */
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c
index a84ee63..26ec64c 100644
--- a/drivers/staging/keucr/usb.c
+++ b/drivers/staging/keucr/usb.c
@@ -181,7 +181,7 @@ static int usb_stor_control_thread(void *__us)
 
/* has the command timed out *already* ? */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
-   us->srb->result = DID_ABORT << 16;
+   us->srb->result = DID_TIME_OUT << 16;
goto SkipForAbort;
}
 
@@ -209,7 +209,8 @@ static int usb_stor_control_thread(void *__us)
scsi_lock(host);
 
/* indicate that the command is done */
-   if (us->srb->result != DID_ABORT << 16) {
+   if ((us->srb->result != DID_ABORT << 16) &&
+   (us->srb->result != DID_TIME_OUT << 16)) {
us->srb->scsi_done(us->srb);
} else {
 SkipForAbort:
-- 
1.8.4.2

Regards,
Vishal

-Original Message-
From: Vishal Annapurve 
Sent: Saturday, November 16, 2013 12:24 PM
To: 'Alan Stern'
Cc: Ming Lei; Linux Kernel Mailing List; linux-usb
Subject: RE: [PATCH] usb-storage: scsiglue: Changing the command result

Hi,

Here are the updated patches:   

[PATCH 1/3] usb: storage: Proper cmd result assignment

This change replaces DID_ABORT with DID_TIMEOUT as a command result whenever 
US_FLIDX_TIMED_OUT bit is set.

This change is made to bring USB storage inline with a recent change:

commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8

[SCSI] Handle disk devices which can not process medium access commands We have 
experienced several devices which fail in a fashion we do not currently handle 
gracefully in SCSI. After a failure these devices will respond to the SCSI 
primary command set (INQUIRY, TEST UNIT READY, etc.) but any command accessing 
the storage medium will time out.

As the USB storage was setting command result as aborted rather than timed out, 
SCSI layer was not recognizing the above mentioned failure pattern.

Signed-off-by: Vishal Annapurve 
---
 drivers/usb/storage/cypress_atacb.c |  1 +
 drivers/usb/storage/isd200.c|  2 +-
 drivers/usb/storage/transport.c |  8 
 drivers/usb/storage/usb.c   | 10 ++
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c 
b/drivers/usb/storage/cypress_atacb.c
index 8514a2d..3477ca19 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ 

RE: [PATCH] usb-storage: scsiglue: Changing the command result

2013-11-15 Thread Vishal Annapurve
Hi,

Here are the updated patches:   

[PATCH 1/3] usb: storage: Proper cmd result assignment

This change replaces DID_ABORT with DID_TIMEOUT as a command result
whenever US_FLIDX_TIMED_OUT bit is set.

This change is made to bring USB storage inline with a recent change:

commit18a4d0a22ed6c54b67af7718c305cd010f09ddf8

[SCSI] Handle disk devices which can not process medium access commands
We have experienced several devices which fail in a fashion we do not
currently handle gracefully in SCSI. After a failure these devices will
respond to the SCSI primary command set (INQUIRY, TEST UNIT READY, etc.)
but any command accessing the storage medium will time out.

As the USB storage was setting command result as aborted rather than
timed out, SCSI layer was not recognizing the above mentioned failure
pattern.

Signed-off-by: Vishal Annapurve 
---
 drivers/usb/storage/cypress_atacb.c |  1 +
 drivers/usb/storage/isd200.c|  2 +-
 drivers/usb/storage/transport.c |  8 
 drivers/usb/storage/usb.c   | 10 ++
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c 
b/drivers/usb/storage/cypress_atacb.c
index 8514a2d..3477ca19 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -168,6 +168,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
 */
if ((srb->result != (DID_ERROR << 16) &&
srb->result != (DID_ABORT << 16)) &&
+   srb->result != (DID_TIME_OUT << 16) &&
save_cmnd[2] & 0x20) {
struct scsi_eh_save ses;
unsigned char regs[8];
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 599d8bf..ffd5d58 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -703,7 +703,7 @@ static void isd200_invoke_transport( struct us_data *us,
/* abort processing: the bulk-only transport requires a reset
 * following an abort */
Handle_Abort:
-   srb->result = DID_ABORT << 16;
+   srb->result = DID_TIME_OUT << 16;
 
/* permit the reset transfer to take place */
clear_bit(US_FLIDX_ABORTING, >dflags);
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 22c7d43..6a90161 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -607,8 +607,8 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
 * short-circuit all other processing
 */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
-   usb_stor_dbg(us, "-- command was aborted\n");
-   srb->result = DID_ABORT << 16;
+   usb_stor_dbg("-- command was aborted because of timeout\n");
+   srb->result = DID_TIME_OUT << 16;
goto Handle_Errors;
}
 
@@ -717,8 +717,8 @@ Retry_Sense:
scsi_eh_restore_cmnd(srb, );
 
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
-   usb_stor_dbg(us, "-- auto-sense aborted\n");
-   srb->result = DID_ABORT << 16;
+   usb_stor_dbg("-- auto-sense aborted due to timeout\n");
+   srb->result = DID_TIME_OUT << 16;
 
/* If SANE_SENSE caused this problem, disable it */
if (sense_size != US_SENSE_SIZE) {
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 5c4fe07..04a68eb 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -325,7 +325,7 @@ static int usb_stor_control_thread(void * __us)
 
/* has the command timed out *already* ? */
if (test_bit(US_FLIDX_TIMED_OUT, >dflags)) {
-   us->srb->result = DID_ABORT << 16;
+   us->srb->result = DID_TIME_OUT << 16;
goto SkipForAbort;
}
 
@@ -379,7 +379,8 @@ static int usb_stor_control_thread(void * __us)
scsi_lock(host);
 
/* indicate that the command is done */
-   if (us->srb->result != DID_ABORT << 16) {
+   if ((us->srb->result != DID_ABORT << 16) &&
+   (us->srb->result != DID_TIME_OUT << 16)) {
usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
 us->srb->result);
us->srb->scsi_done(us->srb);
@@ -390,8 +391,9 @@ SkipForAbort:
 
/* If an abort request was received we need to signal that
 * the abort has finished.  The proper test for this is
-* the TIMED_OUT flag, not srb->result == DID_ABORT, because
-* the timeout might have occurred after the command had
+* the TIMED_OUT flag, not srb->result == DID_ABORT or
+* 

Re: [RFC 02/23] watchdog: omap_wdt: raw read and write endian fix

2013-11-15 Thread Guenter Roeck

On 11/15/2013 04:01 PM, Taras Kondratiuk wrote:

From: Victor Kamensky 

All OMAP IP blocks expect LE data, but CPU may operate in BE mode.
Need to use endian neutral functions to read/write h/w registers.
I.e instead of __raw_read[lw] and __raw_write[lw] functions code
need to use read[lw]_relaxed and write[lw]_relaxed functions.
If the first simply reads/writes register, the second will byteswap
it if host operates in BE mode.

Changes are trivial sed like replacement of __raw_xxx functions
with xxx_relaxed variant.

Signed-off-by: Victor Kamensky 
Signed-off-by: Taras Kondratiuk 


Acked-by: Guenter Roeck 


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


[f2fs-dev] [PATCH] f2fs: use f2fs_put_page to release page for uniform style

2013-11-15 Thread Chao Yu
We should use f2fs_put_page to release page for uniform style of f2fs code.

Signed-off-by: Chao Yu 
---
 fs/f2fs/data.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index aa3438c..076a60c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -714,8 +714,7 @@ static int f2fs_write_end(struct file *file,
update_inode_page(inode);
}
 
-   unlock_page(page);
-   page_cache_release(page);
+   f2fs_put_page(page, 1);
return copied;
 }
 
-- 
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/


[f2fs-dev] [PATCH V2 1/2] f2fs: add a new function to support for merging contiguous read

2013-11-15 Thread Chao Yu
For better read performance, we add a new function to support for merging 
contiguous read as the one for write.

v1-->v2:
 o add declarations here as Gu Zheng suggested.

Signed-off-by: Chao Yu 
Acked-by: Gu Zheng 
---
 fs/f2fs/data.c |   45 +
 fs/f2fs/f2fs.h |4 
 2 files changed, 49 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index aa3438c..18107cb 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -404,6 +404,51 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page 
*page,
return 0;
 }
 
+void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, int rw)
+{
+   down_read(>bio_sem);
+   if (sbi->read_bio) {
+   submit_bio(rw, sbi->read_bio);
+   sbi->read_bio = NULL;
+   }
+   up_read(>bio_sem);
+}
+
+void submit_read_page(struct f2fs_sb_info *sbi, struct page *page,
+   block_t blk_addr, int rw)
+{
+   struct block_device *bdev = sbi->sb->s_bdev;
+   int bio_blocks;
+
+   verify_block_addr(sbi, blk_addr);
+
+   down_read(>bio_sem);
+
+   if (sbi->read_bio && sbi->last_read_block != blk_addr - 1) {
+   submit_bio(rw, sbi->read_bio);
+   sbi->read_bio = NULL;
+   }
+
+alloc_new:
+   if (sbi->read_bio == NULL) {
+   bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
+   sbi->read_bio = f2fs_bio_alloc(bdev, bio_blocks);
+   sbi->read_bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
+   sbi->read_bio->bi_end_io = read_end_io;
+   }
+
+   if (bio_add_page(sbi->read_bio, page, PAGE_CACHE_SIZE, 0) <
+   PAGE_CACHE_SIZE) {
+   submit_bio(rw, sbi->read_bio);
+   sbi->read_bio = NULL;
+   goto alloc_new;
+   }
+
+   sbi->last_read_block = blk_addr;
+
+   up_read(>bio_sem);
+}
+
 /*
  * This function should be used by the data read flow only where it
  * does not check the "create" flag that indicates block allocation.
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 89dc750..bfe9d87 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -359,6 +359,8 @@ struct f2fs_sb_info {
 
/* for segment-related operations */
struct f2fs_sm_info *sm_info;   /* segment manager */
+   struct bio *read_bio;   /* read bios to merge */
+   sector_t last_read_block;   /* last read block number */
struct bio *bio[NR_PAGE_TYPE];  /* bios to merge */
sector_t last_block_in_bio[NR_PAGE_TYPE];   /* last block number */
struct rw_semaphore bio_sem;/* IO semaphore */
@@ -,6 +1113,8 @@ struct page *find_data_page(struct inode *, pgoff_t, 
bool);
 struct page *get_lock_data_page(struct inode *, pgoff_t);
 struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool);
 int f2fs_readpage(struct f2fs_sb_info *, struct page *, block_t, int);
+void f2fs_submit_read_bio(struct f2fs_sb_info *, int);
+void submit_read_page(struct f2fs_sb_info *, struct page *, block_t, int);
 int do_write_data_page(struct page *);
 
 /*
-- 
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/


[f2fs-dev] [PATCH V2 2/2] f2fs: read contiguous sit entry pages by merging for mount performance

2013-11-15 Thread Chao Yu
Previously we read sit entries page one by one, this method lost the chance of 
reading contiguous page together.
So we read pages as contiguous as possible for better mount performance.

v1-->v2:
 o merge judgements/use 'Continue' or 'Break' instead of 'Goto' as Gu Zheng 
suggested.
 o add mark_page_accessed () before release page to delay VM reclaiming them.

Signed-off-by: Chao Yu 
---
 fs/f2fs/segment.c |  108 -
 fs/f2fs/segment.h |2 +
 2 files changed, 84 insertions(+), 26 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index fa284d3..656fe40 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "f2fs.h"
 #include "segment.h"
@@ -1480,41 +1481,96 @@ static int build_curseg(struct f2fs_sb_info *sbi)
return restore_curseg_summaries(sbi);
 }
 
+static int ra_sit_pages(struct f2fs_sb_info *sbi, int start,
+   int nrpages, bool *is_order)
+{
+   struct address_space *mapping = sbi->meta_inode->i_mapping;
+   struct sit_info *sit_i = SIT_I(sbi);
+   struct page *page;
+   block_t blk_addr;
+   int blkno = start, readcnt = 0;
+   int sit_blk_cnt = SIT_BLK_CNT(sbi);
+
+   for (; blkno < start + nrpages && blkno < sit_blk_cnt; blkno++) {
+
+   if ((!f2fs_test_bit(blkno, sit_i->sit_bitmap) ^ !*is_order)) {
+   *is_order = !*is_order;
+   break;
+   }
+
+   blk_addr = sit_i->sit_base_addr + blkno;
+   if (*is_order)
+   blk_addr += sit_i->sit_blocks;
+repeat:
+   page = grab_cache_page(mapping, blk_addr);
+   if (!page) {
+   cond_resched();
+   goto repeat;
+   }
+   if (PageUptodate(page)) {
+   mark_page_accessed(page);
+   f2fs_put_page(page, 1);
+   readcnt++;
+   continue;
+   }
+
+   submit_read_page(sbi, page, blk_addr, READ_SYNC);
+
+   mark_page_accessed(page);
+   f2fs_put_page(page, 0);
+   readcnt++;
+   }
+
+   f2fs_submit_read_bio(sbi, READ_SYNC);
+   return readcnt;
+}
+
 static void build_sit_entries(struct f2fs_sb_info *sbi)
 {
struct sit_info *sit_i = SIT_I(sbi);
struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA);
struct f2fs_summary_block *sum = curseg->sum_blk;
-   unsigned int start;
-
-   for (start = 0; start < TOTAL_SEGS(sbi); start++) {
-   struct seg_entry *se = _i->sentries[start];
-   struct f2fs_sit_block *sit_blk;
-   struct f2fs_sit_entry sit;
-   struct page *page;
-   int i;
+   bool is_order = f2fs_test_bit(0, sit_i->sit_bitmap) ? true : false;
+   int sit_blk_cnt = SIT_BLK_CNT(sbi);
+   unsigned int i, start, end;
+   unsigned int readed, start_blk = 0;
 
-   mutex_lock(>curseg_mutex);
-   for (i = 0; i < sits_in_cursum(sum); i++) {
-   if (le32_to_cpu(segno_in_journal(sum, i)) == start) {
-   sit = sit_in_journal(sum, i);
-   mutex_unlock(>curseg_mutex);
-   goto got_it;
+   do {
+   readed = ra_sit_pages(sbi, start_blk, sit_blk_cnt, _order);
+
+   start = start_blk * sit_i->sents_per_block;
+   end = (start_blk + readed) * sit_i->sents_per_block;
+
+   for (; start < end && start < TOTAL_SEGS(sbi); start++) {
+   struct seg_entry *se = _i->sentries[start];
+   struct f2fs_sit_block *sit_blk;
+   struct f2fs_sit_entry sit;
+   struct page *page;
+
+   mutex_lock(>curseg_mutex);
+   for (i = 0; i < sits_in_cursum(sum); i++) {
+   if (le32_to_cpu(segno_in_journal(sum, i)) == 
start) {
+   sit = sit_in_journal(sum, i);
+   mutex_unlock(>curseg_mutex);
+   goto got_it;
+   }
}
-   }
-   mutex_unlock(>curseg_mutex);
-   page = get_current_sit_page(sbi, start);
-   sit_blk = (struct f2fs_sit_block *)page_address(page);
-   sit = sit_blk->entries[SIT_ENTRY_OFFSET(sit_i, start)];
-   f2fs_put_page(page, 1);
+   mutex_unlock(>curseg_mutex);
+
+   page = get_current_sit_page(sbi, start);
+   sit_blk = (struct f2fs_sit_block *)page_address(page);
+   sit = 

Re: [PATCH] cpufreq: suspend/resume governors with PM notifiers

2013-11-15 Thread Lan Tianyu

On 11/15/2013 06:12 PM, Viresh Kumar wrote:

This patch adds PM notifiers for handling suspend/resume of cpufreq governors.
This is required for early suspend and late resume of governors.

There are multiple reasons that support this patch:
- Firstly it looks very much logical to stop governors when we know we are going
   into suspend. But the question is when? Is PM notifiers the right place?
   Following reasons are the supporting hands for this decision.
- Nishanth Menon (TI) found an interesting problem on his platform, OMAP. His 
board
   wasn't working well with suspend/resume as calls for removing non-boot CPUs
   was turning out into a call to drivers ->target() which then tries to play
   with regulators. But regulators and their I2C bus were already suspended and
   this resulted in a failure. This is why we need a PM notifier here.
- Lan Tianyu (Intel) & Jinhyuk Choi (Broadcom) found another issue where
   tunables configuration for clusters/sockets with non-boot CPUs was getting
   lost after suspend/resume, as we were notifying governors with
   CPUFREQ_GOV_POLICY_EXIT on removal of the last cpu for that policy and so
   deallocating memory for tunables.

All above problems get fixed with having a PM notifier in place which will stop
any operation on governor. Hence no need to do any special handling of variables
like (frozen) in suspend/resume paths.

Reported-by: Lan Tianyu 
Reported-by: Nishanth Menon 
Reported-by: Jinhyuk Choi 
Signed-off-by: Viresh Kumar 
---

Hi Guys,

Can you please verify if this fixes issues reported by you? I have tested this
for multiple suspend-resumes on my thinkpad. It doesn't crash :)


This patch fixs my issue.

Tested-by: Lan Tianyu 



  drivers/cpufreq/cpufreq.c | 63 +++
  1 file changed, 63 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 02d534d..c87ced9 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -26,6 +26,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -47,6 +48,9 @@ static LIST_HEAD(cpufreq_policy_list);
  static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
  #endif

+/* Flag to suspend/resume CPUFreq governors */
+static bool cpufreq_suspended;
+
  static inline bool has_target(void)
  {
return cpufreq_driver->target_index || cpufreq_driver->target;
@@ -1462,6 +1466,54 @@ static struct subsys_interface cpufreq_interface = {
.remove_dev = cpufreq_remove_dev,
  };

+/*
+ * PM Notifier for suspending governors as some platforms can't change 
frequency
+ * after this point in suspend cycle. Because some of the devices (like: i2c,
+ * regulators, etc) they use for changing frequency are suspended quickly after
+ * this point.
+ */
+static int cpufreq_pm_notify(struct notifier_block *nb, unsigned long action,
+   void *data)
+{
+   struct cpufreq_policy *policy;
+   unsigned long flags;
+
+   if (!has_target())
+   return NOTIFY_OK;
+
+   if (action == PM_SUSPEND_PREPARE) {
+   pr_debug("%s: Suspending Governors\n", __func__);
+
+   list_for_each_entry(policy, _policy_list, policy_list)
+   if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP))
+   pr_err("%s: Failed to stop governor for policy: 
%p\n",
+   __func__, policy);
+
+   write_lock_irqsave(_driver_lock, flags);
+   cpufreq_suspended = true;
+   write_unlock_irqrestore(_driver_lock, flags);
+   } else if (action == PM_POST_SUSPEND) {
+   pr_debug("%s: Resuming Governors\n", __func__);
+
+   write_lock_irqsave(_driver_lock, flags);
+   cpufreq_suspended = false;
+   write_unlock_irqrestore(_driver_lock, flags);
+
+   list_for_each_entry(policy, _policy_list, policy_list)
+   if (__cpufreq_governor(policy, CPUFREQ_GOV_START) ||
+   __cpufreq_governor(policy,
+   CPUFREQ_GOV_LIMITS))
+   pr_err("%s: Failed to start governor for policy: 
%p\n",
+   __func__, policy);
+   }
+
+   return NOTIFY_OK;
+}
+
+static struct notifier_block cpufreq_pm_notifier = {
+   .notifier_call = cpufreq_pm_notify,
+};
+
  /**
   * cpufreq_bp_suspend - Prepare the boot CPU for system suspend.
   *
@@ -1752,6 +1804,8 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target);
  static int __cpufreq_governor(struct cpufreq_policy *policy,
unsigned int event)
  {
+   unsigned long flags;
+   bool is_suspended;
int ret;

/* Only must be defined when default governor is known to have latency
@@ -1764,6 +1818,14 @@ static int __cpufreq_governor(struct 

About deadline IO scheduler in kernel

2013-11-15 Thread 韩磊
In deadline scheduler, in a FIFO list when  a request insert it and
other request remove it in the same time,whether it make conflict???
Whether it need lock??
Thank you!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Update PATCH 1/1] Cpufreq: Make governor data on nonboot cpus across system suspend/resume

2013-11-15 Thread viresh kumar
On Friday 15 November 2013 04:24 PM, Viresh Kumar wrote:
> Though the patch I have sent fixes a problem similar to this but I don't think
> patch of any of us will solve the issue Rainer is facing..
> 
> I checked his system configuration and its like this:
> - Four CPUs, all having separate clock domains (atleast from kernel
> perspective) and so separate policy structure.
> - All are using ondemand governor
> - not using CPUFREQ_HAVE_GOVERNOR_PER_POLICY feature
> - So there is a single set of tunables for ondemand governor that is 
> applicable
> across all CPUs..
> 
> The way INIT/EXIT are designed in cpufreq_governor.c should take care
> of this scenario.
> 
> memory for tunables must not be freed unless all the CPUs are removed.
> Which can't happen, as we only offline non-boot CPUs and so I believe
> that memory isn't getting freed and so your solution wouldn't address his
> problem..
> 
> Sorry if I said something stupid enough :)

I haven't :)

>From your another mail it is clear that you have used separate governors and so
you have faced the real problem :)

Hope my patch fixes it for you.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpufreq: stats: Do not populate stats when policy->cur has no exact match

2013-11-15 Thread viresh kumar
On Saturday 16 November 2013 06:40 AM, Rafael J. Wysocki wrote:
> On Friday, November 15, 2013 06:20:43 PM Nishanth Menon wrote:

>> So, instead of having a statistics information that never ever
>> reflects valid data in the mentioned case and scratching our heads, we
>> instead, refuse to populate any of the statistics entries and note in
>> kernel log the error condition for developers to fix. The only useable

s/useable/usable

>> information are the available frequencies which is already available
>> in other cpufreq sysfs entries.

> I like this one.  Any objections from anyone?

Well nothing against the patch but I have other thoughts. There are platforms
which might have no choice of fixing this issue as their bootloaders might be
setting boot freq to any value outside of our freq table.

And those might not have a chance to fix that in driver as well in case they are
using something like cpufreq-cpu0..

So, eventually this patch wouldn't do anything except giving a boot time error
and not initializing any stats at all..

Wouldn't it be better to create another frequency in all these tables, which
will be an *Invalid* frequency.. With a value of -1 (i.e. largest value of an
unsigned int) ??

And so nobody will ever miss stats again, even if they are running on invalid
frequencies. We will capture that information too:
- we have moved from/to invalid frequency to/from a valid/invalid frequency this
much times.
- We have stayed at valid/invalid frequencies for this much time.

I have a untested patch for this. If this looks okay, Nishant can you please try
below patch? With some fixups from your side :)

diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 4cf0d28..0c551a6 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -145,10 +145,12 @@ static struct attribute_group stats_attr_group = {
 static int freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq)
 {
int index;
-   for (index = 0; index < stat->max_state; index++)
+   for (index = 0; index < stat->max_state - 1; index++)
if (stat->freq_table[index] == freq)
return index;
-   return -1;
+
+   /* Last state is INVALID, to mark out of table frequency */
+   return stat->max_state - 1;
 }

 /* should be called late in the CPU removal sequence so that the stats
@@ -222,6 +224,9 @@ static int cpufreq_stats_create_table(struct cpufreq_policy
*policy,
count++;
}

+   /* An extra entry for Invalid frequencies */
+   count++;
+
alloc_size = count * sizeof(int) + count * sizeof(u64);

 #ifdef CONFIG_CPU_FREQ_STAT_DETAILS
@@ -243,9 +248,13 @@ static int cpufreq_stats_create_table(struct cpufreq_policy
*policy,
unsigned int freq = table[i].frequency;
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
-   if (freq_table_get_index(stat, freq) == -1)
+   if (freq_table_get_index(stat, freq) == stat->max_state - 1)
stat->freq_table[j++] = freq;
}
+
+   /* Mark Invalid freq as max value to indicate Invalid freq */
+   stat->freq_table[j++] = -1;
+
stat->state_num = j;
spin_lock(_stats_lock);
stat->last_time = get_jiffies_64();
@@ -315,10 +324,6 @@ static int cpufreq_stat_notifier_trans(struct
notifier_block *nb,
old_index = stat->last_index;
new_index = freq_table_get_index(stat, freq->new);

-   /* We can't do stat->time_in_state[-1]= .. */
-   if (old_index == -1 || new_index == -1)
-   return 0;
-
cpufreq_stats_update(freq->cpu);

if (old_index == new_index)


(@Rafael: Finally I have moved to thunderbird, found a way out, so no more
crappy attachments from me :))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: 3.10.16 cgroup css_set_lock deadlock

2013-11-15 Thread Tejun Heo
Hello,

On Fri, Nov 15, 2013 at 09:53:14AM -0500, Don Morris wrote:
> Are we getting some other thread from while_each_task()
> repeatedly keeping us in the loop? Or is there something
> else going on? The gut instinct is that calling something
> like while_each_task() on an exiting thread would either
> reliably give other threads in the group or quit [if the
> thread is the only one left in the group or if an exiting
> thread is no longer part of the group], but since that would
> make the continue work, obviously I'm missing something.

Thread group leaders are stable at that point because threadgroup_lock
is held and are guaranteed to show up in while_each_thread traversal;
however, !leaders may already be in the process of exiting by the time
control reaches that point and may not show up in the iteration.  As
RCU lock is held, it'll be *safe* to initiate or continue iteration
from it but when the iteration comes around, there's no guarantee that
it'll be included in it and the term condition depends on it showing
up again.  That's what I remember anyway.  Li, please correct me if
I'm mistaken.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: Possible regression with cgroups in 3.11

2013-11-15 Thread Tejun Heo
Hello, Bjorn.

On Fri, Nov 15, 2013 at 05:28:20PM -0700, Bjorn Helgaas wrote:
> It would be better to fix PCI so we don't call VF driver .probe() methods
> from inside a PF driver .probe() method, but that's a bigger project.

Yeah, if pci doesn't need the recursion, we can simply revert restore
the lockdep annoation on work_on_cpu().

> @@ -293,7 +293,9 @@ static int pci_call_probe(struct pci_driver *drv, struct 
> pci_dev *dev,
>  its local memory on the right node without any need to
>  change it. */
>   node = dev_to_node(>dev);
> - if (node >= 0) {
> + preempt_disable();
> +
> + if (node >= 0 && node != numa_node_id()) {

A bit of comment here would be nice but yeah I think this should work.
Can you please also queue the revert of c2fda509667b ("workqueue:
allow work_on_cpu() to be called recursively") after this patch?
Please feel free to add my acked-by.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 tip/core/rcu 11/14] bonding/bond_main: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Ding Tianhong
于 2013/11/16 8:40, Paul E. McKenney 写道:
> From: "Paul E. McKenney" 
>
> The sparse checking for rcu_assign_pointer() was recently upgraded
> to reject non-__kernel address spaces.  This also rejects __rcu,
> which is almost always the right thing to do.  However, the uses in
> bond_change_active_slave() and __bond_release_one() are legitimate:
> They are assigning a pointer to an element from an RCU-protected list
> (or a NULL pointer), and all elements of this list are already visible
> to caller.
>
> This commit therefore silences these false positives either by laundering
> the pointers using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
> Triplett, or by using RCU_INIT_POINTER() for NULL pointer assignments.
I think it is fit for net-next.


> Reported-by: kbuild test robot 
> Signed-off-by: Paul E. McKenney 
> Cc: Stephen Hemminger 
> Cc: "David S. Miller" 
> Cc: bri...@lists.linux-foundation.org
> Cc: net...@vger.kernel.org
> ---
>  drivers/net/bonding/bond_main.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 72df399c4ab3..bbd7fd3e46fe 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -890,7 +890,8 @@ void bond_change_active_slave(struct bonding *bond, 
> struct slave *new_active)
>   if (new_active)
>   bond_set_slave_active_flags(new_active);
>   } else {
> - rcu_assign_pointer(bond->curr_active_slave, new_active);
> + /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
> + ACCESS_ONCE(bond->curr_active_slave) = new_active;
>   }
>  
>   if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) {
> @@ -1801,7 +1802,7 @@ static int __bond_release_one(struct net_device 
> *bond_dev,
>   }
>  
>   if (all) {
> - rcu_assign_pointer(bond->curr_active_slave, NULL);
> + RCU_INIT_POINTER(bond->curr_active_slave, NULL);
>   } else if (oldcurrent == slave) {
>   /*
>* Note that we hold RTNL over this sequence, so there

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Update PATCH 1/1] Cpufreq: Make governor data on nonboot cpus across system suspend/resume

2013-11-15 Thread Lan Tianyu

On 11/15/2013 06:22 PM, Viresh Kumar wrote:

On 15 November 2013 13:45, Lan Tianyu  wrote:

Currently, governor of nonboot cpus will be put to EXIT when system suspend.
Since all these cpus will be unplugged and the governor usage_count decreases
to zero. The governor data and its sysfs interfaces will be freed or released.
This makes user config of these governors loss during suspend and resume.

This doesn't happen on the governor covering boot cpu because it isn't
unplugged during system suspend.

To fix this issue, skipping governor exit during system suspend and check
policy governor data to determine whether the governor is really needed
to be initialized when do init. If not, return EALREADY to indicate the
governor has been initialized and should do nothing. __cpufreq_governor()
convert EALREADY to 0 as return value for INIT event since governor is
still under INIT state and can do START operation.

Signed-off-by: Lan Tianyu 
---


Hi Lan..



Hi Viresh:


Apologies!!

I already had a solution for this as this was reported by few Broadcom people
as well. But I haven't send it to mainline yet as it was untested. It
looked similar
to what you had..

And so I would have taken your patch (as you have sent it first to the list and
there is no real advantage of my patch over yours, they were almost same) :)

But then I went chasing another bug posted by Nishant:

https://lkml.org/lkml/2013/10/24/369

And the final solution I have to write solved all the problems you and he
reported.

Please have a look at that patch (you are cc'd) and give it a try to see
if it fixes your problem..


Never mind. I think it should work and will try it.



Btw, One question about your setup:
- you must have a multi cluster/socket SoC as you have atleast one more
policy structure than used for group containing boot cpu..


Actually, I test on a laptop and find this issue when reading code to 
fix other bug. :)


All cpus have their own policys.


- Are you using separate governor for both groups?


Just to produce the bug, I set one non-boot cpu to conservative gov. All 
other remain default "ondemand".



- Or are you using CPUFREQ_HAVE_GOVERNOR_PER_POLICY stuff
to use same governor with separate tunables for both groups?



No, I am not using this.


Just wanted to know if somebody else is also using
CPUFREQ_HAVE_GOVERNOR_PER_POLICY :)




--
Best Regards
Tianyu Lan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpufreq: suspend/resume governors with PM notifiers

2013-11-15 Thread viresh kumar
On Saturday 16 November 2013 05:54 AM, Rafael J. Wysocki wrote:
> Will cpufreq work during system-wide power transitions (suspend/resume etc.)
> after this?  In particular, what about hibernation?

I am disabling governors as soon as we start suspend. So No, cpufreq wouldn't
work during suspend/resume. But once system is resumed we are starting it back
again.

Hibernation is probably not supported by my code yet.. I just went through
hibernation code quickly and it looks we don't send PM_SUSPEND_PREPARE or
PM_POST_SUSPEND notifications in case of hibernation. Correct?

And these are the notifications that we send:
- PM_HIBERNATION_PREPARE
- PM_POST_HIBERNATION
- PM_RESTORE_PREPARE
- PM_POST_RESTORE

If I am not wrong I need to stop governors on PM_HIBERNATION_PREPARE and need to
start them back on: PM_POST_HIBERNATION (I am a bit confused with this one. Does
this POST_HIBERNATION one happens at the end of going into hibernation? or after
booting back? I need a notifier at the end of restore)..

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


Re: [PATCH v2 1/2] watchdog: bcm281xx: Watchdog Driver

2013-11-15 Thread Guenter Roeck

On 11/15/2013 12:58 PM, Markus Mayer wrote:

This commit adds support for the watchdog timer used on the BCM281xx
family of SoCs.

Signed-off-by: Markus Mayer 


You are using two different e-mail addresses, the one here and the one in 
MODULE_AUTHOR.
Any chance to use only one ? Of course, there may be a reason, so maybe it is 
ok.


Reviewed-by: Matt Porter 
---
  drivers/watchdog/Kconfig|   22 +++
  drivers/watchdog/Makefile   |1 +
  drivers/watchdog/bcm_kona_wdt.c |  367 +++
  3 files changed, 390 insertions(+)
  create mode 100644 drivers/watchdog/bcm_kona_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index d1d53f3..fe8bd21 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1121,6 +1121,28 @@ config BCM2835_WDT
  To compile this driver as a loadable module, choose M here.
  The module will be called bcm2835_wdt.

+config BCM_KONA_WDT
+   tristate "BCM Kona Watchdog"
+   depends on ARCH_BCM
+   select WATCHDOG_CORE
+   help
+ Support for the watchdog timer on the following Broadcom BCM281xx
+ family, which includes BCM11130, BCM11140, BCM11351, BCM28145 and
+ BCM28155 variants.
+
+ Say 'Y' or 'M' here to enable the driver. The module will be called
+ bcm_kona_wdt.
+
+config BCM_KONA_WDT_DEBUG
+   bool "DEBUGFS support for BCM Kona Watchdog"
+   depends on BCM_KONA_WDT
+   help
+ If enabled, adds /sys/kernel/debug/bcm-kona-wdt/info which provides
+ access to the driver's internal data structures as well as watchdog
+ timer hardware registres.
+
+ If in doubt, say 'N'.
+
  config LANTIQ_WDT
tristate "Lantiq SoC watchdog"
depends on LANTIQ
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 6c5bb27..7c860ca 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
  obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
  obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
  obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
+obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o

  # AVR32 Architecture
  obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
new file mode 100644
index 000..5a03d5a
--- /dev/null
+++ b/drivers/watchdog/bcm_kona_wdt.c
@@ -0,0 +1,367 @@
+/*
+ * Copyright (C) 2013 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SECWDOG_CTRL_REG   0x
+#define SECWDOG_COUNT_REG  0x0004
+
+#define SECWDOG_RESERVED_MASK  0x1dff
+#define SECWDOG_WD_LOAD_FLAG   0x1000
+#define SECWDOG_EN_MASK0x0800
+#define SECWDOG_SRSTEN_MASK0x0400
+#define SECWDOG_RES_MASK   0x00f0
+#define SECWDOG_COUNT_MASK 0x000f
+
+#define SECWDOG_MAX_COUNT  SECWDOG_COUNT_MASK
+#define SECWDOG_CLKS_SHIFT 20
+#define SECWDOG_MAX_RES15
+#define SECWDOG_DEFAULT_RESOLUTION 4
+#define SECWDOG_MAX_TRY1000
+
+#define SECS_TO_TICKS(x, w)((x) << (w)->resolution)
+#define TICKS_TO_SECS(x, w)((x) >> (w)->resolution)
+
+#define BCM_KONA_WDT_NAME  "bcm-kona-wdt"
+


You mentioned this should be s/-/_/g in your other mail. Wonder why ?
This name doesn't have to match the file name.


+struct bcm_kona_wdt {
+   void __iomem *base;
+   /*
+* One watchdog tick is 1/(2^resolution) seconds. Resolution can take
+* the values 0-15, meaning one tick can be 1s to 30.52us. Our default
+* resolution of 4 means one tick is 62.5ms.
+*
+* The watchdog counter is 20 bits. Depending on resolution, the maximum
+* counter value of 0xf expires after about 12 days (resolution 0)
+* down to only 32s (resolution 15). The default resolution of 4 gives
+* us a maximum of about 18 hours and 12 minutes before the watchdog
+* times out.
+*/
+   int resolution;
+   spinlock_t lock;
+#ifdef CONFIG_BCM_KONA_WDT_DEBUG
+   struct dentry *debugfs;
+#endif
+};
+
+#ifdef CONFIG_BCM_KONA_WDT_DEBUG
+static unsigned long busy_count = 0;


ERROR: do not initialise statics to 0 or NULL


+#endif
+
+static int secure_register_read(void __iomem 

Re: [Update PATCH 1/1] Cpufreq: Make governor data on nonboot cpus across system suspend/resume

2013-11-15 Thread Lan Tianyu

On 11/16/2013 08:38 AM, Rafael J. Wysocki wrote:

On Friday, November 15, 2013 04:15:34 PM Lan Tianyu wrote:

Currently, governor of nonboot cpus will be put to EXIT when system suspend.
Since all these cpus will be unplugged and the governor usage_count decreases
to zero. The governor data and its sysfs interfaces will be freed or released.
This makes user config of these governors loss during suspend and resume.


First off, do we have a pointer to a bug report related to that?



No, I found this bug when I tried to resolve other similar bug.
https://bugzilla.kernel.org/show_bug.cgi?id=63081. I still have no idea 
about bug 63081 and asked reporter to try this patch.



Second, what does need to be done to reproduce this problem?



Defaultly, all cpus use ondemand governor after bootup. Change one 
non-boot cpu's governor to conservative, modify conservative config via 
sysfs interface and then do system suspend. After resume, the config

of conservative is reset. On my machine, all cpus have owen policy.



This doesn't happen on the governor covering boot cpu because it isn't
unplugged during system suspend.

To fix this issue, skipping governor exit during system suspend and check
policy governor data to determine whether the governor is really needed
to be initialized when do init. If not, return EALREADY to indicate the
governor has been initialized and should do nothing. __cpufreq_governor()
convert EALREADY to 0 as return value for INIT event since governor is
still under INIT state and can do START operation.

Signed-off-by: Lan Tianyu 
---
Fix some typos

  drivers/cpufreq/cpufreq.c  |  5 -
  drivers/cpufreq/cpufreq_governor.c | 13 -
  2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 02d534d..38f2e4a 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1239,7 +1239,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev,

/* If cpu is last user of policy, free policy */
if (cpus == 1) {
-   if (has_target()) {
+   if (has_target() && !frozen) {
ret = __cpufreq_governor(policy,
CPUFREQ_GOV_POLICY_EXIT);
if (ret) {
@@ -1822,6 +1822,9 @@ static int __cpufreq_governor(struct cpufreq_policy 
*policy,
((event == CPUFREQ_GOV_POLICY_EXIT) && !ret))
module_put(policy->governor->owner);

+   if ((event == CPUFREQ_GOV_POLICY_INIT) && ret == -EALREADY)
+   ret = 0;
+
return ret;
  }

diff --git a/drivers/cpufreq/cpufreq_governor.c 
b/drivers/cpufreq/cpufreq_governor.c
index 0806c31..ddb93af 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -204,9 +204,20 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,

switch (event) {
case CPUFREQ_GOV_POLICY_INIT:
+   /*
+* In order to keep governor data across suspend/resume,
+* Governor doesn't exit when suspend and will be
+* reinitialized when resume. Here check policy governor
+* data to determine whether the governor has been exited.
+* If not, return EALREADY.
+*/
if (have_governor_per_policy()) {
-   WARN_ON(dbs_data);
+   if (dbs_data)
+   return -EALREADY;
} else if (dbs_data) {
+   if (policy->governor_data == dbs_data)
+   return -EALREADY;
+
dbs_data->usage_count++;
policy->governor_data = dbs_data;
return 0;




--
Best Regards
Tianyu Lan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 tip/core/rcu 01/28] rcutorture: Add KVM-based test framework

2013-11-15 Thread Paul E. McKenney
On Fri, Nov 15, 2013 at 06:01:20PM -0800, Greg KH wrote:
> On Fri, Nov 15, 2013 at 08:47:27PM -0500, Steven Rostedt wrote:
> > On Fri, 15 Nov 2013 17:21:16 -0800
> > "Paul E. McKenney"  wrote:
> > 
> > 
> > > > Oh, one very minor comment on the patches, you should delete the address
> > > > of the FSF from your file headers, unless you want to track the office
> > > > movements of them for the next 40+ years.  We've been removing them from
> > > > kernel code where we notice them, as half of them are wrong, and I don't
> > > > want to have to go back and fix them again when they move again.
> > > 
> > > I had no idea that they tend to move!  Thank you, I will remove them.
> > 
> > From what I've been told, you should replace:
> > 
> > 
> > # You should have received a copy of the GNU General Public License
> > # along with this program; if not, write to the Free Software
> > # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
> > USA.
> > 
> > With:
> > 
> > # You should have received a copy of the GNU General Public License
> > # along with this program; if not, see  
> 
> But of course, check with your company lawyer for the specific wording,
> I know each one of them like to phrase is all a little bit differently
> (lawyers have to feel useful in some way...)

I get it, no problem!

# You should have received a copy of the GNU General Public License
# along with this program; if not, contact my lawyer.

Thanx, Paul

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


[PATCH] cpufreq: cpufreq-cpu0: Use a sane boot frequency when booting with a mismatched bootloader configuration

2013-11-15 Thread Nishanth Menon
On many development platforms, at boot, the bootloader configured
frequency maynot match the valid frequencies that are stated to be
supported in OPP table. This may occur due to various reasons:
a) older or default bootloader in development platform without latest
updates
b) SoC documentation update that may have occurred in kernel
c) kernel definitions are out of date Vs bootloader which is updated
etc..

In these cases, we should assume from a kernel perspective, the only
safe frequency that the system can be on is the ones available in the
OPP table. This may not handle case (c), but, that is a different
kernel bug of it's own.

Considering that in many existing or development platforms, (a) or
(b) is common, enforce a sanity check and reprogram to a conservative
start configuration at probe to allow sane operation independent of
bootloader.

Reported-by: Carlos Hernandez 
Signed-off-by: Nishanth Menon 
---

based on v3.12 tag - however, a rebase with opp function name change
is needed for v3.13-rc1 if folks are ok, I can repost with updates.

Identified when during debug of https://patchwork.kernel.org/patch/3191411/
on TI vendor kernel based on v3.12 tag.

In the case discussed, bootloader booted OMAP5uEVM at 1.1GHz when the available
frequencies were 500MHz, 1GHz, 1.5GHz.

To prevent system from functioning at this invalid configuration (and hence
trigger the bug seen in stats), we should remove the dependence of the kernel
from bootloader configuration.
With this patch, in the mentioned boot scenario, we get the following log:
[   25.649736] cpufreq_cpu0: bootloader freq 11 no match to table, 
Using 10

Artificially modifying the bootloader to create other boundary conditions:
(lower bound check)
[   25.633535] cpufreq_cpu0: bootloader freq 3Hz no match to table, 
Using 5Hz
(upper bound check)
[   27.355837] cpufreq_cpu0: bootloader freq 16Hz no match to table, 
Using 15Hz

The other alternative(to reduce code churn) would be to just report a
mismatch and continue to function at the potentially risky OPP - but
in the cases such as using userspace governor, the system could be in
unstable state resulting in hard to debug behavior.

The last alternative is to always expect bootloader to be in sync with proper
OPP configuration, which rarely happens correctly.

 drivers/cpufreq/cpufreq-cpu0.c |   84 +++-
 1 file changed, 82 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index c522a95..9765050 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -176,7 +176,8 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
 static int cpu0_cpufreq_probe(struct platform_device *pdev)
 {
struct device_node *np;
-   int ret;
+   int ret, i;
+   long boot_freq;
 
cpu_dev = get_cpu_device(0);
if (!cpu_dev) {
@@ -232,7 +233,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
if (!IS_ERR(cpu_reg)) {
struct opp *opp;
unsigned long min_uV, max_uV;
-   int i;
 
/*
 * OPP is maintained in order of increasing frequency, and
@@ -254,6 +254,86 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
transition_latency += ret * 1000;
}
 
+   boot_freq = clk_get_rate(cpu_clk);
+
+   /* See if we have a perfect match */
+   for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
+   if (boot_freq == freq_table[i].frequency * 1000)
+   break;
+
+   /* If we have a bad bootloader config, try recovery */
+   if (freq_table[i].frequency == CPUFREQ_TABLE_END) {
+   struct opp *opp;
+   long new_freq = boot_freq, freq_exact;
+   unsigned long volt = 0, tol = 0;
+
+   ret = 0;
+   rcu_read_lock();
+
+   /* Try a conservative match */
+   opp = opp_find_freq_floor(cpu_dev, _freq);
+
+   /* If we did not get a floor match, try least available freq */
+   if (IS_ERR(opp)) {
+   new_freq = freq_table[0].frequency * 1000;
+   opp = opp_find_freq_exact(cpu_dev, new_freq, true);
+   }
+   if (IS_ERR(opp))
+   ret = -ERANGE;
+   if (!IS_ERR(opp) && !IS_ERR(cpu_reg)) {
+   volt = opp_get_voltage(opp);
+   tol = volt * voltage_tolerance / 100;
+   }
+   rcu_read_unlock();
+   if (ret) {
+   pr_err("Fail to find match boot clock rate: %lu\n",
+  boot_freq);
+   goto out_free_table;
+   }
+
+   /* We dont expect to endup with same result */
+   WARN_ON(boot_freq == 

Re: [PATCH] PCI: Init NumVFs register to zero in sriov_init()

2013-11-15 Thread Ethan Zhao
On Fri, Nov 15, 2013 at 2:59 PM, Yinghai Lu  wrote:
> On Wed, Nov 13, 2013 at 5:57 PM, Ethan Zhao  wrote:
>> On Wed, Nov 6, 2013 at 10:49 PM, ethan.zhao  wrote:
>>> Though no specification about NumVFs register initial value after POST, to 
>>> void the confusion
>>> lspci output as following before VF was enabled, we should clear the NumVFs 
>>> value left by BIOS
>>> to zero:
>
> Does BIOS need to clear it?

No, don't think BIOS need to clear it, according to the SR-IOV and PCI
specification, BIOS hasn't the responsibility to clear NumVFs register
 or not.  "The initial value of NumVFs is undefined." (SINGLE ROOT I/O
VIRTUALIZATION AND SHARING SPECIFICATION, REV. 1.1 chapter 3.3.7 ).
In fact, Linux doesn't trust the PCI_SRIOV_XX registers initial value
left by BIOS, exactly, it did in iov.c , Linux will re-initialize the
PCI_SRIOV_XX registers' value whatever their original value left by
BIOS.

static int sriov_init(struct pci_dev *dev, int pos)
{
  ... ...
  pci_read_config_word(dev, pos + PCI_SRIOV_CTRL, );
  if (ctrl & PCI_SRIOV_CTRL_VFE) {
  pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, 0);
  ssleep(1);
  }

... ...
ctrl = 0;
... ...
found:
pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl);
... ...
}

If so, why leave  value of NumVFs register un-initialized, till be
exposed to user via lspci etc.

>
>
>>>
>>> $lspci -vvv -s 03:00.0
>>> Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network 
>>> Connection (rev 01)
>>> ~
>>> Capabilities: [160 v1] Single Root I/O Virtualization (SR-IOV)
>>> IOVCap: Migration-, Interrupt Message Number: 000
>>> IOVCtl: Enable+ Migration- Interrupt- MSE+ ARIHierarchy+
>>> IOVSta: Migration-
>>> Initial VFs: 64, Total VFs: 64, Number of VFs: 64, Function 
>>> Dependency Link: 00
>>>
>>> ^dazed !
>>> ~
>
> just display problem?

So far, only catch the issue via lspci, "seems' only confuses user,
the VFs are enabled to 64. in fact, they are disabled. but it is not
bug of lspci, binary dump of lspci could prove it.


Thanks,
Ethan
>
>>> Signed-off-by: ethan.zhao 
>>> ---
>>>  drivers/pci/iov.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
>>> index de8ffac..a4941ad 100644
>>> --- a/drivers/pci/iov.c
>>> +++ b/drivers/pci/iov.c
>>> @@ -439,6 +439,8 @@ static int sriov_init(struct pci_dev *dev, int pos)
>>>
>>>  found:
>>> pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl);
>>> +   /* VF Enable is cleared, so we could init the NumVFs register to 0 
>>> */
>>> +   pci_write_config_word(dev, pos + PCI_SRIOV_NUM_VF, 0);
>>> pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, );
>>> pci_read_config_word(dev, pos + PCI_SRIOV_VF_STRIDE, );
>>> if (!offset || (total > 1 && !stride))
>
> Thanks
>
> Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] A minor amd64_edac fix for 3.13

2013-11-15 Thread Linus Torvalds
[ This was in my spam collection. I don't quite know why, but it might
signify problems with your email setup. Quite often, when gmail is
unhappy about kernel developer emails, it's been because their email
provider ends up doing something odd.

But the headers actually have "spf=pass" and "dkim=pass", so it's
nothing obvious. ]

That said, I don't much like the patch either. The "fixed' version
looks worse than the original. If it's an unsigned type, no extra code
will be generated, and if it's a signed type, it's correct. In either
way, the code looks good, and the range test means that people reading
it don't even need to worry about whether the type is signed or not.

If this patch was written because of some f*cking broken compiler
warning, then just tell the compiler to shut the hell up about it.
This is a clear example of where compiler warnings are actually making
things worse.

 Linus


On Sun, Nov 10, 2013 at 4:26 AM, Borislav Petkov  wrote:
> Hi Linus,
>
> please pull this one minor thing which has been lying around since
> forever... (at least it feels like it - I almost forgot about it :-)).
>
> Thanks.
>
> --
> The following changes since commit 272b98c6455f00884f0350f775c5342358ebb73f:
>
>   Linux 3.12-rc1 (2013-09-16 16:17:51 -0400)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git tags/edac_for_3.13
>
> for you to fetch changes up to c3e511e4c4d9cb962976f63d37816ff8e8efacc5:
>
>   amd64_edac: Remove superfluous condition check. (2013-09-19 09:55:20 +0200)
>
> 
> A minor correctness fix.
>
> 
> Aravind Gopalakrishnan (1):
>   amd64_edac: Remove superfluous condition check.
>
>  drivers/edac/amd64_edac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 3c9e4e98c651..bbd1913ce27c 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -1576,7 +1576,7 @@ static int f15_m30h_match_to_this_node(struct amd64_pvt 
> *pvt, unsigned range,
>  num_dcts_intlv, dct_sel);
>
> /* Verify we stay within the MAX number of channels allowed */
> -   if (channel > 4 || channel < 0)
> +   if (channel > 4)
> return -EINVAL;
>
> leg_mmio_hole = (u8) (dct_cont_base_reg >> 1 & BIT(0));
>
> --
> Regards/Gruss,
> Boris.
>
> Sent from a fat crate under my desk. Formatting is fine.
> --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 tip/core/rcu 01/28] rcutorture: Add KVM-based test framework

2013-11-15 Thread Greg KH
On Fri, Nov 15, 2013 at 08:47:27PM -0500, Steven Rostedt wrote:
> On Fri, 15 Nov 2013 17:21:16 -0800
> "Paul E. McKenney"  wrote:
> 
> 
> > > Oh, one very minor comment on the patches, you should delete the address
> > > of the FSF from your file headers, unless you want to track the office
> > > movements of them for the next 40+ years.  We've been removing them from
> > > kernel code where we notice them, as half of them are wrong, and I don't
> > > want to have to go back and fix them again when they move again.
> > 
> > I had no idea that they tend to move!  Thank you, I will remove them.
> 
> From what I've been told, you should replace:
> 
> 
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
> USA.
> 
> With:
> 
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, see  

But of course, check with your company lawyer for the specific wording,
I know each one of them like to phrase is all a little bit differently
(lawyers have to feel useful in some way...)

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


Re: [RFC PATCH RESEND 1/2] clk: add clk accuracy retrieval support

2013-11-15 Thread Mike Turquette
Quoting Boris BREZILLON (2013-10-13 10:17:10)
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 73bdb69..942811d 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
...
> @@ -194,6 +204,7 @@ struct clk_hw {
>  struct clk_fixed_rate {
> struct  clk_hw hw;
> unsigned long   fixed_rate;
> +   unsigned long   fixed_accuracy;

This change belongs in patch #2. Please also update the kerneldoc above
this struct definition.

Regards,
Mike

> u8  flags;
>  };
>  
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 9a6d045..2fe3b54 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -85,6 +85,23 @@ int clk_notifier_unregister(struct clk *clk, struct 
> notifier_block *nb);
>  #endif
>  
>  /**
> + * clk_get_accuracy - obtain the clock accuracy in ppb (parts per billion)
> + *   for a clock source.
> + * @clk: clock source
> + *
> + * This gets the clock source accuracy expressed in ppb.
> + * A perfect clock returns 0.
> + */
> +#ifdef CONFIG_HAVE_CLK_GET_ACCURACY
> +unsigned long clk_get_accuracy(struct clk *clk);
> +#else
> +static inline unsigned long clk_get_accuracy(struct clk *clk)
> +{
> +   return 0;
> +}
> +#endif
> +
> +/**
>   * clk_prepare - prepare a clock source
>   * @clk: clock source
>   *
> -- 
> 1.7.9.5
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/28] rcutorture: Add KVM-based test framework

2013-11-15 Thread Steven Rostedt
On Fri, 15 Nov 2013 17:21:16 -0800
"Paul E. McKenney"  wrote:


> > Oh, one very minor comment on the patches, you should delete the address
> > of the FSF from your file headers, unless you want to track the office
> > movements of them for the next 40+ years.  We've been removing them from
> > kernel code where we notice them, as half of them are wrong, and I don't
> > want to have to go back and fix them again when they move again.
> 
> I had no idea that they tend to move!  Thank you, I will remove them.

>From what I've been told, you should replace:


# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.

With:

# You should have received a copy of the GNU General Public License
# along with this program; if not, see  


-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] MAINTAINERS: Update Pegasus and RTL8150 driver repositories;

2013-11-15 Thread David Miller
From: Petko Manolov 
Date: Fri, 15 Nov 2013 12:23:44 +0200

> From: Petko Manolov 
> Date: Fri, 15 Nov 2013 11:51:54 +0200
> Subject: [PATCH] Update Pegasus and RTL8150 repositories;

Do not include this metadata in your patch postings, it duplicates
the commit header line when people try to apply it using "git am"

> Update Pegasus and RTL8150 driver repositories;
> 
> The diff is against latest 'net' repository;
> 
> Signed-off-by: Petko Manolov 

Please submit networking patches to net...@vger.kernel.org in the
future, I happened to catch this and applied it this time.

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 tip/core/rcu 01/28] rcutorture: Add KVM-based test framework

2013-11-15 Thread Paul E. McKenney
On Fri, Nov 15, 2013 at 05:05:28PM -0800, Greg KH wrote:
> On Fri, Nov 15, 2013 at 04:35:14PM -0800, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" 
> > 
> > This commit adds the test framework that I used to test RCU under KVM.
> > This consists of a group of scripts and Kconfig fragments.
> > 
> > Signed-off-by: Paul E. McKenney 
> > Cc: Greg KH 
> 
> Yeah!  Thanks for following through on this, it will help me out a lot
> in testing stable kernels.

Glad you like it!  ;-)

> Oh, one very minor comment on the patches, you should delete the address
> of the FSF from your file headers, unless you want to track the office
> movements of them for the next 40+ years.  We've been removing them from
> kernel code where we notice them, as half of them are wrong, and I don't
> want to have to go back and fix them again when they move again.

I had no idea that they tend to move!  Thank you, I will remove them.

Thanx, Paul

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


Re: [PATCH] scripts: Have make TAGS not include structure members

2013-11-15 Thread Steven Rostedt
On Fri, 15 Nov 2013 17:02:36 -0800
Stephen Boyd  wrote:

> On 11/15/13 06:36, Steven Rostedt wrote:
> > diff --git a/scripts/tags.sh b/scripts/tags.sh
> > index 74f02e4..b985371 100755
> > --- a/scripts/tags.sh
> > +++ b/scripts/tags.sh
> > @@ -218,7 +218,7 @@ exuberant()
> >  
> >  emacs()
> >  {
> > -   all_target_sources | xargs $1 -a\
> > +   all_target_sources | xargs $1 -a --no-members   \
> > --regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \
> > --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
> > --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'  \
> > @@ -248,13 +248,13 @@ emacs()
> > --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
> > --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
> >  
> > -   all_kconfigs | xargs $1 -a  \
> > +   all_kconfigs | xargs $1 -a --no-members \
> > --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
> >  
> > -   all_kconfigs | xargs $1 -a  \
> > +   all_kconfigs | xargs $1 -a --no-members \
> > --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
> >  
> > -   all_defconfigs | xargs -r $1 -a \
> > +   all_defconfigs | xargs -r $1 -a --no-members\
> > --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
> >  }
> >  
> 
> Does it actually matter for the kconfigs and defconfigs?
> 

Actually no. I noticed that after I sent the patch. Here's v2:


scripts: Have make TAGS not include structure members

It is really annoying when I use emacs TAGS to search for something
like "dev_name" and have to go through 12 iterations before I find the
function "dev_name". I really do not care about structures that include
"dev_name" as one of its fields, and I'm sure pretty much all other
developers do not care either.

There's a "remove_structs" variable used by the scripts/tags.sh, which
I'm guessing is suppose to remove these structures from the TAGS file,
but it must do a poor job at it, as I'm always hitting structures when
I want the actual declaration.

Luckily, the etags and ctags program comes with an option
"--no-members", which does exactly what I want, and I'm sure all other
kernel developers want too.

Signed-off-by: Steven Rostedt 

Index: linux-trace.git/scripts/tags.sh
===
--- linux-trace.git.orig/scripts/tags.sh
+++ linux-trace.git/scripts/tags.sh
@@ -218,7 +218,7 @@ exuberant()
 
 emacs()
 {
-   all_target_sources | xargs $1 -a\
+   all_target_sources | xargs $1 -a --no-members   \
--regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'  \
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ACPI / LPSS: add ACPI IDs for newer Intel PCHs

2013-11-15 Thread Rafael J. Wysocki
On Tuesday, November 12, 2013 11:48:19 AM Mika Westerberg wrote:
> Some recent Intel PCHs with LPSS have different ACPI IDs for the LPSS
> devices, so add these to the list as well.
> 
> Signed-off-by: Mika Westerberg 

Queued up for the next ACPI pull request, thanks!

> ---
>  drivers/acpi/acpi_lpss.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> index fb78bb9ad8f6..242885715331 100644
> --- a/drivers/acpi/acpi_lpss.c
> +++ b/drivers/acpi/acpi_lpss.c
> @@ -157,6 +157,15 @@ static const struct acpi_device_id 
> acpi_lpss_device_ids[] = {
>   { "80860F41", (unsigned long)_i2c_dev_desc },
>   { "INT33B2", },
>  
> + { "INT3430", (unsigned long)_dev_desc },
> + { "INT3431", (unsigned long)_dev_desc },
> + { "INT3432", (unsigned long)_dev_desc },
> + { "INT3433", (unsigned long)_dev_desc },
> + { "INT3434", (unsigned long)_uart_dev_desc },
> + { "INT3435", (unsigned long)_uart_dev_desc },
> + { "INT3436", (unsigned long)_sdio_dev_desc },
> + { "INT3437", },
> +
>   { }
>  };
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ACPI/AC: Remove the pointer of struct acpi_device in the struct acpi_ac

2013-11-15 Thread Rafael J. Wysocki
On Wednesday, November 13, 2013 11:27:42 AM Lan Tianyu wrote:
> Now the pointer of struct acpi_device can be got by
> ACPI_COMPANION(struct acpi_ac->pdev->dev). So the pointer
> is not necessary and remove it.
> 
> Signed-off-by: Lan Tianyu 

Queued up for the next ACPI pull request, thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Fwd: A problem about IO scheduler in kernel

2013-11-15 Thread 韩磊
-- Forwarded message --
From: 韩磊 
Date: 2013/11/15
Subject: A problem about IO scheduler in kernel
To: Linux Kernel Mailing List 


These days I was programming about IO scheduler called
"Simple_Deadline" in kernel.
"Simple_Deadline" is based on "deadline-iosched".The algorithm is very
simple.It have two lists,one is read,the other is write.A request
enter lists based its weight which count accord to the request's
size,read or write. And when dispatch a request just compare the
weight between read list and write list,the smaller one dispatches.

When I modprobe this module and run it,if  a bit of IO come,it works
well.But when runs a large number IO,the system will crash.  Can you
help me to find the problem? I am so sad and helpless about it.

When system crashed,the screen display some information:

Message from syslogd@han at Nov 15 13:12:03 ...
 kernel:[ cut here ]

Message from syslogd@han at Nov 15 13:12:03 ...
 kernel:invalid opcode:  [#1] SMP

Message from syslogd@han at Nov 15 13:12:03 ...
 kernel:last sysfs file:
/sys/devices/pci:00/:00:04.0/:05:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/block/sda/queue/scheduler

Message from syslogd@han at Nov 15 13:12:03 ...
 kernel:Stack:

Message from syslogd@han at Nov 15 13:12:03 ...
 kernel:Call Trace:

Message from syslogd@han at Nov 15 13:12:03 ...
 kernel:Code: 2a 48 89 fe 4c 89 e7 e8 35 ff 01 00 48 8b 83 80 00 00 00
83 e0 03 4c 09 e0 4c 8b 64 24 08 48 89 83 80 00 00 00 48 8b 1c 24 c9
c3 <0f> 0b eb fe 66 90 55 48 89 e5 0f 1f 44 00 00 45 31 c0 48 89 f9


The code in accessory!  Please help find the bugs!  Thank you!
/*
 *  Deadline i/o scheduler.
 *
 *  Copyright (C) 2002 Jens Axboe 
 */
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

static const int read_expire = HZ / 2; 
static const int write_expire = 5 * HZ; 
static const int writes_starved = 2;
static const int fifo_batch = 16;  




#define DELTA 1

static const int read_time_per_byte = 30 ;  
static const int write_time_per_byte = 30  ; 


static const int read_time_once_transfer = 30 ; 
static const int write_time_once_transfer = 300 ; 

struct req_list_head
{
	struct request *current_req;
	unsigned long last_jiffies;
	long current_weight;
	struct req_list_head *next;
	struct req_list_head *prev;
};

struct deadline_data {

	struct req_list_head req_weight_list[2];
	struct request *next_rq[2];
	struct rb_root sort_list[2];	
	struct list_head fifo_list[2];
	unsigned int batching;		/* number of sequential requests made */  
	sector_t last_sector;		/* head position */
	unsigned int starved;		/* times reads have starved writes */
	int fifo_expire[2]; 
	int fifo_batch;
	int writes_starved;
	int front_merges;

};
void req_list_remove_request(struct req_list_head *list_head);
struct request *select_req_from_weight_list(struct req_list_head *req_write_list,struct req_list_head *req_read_list);
int req_list_empty(struct req_list_head *list_head);
void req_list_add(struct req_list_head *new_req,struct req_list_head *list_head);
void update_req_list_weight(struct req_list_head *list_head);
long req_list_count_weight(int data_dir,unsigned int bio_size);  
void Init_req_list_head(struct req_list_head *req_weight_list);
static void deadline_move_request(struct deadline_data *, struct request *);

static inline struct rb_root *
deadline_rb_root(struct deadline_data *dd, struct request *rq)
{
	return >sort_list[rq_data_dir(rq)];
}

static inline struct request *
deadline_latter_request(struct request *rq)
{
	struct rb_node *node = rb_next(>rb_node);

	if (node)
		return rb_entry_rq(node);

	return NULL;
}

static void
deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
{
	struct rb_root *root = deadline_rb_root(dd, rq);
	struct request *__alias;

	while (unlikely(__alias = elv_rb_add(root, rq)))
		deadline_move_request(dd, __alias);
}

static inline void
deadline_del_rq_rb(struct deadline_data *dd, struct request *rq)
{
	const int data_dir = rq_data_dir(rq);

	if (dd->next_rq[data_dir] == rq)
		dd->next_rq[data_dir] = deadline_latter_request(rq);

	elv_rb_del(deadline_rb_root(dd, rq), rq);
}

/*
 * add rq to rbtree and fifo
 */
static void   
deadline_add_request(struct request_queue *q, struct request *rq)
{
	printk("enter merge_add_request\n");
	struct deadline_data *dd = q->elevator->elevator_data;
	const int data_dir = rq_data_dir(rq);
	
	unsigned int bio_size=rq->__data_len;


	struct req_list_head *req_list=(struct req_list_head *)kmalloc(sizeof(*req_list),GFP_KERNEL);
	req_list->current_req=rq;
	req_list->current_weight=req_list_count_weight(data_dir,bio_size);
	req_list->last_jiffies=jiffies;
	

Re: [PATCH tip/core/rcu 01/28] rcutorture: Add KVM-based test framework

2013-11-15 Thread Greg KH
On Fri, Nov 15, 2013 at 04:35:14PM -0800, Paul E. McKenney wrote:
> From: "Paul E. McKenney" 
> 
> This commit adds the test framework that I used to test RCU under KVM.
> This consists of a group of scripts and Kconfig fragments.
> 
> Signed-off-by: Paul E. McKenney 
> Cc: Greg KH 

Yeah!  Thanks for following through on this, it will help me out a lot
in testing stable kernels.

Oh, one very minor comment on the patches, you should delete the address
of the FSF from your file headers, unless you want to track the office
movements of them for the next 40+ years.  We've been removing them from
kernel code where we notice them, as half of them are wrong, and I don't
want to have to go back and fix them again when they move again.

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] scripts: Have make TAGS not include structure members

2013-11-15 Thread Stephen Boyd
On 11/15/13 06:36, Steven Rostedt wrote:
> diff --git a/scripts/tags.sh b/scripts/tags.sh
> index 74f02e4..b985371 100755
> --- a/scripts/tags.sh
> +++ b/scripts/tags.sh
> @@ -218,7 +218,7 @@ exuberant()
>  
>  emacs()
>  {
> - all_target_sources | xargs $1 -a\
> + all_target_sources | xargs $1 -a --no-members   \
>   --regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \
>   --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
>   --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'  \
> @@ -248,13 +248,13 @@ emacs()
>   --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
>   --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
>  
> - all_kconfigs | xargs $1 -a  \
> + all_kconfigs | xargs $1 -a --no-members \
>   --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
>  
> - all_kconfigs | xargs $1 -a  \
> + all_kconfigs | xargs $1 -a --no-members \
>   --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
>  
> - all_defconfigs | xargs -r $1 -a \
> + all_defconfigs | xargs -r $1 -a --no-members\
>   --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
>  }
>  

Does it actually matter for the kconfigs and defconfigs?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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


Re: perf tip: fails to convert comm

2013-11-15 Thread Frederic Weisbecker
On Fri, Nov 15, 2013 at 09:29:51AM -0700, David Ahern wrote:
> HI Frederic:
> 
> On 11/13/13, 11:03 AM, Frederic Weisbecker wrote:
> >
> >I see. I can reproduce, I'll check and see what happens. It would be nice if
> >we could have an option to dump internal perf events like comm events as well
> >in the perf script stream.
> 
> Any progress on a solution? This is a regression in 3.13.

So the problem is that when a thread overrides its default ":%pid" comm, we 
forget
to tag the thread comm as overriden. Hence, this overriden comm is not 
inherited on
future forks.

So here is a fix. Tell me if you see more issue, I'll cook a proper changelog 
and
resend if everyting looks good.

Thanks.

diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index cd8e2f5..49eaf1d 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -70,14 +70,13 @@ int thread__set_comm(struct thread *thread, const char 
*str, u64 timestamp)
/* Override latest entry if it had no specific time coverage */
if (!curr->start) {
comm__override(curr, str, timestamp);
-   return 0;
+   } else {
+   new = comm__new(str, timestamp);
+   if (!new)
+   return -ENOMEM;
+   list_add(>list, >comm_list);
}
 
-   new = comm__new(str, timestamp);
-   if (!new)
-   return -ENOMEM;
-
-   list_add(>list, >comm_list);
thread->comm_set = true;
 
return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: OMAP: Fix compilation error 'r & ret undeclared'

2013-11-15 Thread Rafael J. Wysocki
On Wednesday, November 13, 2013 03:39:23 PM Viresh Kumar wrote:
> With a recent change "d4019f0 cpufreq: move freq change notifications to 
> cpufreq
> core" few variables (r & ret) are removed by mistake and hence these warnings:
> 
> drivers/cpufreq/omap-cpufreq.c: In function omap_target:
> drivers/cpufreq/omap-cpufreq.c:64:2: error: ret undeclared (first use in this 
> function)
> drivers/cpufreq/omap-cpufreq.c:64:2: note: each undeclared identifier is 
> reported only once for each function it appears in
> drivers/cpufreq/omap-cpufreq.c:94:3: error: r undeclared (first use in this 
> function)
> drivers/cpufreq/omap-cpufreq.c:116:1: warning: control reaches end of 
> non-void function [-Wreturn-type]
> 
> Lets fix them by declaring those variables again.
> 
> Reported-by: Sebastian Capella 
> Signed-off-by: Viresh Kumar 

Queued up for the next PM pull request, thanks!

> ---
>  drivers/cpufreq/omap-cpufreq.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
> index be6d143..a0acd0b 100644
> --- a/drivers/cpufreq/omap-cpufreq.c
> +++ b/drivers/cpufreq/omap-cpufreq.c
> @@ -53,6 +53,7 @@ static unsigned int omap_getspeed(unsigned int cpu)
>  
>  static int omap_target(struct cpufreq_policy *policy, unsigned int index)
>  {
> + int r, ret;
>   struct dev_pm_opp *opp;
>   unsigned long freq, volt = 0, volt_old = 0, tol = 0;
>   unsigned int old_freq, new_freq;
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] Cpufreq: Remove fossil comment in the cpufreq_governor_dbs()

2013-11-15 Thread Rafael J. Wysocki
On Friday, November 15, 2013 02:13:26 PM Viresh Kumar wrote:
> On 15 November 2013 11:24, Lan Tianyu  wrote:
> > The related code has been changed and the comment is out of data.
> > So remove it.
> >
> > Signed-off-by: Lan Tianyu 
> > ---
> >  drivers/cpufreq/cpufreq_governor.c | 4 
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq_governor.c 
> > b/drivers/cpufreq/cpufreq_governor.c
> > index 0806c31..e6be635 100644
> > --- a/drivers/cpufreq/cpufreq_governor.c
> > +++ b/drivers/cpufreq/cpufreq_governor.c
> > @@ -328,10 +328,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
> >  
> > dbs_data->cdata->gov_dbs_timer);
> > }
> >
> > -   /*
> > -* conservative does not implement micro like ondemand
> > -* governor, thus we are bound to jiffes/HZ
> > -*/
> > if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
> > cs_dbs_info->down_skip = 0;
> > cs_dbs_info->enable = 1;
> 
> Acked-by: Viresh Kumar 

Queued up for the next PM pull request, thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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] cpufreq: stats: Do not populate stats when policy->cur has no exact match

2013-11-15 Thread Rafael J. Wysocki
On Friday, November 15, 2013 06:20:43 PM Nishanth Menon wrote:
> commit 46a310b ([CPUFREQ] Don't set stat->last_index to -1 if the
> pol->cur has incorrect value.) tries to handle case where policy->cur
> does not match any entry in freq_table.
> 
> As indicated in the above commit, the exact match search of
> freq_table_get index will return a -1 which is stored in
> stat->last_index. However, as a result of the above commit,
> cpufreq_stat_notifier_trans which updates the statistics, fails
> to update any *further* valid transitions that take place as
> stat->last_index is -1 as the condition occurs at boot and never
> solved.
> 
> So, instead of having a statistics information that never ever
> reflects valid data in the mentioned case and scratching our heads, we
> instead, refuse to populate any of the statistics entries and note in
> kernel log the error condition for developers to fix. The only useable
> information are the available frequencies which is already available
> in other cpufreq sysfs entries.
> 
> Cc: Tobias Diedrich 
> Cc: Konrad Rzeszutek Wilk 
> Cc: Dave Jones 
> Reported-by: Carlos Hernandez 
> Signed-off-by: Nishanth Menon 

I like this one.  Any objections from anyone?

> ---
> 
> Patch based on v3.12 tag
> 
> Reported by Carlos on TI vendor kernel (v3.12tag based):
> 
> OMAP5uEVM: http://pastebin.mozilla.org/3612196
> AM335x-evm: http://pastebin.mozilla.org/3612220
> 
> As can be seen, the translation table are present, however none of the
> transition information is ever updated.
> With the current patch, this becomes: http://pastebin.mozilla.org/3612256
> 
> Original commit thread seems to be:
> https://lkml.org/lkml/2011/6/16/760 but I dont see much information if
> this was discussed further.
> 
> An alternate approach possible is to try and recover from this case by
> using an 'atmost' match to find a closest match and then giveup when
> we cant find one, but that does not really indicate a proper statistic
> (if freq1 < cur_freq < freq2, was the intent to be at freq1 or freq2?
> stats should not make that policy decision)
>   http://pastebin.mozilla.org/3612179 (alternate approach 1)
> 
> Yet another option might be to update last_index using the first
> transition into a valid index, but then, we wont have statistics
> information 100% correct as we did not store the very first frequency
> stat.
>http://pastebin.mozilla.org/3612241 (alternate approach 2)
> 
>  drivers/cpufreq/cpufreq_stats.c |8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index 4cf0d28..4c8a501 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -251,6 +251,14 @@ static int cpufreq_stats_create_table(struct 
> cpufreq_policy *policy,
>   stat->last_time = get_jiffies_64();
>   stat->last_index = freq_table_get_index(stat, policy->cur);
>   spin_unlock(_stats_lock);
> +
> + if (stat->last_index == -1) {
> + pr_err("%s: No match for current freq %u in table. Disabled!\n",
> +__func__, policy->cur);
> + ret = -EINVAL;
> + goto error_out;
> + }
> +
>   cpufreq_cpu_put(current_policy);
>   return 0;
>  error_out:
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Správní zprávy

2013-11-15 Thread Univerzita Karlova



--
Vážení Web - Mail Majitel účtu:
 
To přišlo na naše upozornění , že vaše e-mailová neprošel ověření / 
aktualizace proces, který jsme v současné době pracuje na . V současné 
době modernizace naší databázi a e - mailový účet centrum , čímž Smazání 
všech starých webový e-mail e-mailový účet vytvořit více prostoru pro 
nové účty .


Chcete-li zabránit svému účtu od uzavření budete muset aktualizovat 
tak, že budeme vědět, že jev současné době používán účet . Chcete-li 
dokončit svůj účet re- potvrzení , musíte odpovědět na tento e-mail 
okamžitě a zadejte své údaje o účtu , jak požaduje níže.


***
Email uživatelské jméno :  .
Heslo : ...
Potvrdit heslo: ...
Datum narození: ...



 Důležité:
 
Tato aktualizace je povinná v důsledku našich nedávných serveru změní . 
Pokud se vám nepodaří aktualizovat svou e-mailovou adresu, budete brzy 
moci přijímat / odesílat mails.Also Váš e-mail nebude vybaven 
nejnovějším antivirovým systémem na našich nových servers.This bude vaše 
e-mailová a PC náchylné k útokům virů z internet .

 

 Omlouváme se za způsobené nepříjemnosti .
  Webmail účet Upgrader "
** 
**
 Jedná se o správní Vzkaz od Univerzita Karlova a obsah musí být 
považovány za důvěrné za všech okolností
 ** 







--
Centro de Ci�ncias Agroveterin�rias - CAV/UDESC - Lages
http://www.cav.udesc.br

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 RESEND 1/2] clk: add clk accuracy retrieval support

2013-11-15 Thread Mike Turquette
Quoting boris brezillon (2013-11-08 00:54:45)
> Hello Mike,
> 
> On 08/11/2013 01:51, Mike Turquette wrote:
> > Quoting Boris BREZILLON (2013-10-13 10:17:10)
> >> +/**
> >> + * clk_get_accuracy - return the accuracy of clk
> >> + * @clk: the clk whose accuracy is being returned
> >> + *
> >> + * Simply returns the cached accuracy of the clk, unless
> >> + * CLK_GET_ACCURACY_NOCACHE flag is set, which means a recalc_rate will be
> >> + * issued.
> >> + * If clk is NULL then returns 0.
> >> + */
> >> +unsigned long clk_get_accuracy(struct clk *clk)
> >> +{
> >> +   unsigned long accuracy;
> >> +   clk_prepare_lock();
> >> +
> >> +   if (clk && (clk->flags & CLK_GET_ACCURACY_NOCACHE))
> >> +   __clk_recalc_accuracies(clk);
> > I think that there is some overlap between recalculating the accuracy
> > here and simply getting it. You only provide clk_get_accuracy and it
> > serves both purposes. It would be better if clk_recalc_accuracy walked
> > the subtree of children and if clk_get_accuracy simply returned a cached
> > value.
> 
> I'm not sure I get your point.
> 
> I used exactly the same model as for clk rate retrieval.

Not exactly the same model. For rates we support public clk_recalc_rate
and clk_get_rate functions.

> 
> Actually there's one flag (CLK_GET_ACCURACY_NOCACHE) which is
> checked to decide wether the accuracy should be recalculated each
> time the get_accuracy is called or not.
> 
> This means most of the time the clk_get_accuracy will return the cached
> value unless the clk provider explicitely ask for accuracy recalculation
> (e.g. a clk with dynamic accuracy according to temperature range ?).
> 
> Are you suggesting to expose 2 functions to clk users (clk_get_accuracy
> and clk_recalc_accuracy) ?
> Or is clk_recalc_accuracy an internal/private function used by the CCF ?

I was suggesting that in my previous email. However I've thought on it a
bit and I'm not sure there is any value to having a public
clk_recalc_accuracy right now.

The only reason to do so would be if the accuracy can change in such a
way that the clock framework is never aware of it.  This would mean that
somehow the accuracy changed "behind our back".

One hypothetical example is a PLL which Linux knows about, but perhaps
is controlled by some other co-processor (not Linux). In this case the
co-processor may reprogram/relock the PLL in a way that affects it's
accuracy, and a Linux driver that knows this may want to update the CCF
book-keeping with a call to clk_recalc_accuracy.

That's all hypothetical though and it can be added in later. Looking
over your change again I think that it is sufficient for now.

Can you respin this patch with fixes for the two nitpicks I outlined in
my previous mail and rebase it onto -rc1 when it drops? That should be
any day now.

Thanks!
Mike

> 
> >
> >> +
> >> +   accuracy = __clk_get_accuracy(clk);
> >> +   clk_prepare_unlock();
> >> +
> >> +   return accuracy;
> >> +}
> >> +EXPORT_SYMBOL_GPL(clk_get_accuracy);
> >> +
> >> +/**
> >>* __clk_recalc_rates
> >>* @clk: first clk in the subtree
> >>* @msg: notification type (see include/linux/clk.h)
> >> @@ -1545,6 +1610,7 @@ void __clk_reparent(struct clk *clk, struct clk 
> >> *new_parent)
> >>   {
> >>  clk_reparent(clk, new_parent);
> >>  clk_debug_reparent(clk, new_parent);
> >> +   __clk_recalc_accuracies(clk);
> > Similar to the above statement. Why do this here? We do this for rates
> > since calls to clk_get_rate will return the cached rate (unless the
> > NOCACHE flag is set). But since a call to clk_get_accuracy will always
> > recalculate it then there is no benefit to doing that here.
> 
> This is the same for clk_get_accuracies (it returns the cached
> accuracy unless CLK_GET_ACCURACY_NOCACHE is defined).
> 
> And changing parent of a clk will indirectly change the clk
> accuracy (clk accuracies are cumulative).
> 
> >
> >>  __clk_recalc_rates(clk, POST_RATE_CHANGE);
> >>   }
> >>   
> >> @@ -1615,6 +1681,9 @@ int clk_set_parent(struct clk *clk, struct clk 
> >> *parent)
> >>  /* do the re-parent */
> >>  ret = __clk_set_parent(clk, parent, p_index);
> >>   
> >> +   /* propagate accuracy recalculation */
> >> +   __clk_recalc_accuracies(clk);
> > Ditto.
> Ditto. :)
> 
> 
> Please tell me if I misunderstood your requests.
> 
> Best Regards,
> 
> Boris
> 
> >
> > Regards,
> > Mike
> >
> >> +
> >>  /* propagate rate recalculation accordingly */
> >>  if (ret)
> >>  __clk_recalc_rates(clk, ABORT_RATE_CHANGE);
> >> @@ -1724,6 +1793,21 @@ int __clk_init(struct device *dev, struct clk *clk)
> >>  hlist_add_head(>child_node, _orphan_list);
> >>   
> >>  /*
> >> +* Set clk's accuracy.  The preferred method is to use
> >> +* .recalc_accuracy. For simple clocks and lazy developers the 
> >> default
> >> +* fallback is to use the parent's accuracy.  If a 

[PATCH tip/core/rcu 04/14] decnet: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
dn_insert_route() is legitimate: It is assigning a pointer to an element
from an RCU-protected list, and all elements of this list are already
visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "David S. Miller" 
Cc: Thomas Graf 
Cc: Gao feng 
Cc: Stephen Hemminger 
Cc: linux-decnet-u...@lists.sourceforge.net
Cc: net...@vger.kernel.org
---
 net/decnet/dn_route.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index fe32388ea24f..a6ef8b025035 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -344,8 +344,9 @@ static int dn_insert_route(struct dn_route *rt, unsigned 
int hash, struct dn_rou
if (compare_keys(>fld, >fld)) {
/* Put it first */
*rthp = rth->dst.dn_next;
-   rcu_assign_pointer(rth->dst.dn_next,
-  dn_rt_hash_table[hash].chain);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(rth->dst.dn_next) =
+  dn_rt_hash_table[hash].chain;
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
 
dst_use(>dst, now);
@@ -358,7 +359,8 @@ static int dn_insert_route(struct dn_route *rt, unsigned 
int hash, struct dn_rou
rthp = >dst.dn_next;
}
 
-   rcu_assign_pointer(rt->dst.dn_next, dn_rt_hash_table[hash].chain);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(rt->dst.dn_next) = dn_rt_hash_table[hash].chain;
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
 
dst_use(>dst, now);
-- 
1.8.1.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 tip/core/rcu 01/14] rcu: Add comment on evaluate-once properties of rcu_assign_pointer().

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The rcu_assign_pointer() macro, as with most cpp macros, must not evaluate
its argument more than once.  And it in fact does not.  But this might
not be obvious to the casual observer, because one of the arguments
appears no less than three times.  However, but one expansion is only
visible to sparse (__CHECKER__), and one lives inside a typeof (where
it will never be evaluated), so this is in fact safe.

This commit therefore adds a comment making this explicit.

Reported-by: Josh Triplett 
Signed-off-by: Paul E. McKenney 
---
 include/linux/rcupdate.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 39cbb889e20d..00ad28168ef0 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -911,6 +911,14 @@ static inline notrace void 
rcu_read_unlock_sched_notrace(void)
  * rcu_assign_pointer() is a very bad thing that results in
  * impossible-to-diagnose memory corruption.  So please be careful.
  * See the RCU_INIT_POINTER() comment header for details.
+ *
+ * Note that rcu_assign_pointer() evaluates each of its arguments only
+ * once, appearances notwithstanding.  One of the "extra" evaluations
+ * is in typeof() and the other visible only to sparse (__CHECKER__),
+ * neither of which actually execute the argument.  As with most cpp
+ * macros, this execute-arguments-only-once property is important, so
+ * please be careful when making changes to rcu_assign_pointer() and the
+ * other macros that it invokes.
  */
 #define rcu_assign_pointer(p, v) \
__rcu_assign_pointer((p), (v), __rcu)
-- 
1.8.1.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 tip/core/rcu 06/14] ipv6/ip6_tunnel: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
ip6_tnl_unlink() is legitimate: It is assigning a pointer to an element
from an RCU-protected list, and all elements of this list are already
visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 net/ipv6/ip6_tunnel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 61355f7f4da5..2bea7a4e49ed 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -245,7 +245,8 @@ ip6_tnl_unlink(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
 (iter = rtnl_dereference(*tp)) != NULL;
 tp = >next) {
if (t == iter) {
-   rcu_assign_pointer(*tp, t->next);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(*tp) = t->next;
break;
}
}
-- 
1.8.1.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 tip/core/rcu 13/14] rcu: Make rcu_assign_pointer's assignment volatile and type-safe

2013-11-15 Thread Paul E. McKenney
From: Josh Triplett 

rcu_assign_pointer needs to use ACCESS_ONCE to make the assignment to
the destination pointer volatile, to protect against compilers too
clever for their own good.

In addition, since rcu_assign_pointer force-casts the source pointer to
add the __rcu address space (overriding any existing address space), add
an explicit check that the source pointer has the __kernel address space
to start with.

This new check produces warnings like this, when attempting to assign
from a __user pointer:

test.c:25:9: warning: incorrect type in argument 2 (different address spaces)
test.c:25:9:expected struct foo *
test.c:25:9:got struct foo [noderef] *badsrc

Signed-off-by: Josh Triplett 
Signed-off-by: Paul E. McKenney 
---
 include/linux/rcupdate.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 00ad28168ef0..08c961fa7699 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -506,8 +506,17 @@ static inline void rcu_preempt_sleep_check(void)
 #ifdef __CHECKER__
 #define rcu_dereference_sparse(p, space) \
((void)(((typeof(*p) space *)p) == p))
+/* The dummy first argument in __rcu_assign_pointer_typecheck makes the
+ * typechecked pointer the second argument, matching rcu_assign_pointer itself;
+ * this avoids confusion about argument numbers in warning messages. */
+#define __rcu_assign_pointer_check_kernel(v) \
+   do { \
+   extern void __rcu_assign_pointer_typecheck(int, typeof(*(v)) 
__kernel *); \
+   __rcu_assign_pointer_typecheck(0, v); \
+   } while (0)
 #else /* #ifdef __CHECKER__ */
 #define rcu_dereference_sparse(p, space)
+#define __rcu_assign_pointer_check_kernel(v) do { } while (0)
 #endif /* #else #ifdef __CHECKER__ */
 
 #define __rcu_access_pointer(p, space) \
@@ -551,7 +560,8 @@ static inline void rcu_preempt_sleep_check(void)
 #define __rcu_assign_pointer(p, v, space) \
do { \
smp_wmb(); \
-   (p) = (typeof(*v) __force space *)(v); \
+   __rcu_assign_pointer_check_kernel(v); \
+   ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \
} while (0)
 
 
-- 
1.8.1.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 tip/core/rcu 12/14] bonding/bond_alb.c: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
bond_alb_handle_active_change() is legitimate: It is assigning a pointer
to an element from an RCU-protected list, and all elements of this list
are already visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 drivers/net/bonding/bond_alb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 91f179d5135c..67d3b2893aa3 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1667,7 +1667,8 @@ void bond_alb_handle_active_change(struct bonding *bond, 
struct slave *new_slave
}
 
swap_slave = bond->curr_active_slave;
-   rcu_assign_pointer(bond->curr_active_slave, new_slave);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(bond->curr_active_slave) = new_slave;
 
if (!new_slave || list_empty(>slave_list))
return;
-- 
1.8.1.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 tip/core/rcu 08/14] ipv6/sit: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
ipip6_tunnel_unlink() is legitimate: It is assigning a pointer to an
element from an RCU-protected list, and all elements of this list are
already visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 net/ipv6/sit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 7ee5cb96db34..9b976a4b463d 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -157,7 +157,8 @@ static void ipip6_tunnel_unlink(struct sit_net *sitn, 
struct ip_tunnel *t)
 (iter = rtnl_dereference(*tp)) != NULL;
 tp = >next) {
if (t == iter) {
-   rcu_assign_pointer(*tp, t->next);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(*tp) = t->next;
break;
}
}
-- 
1.8.1.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 tip/core/rcu 14/14] rcu: Add an RCU_INITIALIZER for global RCU-protected pointers

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

There is currently no way to initialize a global RCU-protected pointer
without either putting up with sparse complaints or open-coding an
obscure cast.  This commit therefore creates RCU_INITIALIZER(), which
is intended to be used as follows:

struct foo __rcu *p = RCU_INITIALIZER(_rcu_structure);

This commit also applies RCU_INITIALIZER() to eliminate repeated
open-coded obscure casts in __rcu_assign_pointer(), RCU_INIT_POINTER(),
and RCU_POINTER_INITIALIZER().  This commit also inlines
__rcu_assign_pointer() into its only caller, rcu_assign_pointer().

Suggested-by: Steven Rostedt 
Signed-off-by: Paul E. McKenney 
---
 include/linux/rcupdate.h | 80 +---
 1 file changed, 42 insertions(+), 38 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 08c961fa7699..cebe555c06ce 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -557,11 +557,49 @@ static inline void rcu_preempt_sleep_check(void)
smp_read_barrier_depends(); \
(_p1); \
})
-#define __rcu_assign_pointer(p, v, space) \
+
+/**
+ * RCU_INITIALIZER() - statically initialize an RCU-protected global variable
+ * @v: The value to statically initialize with.
+ */
+#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
+
+/**
+ * rcu_assign_pointer() - assign to RCU-protected pointer
+ * @p: pointer to assign to
+ * @v: value to assign (publish)
+ *
+ * Assigns the specified value to the specified RCU-protected
+ * pointer, ensuring that any concurrent RCU readers will see
+ * any prior initialization.
+ *
+ * Inserts memory barriers on architectures that require them
+ * (which is most of them), and also prevents the compiler from
+ * reordering the code that initializes the structure after the pointer
+ * assignment.  More importantly, this call documents which pointers
+ * will be dereferenced by RCU read-side code.
+ *
+ * In some special cases, you may use RCU_INIT_POINTER() instead
+ * of rcu_assign_pointer().  RCU_INIT_POINTER() is a bit faster due
+ * to the fact that it does not constrain either the CPU or the compiler.
+ * That said, using RCU_INIT_POINTER() when you should have used
+ * rcu_assign_pointer() is a very bad thing that results in
+ * impossible-to-diagnose memory corruption.  So please be careful.
+ * See the RCU_INIT_POINTER() comment header for details.
+ *
+ * Note that rcu_assign_pointer() evaluates each of its arguments only
+ * once, appearances notwithstanding.  One of the "extra" evaluations
+ * is in typeof() and the other visible only to sparse (__CHECKER__),
+ * neither of which actually execute the argument.  As with most cpp
+ * macros, this execute-arguments-only-once property is important, so
+ * please be careful when making changes to rcu_assign_pointer() and the
+ * other macros that it invokes.
+ */
+#define rcu_assign_pointer(p, v) \
do { \
smp_wmb(); \
__rcu_assign_pointer_check_kernel(v); \
-   ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \
+   ACCESS_ONCE(p) = RCU_INITIALIZER(v); \
} while (0)
 
 
@@ -900,40 +938,6 @@ static inline notrace void 
rcu_read_unlock_sched_notrace(void)
 }
 
 /**
- * rcu_assign_pointer() - assign to RCU-protected pointer
- * @p: pointer to assign to
- * @v: value to assign (publish)
- *
- * Assigns the specified value to the specified RCU-protected
- * pointer, ensuring that any concurrent RCU readers will see
- * any prior initialization.
- *
- * Inserts memory barriers on architectures that require them
- * (which is most of them), and also prevents the compiler from
- * reordering the code that initializes the structure after the pointer
- * assignment.  More importantly, this call documents which pointers
- * will be dereferenced by RCU read-side code.
- *
- * In some special cases, you may use RCU_INIT_POINTER() instead
- * of rcu_assign_pointer().  RCU_INIT_POINTER() is a bit faster due
- * to the fact that it does not constrain either the CPU or the compiler.
- * That said, using RCU_INIT_POINTER() when you should have used
- * rcu_assign_pointer() is a very bad thing that results in
- * impossible-to-diagnose memory corruption.  So please be careful.
- * See the RCU_INIT_POINTER() comment header for details.
- *
- * Note that rcu_assign_pointer() evaluates each of its arguments only
- * once, appearances notwithstanding.  One of the "extra" evaluations
- * is in typeof() and the other visible only to sparse (__CHECKER__),
- * neither of which actually execute the argument.  As with most cpp
- * macros, this execute-arguments-only-once property is important, so
- * please be careful when making changes to rcu_assign_pointer() and the
- * other macros that it invokes.
- */
-#define rcu_assign_pointer(p, v) \
-   __rcu_assign_pointer((p), (v), __rcu)
-
-/**
  * RCU_INIT_POINTER() - initialize an RCU protected 

[PATCH tip/core/rcu 10/14] bridge/br_mdb: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
__br_mdb_del() is legitimate: They are assigning a pointer to an element
from an RCU-protected list, and all elements of this list are already
visible to caller.

This commit therefore silences these false positives by laundering
the pointers using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: Stephen Hemminger 
Cc: "David S. Miller" 
Cc: bri...@lists.linux-foundation.org
Cc: net...@vger.kernel.org
---
 net/bridge/br_mdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 85a09bb5ca51..de7197ba8695 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -447,7 +447,7 @@ static int __br_mdb_del(struct net_bridge *br, struct 
br_mdb_entry *entry)
if (p->port->state == BR_STATE_DISABLED)
goto unlock;
 
-   rcu_assign_pointer(*pp, p->next);
+   ACCESS_ONCE(*pp) = p->next; /* OK: Both --rcu and visible. */
hlist_del_init(>mglist);
del_timer(>timer);
call_rcu_bh(>rcu, br_multicast_free_pg);
-- 
1.8.1.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 tip/core/rcu 02/14] notifiers: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
notifier_chain_unregister() is legitimate: It is deleting an element
from an RCU-protected list, and all elements of this list are already
visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
---
 kernel/notifier.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/notifier.c b/kernel/notifier.c
index 2d5cc4ccff7f..197eb70805a4 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -51,7 +51,8 @@ static int notifier_chain_unregister(struct notifier_block 
**nl,
 {
while ((*nl) != NULL) {
if ((*nl) == n) {
-   rcu_assign_pointer(*nl, n->next);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(*nl) = n->next;
return 0;
}
nl = &((*nl)->next);
-- 
1.8.1.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 tip/core/rcu 09/14] mac80211: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the uses in
sta_info_hash_del() are legitimate: They are assigning a pointer to an
element from an RCU-protected list, and all elements of this list are
already visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "John W. Linville" 
Cc: Johannes Berg 
Cc: "David S. Miller" 
Cc: linux-wirel...@vger.kernel.org
Cc: net...@vger.kernel.org
---
 net/mac80211/sta_info.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index aeb967a0aeed..494f03c0831f 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -74,8 +74,8 @@ static int sta_info_hash_del(struct ieee80211_local *local,
if (!s)
return -ENOENT;
if (s == sta) {
-   rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)],
-  s->hnext);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(local->sta_hash[STA_HASH(sta->sta.addr)]) = 
s->hnext;
return 0;
}
 
@@ -84,7 +84,8 @@ static int sta_info_hash_del(struct ieee80211_local *local,
s = rcu_dereference_protected(s->hnext,
lockdep_is_held(>sta_mtx));
if (rcu_access_pointer(s->hnext)) {
-   rcu_assign_pointer(s->hnext, sta->hnext);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(s->hnext) = sta->hnext;
return 0;
}
 
-- 
1.8.1.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 tip/core/rcu 14/28] rcutorture: Eliminate --rcu-kvm argument

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The --rcu-kvm argument was intended to allow the scripts to live in
an alternate location.  Unfortunately, this prevents the kvm.sh script
from using common functions until after it finished parsing arguments,
because it doesn't know where to find them until then.  However, "cp -a"
and "ln -s" work pretty well, so lack of an --rcu-kvm argument can be
easily worked around.

This commit therefore removes this argument.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 89164c245ca1..2af549491f23 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -46,7 +46,6 @@ usage () {
echo "   --duration minutes"
echo "   --kversion vN.NN"
echo "   --qemu-cmd qemu-system-..."
-   echo "   --rcu-kvm absolute-pathname"
echo "   --results absolute-pathname"
echo "   --relbuilddir relative-pathname"
exit 1
@@ -107,19 +106,6 @@ do
RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
shift
;;
-   --rcu-kvm)
-   checkarg --rcu-kvm "(absolute pathname)" "$#" "$2" '^/' error
-   KVM=$2; export KVM
-   if -z "$gotbuilddir"
-   then
-   builddir=${KVM}/b1
-   fi
-   if -n "$gotrelbuilddir"
-   then
-   builddir=${KVM}/${relbuilddir}
-   fi
-   shift
-   ;;
--relbuilddir)
checkarg --relbuilddir "(relative pathname)" "$#" "$2" 
'^[^/]*$' '^--'
relbuilddir=$2
@@ -133,6 +119,7 @@ do
shift
;;
*)
+   echo Unknown argument $1
usage
;;
esac
-- 
1.8.1.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 tip/core/rcu 03/14] bridge: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the uses in
br_multicast_del_pg() and br_multicast_new_port_group() are legitimate:
They are assigning a pointer to an element from an RCU-protected list,
and all elements of this list are already visible to caller.

This commit therefore silences these false positives by laundering
the pointers using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: Stephen Hemminger 
Cc: "David S. Miller" 
Cc: bri...@lists.linux-foundation.org
Cc: net...@vger.kernel.org
---
 net/bridge/br_multicast.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index d1c578630678..bcc4bbc16498 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -267,7 +267,7 @@ static void br_multicast_del_pg(struct net_bridge *br,
if (p != pg)
continue;
 
-   rcu_assign_pointer(*pp, p->next);
+   ACCESS_ONCE(*pp) = p->next; /* OK: Both --rcu and visible. */
hlist_del_init(>mglist);
del_timer(>timer);
call_rcu_bh(>rcu, br_multicast_free_pg);
@@ -646,7 +646,7 @@ struct net_bridge_port_group *br_multicast_new_port_group(
p->addr = *group;
p->port = port;
p->state = state;
-   rcu_assign_pointer(p->next, next);
+   ACCESS_ONCE(p->next) = next; /* OK: Both --rcu and visible. */
hlist_add_head(>mglist, >mglist);
setup_timer(>timer, br_multicast_port_group_expired,
(unsigned long)p);
-- 
1.8.1.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 tip/core/rcu 26/28] rcutorture: Record results from repeated runs of the same test scenario

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Repeatedly running a given test, for example, by repeating the name
as in "--configs "TREE08 TREE08 TREE08" records the results only of
the last run of this test.  This is because the earlier results are
overwritten by the later results.

This commit therefore checks for earlier results, using numbered
file extensions to distinguish multiple runs.  The earlier example
would therefore create directories TREE01, TREE01.2, and TREE01.3.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index b8d278904dee..0783ec9c583e 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -204,8 +204,22 @@ fi
 
 for CF in $configs
 do
+   # Running TREE01 multiple times creates TREE01, TREE01.2, TREE01.3, ...
rd=$resdir/$ds/$CF
-   mkdir $rd || :
+   if test -d "${rd}"
+   then
+   n="`ls -d "${rd}"* | grep '\.[0-9]\+$' |
+   sed -e 's/^.*\.\([0-9]\+\)/\1/' |
+   sort -k1n | tail -1`"
+   if test -z "$n"
+   then
+   rd="${rd}.2"
+   else
+   n="`expr $n + 1`"
+   rd="${rd}.${n}"
+   fi
+   fi
+   mkdir "${rd}"
echo Results directory: $rd
kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 
$RCU_BOOTARGS"
 done
-- 
1.8.1.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 tip/core/rcu 07/14] ipv6/ip6_gre: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
ip6gre_tunnel_unlink() is legitimate: It is assigning a pointer to an
element from an RCU-protected list, and all elements of this list are
already visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 net/ipv6/ip6_gre.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 6b26e9feafb9..7bc9e1b3283e 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -276,7 +276,8 @@ static void ip6gre_tunnel_unlink(struct ip6gre_net *ign, 
struct ip6_tnl *t)
 (iter = rtnl_dereference(*tp)) != NULL;
 tp = >next) {
if (t == iter) {
-   rcu_assign_pointer(*tp, t->next);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(*tp) = t->next;
break;
}
}
-- 
1.8.1.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 tip/core/rcu 11/14] bonding/bond_main: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the uses in
bond_change_active_slave() and __bond_release_one() are legitimate:
They are assigning a pointer to an element from an RCU-protected list
(or a NULL pointer), and all elements of this list are already visible
to caller.

This commit therefore silences these false positives either by laundering
the pointers using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett, or by using RCU_INIT_POINTER() for NULL pointer assignments.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: Stephen Hemminger 
Cc: "David S. Miller" 
Cc: bri...@lists.linux-foundation.org
Cc: net...@vger.kernel.org
---
 drivers/net/bonding/bond_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 72df399c4ab3..bbd7fd3e46fe 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -890,7 +890,8 @@ void bond_change_active_slave(struct bonding *bond, struct 
slave *new_active)
if (new_active)
bond_set_slave_active_flags(new_active);
} else {
-   rcu_assign_pointer(bond->curr_active_slave, new_active);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(bond->curr_active_slave) = new_active;
}
 
if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) {
@@ -1801,7 +1802,7 @@ static int __bond_release_one(struct net_device *bond_dev,
}
 
if (all) {
-   rcu_assign_pointer(bond->curr_active_slave, NULL);
+   RCU_INIT_POINTER(bond->curr_active_slave, NULL);
} else if (oldcurrent == slave) {
/*
 * Note that we hold RTNL over this sequence, so there
-- 
1.8.1.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 tip/core/rcu 05/14] ipv4/ip_socketglue: Apply ACCESS_ONCE() to avoid sparse false positive

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the use in
ip_ra_control() is legitimate: It is assigning a pointer to an element
from an RCU-protected list, and all elements of this list are already
visible to caller.

This commit therefore silences this false positive by laundering the
pointer using ACCESS_ONCE() as suggested by Eric Dumazet and Josh
Triplett.

Reported-by: kbuild test robot 
Signed-off-by: Paul E. McKenney 
Cc: "David S. Miller" 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: net...@vger.kernel.org
---
 net/ipv4/ip_sockglue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index d9c4f113d709..a0e7f176e9c8 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -269,7 +269,8 @@ int ip_ra_control(struct sock *sk, unsigned char on,
}
/* dont let ip_call_ra_chain() use sk again */
ra->sk = NULL;
-   rcu_assign_pointer(*rap, ra->next);
+   /* Both --rcu and visible, so ACCESS_ONCE() is OK. */
+   ACCESS_ONCE(*rap) = ra->next;
spin_unlock_bh(_ra_lock);
 
if (ra->destructor)
-- 
1.8.1.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 tip/core/rcu 0/14] sparse improvements of rcu_assign_pointer() for 3.14

2013-11-15 Thread Paul E. McKenney
Hello!

This series once again attempts to improve rcu_assign_pointer()'s
relationship with sparse.

1.  Add a comment indicating that despite appearances,
rcu_assign_pointer() really only evaluates its arguments once,
as a cpp macro should.

2-13.   Apply ACCESS_ONCE() to avoid a number of rcu_assign_pointer()
calls that would otherwise suffer sparse false positives given
patch #13 below.

14. Apply ACCESS_ONCE() to rcu_assign_pointer()'s target to prevent
comiler mischief.  Also require that the source pointer be from
the kernel address space.  Sometimes it can be from the RCU address
space, which necessitates the remaining patches in this series.
Which, it must be admitted, apply to a very small fraction of
the rcu_assign_pointer() invocations in the kernel.  This commit
courtesy of Josh Triplett.

Changes from v3:

o   Remove the replacements of rcu_assign_pointer() with ACCESS_ONCE()
where new data really was being exposed to readers.

Changes from v2:

o   Switch from rcu_assign_pointer() to ACCESS_ONCE() given that
the pointers are all --rcu and already visible to readers,
as suggested by Eric Dumazet and Josh Triplett.

o   Place the commit adding the rcu_assign_pointer()'s ACCESS_ONCE()
at the end to allow better bisectability, as suggested by Josh
Triplett.

o   Add a comment to rcu_assign_pointer() noting that it only evaluates
its arguments once, as suggested by Josh Triplett.

Changes from v1:

o   Fix grammar nit in commit logs.

Thanx, Paul

 b/drivers/net/bonding/bond_alb.c  |3 -
 b/drivers/net/bonding/bond_main.c |5 +-
 b/include/linux/rcupdate.h|8 +++
 b/kernel/notifier.c   |3 -
 b/net/bridge/br_mdb.c |2 
 b/net/bridge/br_multicast.c   |4 -
 b/net/decnet/dn_route.c   |8 ++-
 b/net/ipv4/ip_sockglue.c  |3 -
 b/net/ipv6/ip6_gre.c  |3 -
 b/net/ipv6/ip6_tunnel.c   |3 -
 b/net/ipv6/sit.c  |3 -
 b/net/mac80211/sta_info.c |7 +-
 include/linux/rcupdate.h  |   92 +-
 13 files changed, 88 insertions(+), 56 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 tip/core/rcu 17/28] rcutorture: Eliminate configdir argument from kvm-recheck.sh script

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Don't grab the configuration fragment from the configs directory because
it might well have been changed since the test was run.  Instead, use
the ConfigFragment file that was placed in the results directory.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-recheck.sh | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
index 0876af75b66b..26e82b5d67f8 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
@@ -4,7 +4,7 @@
 # check the build and console output for errors.  Given a directory
 # containing results directories, this recursively checks them all.
 #
-# Usage: sh kvm-recheck.sh configdir resdir ...
+# Usage: sh kvm-recheck.sh resdir ...
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,8 +25,6 @@
 # Authors: Paul E. McKenney 
 
 PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
-configdir=${1}
-shift
 for rd in "$@"
 do
dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 
's,/[^/]*$,,' | sort -u`
@@ -34,7 +32,7 @@ do
do
configfile=`echo $i | sed -e 's/^.*\///'`
echo $i
-   configcheck.sh $i/.config $configdir/$configfile
+   configcheck.sh $i/.config $i/ConfigFragment
parse-build.sh $i/Make.out $configfile
parse-rcutorture.sh $i/console.log $configfile
parse-console.sh $i/console.log $configfile
-- 
1.8.1.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 tip/core/rcu 13/28] rcutorture: Remove decorative qemu argument

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The qemu -name argument doesn't seem to be useful in this environment,
so this commit removes it.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index ddf3bd6eaf19..5e2e79b5eaba 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -137,7 +137,7 @@ boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`"
 # Pull in Kconfig-fragment boot parameters
 boot_args="`configfrag_boot_params "$boot_args" "$config_template"`"
 
-echo $QEMU -name rcu-test -serial file:$builddir/console.log $qemu_args -m 512 
-kernel $builddir/arch/x86/boot/bzImage -append \"noapic selinux=0 
console=ttyS0 initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args\" 
> $resdir/qemu-cmd
+echo $QEMU -serial file:$builddir/console.log $qemu_args -m 512 -kernel 
$builddir/arch/x86/boot/bzImage -append \"noapic selinux=0 console=ttyS0 
initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args\" 
> $resdir/qemu-cmd
 $QEMU -name rcu-test -serial file:$builddir/console.log $qemu_args -m 512 
-kernel $builddir/arch/x86/boot/bzImage -append "noapic selinux=0 console=ttyS0 
initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args" &
 qemu_pid=$!
 commandcompleted=0
-- 
1.8.1.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 tip/core/rcu 09/28] rcutorture: Refactor TINY_RCU test cases

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The TINY_RCU test cases were first put in place many years ago, and have
been incrementally modified rather than being reworked.  This commit
therefore completes a long-overdue reworking of the TINY_RCU test cases.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/configs/CFLIST  |  4 +--
 tools/testing/selftests/rcutorture/configs/NT1-nh  | 23 -
 tools/testing/selftests/rcutorture/configs/NT3-NH  | 20 ---
 tools/testing/selftests/rcutorture/configs/PT1-nh  | 23 -
 tools/testing/selftests/rcutorture/configs/PT2-NH  | 22 
 tools/testing/selftests/rcutorture/configs/TINY01  | 13 +++
 tools/testing/selftests/rcutorture/configs/TINY02  | 13 +++
 .../testing/selftests/rcutorture/doc/TINY_RCU.txt  | 40 ++
 8 files changed, 68 insertions(+), 90 deletions(-)
 delete mode 100644 tools/testing/selftests/rcutorture/configs/NT1-nh
 delete mode 100644 tools/testing/selftests/rcutorture/configs/NT3-NH
 delete mode 100644 tools/testing/selftests/rcutorture/configs/PT1-nh
 delete mode 100644 tools/testing/selftests/rcutorture/configs/PT2-NH
 create mode 100644 tools/testing/selftests/rcutorture/configs/TINY01
 create mode 100644 tools/testing/selftests/rcutorture/configs/TINY02
 create mode 100644 tools/testing/selftests/rcutorture/doc/TINY_RCU.txt

diff --git a/tools/testing/selftests/rcutorture/configs/CFLIST 
b/tools/testing/selftests/rcutorture/configs/CFLIST
index 884491b25c19..cd3d29cb0a47 100644
--- a/tools/testing/selftests/rcutorture/configs/CFLIST
+++ b/tools/testing/selftests/rcutorture/configs/CFLIST
@@ -9,5 +9,5 @@ TREE08
 TREE09
 SRCU-N
 SRCU-P
-NT1-nh
-NT3-NH
+TINY01
+TINY02
diff --git a/tools/testing/selftests/rcutorture/configs/NT1-nh 
b/tools/testing/selftests/rcutorture/configs/NT1-nh
deleted file mode 100644
index 023f312a931c..
--- a/tools/testing/selftests/rcutorture/configs/NT1-nh
+++ /dev/null
@@ -1,23 +0,0 @@
-#CHECK#CONFIG_TINY_RCU=y
-CONFIG_RCU_TRACE=y
-CONFIG_RCU_TORTURE_TEST=m
-CONFIG_MODULE_UNLOAD=y
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
-#
-CONFIG_SMP=n
-#
-CONFIG_HOTPLUG_CPU=n
-#
-CONFIG_NO_HZ=n
-#
-CONFIG_PREEMPT_NONE=y
-CONFIG_PREEMPT_VOLUNTARY=n
-CONFIG_PREEMPT=n
-CONFIG_PROVE_LOCKING=y
-CONFIG_PROVE_RCU=y
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_PRINTK_TIME=y
-
diff --git a/tools/testing/selftests/rcutorture/configs/NT3-NH 
b/tools/testing/selftests/rcutorture/configs/NT3-NH
deleted file mode 100644
index 6fd0235dae73..
--- a/tools/testing/selftests/rcutorture/configs/NT3-NH
+++ /dev/null
@@ -1,20 +0,0 @@
-#CHECK#CONFIG_TINY_RCU=y
-CONFIG_RCU_TORTURE_TEST=m
-CONFIG_MODULE_UNLOAD=y
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
-#
-CONFIG_SMP=n
-#
-CONFIG_HOTPLUG_CPU=n
-#
-CONFIG_NO_HZ=y
-#
-CONFIG_PREEMPT_NONE=y
-CONFIG_PREEMPT_VOLUNTARY=n
-CONFIG_PREEMPT=n
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_PRINTK_TIME=y
-
diff --git a/tools/testing/selftests/rcutorture/configs/PT1-nh 
b/tools/testing/selftests/rcutorture/configs/PT1-nh
deleted file mode 100644
index e3361c3894a1..
--- a/tools/testing/selftests/rcutorture/configs/PT1-nh
+++ /dev/null
@@ -1,23 +0,0 @@
-CONFIG_TINY_PREEMPT_RCU=y
-CONFIG_RCU_BOOST=y
-CONFIG_RCU_BOOST_PRIO=2
-CONFIG_RCU_TRACE=y
-CONFIG_RCU_TORTURE_TEST=m
-CONFIG_MODULE_UNLOAD=y
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
-#
-CONFIG_SMP=n
-#
-CONFIG_HOTPLUG_CPU=n
-#
-CONFIG_NO_HZ=n
-#
-CONFIG_PREEMPT_NONE=n
-CONFIG_PREEMPT_VOLUNTARY=n
-CONFIG_PREEMPT=y
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_PRINTK_TIME=y
-
diff --git a/tools/testing/selftests/rcutorture/configs/PT2-NH 
b/tools/testing/selftests/rcutorture/configs/PT2-NH
deleted file mode 100644
index 64abfc3b4d94..
--- a/tools/testing/selftests/rcutorture/configs/PT2-NH
+++ /dev/null
@@ -1,22 +0,0 @@
-CONFIG_TINY_PREEMPT_RCU=y
-CONFIG_RCU_TORTURE_TEST=m
-CONFIG_MODULE_UNLOAD=y
-CONFIG_SUSPEND=n
-CONFIG_HIBERNATION=n
-#
-CONFIG_SMP=n
-#
-CONFIG_HOTPLUG_CPU=n
-#
-CONFIG_NO_HZ=y
-#
-CONFIG_PREEMPT_NONE=n
-CONFIG_PREEMPT_VOLUNTARY=n
-CONFIG_PREEMPT=y
-CONFIG_PROVE_LOCKING=y
-CONFIG_PROVE_RCU=y
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_PRINTK_TIME=y
-
diff --git a/tools/testing/selftests/rcutorture/configs/TINY01 
b/tools/testing/selftests/rcutorture/configs/TINY01
new file mode 100644
index ..0c2823f21712
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/TINY01
@@ -0,0 +1,13 @@
+CONFIG_SMP=n
+CONFIG_PREEMPT_NONE=y
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=n
+#CHECK#CONFIG_TINY_RCU=y
+CONFIG_HZ_PERIODIC=n
+CONFIG_NO_HZ_IDLE=y
+CONFIG_NO_HZ_FULL=n
+CONFIG_RCU_TRACE=n
+CONFIG_DEBUG_LOCK_ALLOC=n
+CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_PREEMPT_COUNT=n
+CONFIG_PRINTK_TIME=y
diff --git a/tools/testing/selftests/rcutorture/configs/TINY02 

[PATCH tip/core/rcu 28/28] rcutorture: Move checkarg to functions.sh

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/bin/functions.sh  | 24 +
 tools/testing/selftests/rcutorture/bin/kvm.sh  | 25 +++---
 2 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh 
b/tools/testing/selftests/rcutorture/bin/functions.sh
index 963b6f04d4ef..3052f1bea6bf 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -28,6 +28,30 @@ bootparam_hotplug_cpu () {
echo "$1" | grep -q "rcutorture\.onoff_"
 }
 
+# checkarg --argname argtype $# arg mustmatch cannotmatch
+#
+# Checks the specified argument "arg" against the mustmatch and cannotmatch
+# patterns.
+checkarg () {
+   if test $3 -le 1
+   then
+   echo $1 needs argument $2 matching \"$5\"
+   usage
+   fi
+   if echo "$4" | grep -q -e "$5"
+   then
+   :
+   else
+   echo $1 $2 \"$4\" must match \"$5\"
+   usage
+   fi
+   if echo "$4" | grep -q -e "$6"
+   then
+   echo $1 $2 \"$4\" must not match \"$6\"
+   usage
+   fi
+}
+
 # configfrag_boot_params bootparam-string config-fragment-file
 #
 # Adds boot parameters from the .boot file, if any.
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 0783ec9c583e..7ba375ebe396 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -32,6 +32,7 @@ args="$*"
 
 dur=30
 KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
+PATH=${KVM}/bin:$PATH; export PATH
 builddir="${KVM}/b1"
 RCU_INITRD="$KVM/initrd"; export RCU_INITRD
 RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG
@@ -40,6 +41,8 @@ configs=""
 ds=`date +%Y.%m.%d-%H:%M:%S`
 kversion=""
 
+. functions.sh
+
 usage () {
echo "Usage: $scriptname optional arguments:"
echo "   --bootargs kernel-boot-arguments"
@@ -60,27 +63,6 @@ usage () {
exit 1
 }
 
-# checkarg --argname argtype $# arg mustmatch cannotmatch
-checkarg () {
-   if test $3 -le 1
-   then
-   echo $1 needs argument $2 matching \"$5\"
-   usage
-   fi
-   if echo "$4" | grep -q -e "$5"
-   then
-   :
-   else
-   echo $1 $2 \"$4\" must match \"$5\"
-   usage
-   fi
-   if echo "$4" | grep -q -e "$6"
-   then
-   echo $1 $2 \"$4\" must not match \"$6\"
-   usage
-   fi
-}
-
 while test $# -gt 0
 do
case "$1" in
@@ -164,7 +146,6 @@ do
shift
 done
 
-PATH=${KVM}/bin:$PATH; export PATH
 CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
 KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
 
-- 
1.8.1.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 tip/core/rcu 24/28] rcutorture: Update comment in kvm.sh listing typical RCU trace events

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 69b6523bb854..02ac41e6d10e 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -209,4 +209,4 @@ do
echo Results directory: $rd
kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 
$RCU_BOOTARGS"
 done
-# Tracing: 
trace_event=rcu:rcu_nocb_grace_period,rcu:rcu_grace_period,rcu:rcu_grace_period_init,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_torture_read,rcu:rcu_invoke_callback,rcu:rcu_fqs,rcu:rcu_dyntick,rcu:rcu_unlock_preempted_task
+# Tracing: 
trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier
-- 
1.8.1.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 tip/core/rcu 15/28] rcutorture: Refactor to enable non-x86 architectures

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit expands the checks for what architecture is running to generate
additional qemu-system- commands, then uses the resulting qemu-system-
command name to choose different qemu arguments as needed for different
architectures.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/bin/functions.sh  | 78 ++
 .../selftests/rcutorture/bin/kvm-test-1-rcu.sh | 27 
 tools/testing/selftests/rcutorture/bin/kvm.sh  | 10 +++
 3 files changed, 102 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh 
b/tools/testing/selftests/rcutorture/bin/functions.sh
index c974414ef7a5..d0d19ebd2a94 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -78,3 +78,81 @@ identify_qemu () {
exit 1
fi
 }
+
+# identify_qemu_append qemu-cmd
+#
+# Output arguments for the qemu "-append" string based on CPU type
+# and the RCU_QEMU_INTERACTIVE environment variable.
+identify_qemu_append () {
+   case "$1" in
+   qemu-system-x86_64|qemu-system-i386)
+   echo noapic selinux=0 initcall_debug debug
+   ;;
+   esac
+   if test -n "$RCU_QEMU_INTERACTIVE"
+   then
+   echo root=/dev/sda
+   else
+   echo console=ttyS0
+   fi
+}
+
+# identify_qemu_args qemu-cmd serial-file
+#
+# Output arguments for qemu arguments based on the RCU_QEMU_MAC
+# and RCU_QEMU_INTERACTIVE environment variables.
+identify_qemu_args () {
+   case "$1" in
+   qemu-system-x86_64|qemu-system-i386)
+   ;;
+   qemu-system-ppc64)
+   echo -enable-kvm -M pseries -cpu POWER7 -nodefaults
+   echo -device spapr-vscsi
+   if test -n "$RCU_QEMU_INTERACTIVE" -a -n "$RCU_QEMU_MAC"
+   then
+   echo -device spapr-vlan,netdev=net0,mac=$RCU_QEMU_MAC
+   echo -netdev bridge,br=br0,id=net0
+   elif test -n "$RCU_QEMU_INTERACTIVE"
+   then
+   echo -net nic -net user
+   fi
+   ;;
+   esac
+   if test -n "$RCU_QEMU_INTERACTIVE"
+   then
+   echo -monitor stdio -serial pty -S
+   else
+   echo -serial file:$2
+   fi
+}
+
+# identify_qemu_vcpus
+#
+# Returns the number of virtual CPUs available to the aggregate of the
+# guest OSes.
+identify_qemu_vcpus () {
+   lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://'
+}
+
+# specify_qemu_cpus qemu-cmd qemu-args #cpus
+#
+# Appends a string containing "-smp XXX" to qemu-args, unless the incoming
+# qemu-args already contains "-smp".
+specify_qemu_cpus () {
+   local nt;
+
+   if echo $2 | grep -q -e -smp
+   then
+   echo $2
+   else
+   case "$1" in
+   qemu-system-x86_64|qemu-system-i386)
+   echo $2 -smp $3
+   ;;
+   qemu-system-ppc64)
+   nt="`lscpu | grep '^NUMA node0' | sed -e 
's/^[^,]*,\([0-9]*\),.*$/\1/'`"
+   echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / 
$nt`,threads=$nt
+   ;;
+   esac
+   fi
+}
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 5e2e79b5eaba..9fd546ccb075 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -115,20 +115,21 @@ QEMU="`identify_qemu $builddir/vmlinux.o`"
 
 # Generate -smp qemu argument.
 cpu_count=`configNR_CPUS.sh $config_template`
-ncpus=`grep '^processor' /proc/cpuinfo | wc -l`
-if test $cpu_count -gt $ncpus
+vcpus=`identify_qemu_vcpus`
+if test $cpu_count -gt $vcpus
 then
-   echo CPU count limited from $cpu_count to $ncpus
+   echo CPU count limited from $cpu_count to $vcpus
touch $resdir/Warnings
-   echo CPU count limited from $cpu_count to $ncpus >> $resdir/Warnings
-   cpu_count=$ncpus
-fi
-if echo $qemu_args | grep -q -e -smp
-then
-   echo CPU count specified by caller
-else
-   qemu_args="$qemu_args -smp $cpu_count"
+   echo CPU count limited from $cpu_count to $vcpus >> $resdir/Warnings
+   cpu_count=$vcpus
 fi
+qemu_args="`specify_qemu_cpus "$QEMU" "$qemu_args" "$cpu_count"`"
+
+# Generate architecture-specific and interaction-specific qemu arguments
+qemu_args="$qemu_args `identify_qemu_args "$QEMU" "$builddir/console.log"`"
+
+# Generate qemu -append arguments
+qemu_append="`identify_qemu_append "$QEMU"`"
 
 # Generate CPU-hotplug boot parameters
 boot_args="`rcutorture_param_onoff "$boot_args" $builddir/.config`"
@@ -137,8 +138,8 @@ boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`"
 # Pull in Kconfig-fragment boot parameters
 boot_args="`configfrag_boot_params 

[PATCH tip/core/rcu 20/28] rcutorture: Add --qemu-args argument to kvm.sh

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commits adds the --qemu-args argument to kvm.sh that is required
to pass boot devices down through to qemu.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 2fb91d4f7996..7d6ca337d1fd 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -49,6 +49,7 @@ usage () {
echo "   --interactive"
echo "   --kversion vN.NN"
echo "   --mac nn:nn:nn:nn:nn:nn"
+   echo "   --qemu-args qemu-system-..."
echo "   --qemu-cmd qemu-system-..."
echo "   --results absolute-pathname"
echo "   --relbuilddir relative-pathname"
@@ -85,7 +86,7 @@ do
shift
;;
--builddir)
-   checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error
+   checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' 
'^error'
builddir=$2
gotbuilddir=1
shift
@@ -104,7 +105,7 @@ do
shift
;;
--duration)
-   checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error
+   checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
dur=$2
shift
;;
@@ -112,7 +113,7 @@ do
RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
;;
--kversion)
-   checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' 
error
+   checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' 
'^error'
kversion=$2
shift
;;
@@ -121,6 +122,11 @@ do
RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
shift
;;
+   --qemu-args)
+   checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
+   RCU_QEMU_ARG="$2"
+   shift
+   ;;
--qemu-cmd)
checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' 
'^--'
RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
@@ -134,7 +140,7 @@ do
shift
;;
--results)
-   checkarg --results "(absolute pathname)" "$#" "$2" '^/' error
+   checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
resdir=$2
shift
;;
@@ -189,6 +195,6 @@ do
rd=$resdir/$ds/$CF
mkdir $rd || :
echo Results directory: $rd
-   kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS"
+   kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 
$RCU_BOOTARGS"
 done
 # Tracing: 
trace_event=rcu:rcu_nocb_grace_period,rcu:rcu_grace_period,rcu:rcu_grace_period_init,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_torture_read,rcu:rcu_invoke_callback,rcu:rcu_fqs,rcu:rcu_dyntick,rcu:rcu_unlock_preempted_task
-- 
1.8.1.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 tip/core/rcu 27/28] rcutorture: Flag errors and warnings with color coding

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The output of the rcutorture scripts often requires interpretation, so
this commit simplifies this interpretation by tagging messages as
BUGs (colored red) or WARNINGs (colored yellow).

Reported-by: Ingo Molnar 
Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/functions.sh| 16 
 .../testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh |  5 ++---
 tools/testing/selftests/rcutorture/bin/parse-build.sh  | 18 ++
 .../testing/selftests/rcutorture/bin/parse-console.sh  |  4 +++-
 .../selftests/rcutorture/bin/parse-rcutorture.sh   | 10 ++
 5 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh 
b/tools/testing/selftests/rcutorture/bin/functions.sh
index d0d19ebd2a94..963b6f04d4ef 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -134,6 +134,22 @@ identify_qemu_vcpus () {
lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://'
 }
 
+# print_bug
+#
+# Prints "BUG: " in red followed by remaining arguments
+print_bug () {
+   printf '\033[031mBUG: \033[m'
+   echo $*
+}
+
+# print_warning
+#
+# Prints "WARNING: " in yellow followed by remaining arguments
+print_warning () {
+   printf '\033[033mWARNING: \033[m'
+   echo $*
+}
+
 # specify_qemu_cpus qemu-cmd qemu-args #cpus
 #
 # Appends a string containing "-smp XXX" to qemu-args, unless the incoming
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 3df1581e78ae..46f97d33e1ba 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -188,6 +188,5 @@ then
 fi
 
 cp $builddir/console.log $resdir
-parse-rcutorture.sh $resdir/console.log $title >> $resdir/Warnings 2>&1
-parse-console.sh $resdir/console.log $title >> $resdir/Warnings 2>&1
-cat $resdir/Warnings
+parse-rcutorture.sh $resdir/console.log $title
+parse-console.sh $resdir/console.log $title
diff --git a/tools/testing/selftests/rcutorture/bin/parse-build.sh 
b/tools/testing/selftests/rcutorture/bin/parse-build.sh
index 2e0e9f7ebbb0..9da2c7ba3fce 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-build.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-build.sh
@@ -30,18 +30,28 @@
 T=$1
 title=$2
 
+. functions.sh
+
 if grep -q CC < $T
 then
:
 else
-   echo $title no build
+   print_bug $title no build
exit 1
 fi
 
-if egrep -q "error:|rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
+if grep -q "error:" < $T
+then
+   print_bug $title build errors:
+   grep "error:" < $T
+   exit 2
+fi
+exit 0
+
+if egrep -q "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
 then
-   echo $title build errors:
-   egrep "error:|rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
+   print_warning $title build errors:
+   egrep "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
exit 2
 fi
 exit 0
diff --git a/tools/testing/selftests/rcutorture/bin/parse-console.sh 
b/tools/testing/selftests/rcutorture/bin/parse-console.sh
index bc1496fa1263..8f4be78f06b6 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-console.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-console.sh
@@ -31,9 +31,11 @@ trap 'rm -f $T' 0
 file="$1"
 title="$2"
 
+. functions.sh
+
 egrep 'Badness|WARNING:|Warn|BUG|===|Call Trace:|Oops:' < $file | grep 
-v 'ODEBUG: ' | grep -v 'Warning: unable to open an initial console' > $T
 if test -s $T
 then
-   echo Assertion failure in $file $title
+   print_warning Assertion failure in $file $title
cat $T
 fi
diff --git a/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh 
b/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
index 37368a046a9f..ac2f75a83225 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
@@ -34,6 +34,8 @@ title="$2"
 
 trap 'rm -f $T.seq' 0
 
+. functions.sh
+
 # check for presence of rcutorture.txt file
 
 if test -f "$file" -a -r "$file"
@@ -49,7 +51,7 @@ fi
 if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
 then
nerrs=`grep --binary-files=text '!!!' $file | tail -1 | awk '{for 
(i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
-   echo $title FAILURE, $nerrs instances
+   print_bug $title FAILURE, $nerrs instances
echo "   " $url
exit
 fi
@@ -84,21 +86,21 @@ if grep -q SUCCESS $file
 then
if test -s $T.seq
then
-   echo WARNING $title `cat $T.seq`
+   print_warning $title $title `cat $T.seq`
echo "   " $file
exit 2
fi
 else
if grep -q RCU_HOTPLUG $file
then
-   echo WARNING: HOTPLUG FAILURES $title `cat $T.seq`
+   

[PATCH tip/core/rcu 05/28] rcutorture: Add per-Kconfig fragment boot parameters

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Some Kconfig fragments require rcutorture module parameters to
do optimal testing, for example, a configuration for SRCU would
need rcutorture.torture_type=srcu.  This commit therefore adds a
per-Kconfig-fragment boot-parameter capability.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/functions.sh  | 12 
 tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh 
b/tools/testing/selftests/rcutorture/bin/functions.sh
index d4c15f81cd27..8f912419ed7f 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -28,6 +28,18 @@ bootparam_hotplug_cpu () {
echo "$1" | grep -q "rcutorture\.onoff_"
 }
 
+# configfrag_boot_params bootparam-string config-fragment-file
+#
+# Adds boot parameters from the .boot file, if any.
+configfrag_boot_params () {
+   if test -r "$2.boot"
+   then
+   echo $1 `grep -v '^#' "$2.boot" | tr '\012' ' '`
+   else
+   echo $1
+   fi
+}
+
 # configfrag_hotplug_cpu config-fragment-file
 #
 # Returns 1 if the config fragment specifies hotplug CPU.
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 0a3f037a8bb3..618aa4d766d3 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -137,6 +137,8 @@ fi
 boot_args="`rcutorture_param_onoff "$boot_args" $builddir/.config`"
 # Generate rcu_barrier() boot parameter
 boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`"
+# Pull in Kconfig-fragment boot parameters
+boot_args="`configfrag_boot_params "$boot_args" "$config_template"`"
 
 echo $QEMU -name rcu-test -serial file:$builddir/console.log $qemu_args -m 512 
-kernel $builddir/arch/x86/boot/bzImage -append \"noapic selinux=0 
console=ttyS0 initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args\" 
> $resdir/qemu-cmd
 $QEMU -name rcu-test -serial file:$builddir/console.log $qemu_args -m 512 
-kernel $builddir/arch/x86/boot/bzImage -append "noapic selinux=0 console=ttyS0 
initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args" &
-- 
1.8.1.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 tip/core/rcu 11/28] rcutorture: Eliminate duplicate .config-check code

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The commit uses configcheck.sh from within configinit.sh, replacing the
imperfect inline expansion that was there before.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/bin/configinit.sh | 27 +-
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/configinit.sh 
b/tools/testing/selftests/rcutorture/bin/configinit.sh
index 926fbd30bcbd..939c16cd03ab 100755
--- a/tools/testing/selftests/rcutorture/bin/configinit.sh
+++ b/tools/testing/selftests/rcutorture/bin/configinit.sh
@@ -51,31 +51,6 @@ cp $builddir/.config $builddir/.config.new
 yes '' | make $buildloc oldconfig > $builddir/Make.modconfig.out 2>&1
 
 # verify new config matches specification.
+configcheck.sh $builddir/.config $c
 
-sed -e 's/"//g' < $c > $T/c
-sed -e 's/"//g' < $builddir/.config > $T/.config
-sed -e 's/\(.*\)=n/# \1 is not set/' -e 's/^#CHECK#//' < $c |
-awk'
-   {
-   print "if grep -q \"" $0 "\" < '"$T/.config"'";
-   print "then";
-   print "\t:";
-   print "else";
-   if ($1 == "#") {
-   print "\tif grep -q \"" $2 "\" < '"$T/.config"'";
-   print "\tthen";
-   print "\t\techo \":" $2 ": improperly set\"";
-   print "\telse";
-   print "\t\t:";
-   print "\tfi";
-   } else {
-   print "\techo \":" $0 ": improperly set\"";
-   }
-   print "fi";
-   }' | sh > $T/diagnostics
-if test -s $T/diagnostics
-then
-   cat $T/diagnostics
-   exit 1
-fi
 exit 0
-- 
1.8.1.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 tip/core/rcu 07/28] rcutorture: Add SRCU Kconfig-fragment files

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Use .boot facility to ease inclusion of SRCU into automated testing.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/configs/SRCU-N  | 8 
 tools/testing/selftests/rcutorture/configs/SRCU-N.boot | 1 +
 tools/testing/selftests/rcutorture/configs/SRCU-P  | 8 
 tools/testing/selftests/rcutorture/configs/SRCU-P.boot | 1 +
 4 files changed, 18 insertions(+)
 create mode 100644 tools/testing/selftests/rcutorture/configs/SRCU-N
 create mode 100644 tools/testing/selftests/rcutorture/configs/SRCU-N.boot
 create mode 100644 tools/testing/selftests/rcutorture/configs/SRCU-P
 create mode 100644 tools/testing/selftests/rcutorture/configs/SRCU-P.boot

diff --git a/tools/testing/selftests/rcutorture/configs/SRCU-N 
b/tools/testing/selftests/rcutorture/configs/SRCU-N
new file mode 100644
index ..10a0e27f4c75
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/SRCU-N
@@ -0,0 +1,8 @@
+CONFIG_RCU_TRACE=n
+CONFIG_SMP=y
+CONFIG_NR_CPUS=8
+CONFIG_HOTPLUG_CPU=y
+CONFIG_PREEMPT_NONE=y
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=n
+CONFIG_PRINTK_TIME=y
diff --git a/tools/testing/selftests/rcutorture/configs/SRCU-N.boot 
b/tools/testing/selftests/rcutorture/configs/SRCU-N.boot
new file mode 100644
index ..238bfe3bd0cc
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/SRCU-N.boot
@@ -0,0 +1 @@
+rcutorture.torture_type=srcu
diff --git a/tools/testing/selftests/rcutorture/configs/SRCU-P 
b/tools/testing/selftests/rcutorture/configs/SRCU-P
new file mode 100644
index ..6650e00c6d91
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/SRCU-P
@@ -0,0 +1,8 @@
+CONFIG_RCU_TRACE=n
+CONFIG_SMP=y
+CONFIG_NR_CPUS=8
+CONFIG_HOTPLUG_CPU=y
+CONFIG_PREEMPT_NONE=n
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=y
+CONFIG_PRINTK_TIME=y
diff --git a/tools/testing/selftests/rcutorture/configs/SRCU-P.boot 
b/tools/testing/selftests/rcutorture/configs/SRCU-P.boot
new file mode 100644
index ..238bfe3bd0cc
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/SRCU-P.boot
@@ -0,0 +1 @@
+rcutorture.torture_type=srcu
-- 
1.8.1.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 tip/core/rcu 21/28] rcutorture: Add --no-initrd argument to kvm.sh

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit adds the --no-initrd argument to kvm.sh, which permits
initrd to be contained in a root partition specified by the --bootargs
argument.  Without --no-initrd, the kernel build expects an initrd
directory in the same rcutorture directory that contains bin and configs.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-build.sh | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm.sh   | 9 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-build.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-build.sh
index 07bbeccb5a28..618ef2c543fd 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-build.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-build.sh
@@ -47,7 +47,7 @@ mkdir $T
 
 cat ${config_template} | grep -v CONFIG_RCU_TORTURE_TEST > $T/config
 cat << ___EOF___ >> $T/config
-CONFIG_INITRAMFS_SOURCE="$KVM/initrd"
+CONFIG_INITRAMFS_SOURCE="$RCU_INITRD"
 CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_CONSOLE=y
 ___EOF___
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 7d6ca337d1fd..a833160dcdc3 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -31,8 +31,9 @@ scriptname=$0
 args="$*"
 
 dur=30
-KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM
-builddir=${KVM}/b1
+KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
+builddir="${KVM}/b1"
+RCU_INITRD="$KVM/initrd"; export RCU_INITRD
 resdir=""
 configs=""
 ds=`date +%Y.%m.%d-%H:%M:%S`
@@ -49,6 +50,7 @@ usage () {
echo "   --interactive"
echo "   --kversion vN.NN"
echo "   --mac nn:nn:nn:nn:nn:nn"
+   echo "   --no-initrd"
echo "   --qemu-args qemu-system-..."
echo "   --qemu-cmd qemu-system-..."
echo "   --results absolute-pathname"
@@ -122,6 +124,9 @@ do
RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
shift
;;
+   --no-initrd)
+   RCU_INITRD=""; export RCU_INITRD
+   ;;
--qemu-args)
checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
RCU_QEMU_ARG="$2"
-- 
1.8.1.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 tip/core/rcu 22/28] rcutorture: Add --kmake-arg argument to kvm.sh

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit adds the --kmake-arg to kvm.sh, which allows passing in
things like "V=1" to see the build commands, as well as enabling the
CROSS_COMPILE= make macro used for cross-building.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-build.sh | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm.sh   | 7 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-build.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-build.sh
index 618ef2c543fd..8c4aa7d63394 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-build.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-build.sh
@@ -60,7 +60,7 @@ then
exit 2
 fi
 ncpus=`cpus2use.sh`
-make O=$builddir -j$ncpus > $builddir/Make.out 2>&1
+make O=$builddir -j$ncpus $RCU_KMAKE_ARG > $builddir/Make.out 2>&1
 retval=$?
 if test $retval -ne 0 || grep "rcu[^/]*": < $builddir/Make.out | egrep -q 
"Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < 
$builddir/Make.out
 then
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index a833160dcdc3..69b6523bb854 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -34,6 +34,7 @@ dur=30
 KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
 builddir="${KVM}/b1"
 RCU_INITRD="$KVM/initrd"; export RCU_INITRD
+RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG
 resdir=""
 configs=""
 ds=`date +%Y.%m.%d-%H:%M:%S`
@@ -48,6 +49,7 @@ usage () {
echo "   --datestamp string"
echo "   --duration minutes"
echo "   --interactive"
+   echo "   --kmake-arg kernel-make-arguments"
echo "   --kversion vN.NN"
echo "   --mac nn:nn:nn:nn:nn:nn"
echo "   --no-initrd"
@@ -114,6 +116,11 @@ do
--interactive)
RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
;;
+   --kmake-arg)
+   checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' 
'^error$'
+   RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG
+   shift
+   ;;
--kversion)
checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' 
'^error'
kversion=$2
-- 
1.8.1.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 tip/core/rcu 10/28] rcutorture: Make test output less chatty

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit drops no-longer-needed diagnostics from the output.  Some of
them are retained in logfiles, in case they are ever needed.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/bin/configinit.sh |  2 --
 .../selftests/rcutorture/bin/kvm-test-1-rcu.sh |  2 +-
 tools/testing/selftests/rcutorture/bin/kvm.sh  | 25 +-
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/configinit.sh 
b/tools/testing/selftests/rcutorture/bin/configinit.sh
index 1f09d599e9d9..926fbd30bcbd 100755
--- a/tools/testing/selftests/rcutorture/bin/configinit.sh
+++ b/tools/testing/selftests/rcutorture/bin/configinit.sh
@@ -14,8 +14,6 @@
 # for example, "O=/tmp/foo".  If this argument is omitted, the .config
 # file will be generated directly in the current directory.
 
-echo configinit.sh $*
-
 T=/tmp/configinit.sh.$$
 trap 'rm -rf $T' 0
 mkdir $T
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 618aa4d766d3..5526550a5d56 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -62,7 +62,7 @@ then
 fi
 cp $config_template $resdir/ConfigFragment
 echo ' ---' `date`: Starting build
-echo ' ---' Kconfig fragment at: $config_template
+echo ' ---' Kconfig fragment at: $config_template >> $resdir/log
 cat << '___EOF___' >> $T
 CONFIG_RCU_TORTURE_TEST=y
 ___EOF___
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 92f726b01044..bf6d68e96e94 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -28,6 +28,7 @@
 # Authors: Paul E. McKenney 
 
 scriptname=$0
+args="$*"
 
 dur=30
 KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM
@@ -73,7 +74,6 @@ checkarg () {
 
 while test $# -gt 0
 do
-   echo ":$1:"
case "$1" in
--builddir)
checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error
@@ -133,11 +133,6 @@ do
shift
 done
 
-echo "builddir=$builddir"
-echo "dur=$dur"
-echo "KVM=$KVM"
-echo "resdir=$resdir"
-
 PATH=${KVM}/bin:$PATH; export PATH
 CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
 KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
@@ -150,12 +145,19 @@ fi
 if test -z "$resdir"
 then
resdir=$KVM/res
-   mkdir $resdir || :
+   if ! test -e $resdir
+   then
+   mkdir $resdir || :
+   fi
 else
-   mkdir -p "$resdir" || :
+   if ! test -e $resdir
+   then
+   mkdir -p "$resdir" || :
+   fi
 fi
 mkdir $resdir/$ds
-echo Datestamp: $ds
+touch $resdir/$ds/log
+echo $scriptname $args >> $resdir/$ds/log
 
 pwd > $resdir/$ds/testid.txt
 if test -d .git
@@ -164,7 +166,10 @@ then
git rev-parse HEAD >> $resdir/$ds/testid.txt
 fi
 builddir=$KVM/b1
-mkdir $builddir || :
+if ! test -e $builddir
+then
+   mkdir $builddir || :
+fi
 
 for CF in $configs
 do
-- 
1.8.1.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 tip/core/rcu 16/28] rcutorture: Allow Kconfig-related boot parameters to override

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

As it stands, the default kernel boot parameters generated from
the Kconfig fragment will override any supplied with the .boot
file that can optionally accompany a Kconfig fragment.  Rearrange
ordering to permit the specific .boot arguments to override those
generated by analyzing the Kconfig fragment.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 9fd546ccb075..93342f7ce6d5 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -131,15 +131,17 @@ qemu_args="$qemu_args `identify_qemu_args "$QEMU" 
"$builddir/console.log"`"
 # Generate qemu -append arguments
 qemu_append="`identify_qemu_append "$QEMU"`"
 
+# Pull in Kconfig-fragment boot parameters
+boot_args="`configfrag_boot_params "$boot_args" "$config_template"`"
 # Generate CPU-hotplug boot parameters
 boot_args="`rcutorture_param_onoff "$boot_args" $builddir/.config`"
 # Generate rcu_barrier() boot parameter
 boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`"
-# Pull in Kconfig-fragment boot parameters
-boot_args="`configfrag_boot_params "$boot_args" "$config_template"`"
+# Pull in standard rcutorture boot arguments
+boot_args="$boot_args rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1"
 
-echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append 
\"$qemu_append rcutorture.stat_interval=15 rcutorture.shutdown_secs=$seconds 
rcutorture.rcutorture_runnable=1 $boot_args\" > $resdir/qemu-cmd
-$QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append 
"$qemu_append rcutorture.stat_interval=15 rcutorture.shutdown_secs=$seconds 
rcutorture.rcutorture_runnable=1 $boot_args" &
+echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append 
\"$qemu_append $boot_args\" > $resdir/qemu-cmd
+$QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append 
"$qemu_append $boot_args" &
 qemu_pid=$!
 commandcompleted=0
 echo Monitoring qemu job at pid $qemu_pid
-- 
1.8.1.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 tip/core/rcu 08/28] rcutorture: Refactor TREE_RCU test cases

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The TREE_RCU test cases were first put in place many years ago, and have
been incrementally modified rather than being reworked.  This commit
therefore completes a long-overdue reworking of the TREE_RCU test cases.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/configs/CFLIST  | 26 +++---
 .../rcutorture/configs/N1-S-T-NH-SD-SMP-HP | 19 -
 .../rcutorture/configs/N2-2-t-nh-sd-SMP-hp | 20 -
 .../rcutorture/configs/N3-3-T-nh-SD-SMP-hp | 22 -
 .../rcutorture/configs/N4-A-t-NH-sd-SMP-HP | 18 
 .../rcutorture/configs/N5-U-T-NH-sd-SMP-hp | 22 -
 .../rcutorture/configs/N6---t-nh-SD-smp-hp | 19 -
 .../rcutorture/configs/N7-4-T-NH-SD-SMP-HP | 26 --
 .../rcutorture/configs/N8-2-T-NH-SD-SMP-HP | 22 -
 .../rcutorture/configs/P1-S-T-NH-SD-SMP-HP | 20 -
 .../rcutorture/configs/P2-2-t-nh-sd-SMP-hp | 20 -
 .../rcutorture/configs/P3-3-T-nh-SD-SMP-hp | 20 -
 .../rcutorture/configs/P4-A-t-NH-sd-SMP-HP | 22 -
 .../rcutorture/configs/P5-U-T-NH-sd-SMP-hp | 28 ---
 .../rcutorture/configs/P6---t-nh-SD-smp-hp | 18 
 .../rcutorture/configs/P7-4-T-NH-SD-SMP-HP | 30 ---
 .../rcutorture/configs/P7-4-T-NH-SD-SMP-HP-all | 30 ---
 .../rcutorture/configs/P7-4-T-NH-SD-SMP-HP-none| 30 ---
 .../rcutorture/configs/P7-4-T-NH-SD-SMP-hp | 30 ---
 tools/testing/selftests/rcutorture/configs/TREE01  | 23 ++
 .../selftests/rcutorture/configs/TREE01.boot   |  1 +
 tools/testing/selftests/rcutorture/configs/TREE02  | 26 ++
 tools/testing/selftests/rcutorture/configs/TREE03  | 23 ++
 tools/testing/selftests/rcutorture/configs/TREE04  | 25 ++
 .../selftests/rcutorture/configs/TREE04.boot   |  1 +
 tools/testing/selftests/rcutorture/configs/TREE05  | 25 ++
 .../selftests/rcutorture/configs/TREE05.boot   |  1 +
 tools/testing/selftests/rcutorture/configs/TREE06  | 26 ++
 tools/testing/selftests/rcutorture/configs/TREE07  | 24 ++
 tools/testing/selftests/rcutorture/configs/TREE08  | 26 ++
 tools/testing/selftests/rcutorture/configs/TREE09  | 21 +
 .../rcutorture/configs/sysidleN.2013.06.19a| 23 --
 .../rcutorture/configs/sysidleY.2013.06.19a| 26 --
 .../selftests/rcutorture/doc/TREE_RCU-Kconfig.txt  | 95 ++
 34 files changed, 328 insertions(+), 480 deletions(-)
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N1-S-T-NH-SD-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N2-2-t-nh-sd-SMP-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N3-3-T-nh-SD-SMP-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N4-A-t-NH-sd-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N5-U-T-NH-sd-SMP-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N6---t-nh-SD-smp-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N7-4-T-NH-SD-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/N8-2-T-NH-SD-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P1-S-T-NH-SD-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P2-2-t-nh-sd-SMP-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P3-3-T-nh-SD-SMP-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P4-A-t-NH-sd-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P5-U-T-NH-sd-SMP-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P6---t-nh-SD-smp-hp
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-HP
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-HP-all
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-HP-none
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-hp
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE01
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE01.boot
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE02
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE03
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE04
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE04.boot
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE05
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE05.boot
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE06
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE07
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE08
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE09
 delete mode 100644 
tools/testing/selftests/rcutorture/configs/sysidleN.2013.06.19a
 delete mode 100644 

[PATCH tip/core/rcu 06/28] rcutorture: Add v3.12 version, which adds sysidle testing

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The v3.12 version of the kernel added the CONFIG_NO_HZ_FULL_SYSIDLE
Kconfig parameter, so this commit adds a version transition at that
point.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../selftests/rcutorture/configs/v3.12/CFLIST  | 17 
 .../rcutorture/configs/v3.12/N1-S-T-NH-SD-SMP-HP   | 19 ++
 .../rcutorture/configs/v3.12/N2-2-t-nh-sd-SMP-hp   | 20 +++
 .../rcutorture/configs/v3.12/N3-3-T-nh-SD-SMP-hp   | 22 
 .../rcutorture/configs/v3.12/N4-A-t-NH-sd-SMP-HP   | 18 +
 .../rcutorture/configs/v3.12/N5-U-T-NH-sd-SMP-hp   | 22 
 .../rcutorture/configs/v3.12/N6---t-nh-SD-smp-hp   | 19 ++
 .../rcutorture/configs/v3.12/N7-4-T-NH-SD-SMP-HP   | 26 +++
 .../rcutorture/configs/v3.12/N8-2-T-NH-SD-SMP-HP   | 22 
 .../selftests/rcutorture/configs/v3.12/NT1-nh  | 23 +
 .../selftests/rcutorture/configs/v3.12/NT3-NH  | 20 +++
 .../rcutorture/configs/v3.12/P1-S-T-NH-SD-SMP-HP   | 20 +++
 .../rcutorture/configs/v3.12/P2-2-t-nh-sd-SMP-hp   | 20 +++
 .../rcutorture/configs/v3.12/P3-3-T-nh-SD-SMP-hp   | 20 +++
 .../rcutorture/configs/v3.12/P4-A-t-NH-sd-SMP-HP   | 22 
 .../rcutorture/configs/v3.12/P5-U-T-NH-sd-SMP-hp   | 28 
 .../rcutorture/configs/v3.12/P6---t-nh-SD-smp-hp   | 18 +
 .../rcutorture/configs/v3.12/P7-4-T-NH-SD-SMP-HP   | 30 ++
 .../configs/v3.12/P7-4-T-NH-SD-SMP-HP-all  | 30 ++
 .../configs/v3.12/P7-4-T-NH-SD-SMP-HP-none | 30 ++
 .../rcutorture/configs/v3.12/P7-4-T-NH-SD-SMP-hp   | 30 ++
 .../selftests/rcutorture/configs/v3.12/PT1-nh  | 23 +
 .../selftests/rcutorture/configs/v3.12/PT2-NH  | 22 
 23 files changed, 521 insertions(+)
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.12/CFLIST
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N1-S-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N2-2-t-nh-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N3-3-T-nh-SD-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N4-A-t-NH-sd-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N5-U-T-NH-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N6---t-nh-SD-smp-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N7-4-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/N8-2-T-NH-SD-SMP-HP
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.12/NT1-nh
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.12/NT3-NH
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P1-S-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P2-2-t-nh-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P3-3-T-nh-SD-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P4-A-t-NH-sd-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P5-U-T-NH-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P6---t-nh-SD-smp-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P7-4-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P7-4-T-NH-SD-SMP-HP-all
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P7-4-T-NH-SD-SMP-HP-none
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.12/P7-4-T-NH-SD-SMP-hp
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.12/PT1-nh
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.12/PT2-NH

diff --git a/tools/testing/selftests/rcutorture/configs/v3.12/CFLIST 
b/tools/testing/selftests/rcutorture/configs/v3.12/CFLIST
new file mode 100644
index ..da4cbc668f2a
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/v3.12/CFLIST
@@ -0,0 +1,17 @@
+sysidleY.2013.06.19a
+sysidleN.2013.06.19a
+P1-S-T-NH-SD-SMP-HP
+P2-2-t-nh-sd-SMP-hp
+P3-3-T-nh-SD-SMP-hp
+P4-A-t-NH-sd-SMP-HP
+P5-U-T-NH-sd-SMP-hp
+P6---t-nh-SD-smp-hp
+N1-S-T-NH-SD-SMP-HP
+N2-2-t-nh-sd-SMP-hp
+N3-3-T-nh-SD-SMP-hp
+N4-A-t-NH-sd-SMP-HP
+N5-U-T-NH-sd-SMP-hp
+PT1-nh
+PT2-NH
+NT1-nh
+NT3-NH
diff --git 
a/tools/testing/selftests/rcutorture/configs/v3.12/N1-S-T-NH-SD-SMP-HP 
b/tools/testing/selftests/rcutorture/configs/v3.12/N1-S-T-NH-SD-SMP-HP
new file mode 100644
index ..d81e11d280aa
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/v3.12/N1-S-T-NH-SD-SMP-HP
@@ -0,0 +1,19 @@
+CONFIG_RCU_TRACE=y
+CONFIG_RCU_FAST_NO_HZ=y
+CONFIG_NO_HZ=y
+CONFIG_SMP=y
+CONFIG_RCU_FANOUT=8
+CONFIG_NR_CPUS=8

[PATCH tip/core/rcu 23/28] rcutorture: Add tracing-enabled version of TREE08

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The TREE08 Kconfig fragment does not enable tracing, which is appropriate
for its test case.  However, this can be inconvenient in cases where
TREE08 locates RCU bugs.  This commit therefore adds a TREE08-T that
differs from TREE08 only in enabling CONFIG_RCU_TRACE.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/configs/TREE08-T  | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 tools/testing/selftests/rcutorture/configs/TREE08-T

diff --git a/tools/testing/selftests/rcutorture/configs/TREE08-T 
b/tools/testing/selftests/rcutorture/configs/TREE08-T
new file mode 100644
index ..442c4e450ab3
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/TREE08-T
@@ -0,0 +1,26 @@
+CONFIG_SMP=y
+CONFIG_NR_CPUS=16
+CONFIG_PREEMPT_NONE=n
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=y
+#CHECK#CONFIG_TREE_PREEMPT_RCU=y
+CONFIG_HZ_PERIODIC=n
+CONFIG_NO_HZ_IDLE=y
+CONFIG_NO_HZ_FULL=n
+CONFIG_RCU_FAST_NO_HZ=n
+CONFIG_RCU_TRACE=y
+CONFIG_HOTPLUG_CPU=n
+CONFIG_SUSPEND=n
+CONFIG_HIBERNATION=n
+CONFIG_RCU_FANOUT=3
+CONFIG_RCU_FANOUT_EXACT=y
+CONFIG_RCU_FANOUT_LEAF=2
+CONFIG_RCU_NOCB_CPU=y
+CONFIG_RCU_NOCB_CPU_ALL=y
+CONFIG_DEBUG_LOCK_ALLOC=n
+CONFIG_PROVE_RCU_DELAY=n
+CONFIG_RCU_CPU_STALL_INFO=n
+CONFIG_RCU_CPU_STALL_VERBOSE=n
+CONFIG_RCU_BOOST=n
+CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_PRINTK_TIME=y
-- 
1.8.1.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 tip/core/rcu 25/28] rcutorture: Test summary at end of run with less chattiness

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The commit causes kvm.sh to invoke kvm-recheck.sh at the end of each
run, and causes kvm-recheck.sh to print only the name of the test, not
the full path to the corresponding Kconfig file.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-recheck.sh | 2 +-
 tools/testing/selftests/rcutorture/bin/kvm.sh | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
index 26e82b5d67f8..874cd32d0486 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
@@ -31,7 +31,7 @@ do
for i in $dirs
do
configfile=`echo $i | sed -e 's/^.*\///'`
-   echo $i
+   echo $configfile
configcheck.sh $i/.config $i/ConfigFragment
parse-build.sh $i/Make.out $configfile
parse-rcutorture.sh $i/console.log $configfile
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 02ac41e6d10e..b8d278904dee 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -210,3 +210,6 @@ do
kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 
$RCU_BOOTARGS"
 done
 # Tracing: 
trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier
+
+echo " --- `date` Test summary:"
+kvm-recheck.sh $resdir/$ds
-- 
1.8.1.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 tip/core/rcu 18/28] rcutorture: Add --buildonly dry-run capability

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit adds --buildonly, which does the builds specified by the
--configs argument, but does not boot or test the resulting kernels.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh | 5 +
 tools/testing/selftests/rcutorture/bin/kvm.sh| 4 
 2 files changed, 9 insertions(+)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 93342f7ce6d5..3df1581e78ae 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -141,6 +141,11 @@ boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`"
 boot_args="$boot_args rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1"
 
 echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append 
\"$qemu_append $boot_args\" > $resdir/qemu-cmd
+if test -n "$RCU_BUILDONLY"
+then
+   echo Build-only run specified, boot/test omitted.
+   exit 0
+fi
 $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append 
"$qemu_append $boot_args" &
 qemu_pid=$!
 commandcompleted=0
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 979c34134634..6c67d0ca8c9a 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -41,6 +41,7 @@ kversion=""
 usage () {
echo "Usage: $scriptname optional arguments:"
echo "   --builddir absolute-pathname"
+   echo "   --buildonly"
echo "   --configs \"config-file list\""
echo "   --datestamp string"
echo "   --duration minutes"
@@ -83,6 +84,9 @@ do
gotbuilddir=1
shift
;;
+   --buildonly)
+   RCU_BUILDONLY=1; export RCU_BUILDONLY
+   ;;
--configs)
checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' 
'^--'
configs="$2"
-- 
1.8.1.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 tip/core/rcu 19/28] rcutorture: Add --bootargs argument to specify additional boot arguments

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit allows easy specification of trace_event lists, among other
things.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 6c67d0ca8c9a..2fb91d4f7996 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -40,6 +40,7 @@ kversion=""
 
 usage () {
echo "Usage: $scriptname optional arguments:"
+   echo "   --bootargs kernel-boot-arguments"
echo "   --builddir absolute-pathname"
echo "   --buildonly"
echo "   --configs \"config-file list\""
@@ -78,6 +79,11 @@ checkarg () {
 while test $# -gt 0
 do
case "$1" in
+   --bootargs)
+   checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" 
'.*' '^--'
+   RCU_BOOTARGS="$2"
+   shift
+   ;;
--builddir)
checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error
builddir=$2
@@ -183,6 +189,6 @@ do
rd=$resdir/$ds/$CF
mkdir $rd || :
echo Results directory: $rd
-   kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1"
+   kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur 
"-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS"
 done
 # Tracing: 
trace_event=rcu:rcu_nocb_grace_period,rcu:rcu_grace_period,rcu:rcu_grace_period_init,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_torture_read,rcu:rcu_invoke_callback,rcu:rcu_fqs,rcu:rcu_dyntick,rcu:rcu_unlock_preempted_task
-- 
1.8.1.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 tip/core/rcu 04/28] rcutorture: Add per-version default Kconfig fragments and module parameters

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Different Kconfig parameters apply to different kernel versions, as
do different rcutorture module parameters.  This commit allows the
rcutorture test scripts to adjust for different kernel versions.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/bin/functions.sh  |  7 ++--
 .../selftests/rcutorture/bin/kvm-test-1-rcu.sh | 12 ++
 tools/testing/selftests/rcutorture/bin/kvm.sh  | 26 
 tools/testing/selftests/rcutorture/configs/CFLIST  | 17 
 .../selftests/rcutorture/configs/v0.0/CFLIST   | 14 +++
 .../rcutorture/configs/v0.0/N1-S-T-NH-SD-SMP-HP|  1 -
 .../rcutorture/configs/v0.0/P1-S-T-NH-SD-SMP-HP|  1 -
 .../rcutorture/configs/v0.0/ver_functions.sh   | 35 
 .../selftests/rcutorture/configs/v3.3/CFLIST   | 14 +++
 .../rcutorture/configs/v3.3/ver_functions.sh   | 41 +++
 .../selftests/rcutorture/configs/v3.5/CFLIST   | 14 +++
 .../rcutorture/configs/v3.5/ver_functions.sh   | 46 ++
 .../selftests/rcutorture/configs/ver_functions.sh  | 46 ++
 13 files changed, 242 insertions(+), 32 deletions(-)
 create mode 100644 tools/testing/selftests/rcutorture/configs/CFLIST
 create mode 100644 tools/testing/selftests/rcutorture/configs/v0.0/CFLIST
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/ver_functions.sh
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.3/CFLIST
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.3/ver_functions.sh
 create mode 100644 tools/testing/selftests/rcutorture/configs/v3.5/CFLIST
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.5/ver_functions.sh
 create mode 100644 tools/testing/selftests/rcutorture/configs/ver_functions.sh

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh 
b/tools/testing/selftests/rcutorture/bin/functions.sh
index db1c32acdcf6..d4c15f81cd27 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -32,11 +32,10 @@ bootparam_hotplug_cpu () {
 #
 # Returns 1 if the config fragment specifies hotplug CPU.
 configfrag_hotplug_cpu () {
-   cf=$1
-   if test ! -r $cf
+   if test ! -r "$1"
then
-   echo Unreadable config fragment $cf 1>&2
+   echo Unreadable config fragment "$1" 1>&2
exit -1
fi
-   grep -q '^CONFIG_HOTPLUG_CPU=y$' $cf
+   grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1"
 }
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 3b53078c5ff2..0a3f037a8bb3 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -44,6 +44,7 @@ T=/tmp/kvm-test-1-rcu.sh.$$
 trap 'rm -rf $T' 0
 
 . $KVM/bin/functions.sh
+. $KVPATH/ver_functions.sh
 
 config_template=${1}
 title=`echo $config_template | sed -e 's/^.*\///'`
@@ -133,14 +134,9 @@ else
 fi
 
 # Generate CPU-hotplug boot parameters
-if ! bootparam_hotplug_cpu "$bootargs"
-then
-   if configfrag_hotplug_cpu $builddir/.config
-   then
-   echo Kernel configured for CPU hotplug, adding rcutorture.
-   bootargs="$bootargs rcutorture.onoff_interval=3 
rcutorture.onoff_holdoff=30"
-   fi
-fi
+boot_args="`rcutorture_param_onoff "$boot_args" $builddir/.config`"
+# Generate rcu_barrier() boot parameter
+boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`"
 
 echo $QEMU -name rcu-test -serial file:$builddir/console.log $qemu_args -m 512 
-kernel $builddir/arch/x86/boot/bzImage -append \"noapic selinux=0 
console=ttyS0 initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args\" 
> $resdir/qemu-cmd
 $QEMU -name rcu-test -serial file:$builddir/console.log $qemu_args -m 512 
-kernel $builddir/arch/x86/boot/bzImage -append "noapic selinux=0 console=ttyS0 
initcall_debug debug rcutorture.stat_interval=15 
rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args" &
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 7deb7b44d647..92f726b01044 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -33,23 +33,7 @@ dur=30
 KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM
 builddir=${KVM}/b1
 resdir=""
-configs=" sysidleY.2013.06.19a \
- sysidleN.2013.06.19a \
- P1-S-T-NH-SD-SMP-HP \
- P2-2-t-nh-sd-SMP-hp \
- P3-3-T-nh-SD-SMP-hp \
- P4-A-t-NH-sd-SMP-HP \
- P5-U-T-NH-sd-SMP-hp \
- P6---t-nh-SD-smp-hp \
- N1-S-T-NH-SD-SMP-HP \
- N2-2-t-nh-sd-SMP-hp \
- N3-3-T-nh-SD-SMP-hp \
- N4-A-t-NH-sd-SMP-HP \
- 

[PATCH tip/core/rcu 12/28] rcutorture: Abstract qemu-flavor identification

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The task of working out which flavor of qemu to use gets more complex
as more types of CPUs are supported.  Adding Power makes three in addition
to 32-bit and 64-bit x86, so it is time to pull this out into a function.
This commit therefore creates an identify_qemu function and also adds
a --qemu-cmd command-line argument for the inevitable case where the
identify_qemu cannot figure it out.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../testing/selftests/rcutorture/bin/functions.sh  | 27 ++
 .../selftests/rcutorture/bin/kvm-test-1-rcu.sh |  9 +++-
 tools/testing/selftests/rcutorture/bin/kvm.sh  |  6 +
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh 
b/tools/testing/selftests/rcutorture/bin/functions.sh
index 8f912419ed7f..c974414ef7a5 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -51,3 +51,30 @@ configfrag_hotplug_cpu () {
fi
grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1"
 }
+
+# identify_qemu builddir
+#
+# Returns our best guess as to which qemu command is appropriate for
+# the kernel at hand.  Override with the RCU_QEMU_CMD environment variable.
+identify_qemu () {
+   local u="`file "$1"`"
+   if test -n "$RCU_QEMU_CMD"
+   then
+   echo $RCU_QEMU_CMD
+   elif echo $u | grep -q x86-64
+   then
+   echo qemu-system-x86_64
+   elif echo $u | grep -q "Intel 80386"
+   then
+   echo qemu-system-i386
+   elif uname -a | grep -q ppc64
+   then
+   echo qemu-system-ppc64
+   else
+   echo Cannot figure out what qemu command to use! 1>&2
+   # Usually this will be one of /usr/bin/qemu-system-*
+   # Use RCU_QEMU_CMD environment variable or appropriate
+   # argument to top-level script.
+   exit 1
+   fi
+}
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 5526550a5d56..ddf3bd6eaf19 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -109,12 +109,9 @@ boot_args=$6
 cd $KVM
 kstarttime=`awk 'BEGIN { print systime() }' < /dev/null`
 echo ' ---' `date`: Starting kernel
-if file linux-2.6/*.o | grep -q 64-bit
-then
-   QEMU=qemu-system-x86_64
-else
-   QEMU=qemu-system-i386
-fi
+
+# Determine the appropriate flavor of qemu command.
+QEMU="`identify_qemu $builddir/vmlinux.o`"
 
 # Generate -smp qemu argument.
 cpu_count=`configNR_CPUS.sh $config_template`
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index bf6d68e96e94..89164c245ca1 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -45,6 +45,7 @@ usage () {
echo "   --datestamp string"
echo "   --duration minutes"
echo "   --kversion vN.NN"
+   echo "   --qemu-cmd qemu-system-..."
echo "   --rcu-kvm absolute-pathname"
echo "   --results absolute-pathname"
echo "   --relbuilddir relative-pathname"
@@ -101,6 +102,11 @@ do
kversion=$2
shift
;;
+   --qemu-cmd)
+   checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' 
'^--'
+   RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
+   shift
+   ;;
--rcu-kvm)
checkarg --rcu-kvm "(absolute pathname)" "$#" "$2" '^/' error
KVM=$2; export KVM
-- 
1.8.1.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 tip/core/rcu 02/28] rcutorture: Add datestamp argument to kvm.sh

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Allow datestamp to be specified to allow tests to be broken up and run
in parallel.

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 46c75ee2f528..9fcceed81079 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -50,11 +50,13 @@ configs=" sysidleY.2013.06.19a \
  PT2-NH \
  NT1-nh \
  NT3-NH"
+ds=`date +%Y.%m.%d-%H:%M:%S`
 
 usage () {
echo "Usage: $scriptname optional arguments:"
echo "   --builddir absolute-pathname"
echo "   --configs \"config-file list\""
+   echo "   --datestamp string"
echo "   --duration minutes"
echo "   --rcu-kvm absolute-pathname"
echo "   --results absolute-pathname"
@@ -98,6 +100,11 @@ do
configs="$2"
shift
;;
+   --datestamp)
+   checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' 
'^--'
+   ds=$2
+   shift
+   ;;
--duration)
checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error
dur=$2
@@ -147,13 +154,12 @@ if test -z "$resdir"
 then
resdir=$KVM/res
mkdir $resdir || :
-   ds=`date +%Y.%m.%d-%H:%M:%S`
-   mkdir $resdir/$ds
-   echo Datestamp: $ds
 else
-   mkdir -p "$resdir"
-   ds=""
+   mkdir -p "$resdir" || :
 fi
+mkdir $resdir/$ds
+echo Datestamp: $ds
+
 pwd > $resdir/$ds/testid.txt
 if test -d .git
 then
-- 
1.8.1.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 tip/core/rcu 03/28] rcutorture: Add kernel-version argument

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Signed-off-by: Paul E. McKenney 
Cc: Greg KH 
---
 .../selftests/rcutorture/bin/kvm-test-1-rcu.sh |  1 +
 tools/testing/selftests/rcutorture/bin/kvm.sh  |  9 ++-
 .../rcutorture/configs/v0.0/N1-S-T-NH-SD-SMP-HP| 19 +++
 .../rcutorture/configs/v0.0/N2-2-t-nh-sd-SMP-hp| 20 
 .../rcutorture/configs/v0.0/N3-3-T-nh-SD-SMP-hp| 22 +
 .../rcutorture/configs/v0.0/N4-A-t-NH-sd-SMP-HP| 18 ++
 .../rcutorture/configs/v0.0/N5-U-T-NH-sd-SMP-hp| 22 +
 .../selftests/rcutorture/configs/v0.0/NT1-nh   | 23 ++
 .../selftests/rcutorture/configs/v0.0/NT3-NH   | 20 
 .../rcutorture/configs/v0.0/P1-S-T-NH-SD-SMP-HP| 20 
 .../rcutorture/configs/v0.0/P2-2-t-nh-sd-SMP-hp| 20 
 .../rcutorture/configs/v0.0/P3-3-T-nh-SD-SMP-hp| 20 
 .../rcutorture/configs/v0.0/P4-A-t-NH-sd-SMP-HP| 22 +
 .../rcutorture/configs/v0.0/P5-U-T-NH-sd-SMP-hp| 28 ++
 .../selftests/rcutorture/configs/v0.0/PT1-nh   | 23 ++
 .../selftests/rcutorture/configs/v0.0/PT2-NH   | 22 +
 .../rcutorture/configs/v3.3/N1-S-T-NH-SD-SMP-HP| 19 +++
 .../rcutorture/configs/v3.3/N2-2-t-nh-sd-SMP-hp| 20 
 .../rcutorture/configs/v3.3/N3-3-T-nh-SD-SMP-hp| 22 +
 .../rcutorture/configs/v3.3/N4-A-t-NH-sd-SMP-HP| 18 ++
 .../rcutorture/configs/v3.3/N5-U-T-NH-sd-SMP-hp| 22 +
 .../selftests/rcutorture/configs/v3.3/NT1-nh   | 23 ++
 .../selftests/rcutorture/configs/v3.3/NT3-NH   | 20 
 .../rcutorture/configs/v3.3/P1-S-T-NH-SD-SMP-HP| 20 
 .../rcutorture/configs/v3.3/P2-2-t-nh-sd-SMP-hp| 20 
 .../rcutorture/configs/v3.3/P3-3-T-nh-SD-SMP-hp| 20 
 .../rcutorture/configs/v3.3/P4-A-t-NH-sd-SMP-HP| 22 +
 .../rcutorture/configs/v3.3/P5-U-T-NH-sd-SMP-hp| 28 ++
 .../selftests/rcutorture/configs/v3.3/PT1-nh   | 23 ++
 .../selftests/rcutorture/configs/v3.3/PT2-NH   | 22 +
 .../rcutorture/configs/v3.5/N1-S-T-NH-SD-SMP-HP| 19 +++
 .../rcutorture/configs/v3.5/N2-2-t-nh-sd-SMP-hp| 20 
 .../rcutorture/configs/v3.5/N3-3-T-nh-SD-SMP-hp| 22 +
 .../rcutorture/configs/v3.5/N4-A-t-NH-sd-SMP-HP| 18 ++
 .../rcutorture/configs/v3.5/N5-U-T-NH-sd-SMP-hp| 22 +
 .../selftests/rcutorture/configs/v3.5/NT1-nh   | 23 ++
 .../selftests/rcutorture/configs/v3.5/NT3-NH   | 20 
 .../rcutorture/configs/v3.5/P1-S-T-NH-SD-SMP-HP| 20 
 .../rcutorture/configs/v3.5/P2-2-t-nh-sd-SMP-hp| 20 
 .../rcutorture/configs/v3.5/P3-3-T-nh-SD-SMP-hp| 20 
 .../rcutorture/configs/v3.5/P4-A-t-NH-sd-SMP-HP| 22 +
 .../rcutorture/configs/v3.5/P5-U-T-NH-sd-SMP-hp| 28 ++
 .../selftests/rcutorture/configs/v3.5/PT1-nh   | 23 ++
 .../selftests/rcutorture/configs/v3.5/PT2-NH   | 22 +
 44 files changed, 906 insertions(+), 1 deletion(-)
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/N1-S-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/N2-2-t-nh-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/N3-3-T-nh-SD-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/N4-A-t-NH-sd-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/N5-U-T-NH-sd-SMP-hp
 create mode 100644 tools/testing/selftests/rcutorture/configs/v0.0/NT1-nh
 create mode 100644 tools/testing/selftests/rcutorture/configs/v0.0/NT3-NH
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/P1-S-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/P2-2-t-nh-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/P3-3-T-nh-SD-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/P4-A-t-NH-sd-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v0.0/P5-U-T-NH-sd-SMP-hp
 create mode 100644 tools/testing/selftests/rcutorture/configs/v0.0/PT1-nh
 create mode 100644 tools/testing/selftests/rcutorture/configs/v0.0/PT2-NH
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.3/N1-S-T-NH-SD-SMP-HP
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.3/N2-2-t-nh-sd-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.3/N3-3-T-nh-SD-SMP-hp
 create mode 100644 
tools/testing/selftests/rcutorture/configs/v3.3/N4-A-t-NH-sd-SMP-HP
 create mode 100644 

[PATCH tip/core/rcu 0/28] RCU torture scripting for 3.14

2013-11-15 Thread Paul E. McKenney
Hello!

This series contains scripting that I use to test RCU under KVM, including
different Kconfig combinations to test, automated launching and monitoring
of multiple tests scenarios, kernel-version adaptation, and automated
evaluation of test output.  This version works on x86 32- and 64-bit,
and limps on PowerPC.

This also contains refactored test scenarios that greatly improve RCU
test coverage (resulting in fixes) while also reducing test run time.
There is a fair amount of work remaining, particularly in the areas of
documentation, automating initrd generation, and general reduction in
user-hostility.  Nevertheless, a much-needed improvement in the kernel's
RCU-testing capabilities.

Thanx, Paul



 a/tools/testing/selftests/rcutorture/configs/N1-S-T-NH-SD-SMP-HP|  
 19 
 a/tools/testing/selftests/rcutorture/configs/N2-2-t-nh-sd-SMP-hp|  
 20 
 a/tools/testing/selftests/rcutorture/configs/N3-3-T-nh-SD-SMP-hp|  
 22 
 a/tools/testing/selftests/rcutorture/configs/N4-A-t-NH-sd-SMP-HP|  
 18 
 a/tools/testing/selftests/rcutorture/configs/N5-U-T-NH-sd-SMP-hp|  
 22 
 a/tools/testing/selftests/rcutorture/configs/N6---t-nh-SD-smp-hp|  
 19 
 a/tools/testing/selftests/rcutorture/configs/N7-4-T-NH-SD-SMP-HP|  
 26 
 a/tools/testing/selftests/rcutorture/configs/N8-2-T-NH-SD-SMP-HP|  
 22 
 a/tools/testing/selftests/rcutorture/configs/NT1-nh |  
 23 
 a/tools/testing/selftests/rcutorture/configs/NT3-NH |  
 20 
 a/tools/testing/selftests/rcutorture/configs/P1-S-T-NH-SD-SMP-HP|  
 20 
 a/tools/testing/selftests/rcutorture/configs/P2-2-t-nh-sd-SMP-hp|  
 20 
 a/tools/testing/selftests/rcutorture/configs/P3-3-T-nh-SD-SMP-hp|  
 20 
 a/tools/testing/selftests/rcutorture/configs/P4-A-t-NH-sd-SMP-HP|  
 22 
 a/tools/testing/selftests/rcutorture/configs/P5-U-T-NH-sd-SMP-hp|  
 28 
 a/tools/testing/selftests/rcutorture/configs/P6---t-nh-SD-smp-hp|  
 18 
 a/tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-HP|  
 30 
 a/tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-HP-all|  
 30 
 a/tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-HP-none   |  
 30 
 a/tools/testing/selftests/rcutorture/configs/P7-4-T-NH-SD-SMP-hp|  
 30 
 a/tools/testing/selftests/rcutorture/configs/PT1-nh |  
 23 
 a/tools/testing/selftests/rcutorture/configs/PT2-NH |  
 22 
 a/tools/testing/selftests/rcutorture/configs/sysidleN.2013.06.19a   |  
 23 
 a/tools/testing/selftests/rcutorture/configs/sysidleY.2013.06.19a   |  
 26 
 b/MAINTAINERS   |  
  6 
 b/tools/testing/selftests/rcutorture/.gitignore |  
  6 
 b/tools/testing/selftests/rcutorture/bin/config2frag.sh |  
 25 
 b/tools/testing/selftests/rcutorture/bin/configNR_CPUS.sh   |  
 45 +
 b/tools/testing/selftests/rcutorture/bin/configcheck.sh |  
 54 +
 b/tools/testing/selftests/rcutorture/bin/configinit.sh  |  
112 ++-
 b/tools/testing/selftests/rcutorture/bin/cpus2use.sh|  
 41 +
 b/tools/testing/selftests/rcutorture/bin/functions.sh   |  
206 +
 b/tools/testing/selftests/rcutorture/bin/kvm-build.sh   |  
 75 +-
 b/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh |  
 54 +
 b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh  |  
264 ++-
 b/tools/testing/selftests/rcutorture/bin/kvm.sh |  
370 +++---
 b/tools/testing/selftests/rcutorture/bin/parse-build.sh |  
 65 +
 b/tools/testing/selftests/rcutorture/bin/parse-console.sh   |  
 43 +
 b/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh|  
114 ++-
 b/tools/testing/selftests/rcutorture/configs/CFLIST |  
 47 -
 b/tools/testing/selftests/rcutorture/configs/N1-S-T-NH-SD-SMP-HP|  
 19 
 b/tools/testing/selftests/rcutorture/configs/N2-2-t-nh-sd-SMP-hp|  
 20 
 b/tools/testing/selftests/rcutorture/configs/N3-3-T-nh-SD-SMP-hp|  
 22 
 b/tools/testing/selftests/rcutorture/configs/N4-A-t-NH-sd-SMP-HP|  
 18 
 b/tools/testing/selftests/rcutorture/configs/N5-U-T-NH-sd-SMP-hp|  
 22 
 b/tools/testing/selftests/rcutorture/configs/N6---t-nh-SD-smp-hp|  
 19 
 b/tools/testing/selftests/rcutorture/configs/N7-4-T-NH-SD-SMP-HP|  
 26 
 b/tools/testing/selftests/rcutorture/configs/N8-2-T-NH-SD-SMP-HP  

Re: /dev/random changes for 3.13

2013-11-15 Thread Theodore Ts'o
On Fri, Nov 15, 2013 at 01:58:05PM -0800, Linus Torvalds wrote:
> Ok, I finally got around to the random tree, but your proposed merge
> resolution makes no sense, so I didn't end up applying it.
> 
> > - - r->entropy_total += nbits;
> > if (!r->initialized && nbits > 0) {
> > +   r->entropy_total += nbits;
> 
> This part undoes your commit 6265e169cd31 ("random: push extra entropy
> to the output pools"), and the "entropy_total" field will now never be
> non-zero when "r->initialized" is set

You're right, I totally screwed that up.  Part of the problem is that
I should have cleaned up the if statement in commit 6265e169cd31 so
that it looked like this:

r->entropy_total += nbits;
if (!r->initialized && (r->entropy_total > 128)) {
r->initialized = 1;
r->entropy_total = 0;
}
}

... and so at the top of the dev branch, it should have looked like
this:

r->entropy_total += nbits;
if (!r->initialized && (r->entropy_total > 128)) {
if (r == _pool)
pr_notice("random: %s pool is initialized\n", r->name);
r->initialized = 1;
r->entropy_total = 0;
}

Instead, I had a more complicated structure which confused me when I
cleaned up the merge.

So I'm going to propose the following merge resolution:

diff --cc drivers/char/random.c
index cdf4cfb,4fe5609..000
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@@ -654,14 -601,12 +654,13 @@@ retry
if (cmpxchg(>entropy_count, orig, entropy_count) != orig)
goto retry;
  
 -  if (!r->initialized && nbits > 0) {
 -  r->entropy_total += nbits;
 -  if (r->entropy_total > 128) {
 -  r->initialized = 1;
 -  if (r == _pool)
 -  prandom_reseed_late();
 +  r->entropy_total += nbits;
-   if (!r->initialized && nbits > 0) {
-   if (r->entropy_total > 128) {
-   if (r == _pool)
-   pr_notice("random: %s pool is initialized\n",
- r->name);
-   r->initialized = 1;
-   r->entropy_total = 0;
++  if (!r->initialized && (r->entropy_total > 128)) {
++  r->initialized = 1;
++  r->entropy_total = 0;
++  if (r == _pool) {
++  prandom_reseed_late();
++  pr_notice("random: %s pool is initialized\n", r->name);
}
}

It does fold a cleanup in with the merge resolution, but it's not
actually changing anything in terms of code behavior, and it makes the
resulting merge much more obvious.

Are you OK with that?

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


Re: Possible regression with cgroups in 3.11

2013-11-15 Thread Bjorn Helgaas
On Wed, Nov 13, 2013 at 04:38:06PM +0900, Tejun Heo wrote:
> Hey, guys.
> 
> cc'ing people from "workqueue, pci: INFO: possible recursive locking
> detected" thread.
> 
>   http://thread.gmane.org/gmane.linux.kernel/1525779
> 
> So, to resolve that issue, we ripped out lockdep annotation from
> work_on_cpu() and cgroup is now experiencing deadlock involving
> work_on_cpu().  It *could* be that workqueue is actually broken or
> memcg is looping but it doesn't seem like a very good idea to not have
> lockdep annotation around work_on_cpu().
> 
> IIRC, there was one pci code path which called work_on_cpu()
> recursively.  Would it be possible for that path to use something like
> work_on_cpu_nested(XXX, depth) so that we can retain lockdep
> annotation on work_on_cpu()?

I'm open to changing the way pci_call_probe() works, but my opinion is
that the PCI path that causes trouble is a broken design, and we shouldn't
complicate the work_on_cpu() interface just to accommodate that broken
design.

The problem is that when a PF .probe() method that calls
pci_enable_sriov(), we add new VF devices and call *their* .probe()
methods before the PF .probe() method completes.  That is ugly and
error-prone.

When we call .probe() methods for the VFs, we're obviously already on the
correct node, because the VFs are on the same node as the PF, so I think
the best short-term fix is Alexander's patch to avoid work_on_cpu() when
we're already on the correct node -- something like the (untested) patch
below.

Bjorn


PCI: Avoid unnecessary CPU switch when calling driver .probe() method

From: Bjorn Helgaas 

If we are already on a CPU local to the device, call the driver .probe()
method directly without using work_on_cpu().

This is a workaround for a lockdep warning in the following scenario:

  pci_call_probe
work_on_cpu(cpu, local_pci_probe, ...)
  driver .probe
pci_enable_sriov
  ...
pci_bus_add_device
  ...
pci_call_probe
  work_on_cpu(cpu, local_pci_probe, ...)

It would be better to fix PCI so we don't call VF driver .probe() methods
from inside a PF driver .probe() method, but that's a bigger project.

This patch is due to Alexander Duyck ; I merely
added the preemption disable.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=65071
Link: 
http://lkml.kernel.org/r/CAE9FiQXYQEAZ=0sg6+2odffbqfls9mpon1xvirr9adbxpxc...@mail.gmail.com
Link: 
http://lkml.kernel.org/r/20130624195942.40795.27292.st...@ahduyck-cp1.jf.intel.com
Signed-off-by: Bjorn Helgaas 
---
 drivers/pci/pci-driver.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 454853507b7e..accae06aa79a 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -293,7 +293,9 @@ static int pci_call_probe(struct pci_driver *drv, struct 
pci_dev *dev,
   its local memory on the right node without any need to
   change it. */
node = dev_to_node(>dev);
-   if (node >= 0) {
+   preempt_disable();
+
+   if (node >= 0 && node != numa_node_id()) {
int cpu;
 
get_online_cpus();
@@ -305,6 +307,8 @@ static int pci_call_probe(struct pci_driver *drv, struct 
pci_dev *dev,
put_online_cpus();
} else
error = local_pci_probe();
+
+   preempt_enable();
return error;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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: [Update PATCH 1/1] Cpufreq: Make governor data on nonboot cpus across system suspend/resume

2013-11-15 Thread Rafael J. Wysocki
On Friday, November 15, 2013 04:15:34 PM Lan Tianyu wrote:
> Currently, governor of nonboot cpus will be put to EXIT when system suspend.
> Since all these cpus will be unplugged and the governor usage_count decreases
> to zero. The governor data and its sysfs interfaces will be freed or released.
> This makes user config of these governors loss during suspend and resume.

First off, do we have a pointer to a bug report related to that?

Second, what does need to be done to reproduce this problem?

> This doesn't happen on the governor covering boot cpu because it isn't
> unplugged during system suspend.
> 
> To fix this issue, skipping governor exit during system suspend and check
> policy governor data to determine whether the governor is really needed
> to be initialized when do init. If not, return EALREADY to indicate the
> governor has been initialized and should do nothing. __cpufreq_governor()
> convert EALREADY to 0 as return value for INIT event since governor is
> still under INIT state and can do START operation.
> 
> Signed-off-by: Lan Tianyu 
> ---
> Fix some typos
> 
>  drivers/cpufreq/cpufreq.c  |  5 -
>  drivers/cpufreq/cpufreq_governor.c | 13 -
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 02d534d..38f2e4a 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1239,7 +1239,7 @@ static int __cpufreq_remove_dev_finish(struct device 
> *dev,
>  
>   /* If cpu is last user of policy, free policy */
>   if (cpus == 1) {
> - if (has_target()) {
> + if (has_target() && !frozen) {
>   ret = __cpufreq_governor(policy,
>   CPUFREQ_GOV_POLICY_EXIT);
>   if (ret) {
> @@ -1822,6 +1822,9 @@ static int __cpufreq_governor(struct cpufreq_policy 
> *policy,
>   ((event == CPUFREQ_GOV_POLICY_EXIT) && !ret))
>   module_put(policy->governor->owner);
>  
> + if ((event == CPUFREQ_GOV_POLICY_INIT) && ret == -EALREADY)
> + ret = 0;
> +
>   return ret;
>  }
>  
> diff --git a/drivers/cpufreq/cpufreq_governor.c 
> b/drivers/cpufreq/cpufreq_governor.c
> index 0806c31..ddb93af 100644
> --- a/drivers/cpufreq/cpufreq_governor.c
> +++ b/drivers/cpufreq/cpufreq_governor.c
> @@ -204,9 +204,20 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
>  
>   switch (event) {
>   case CPUFREQ_GOV_POLICY_INIT:
> + /*
> +  * In order to keep governor data across suspend/resume,
> +  * Governor doesn't exit when suspend and will be
> +  * reinitialized when resume. Here check policy governor
> +  * data to determine whether the governor has been exited.
> +  * If not, return EALREADY.
> +  */
>   if (have_governor_per_policy()) {
> - WARN_ON(dbs_data);
> + if (dbs_data)
> + return -EALREADY;
>   } else if (dbs_data) {
> + if (policy->governor_data == dbs_data)
> + return -EALREADY;
> +
>   dbs_data->usage_count++;
>   policy->governor_data = dbs_data;
>   return 0;
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@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 tip/core/rcu 07/16] rcu: Fix coccinelle warnings

2013-11-15 Thread Paul E. McKenney
From: "Signed-off-by: Fengguang Wu" 

This commit fixes the following coccinelle warning:

kernel/rcu/tree.c:712:9-10: WARNING: return of 0/1 in function
'rcu_lockdep_current_cpu_online' with return type bool

Return statements in functions returning bool should use
 true/false instead of 1/0.
 Generated by: coccinelle/misc/boolreturn.cocci

Signed-off-by: Fengguang Wu 
Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 875f2a0f9d8d..e0a58eca0092 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -725,7 +725,7 @@ bool rcu_lockdep_current_cpu_online(void)
bool ret;
 
if (in_nmi())
-   return 1;
+   return true;
preempt_disable();
rdp = this_cpu_ptr(_sched_data);
rnp = rdp->mynode;
-- 
1.8.1.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 tip/core/rcu 15/16] rcu: Remove "extern" from function declarations in include/linux/*rcu*.h

2013-11-15 Thread Paul E. McKenney
From: Teodora Baluta 

Function prototypes don't need to have the "extern" keyword since this
is the default behavior. Its explicit use is redundant.  This commit
therefore removes them.

Signed-off-by: Teodora Baluta 
Signed-off-by: Paul E. McKenney 
---
 include/linux/rculist.h  |  4 +--
 include/linux/rcupdate.h | 80 
 include/linux/rcutiny.h  |  2 +-
 include/linux/rcutree.h  | 36 +++---
 4 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 45a0a9e81478..dbaf99084112 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -55,8 +55,8 @@ static inline void __list_add_rcu(struct list_head *new,
next->prev = new;
 }
 #else
-extern void __list_add_rcu(struct list_head *new,
-   struct list_head *prev, struct list_head *next);
+void __list_add_rcu(struct list_head *new,
+   struct list_head *prev, struct list_head *next);
 #endif
 
 /**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index a94a5805d378..52c1b13c4d76 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -50,13 +50,13 @@ extern int rcutorture_runnable; /* for sysctl */
 #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
-extern void rcutorture_record_test_transition(void);
-extern void rcutorture_record_progress(unsigned long vernum);
-extern void do_trace_rcu_torture_read(const char *rcutorturename,
- struct rcu_head *rhp,
- unsigned long secs,
- unsigned long c_old,
- unsigned long c);
+void rcutorture_record_test_transition(void);
+void rcutorture_record_progress(unsigned long vernum);
+void do_trace_rcu_torture_read(const char *rcutorturename,
+  struct rcu_head *rhp,
+  unsigned long secs,
+  unsigned long c_old,
+  unsigned long c);
 #else
 static inline void rcutorture_record_test_transition(void)
 {
@@ -65,11 +65,11 @@ static inline void rcutorture_record_progress(unsigned long 
vernum)
 {
 }
 #ifdef CONFIG_RCU_TRACE
-extern void do_trace_rcu_torture_read(const char *rcutorturename,
- struct rcu_head *rhp,
- unsigned long secs,
- unsigned long c_old,
- unsigned long c);
+void do_trace_rcu_torture_read(const char *rcutorturename,
+  struct rcu_head *rhp,
+  unsigned long secs,
+  unsigned long c_old,
+  unsigned long c);
 #else
 #define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
do { } while (0)
@@ -118,8 +118,8 @@ extern void do_trace_rcu_torture_read(const char 
*rcutorturename,
  * if CPU A and CPU B are the same CPU (but again only if the system has
  * more than one CPU).
  */
-extern void call_rcu(struct rcu_head *head,
- void (*func)(struct rcu_head *head));
+void call_rcu(struct rcu_head *head,
+ void (*func)(struct rcu_head *head));
 
 #else /* #ifdef CONFIG_PREEMPT_RCU */
 
@@ -149,8 +149,8 @@ extern void call_rcu(struct rcu_head *head,
  * See the description of call_rcu() for more detailed information on
  * memory ordering guarantees.
  */
-extern void call_rcu_bh(struct rcu_head *head,
-   void (*func)(struct rcu_head *head));
+void call_rcu_bh(struct rcu_head *head,
+void (*func)(struct rcu_head *head));
 
 /**
  * call_rcu_sched() - Queue an RCU for invocation after sched grace period.
@@ -171,16 +171,16 @@ extern void call_rcu_bh(struct rcu_head *head,
  * See the description of call_rcu() for more detailed information on
  * memory ordering guarantees.
  */
-extern void call_rcu_sched(struct rcu_head *head,
-  void (*func)(struct rcu_head *rcu));
+void call_rcu_sched(struct rcu_head *head,
+   void (*func)(struct rcu_head *rcu));
 
-extern void synchronize_sched(void);
+void synchronize_sched(void);
 
 #ifdef CONFIG_PREEMPT_RCU
 
-extern void __rcu_read_lock(void);
-extern void __rcu_read_unlock(void);
-extern void rcu_read_unlock_special(struct task_struct *t);
+void __rcu_read_lock(void);
+void __rcu_read_unlock(void);
+void rcu_read_unlock_special(struct task_struct *t);
 void synchronize_rcu(void);
 
 /*
@@ -216,19 +216,19 @@ static inline int rcu_preempt_depth(void)
 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
 
 /* Internal to kernel */
-extern void rcu_init(void);
-extern void rcu_sched_qs(int cpu);
-extern void rcu_bh_qs(int cpu);
-extern void rcu_check_callbacks(int cpu, int user);
+void 

[PATCH tip/core/rcu 01/16] rcu: Kick CPU halfway to RCU CPU stall warning

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

When an RCU CPU stall warning occurs, the CPU invokes resched_cpu() on
itself.  This can help move the grace period forward in some situations,
but it would be even better to do this -before- the RCU CPU stall warning.
This commit therefore causes resched_cpu() to be called every five jiffies
once the system is halfway to an RCU CPU stall warning.

Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/tree.c | 26 +-
 kernel/rcu/tree.h |  2 ++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 8a2c81e86dda..e00946e432ae 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -755,6 +755,12 @@ static int dyntick_save_progress_counter(struct rcu_data 
*rdp,
 }
 
 /*
+ * This function really isn't for public consumption, but RCU is special in
+ * that context switches can allow the state machine to make progress.
+ */
+extern void resched_cpu(int cpu);
+
+/*
  * Return true if the specified CPU has passed through a quiescent
  * state by virtue of being in or having passed through an dynticks
  * idle state since the last call to dyntick_save_progress_counter()
@@ -812,16 +818,34 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,
 */
rcu_kick_nohz_cpu(rdp->cpu);
 
+   /*
+* Alternatively, the CPU might be running in the kernel
+* for an extended period of time without a quiescent state.
+* Attempt to force the CPU through the scheduler to gain the
+* needed quiescent state, but only if the grace period has gone
+* on for an uncommonly long time.  If there are many stuck CPUs,
+* we will beat on the first one until it gets unstuck, then move
+* to the next.  Only do this for the primary flavor of RCU.
+*/
+   if (rdp->rsp == rcu_state &&
+   ULONG_CMP_GE(ACCESS_ONCE(jiffies), rdp->rsp->jiffies_resched)) {
+   rdp->rsp->jiffies_resched += 5;
+   resched_cpu(rdp->cpu);
+   }
+
return 0;
 }
 
 static void record_gp_stall_check_time(struct rcu_state *rsp)
 {
unsigned long j = ACCESS_ONCE(jiffies);
+   unsigned long j1;
 
rsp->gp_start = j;
smp_wmb(); /* Record start time before stall time. */
-   rsp->jiffies_stall = j + rcu_jiffies_till_stall_check();
+   j1 = rcu_jiffies_till_stall_check();
+   rsp->jiffies_stall = j + j1;
+   rsp->jiffies_resched = j + j1 / 2;
 }
 
 /*
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 52be957c9fe2..8e34d8674a4e 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -453,6 +453,8 @@ struct rcu_state {
/*  but in jiffies. */
unsigned long jiffies_stall;/* Time at which to check */
/*  for CPU stalls. */
+   unsigned long jiffies_resched;  /* Time at which to resched */
+   /*  a reluctant CPU. */
unsigned long gp_max;   /* Maximum GP duration in */
/*  jiffies. */
const char *name;   /* Name of structure. */
-- 
1.8.1.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 tip/core/rcu 04/16] rcu: Allow task-level idle entry/exit nesting

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

The current task-level idle entry/exit code forces an entry/exit on
each call, regardless of the nesting level.  This commit therefore
properly accounts for nesting.

Signed-off-by: Paul E. McKenney 
Reviewed-by: Frederic Weisbecker 
---
 kernel/rcu/tree.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index c01213b19dee..acbfead2eb82 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -418,11 +418,12 @@ static void rcu_eqs_enter(bool user)
rdtp = this_cpu_ptr(_dynticks);
oldval = rdtp->dynticks_nesting;
WARN_ON_ONCE((oldval & DYNTICK_TASK_NEST_MASK) == 0);
-   if ((oldval & DYNTICK_TASK_NEST_MASK) == DYNTICK_TASK_NEST_VALUE)
+   if ((oldval & DYNTICK_TASK_NEST_MASK) == DYNTICK_TASK_NEST_VALUE) {
rdtp->dynticks_nesting = 0;
-   else
+   rcu_eqs_enter_common(rdtp, oldval, user);
+   } else {
rdtp->dynticks_nesting -= DYNTICK_TASK_NEST_VALUE;
-   rcu_eqs_enter_common(rdtp, oldval, user);
+   }
 }
 
 /**
@@ -540,11 +541,12 @@ static void rcu_eqs_exit(bool user)
rdtp = this_cpu_ptr(_dynticks);
oldval = rdtp->dynticks_nesting;
WARN_ON_ONCE(oldval < 0);
-   if (oldval & DYNTICK_TASK_NEST_MASK)
+   if (oldval & DYNTICK_TASK_NEST_MASK) {
rdtp->dynticks_nesting += DYNTICK_TASK_NEST_VALUE;
-   else
+   } else {
rdtp->dynticks_nesting = DYNTICK_TASK_EXIT_IDLE;
-   rcu_eqs_exit_common(rdtp, oldval, user);
+   rcu_eqs_exit_common(rdtp, oldval, user);
+   }
 }
 
 /**
-- 
1.8.1.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 tip/core/rcu 14/16] rcu/torture: Dynamically allocate SRCU output buffer to avoid overflow

2013-11-15 Thread Paul E. McKenney
From: Chen Gang 

If the rcutorture SRCU output exceeds 4096 bytes, for example, if you
have more than about 75 CPUs, it will overflow the current statically
allocated buffer.  This commit therefore replaces this static buffer
with a dynamically buffer whose size is based on the number of CPUs.

Benefits:

 - Avoids both buffer overflow and output truncation.
 - Handles an arbitrarily large number of CPUs.
 - Straightforward implementation.

Shortcomings:

 - Some memory is wasted:

   1 cpu now comsumes 50 - 60 bytes, and this patch provides 200 bytes.
   Therefore, for 1K CPUs, roughly 100KB of memory will be wasted.
   However, the memory is freed immediately after printing, so this
   wastage should not be a problem in practice.

Testing (Fedora16 2 CPUs, 2GB RAM x86_64):

 - as module, with/without "torture_type=srcu".
 - build-in not boot runnable, with/without "torture_type=srcu".
 - build-in let boot runnable, with/without "torture_type=srcu".

Signed-off-by: Chen Gang 
Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/torture.c | 67 ++--
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/kernel/rcu/torture.c b/kernel/rcu/torture.c
index 69a4ec80a788..732f8ae3086a 100644
--- a/kernel/rcu/torture.c
+++ b/kernel/rcu/torture.c
@@ -139,8 +139,6 @@ MODULE_PARM_DESC(verbose, "Enable verbose debugging 
printk()s");
 #define VERBOSE_PRINTK_ERRSTRING(s) \
do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! " s "\n", 
torture_type); } while (0)
 
-static char printk_buf[4096];
-
 static int nrealreaders;
 static struct task_struct *writer_task;
 static struct task_struct **fakewriter_tasks;
@@ -376,7 +374,7 @@ struct rcu_torture_ops {
void (*call)(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
void (*cb_barrier)(void);
void (*fqs)(void);
-   int (*stats)(char *page);
+   void (*stats)(char *page);
int irq_capable;
int can_boost;
const char *name;
@@ -578,21 +576,19 @@ static void srcu_torture_barrier(void)
srcu_barrier(_ctl);
 }
 
-static int srcu_torture_stats(char *page)
+static void srcu_torture_stats(char *page)
 {
-   int cnt = 0;
int cpu;
int idx = srcu_ctl.completed & 0x1;
 
-   cnt += sprintf([cnt], "%s%s per-CPU(idx=%d):",
+   page += sprintf(page, "%s%s per-CPU(idx=%d):",
   torture_type, TORTURE_FLAG, idx);
for_each_possible_cpu(cpu) {
-   cnt += sprintf([cnt], " %d(%lu,%lu)", cpu,
+   page += sprintf(page, " %d(%lu,%lu)", cpu,
   per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[!idx],
   per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[idx]);
}
-   cnt += sprintf([cnt], "\n");
-   return cnt;
+   sprintf(page, "\n");
 }
 
 static void srcu_torture_synchronize_expedited(void)
@@ -1052,10 +1048,9 @@ rcu_torture_reader(void *arg)
 /*
  * Create an RCU-torture statistics message in the specified buffer.
  */
-static int
+static void
 rcu_torture_printk(char *page)
 {
-   int cnt = 0;
int cpu;
int i;
long pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };
@@ -1071,8 +1066,8 @@ rcu_torture_printk(char *page)
if (pipesummary[i] != 0)
break;
}
-   cnt += sprintf([cnt], "%s%s ", torture_type, TORTURE_FLAG);
-   cnt += sprintf([cnt],
+   page += sprintf(page, "%s%s ", torture_type, TORTURE_FLAG);
+   page += sprintf(page,
   "rtc: %p ver: %lu tfle: %d rta: %d rtaf: %d rtf: %d ",
   rcu_torture_current,
   rcu_torture_current_version,
@@ -1080,53 +1075,52 @@ rcu_torture_printk(char *page)
   atomic_read(_rcu_torture_alloc),
   atomic_read(_rcu_torture_alloc_fail),
   atomic_read(_rcu_torture_free));
-   cnt += sprintf([cnt], "rtmbe: %d rtbke: %ld rtbre: %ld ",
+   page += sprintf(page, "rtmbe: %d rtbke: %ld rtbre: %ld ",
   atomic_read(_rcu_torture_mberror),
   n_rcu_torture_boost_ktrerror,
   n_rcu_torture_boost_rterror);
-   cnt += sprintf([cnt], "rtbf: %ld rtb: %ld nt: %ld ",
+   page += sprintf(page, "rtbf: %ld rtb: %ld nt: %ld ",
   n_rcu_torture_boost_failure,
   n_rcu_torture_boosts,
   n_rcu_torture_timers);
-   cnt += sprintf([cnt],
+   page += sprintf(page,
   "onoff: %ld/%ld:%ld/%ld %d,%d:%d,%d %lu:%lu (HZ=%d) ",
   n_online_successes, n_online_attempts,
   n_offline_successes, n_offline_attempts,
   min_online, max_online,
   min_offline, max_offline,
   sum_online, sum_offline, HZ);
-   cnt += sprintf([cnt], "barrier: %ld/%ld:%ld",
+   page 

Re: [PATCH] power: Change device_wakeup_enable() to check for null dev_name(dev)

2013-11-15 Thread Greg KH
On Fri, Nov 15, 2013 at 05:16:31PM -0700, Shuah Khan wrote:
> On 11/15/2013 05:21 PM, Rafael J. Wysocki wrote:
> > On Friday, November 15, 2013 05:03:57 PM Shuah Khan wrote:
> >> device_wakeup_enable() uses dev_name(dev) as the wakeup source name.
> >> When it gets called with a device with its name not yet set, ws structure
> >> with ws->name = NULL gets created.
> >>
> >> When kernel is booted with wakeup_source_activate enabled, it will panic
> >> when the trace point code tries to derefernces ws->name.
> >>
> >> Change device_wakeup_enable() to check for dev_name(dev) null condition
> >> and return -EINVAL to avoid panics when device_wakeup_enable() gets called
> >> before device is fully initialized with its name.
>   return -EINVAL;
> >
> > Can you please use WARN_ON(!dev_name(dev)) here?  While I agree that it is a
> > bad idea to crash the kernel because dev has no name, that indicates a 
> > driver
> > bug that shouldn't be too easy to ignore.
> >
> > Thanks!
> >
> 
> Right. ok I will re-cut the patch with WARN_ON and send it. fyi I did 
> send fix for the driver (power_supply) as well.
> 
> http://www.kernelhub.org/?msg=362354=2

Why is a driver calling kobject_set_name() instead of device_set_name()?

Yes, it's really the same thing deep down, but drivers should never care
about a kobject, just 'struct device'.  Well, even then it usually
should care about it's type of 'struct device' but that's a different
issue...

Anyway, not saying your patch is wrong at all, just for the future if
people are looking for code cleanups...

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 tip/core/rcu 06/16] rcu: Let the world know when RCU adjusts its geometry

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Some RCU bugs have been specific to the layout of the rcu_node tree,
but RCU will silently adjust the tree at boot time if appropriate.
This obscures valuable debugging information, so print a message when
this happens.

Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/tree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index acbfead2eb82..875f2a0f9d8d 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3378,6 +3378,8 @@ static void __init rcu_init_geometry(void)
if (rcu_fanout_leaf == CONFIG_RCU_FANOUT_LEAF &&
nr_cpu_ids == NR_CPUS)
return;
+   pr_info("RCU: Adjusting geometry for rcu_fanout_leaf=%d, 
nr_cpu_ids=%d\n",
+   rcu_fanout_leaf, nr_cpu_ids);
 
/*
 * Compute number of nodes that can be handled an rcu_node tree
-- 
1.8.1.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 tip/core/rcu 08/16] rcu: Fix CONFIG_RCU_FANOUT_EXACT for odd fanout/leaf values

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Each element of the rcu_state structure's ->levelspread[] array
is intended to contain the per-level fanout, where the zero-th
element corresponds to the root of the rcu_node tree, and the last
element corresponds to the leaves.  In the CONFIG_RCU_FANOUT_EXACT
case, this means that the last element should be filled in
from CONFIG_RCU_FANOUT_LEAF (or from the rcu_fanout_leaf boot
parameter, if provided) and that the remaining elements should
be filled in from CONFIG_RCU_FANOUT.  Unfortunately, the current
code in rcu_init_levelspread() takes the opposite approach, placing
CONFIG_RCU_FANOUT_LEAF in the zero-th element and CONFIG_RCU_FANOUT in
the remaining elements.

For typical power-of-two values, this generates odd but functional
rcu_node trees.  However, other values, for example CONFIG_RCU_FANOUT=3
and CONFIG_RCU_FANOUT_LEAF=2, generate trees that can leave some CPUs
out of the grace-period computation, resulting in too-short grace periods
and therefore a broken RCU implementation.

This commit therefore fixes rcu_init_levelspread() to set the last
->levelspread[] array element from CONFIG_RCU_FANOUT_LEAF and the
remaining elements from CONFIG_RCU_FANOUT, thus generating the
intended rcu_node trees.

Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index e0a58eca0092..13d1a1a0d60a 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3246,9 +3246,9 @@ static void __init rcu_init_levelspread(struct rcu_state 
*rsp)
 {
int i;
 
-   for (i = rcu_num_lvls - 1; i > 0; i--)
+   rsp->levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
+   for (i = rcu_num_lvls - 2; i >= 0; i--)
rsp->levelspread[i] = CONFIG_RCU_FANOUT;
-   rsp->levelspread[0] = rcu_fanout_leaf;
 }
 #else /* #ifdef CONFIG_RCU_FANOUT_EXACT */
 static void __init rcu_init_levelspread(struct rcu_state *rsp)
-- 
1.8.1.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 tip/core/rcu 09/16] rcu: Improve SRCU's grace-period comments

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

This commit documents the memory-barrier guarantees provided by
synchronize_srcu() and call_srcu().

Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/srcu.c | 56 ---
 1 file changed, 49 insertions(+), 7 deletions(-)

diff --git a/kernel/rcu/srcu.c b/kernel/rcu/srcu.c
index 0f0c63111f20..3318d8284384 100644
--- a/kernel/rcu/srcu.c
+++ b/kernel/rcu/srcu.c
@@ -363,6 +363,29 @@ static void srcu_flip(struct srcu_struct *sp)
 /*
  * Enqueue an SRCU callback on the specified srcu_struct structure,
  * initiating grace-period processing if it is not already running.
+ *
+ * Note that all CPUs must agree that the grace period extended beyond
+ * all pre-existing SRCU read-side critical section.  On systems with
+ * more than one CPU, this means that when "func()" is invoked, each CPU
+ * is guaranteed to have executed a full memory barrier since the end of
+ * its last corresponding SRCU read-side critical section whose beginning
+ * preceded the call to call_rcu().  It also means that each CPU executing
+ * an SRCU read-side critical section that continues beyond the start of
+ * "func()" must have executed a memory barrier after the call_rcu()
+ * but before the beginning of that SRCU read-side critical section.
+ * Note that these guarantees include CPUs that are offline, idle, or
+ * executing in user mode, as well as CPUs that are executing in the kernel.
+ *
+ * Furthermore, if CPU A invoked call_rcu() and CPU B invoked the
+ * resulting SRCU callback function "func()", then both CPU A and CPU
+ * B are guaranteed to execute a full memory barrier during the time
+ * interval between the call to call_rcu() and the invocation of "func()".
+ * This guarantee applies even if CPU A and CPU B are the same CPU (but
+ * again only if the system has more than one CPU).
+ *
+ * Of course, these guarantees apply only for invocations of call_srcu(),
+ * srcu_read_lock(), and srcu_read_unlock() that are all passed the same
+ * srcu_struct structure.
  */
 void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
void (*func)(struct rcu_head *head))
@@ -459,7 +482,30 @@ static void __synchronize_srcu(struct srcu_struct *sp, int 
trycount)
  * Note that it is illegal to call synchronize_srcu() from the corresponding
  * SRCU read-side critical section; doing so will result in deadlock.
  * However, it is perfectly legal to call synchronize_srcu() on one
- * srcu_struct from some other srcu_struct's read-side critical section.
+ * srcu_struct from some other srcu_struct's read-side critical section,
+ * as long as the resulting graph of srcu_structs is acyclic.
+ *
+ * There are memory-ordering constraints implied by synchronize_srcu().
+ * On systems with more than one CPU, when synchronize_srcu() returns,
+ * each CPU is guaranteed to have executed a full memory barrier since
+ * the end of its last corresponding SRCU-sched read-side critical section
+ * whose beginning preceded the call to synchronize_srcu().  In addition,
+ * each CPU having an SRCU read-side critical section that extends beyond
+ * the return from synchronize_srcu() is guaranteed to have executed a
+ * full memory barrier after the beginning of synchronize_srcu() and before
+ * the beginning of that SRCU read-side critical section.  Note that these
+ * guarantees include CPUs that are offline, idle, or executing in user mode,
+ * as well as CPUs that are executing in the kernel.
+ *
+ * Furthermore, if CPU A invoked synchronize_srcu(), which returned
+ * to its caller on CPU B, then both CPU A and CPU B are guaranteed
+ * to have executed a full memory barrier during the execution of
+ * synchronize_srcu().  This guarantee applies even if CPU A and CPU B
+ * are the same CPU, but again only if the system has more than one CPU.
+ *
+ * Of course, these memory-ordering guarantees apply only when
+ * synchronize_srcu(), srcu_read_lock(), and srcu_read_unlock() are
+ * passed the same srcu_struct structure.
  */
 void synchronize_srcu(struct srcu_struct *sp)
 {
@@ -476,12 +522,8 @@ EXPORT_SYMBOL_GPL(synchronize_srcu);
  * Wait for an SRCU grace period to elapse, but be more aggressive about
  * spinning rather than blocking when waiting.
  *
- * Note that it is also illegal to call synchronize_srcu_expedited()
- * from the corresponding SRCU read-side critical section;
- * doing so will result in deadlock.  However, it is perfectly legal
- * to call synchronize_srcu_expedited() on one srcu_struct from some
- * other srcu_struct's read-side critical section, as long as
- * the resulting graph of srcu_structs is acyclic.
+ * Note that synchronize_srcu_expedited() has the same deadlock and
+ * memory-ordering properties as does synchronize_srcu().
  */
 void synchronize_srcu_expedited(struct srcu_struct *sp)
 {
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More 

[PATCH tip/core/rcu 10/16] rcu: Provide better diagnostics for blocking in RCU callback functions

2013-11-15 Thread Paul E. McKenney
From: "Paul E. McKenney" 

Currently blocking in an RCU callback function will result in
"scheduling while atomic", which could be triggered for any number
of reasons.  To aid debugging, this patch introduces a rcu_callback_map
that is used to tie the inappropriate voluntary context switch back
to the fact that the function is being invoked from within a callback.

Signed-off-by: Paul E. McKenney 
---
 include/linux/rcupdate.h | 1 +
 kernel/rcu/rcu.h | 3 +++
 kernel/rcu/update.c  | 5 +
 3 files changed, 9 insertions(+)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 39cbb889e20d..a94a5805d378 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -325,6 +325,7 @@ static inline void rcu_lock_release(struct lockdep_map *map)
 extern struct lockdep_map rcu_lock_map;
 extern struct lockdep_map rcu_bh_lock_map;
 extern struct lockdep_map rcu_sched_lock_map;
+extern struct lockdep_map rcu_callback_map;
 extern int debug_lockdep_rcu_enabled(void);
 
 /**
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 7859a0a3951e..a8f981a2d110 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -102,13 +102,16 @@ static inline bool __rcu_reclaim(const char *rn, struct 
rcu_head *head)
 {
unsigned long offset = (unsigned long)head->func;
 
+   rcu_lock_acquire(_callback_map);
if (__is_kfree_rcu_offset(offset)) {
RCU_TRACE(trace_rcu_invoke_kfree_callback(rn, head, offset));
kfree((void *)head - offset);
+   rcu_lock_release(_callback_map);
return 1;
} else {
RCU_TRACE(trace_rcu_invoke_callback(rn, head));
head->func(head);
+   rcu_lock_release(_callback_map);
return 0;
}
 }
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 6cb3dff89e2b..802365ccd591 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -128,6 +128,11 @@ struct lockdep_map rcu_sched_lock_map =
STATIC_LOCKDEP_MAP_INIT("rcu_read_lock_sched", _sched_lock_key);
 EXPORT_SYMBOL_GPL(rcu_sched_lock_map);
 
+static struct lock_class_key rcu_callback_key;
+struct lockdep_map rcu_callback_map =
+   STATIC_LOCKDEP_MAP_INIT("rcu_callback", _callback_key);
+EXPORT_SYMBOL_GPL(rcu_callback_map);
+
 int notrace debug_lockdep_rcu_enabled(void)
 {
return rcu_scheduler_active && debug_locks &&
-- 
1.8.1.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 tip/core/rcu 16/16] rcu: Remove "extern" from function declarations in kernel/rcu/rcu.h

2013-11-15 Thread Paul E. McKenney
From: Teodora Baluta 

Function prototypes don't need to have the "extern" keyword since this
is the default behavior. Its explicit use is redundant.  This commit
therefore removes them.

Signed-off-by: Teodora Baluta 
Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/rcu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index a8f981a2d110..79c3877e9c5b 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -96,7 +96,7 @@ static inline void debug_rcu_head_unqueue(struct rcu_head 
*head)
 }
 #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
 
-extern void kfree(const void *);
+void kfree(const void *);
 
 static inline bool __rcu_reclaim(const char *rn, struct rcu_head *head)
 {
-- 
1.8.1.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/


  1   2   3   4   5   6   7   8   9   10   >