* Re: [PATCH V2] powerpc/eeh: Fix kernel crash when passing through VF
From: Michael Ellerman @ 2014-09-15 2:49 UTC (permalink / raw)
To: Gavin Shan; +Cc: Wei Yang, linuxppc-dev
In-Reply-To: <20140912050518.GA17933@shangw>
On Fri, 2014-09-12 at 15:05 +1000, Gavin Shan wrote:
> On Fri, Sep 12, 2014 at 01:55:23PM +1000, Michael Ellerman wrote:
> >On Thu, 2014-09-11 at 11:42 +0800, Wei Yang wrote:
> >> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
> >> index 4a45ba8..403445e 100644
> >> --- a/arch/powerpc/kernel/eeh.c
> >> +++ b/arch/powerpc/kernel/eeh.c
> >> @@ -625,7 +625,7 @@ int eeh_pci_enable(struct eeh_pe *pe, int function)
> >> int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
> >> {
> >> struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
> >> - struct eeh_pe *pe = edev->pe;
> >> + struct eeh_pe *pe = edev ? edev->pe : NULL;
> >>
> >> if (!pe) {
> >> pr_err("%s: No PE found on PCI device %s\n",
> >
> >
> >We seem to do this or something similar in a few places. Is it worth having a
> >pci_dev_to_eeh_pe() inline?
> >
>
> Yes, maybe we just need a eeh_dev_to_pe() because converting
> pci_dev to eeh_dev is already coverred by pci_dev_to_eeh_dev().
>
> With eeh_dev_to_pe(), it looks like this:
>
> struct pci_dev *pdev;
> struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev);
> struct eeh_pe *pe = eeh_dev_to_pe(edev);
>
> Or another case:
>
> struct device_node *dn;
> struct eeh_dev *edev = of_node_to_eeh_dev(dn);
> struct eeh_pe *pe = eeh_dev_to_pe(edev);
Yeah I guess.
I saw a few places where we go from pci_dev to eeh_pe via a eeh_dev but then
don't use the eeh_dev at all. So for those it would make sense to have one
macro that does the full conversion from pci_dev to eeh_pe.
But if you think that's not very common then yeah a macro to do each stage is
fine.
cheers
^ permalink raw reply
* Re: [PATCH v2 1/3] PCI/MSI/PPC: Remove arch_msi_check_device()
From: Michael Ellerman @ 2014-09-15 2:42 UTC (permalink / raw)
To: Alexander Gordeev; +Cc: linux-pci, linuxppc-dev, linux-kernel
In-Reply-To: <a7a806c4f531ba80386e9d0baf69571a827ea59c.1410078503.git.agordeev@redhat.com>
On Sun, 2014-09-07 at 20:57 +0200, Alexander Gordeev wrote:
> Moving MSI checks from arch_msi_check_device() function to
> arch_setup_msi_irqs() function makes code more compact and
> allows removing unnecessary hook arch_msi_check_device()
> from generic MSI code.
>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-pci@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
I already acked the previous version, but if you didn't want it that's fine :)
cheers
^ permalink raw reply
* Re: [PATCH v3 3/3] sched: BUG when stack end location is over written
From: Michael Ellerman @ 2014-09-15 2:39 UTC (permalink / raw)
To: Mike Galbraith
Cc: dzickus, jcastillo, riel, prarit, pzijlstr, peterz, bmr, x86,
oleg, rostedt, linux-kernel, hannes, minchan, mingo, tglx,
aneesh.kumar, Aaron Tomlin, akpm, linuxppc-dev, jgh, akpm
In-Reply-To: <1410519533.5547.49.camel@marge.simpson.net>
On Fri, 2014-09-12 at 12:58 +0200, Mike Galbraith wrote:
> On Fri, 2014-09-12 at 10:44 +0100, Aaron Tomlin wrote:
> > On Fri, Sep 12, 2014 at 02:06:57PM +1000, Michael Ellerman wrote:
> > > On Thu, 2014-09-11 at 16:41 +0100, Aaron Tomlin wrote:
> > > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > > index a285900..2a8280a 100644
> > > > --- a/lib/Kconfig.debug
> > > > +++ b/lib/Kconfig.debug
> > > > @@ -824,6 +824,18 @@ config SCHEDSTATS
> > > > application, you can say N to avoid the very slight overhead
> > > > this adds.
> > > >
> > > > +config SCHED_STACK_END_CHECK
> > > > + bool "Detect stack corruption on calls to schedule()"
> > > > + depends on DEBUG_KERNEL
> > > > + default y
> > >
> > > Did you really mean default y?
> > >
> > > Doing so means it will be turned on more or less everywhere, which defeats the
> > > purpose of having a config option in the first place.
> >
> > Only if Kconfig CONFIG_DEBUG_KERNEL is enabled in the first place.
>
> Which is likely enabled just about everywhere on the planet.
Yes, including all distros I'm aware of.
cheers
^ permalink raw reply
* Re: bit fields && data tearing
From: One Thousand Gnomes @ 2014-09-14 23:24 UTC (permalink / raw)
To: Peter Hurley
Cc: Jakub Jelinek, linux-arch@vger.kernel.org, Tony Luck,
linux-ia64@vger.kernel.org, linux-alpha, Oleg Nesterov,
linux-kernel@vger.kernel.org, David Laight, Paul Mackerras,
H. Peter Anvin, Paul E. McKenney, linuxppc-dev@lists.ozlabs.org,
Miroslav Franc, Richard Henderson
In-Reply-To: <5411FFB6.2080702@hurleysoftware.com>
> So a problem that no one has ever complained about on _any_ arch is suddenly
> a problem on a subset of Alpha cpus, but a problem I know exists on Alpha
> isn't important because no one's filed a bug about it?
Yes - because if you think about it that tells you that nobody is hitting
it with the old code and it probably doesn't matter.
> The only Alpha person in this discussion has come out clearly in favor
> of dropping EV4/5 support.
That's not a statistically valid sample size btw
Plus as I pointed out (and you ignored) you are shutting out any future
processors with this kind of oddity, and you have not audited all the
embedded devices we support or may support in future.
> The fact is that the kernel itself is much more parallel than it was
> 15 years ago, and that trend is going to continue. Paired with the fact
> that the Alpha is the least-parallel-friendly arch, makes improving
> parallelism and correctness even harder within kernel subsystems; harder
> than it has to be and harder than it should be.
>
> Linus has repeatedly stated that non-arch code should be as
> arch-independent as possible
That's why many many years ago we added set_bit() and the other bit
functions. On sane processors they are very fast. On insane ones they
work. They understand byte tearing, they understand store ordering (which
a simple variable does not so you've got to audit all your memory
barriers too). In many cases they are faster than using memory barriers
to guide the compiler because they invalidate less and allow the compiler
more freedom.
All this started because I suggested you use set_bit and friends and for
some reason you've decided to try and find another way to do it. We have
the bit operations for a reason. On x86 they are very very fast, on
uniprocessor anything they are very fast, on multiprocessor in general
they are very fast, or you are dealing with boxes that have sanity
problems of other kinds.
Alan
^ permalink raw reply
* [PATCH] video: valkyriefb: Fix unused variable warning in set_valkyrie_clock()
From: Geert Uytterhoeven @ 2014-09-14 9:48 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen
Cc: Geert Uytterhoeven, linux-fbdev, linuxppc-dev, linux-m68k
If CONFIG_ADB_CUDA=n:
drivers/video/fbdev/valkyriefb.c: In function ‘set_valkyrie_clock’:
drivers/video/fbdev/valkyriefb.c:267: warning: unused variable ‘i’
drivers/video/fbdev/valkyriefb.c:266: warning: unused variable ‘req’
Move the variable declarations inside the existing #ifdef section to fix
this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/video/fbdev/valkyriefb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index 97cb9bd1d1dd..b6ed09f16355 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -263,10 +263,10 @@ static inline int valkyrie_vram_reqd(int video_mode, int color_mode)
static void set_valkyrie_clock(unsigned char *params)
{
+#ifdef CONFIG_ADB_CUDA
struct adb_request req;
int i;
-#ifdef CONFIG_ADB_CUDA
for (i = 0; i < 3; ++i) {
cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC,
0x50, i + 1, params[i]);
--
1.9.1
^ permalink raw reply related
* Re: [PATCH V2] powerpc/eeh: Fix kernel crash when passing through VF
From: Gavin Shan @ 2014-09-14 1:19 UTC (permalink / raw)
To: Wei Yang; +Cc: linuxppc-dev, Gavin Shan
In-Reply-To: <20140912093525.GA6916@richard>
On Fri, Sep 12, 2014 at 05:35:25PM +0800, Wei Yang wrote:
>On Fri, Sep 12, 2014 at 03:05:18PM +1000, Gavin Shan wrote:
>>On Fri, Sep 12, 2014 at 01:55:23PM +1000, Michael Ellerman wrote:
>>>On Thu, 2014-09-11 at 11:42 +0800, Wei Yang wrote:
>>>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
>>>> index 4a45ba8..403445e 100644
>>>> --- a/arch/powerpc/kernel/eeh.c
>>>> +++ b/arch/powerpc/kernel/eeh.c
>>>> @@ -625,7 +625,7 @@ int eeh_pci_enable(struct eeh_pe *pe, int function)
>>>> int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
>>>> {
>>>> struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
>>>> - struct eeh_pe *pe = edev->pe;
>>>> + struct eeh_pe *pe = edev ? edev->pe : NULL;
>>>>
>>>> if (!pe) {
>>>> pr_err("%s: No PE found on PCI device %s\n",
>>>
>>>
>>>We seem to do this or something similar in a few places. Is it worth having a
>>>pci_dev_to_eeh_pe() inline?
>>>
>>
>>Yes, maybe we just need a eeh_dev_to_pe() because converting
>>pci_dev to eeh_dev is already coverred by pci_dev_to_eeh_dev().
>>
>>With eeh_dev_to_pe(), it looks like this:
>>
>>struct pci_dev *pdev;
>>struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev);
>>struct eeh_pe *pe = eeh_dev_to_pe(edev);
>>
>>Or another case:
>>
>>struct device_node *dn;
>>struct eeh_dev *edev = of_node_to_eeh_dev(dn);
>>struct eeh_pe *pe = eeh_dev_to_pe(edev);
>
>With these helper, it would be more consolidate to jump between those data.
>
>Gavin,
>
>You would add these helpers? Or would like me to add them?
>
It would be Richard to help on this :-)
Thanks,
Gavin
^ permalink raw reply
* [PATCH] Simplify symbol check in prom_init_check.sh
From: Andreas Schwab @ 2014-09-13 8:20 UTC (permalink / raw)
To: av1474; +Cc: linuxppc-dev
In-Reply-To: <87r3zgd5xx.fsf_-___23348.7322264866$1410551821$gmane$org@comtv.ru>
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
arch/powerpc/kernel/prom_init_check.sh | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index fe8e54b..12640f7 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -50,24 +50,14 @@ do
done
# ignore register save/restore funcitons
- if [ "${UNDEF:0:9}" = "_restgpr_" ]; then
+ case $UNDEF in
+ _restgpr_*|_restgpr0_*|_rest32gpr_*)
OK=1
- fi
- if [ "${UNDEF:0:10}" = "_restgpr0_" ]; then
- OK=1
- fi
- if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then
- OK=1
- fi
- if [ "${UNDEF:0:9}" = "_savegpr_" ]; then
+ ;;
+ _savegpr_*|_savegpr0_*|_save32gpr_*)
OK=1
- fi
- if [ "${UNDEF:0:10}" = "_savegpr0_" ]; then
- OK=1
- fi
- if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then
- OK=1
- fi
+ ;;
+ esac
if [ $OK -eq 0 ]; then
ERROR=1
--
2.1.0
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply related
* Re: [alsa-devel] [PATCH V3] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Michael Trimarchi @ 2014-09-12 20:02 UTC (permalink / raw)
To: Shengjiu Wang
Cc: alsa-devel, timur, tiwai, linux-kernel, broonie, lgirdwood, perex,
nicoleotsuka, Li.Xiubo, mpa, linuxppc-dev
In-Reply-To: <894383e00876763f22988fc5f3f9f232f939f923.1410517971.git.shengjiu.wang@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 5613 bytes --]
Hi
Il 12/set/2014 14:18 "Shengjiu Wang" <shengjiu.wang@freescale.com> ha
scritto:
>
> Check if ipg clock is in clock-names property, then we can move the
> ipg clock enable and disable operation to startup and shutdown, that
> is only enable ipg clock when ssi is working and keep clock is disabled
> when ssi is in idle.
> But when the checking is failed, remain the clock control as before.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> ---
> V3 change log:
> update patch according Nicolin and markus's comments
>
>
> sound/soc/fsl/fsl_ssi.c | 53
++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 45 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 2fc3e66..6d1dfd5 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -169,6 +169,7 @@ struct fsl_ssi_private {
> u8 i2s_mode;
> bool use_dma;
> bool use_dual_fifo;
> + bool has_ipg_clk_name;
> unsigned int fifo_depth;
> struct fsl_ssi_rxtx_reg_val rxtx_reg_val;
>
> @@ -530,6 +531,11 @@ static int fsl_ssi_startup(struct snd_pcm_substream
*substream,
> struct snd_soc_pcm_runtime *rtd = substream->private_data;
> struct fsl_ssi_private *ssi_private =
> snd_soc_dai_get_drvdata(rtd->cpu_dai);
> + int ret;
> +
> + ret = clk_prepare_enable(ssi_private->clk);
> + if (ret)
> + return ret;
>
> /* When using dual fifo mode, it is safer to ensure an even period
> * size. If appearing to an odd number while DMA always starts its
> @@ -544,6 +550,21 @@ static int fsl_ssi_startup(struct snd_pcm_substream
*substream,
> }
>
> /**
> + * fsl_ssi_shutdown: shutdown the SSI
> + *
> + */
> +static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct fsl_ssi_private *ssi_private =
> + snd_soc_dai_get_drvdata(rtd->cpu_dai);
> +
> + clk_disable_unprepare(ssi_private->clk);
> +
> +}
> +
> +/**
> * fsl_ssi_set_bclk - configure Digital Audio Interface bit clock
> *
> * Note: This function can be only called when using SSI as DAI master
> @@ -1043,6 +1064,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai
*dai)
>
> static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
> .startup = fsl_ssi_startup,
> + .shutdown = fsl_ssi_shutdown,
> .hw_params = fsl_ssi_hw_params,
> .hw_free = fsl_ssi_hw_free,
> .set_fmt = fsl_ssi_set_dai_fmt,
> @@ -1168,17 +1190,22 @@ static int fsl_ssi_imx_probe(struct
platform_device *pdev,
> u32 dmas[4];
> int ret;
>
> - ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
> + if (ssi_private->has_ipg_clk_name)
> + ssi_private->clk = devm_clk_get(&pdev->dev, "ipg");
> + else
> + ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(ssi_private->clk)) {
> ret = PTR_ERR(ssi_private->clk);
> dev_err(&pdev->dev, "could not get clock: %d\n", ret);
> return ret;
> }
>
> - ret = clk_prepare_enable(ssi_private->clk);
> - if (ret) {
> - dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n",
ret);
> - return ret;
> + if (!ssi_private->has_ipg_clk_name) {
> + ret = clk_prepare_enable(ssi_private->clk);
> + if (ret) {
> + dev_err(&pdev->dev, "clk_prepare_enable failed:
%d\n", ret);
> + return ret;
> + }
> }
>
> /* For those SLAVE implementations, we ingore non-baudclk cases
> @@ -1236,8 +1263,9 @@ static int fsl_ssi_imx_probe(struct platform_device
*pdev,
> return 0;
>
> error_pcm:
> - clk_disable_unprepare(ssi_private->clk);
>
> + if (!ssi_private->has_ipg_clk_name)
> + clk_disable_unprepare(ssi_private->clk);
> return ret;
> }
>
> @@ -1246,7 +1274,8 @@ static void fsl_ssi_imx_clean(struct
platform_device *pdev,
> {
> if (!ssi_private->use_dma)
> imx_pcm_fiq_exit(pdev);
> - clk_disable_unprepare(ssi_private->clk);
> + if (!ssi_private->has_ipg_clk_name)
> + clk_disable_unprepare(ssi_private->clk);
> }
>
> static int fsl_ssi_probe(struct platform_device *pdev)
> @@ -1321,8 +1350,16 @@ static int fsl_ssi_probe(struct platform_device
*pdev)
> return -ENOMEM;
> }
>
> - ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
> + ret = of_property_match_string(np, "clock-names", "ipg");
> + if (ret < 0) {
> + ssi_private->has_ipg_clk_name = false;
It's false already.
Michael
> + ssi_private->regs = devm_regmap_init_mmio(&pdev->dev,
iomem,
> &fsl_ssi_regconfig);
> + } else {
> + ssi_private->has_ipg_clk_name = true;
> + ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
> + "ipg", iomem, &fsl_ssi_regconfig);
> + }
> if (IS_ERR(ssi_private->regs)) {
> dev_err(&pdev->dev, "Failed to init register map\n");
> return PTR_ERR(ssi_private->regs);
> --
> 1.7.9.5
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
[-- Attachment #2: Type: text/html, Size: 7825 bytes --]
^ permalink raw reply
* powerpc: Avoid bashisms in prom_init_check.sh
From: av1474 @ 2014-09-12 18:55 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <1410510342.17540.10.camel@concordia>
>From 300a98f895dc7e2167cf379408322a9607907761 Mon Sep 17 00:00:00 2001
From: malc <av1474 at comtv.ru>
Date: Mon, 4 Aug 2014 23:28:05 +0400
Subject: [PATCH] powerpc: Avoid bashisms in prom_init_check.sh
Signed-off-by: Vassili Karpov <av1474@comtv.ru>
---
arch/powerpc/kernel/prom_init_check.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index fe8e54b..413f792 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -50,22 +50,22 @@ do
done
# ignore register save/restore funcitons
- if [ "${UNDEF:0:9}" = "_restgpr_" ]; then
+ if [ "$(printf %.9s $UNDEF)" = "_restgpr_" ]; then
OK=1
fi
- if [ "${UNDEF:0:10}" = "_restgpr0_" ]; then
+ if [ "$(printf %.10s $UNDEF)" = "_restgpr0_" ]; then
OK=1
fi
- if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then
+ if [ "$(printf %.11s $UNDEF)" = "_rest32gpr_" ]; then
OK=1
fi
- if [ "${UNDEF:0:9}" = "_savegpr_" ]; then
+ if [ "$(printf %.9s $UNDEF)" = "_savegpr_" ]; then
OK=1
fi
- if [ "${UNDEF:0:10}" = "_savegpr0_" ]; then
+ if [ "$(printf %.10s $UNDEF)" = "_savegpr0_" ]; then
OK=1
fi
- if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then
+ if [ "$(printf %.11s $UNDEF)" = "_save32gpr_" ]; then
OK=1
fi
--
2.0.0.GIT
> On Mon, 2014-08-04 at 23:36 +0400, av1474@comtv.ru wrote:
>> From 300a98f895dc7e2167cf379408322a9607907761 Mon Sep 17 00:00:00 2001
>> From: malc <av1474@comtv.ru>
>> Date: Mon, 4 Aug 2014 23:28:05 +0400
>> Subject: [PATCH] Avoid bashisms
>
> Hi malc,
>
> If you want us to take your patch, please resend with:
> - a better subject, eg:
> powerpc: Avoid bashisms in prom_init_check.sh
> - a Signed-off-by line.
>
> cheers
Thanks for suggestions,
--
mailto:av1474@comtv.ru
^ permalink raw reply related
* [PATCH v2 2/2] pseries: Fix endian issues in cpu hot-removal
From: Thomas Falcon @ 2014-09-12 19:11 UTC (permalink / raw)
To: mpe; +Cc: Thomas Falcon, linuxppc-dev
In-Reply-To: <1410549102-8410-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
When removing a cpu, this patch makes sure that values
gotten from or passed to firmware are in the correct
endian format.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
Changes in v2:
Followed suggestions from Michael Ellerman:
Conversion of intserv to cpu endian occurs once.
Conversion of drc_index to cpu endian occurs once
using of_property_read_u32.
---
arch/powerpc/platforms/pseries/dlpar.c | 20 +++++++++++---------
arch/powerpc/platforms/pseries/hotplug-cpu.c | 10 ++++++----
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 9e9f30b2..343dfdf 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -444,7 +444,8 @@ static int dlpar_offline_cpu(struct device_node *dn)
int rc = 0;
unsigned int cpu;
int len, nthreads, i;
- const u32 *intserv;
+ const __be32 *intserv;
+ u32 thread;
intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
if (!intserv)
@@ -454,8 +455,9 @@ static int dlpar_offline_cpu(struct device_node *dn)
cpu_maps_update_begin();
for (i = 0; i < nthreads; i++) {
+ thread = be32_to_cpu(intserv[i]);
for_each_present_cpu(cpu) {
- if (get_hard_smp_processor_id(cpu) != intserv[i])
+ if (get_hard_smp_processor_id(cpu) != thread)
continue;
if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
@@ -477,14 +479,14 @@ static int dlpar_offline_cpu(struct device_node *dn)
* Upgrade it's state to CPU_STATE_OFFLINE.
*/
set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
- BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
+ BUG_ON(plpar_hcall_norets(H_PROD, thread)
!= H_SUCCESS);
__cpu_die(cpu);
break;
}
if (cpu == num_possible_cpus())
printk(KERN_WARNING "Could not find cpu to offline "
- "with physical id 0x%x\n", intserv[i]);
+ "with physical id 0x%x\n", thread);
}
cpu_maps_update_done();
@@ -496,15 +498,15 @@ out:
static ssize_t dlpar_cpu_release(const char *buf, size_t count)
{
struct device_node *dn;
- const u32 *drc_index;
+ const u32 drc_index;
int rc;
dn = of_find_node_by_path(buf);
if (!dn)
return -EINVAL;
- drc_index = of_get_property(dn, "ibm,my-drc-index", NULL);
- if (!drc_index) {
+ rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index);
+ if (rc) {
of_node_put(dn);
return -EINVAL;
}
@@ -515,7 +517,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
return -EINVAL;
}
- rc = dlpar_release_drc(*drc_index);
+ rc = dlpar_release_drc(drc_index);
if (rc) {
of_node_put(dn);
return rc;
@@ -523,7 +525,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
rc = dlpar_detach_node(dn);
if (rc) {
- dlpar_acquire_drc(*drc_index);
+ dlpar_acquire_drc(drc_index);
return rc;
}
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 447f8c6..5c375f9 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -90,7 +90,7 @@ static void rtas_stop_self(void)
{
static struct rtas_args args = {
.nargs = 0,
- .nret = 1,
+ .nret = cpu_to_be32(1),
.rets = &args.args[0],
};
@@ -312,7 +312,8 @@ static void pseries_remove_processor(struct device_node *np)
{
unsigned int cpu;
int len, nthreads, i;
- const u32 *intserv;
+ const __be32 *intserv;
+ u32 thread;
intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
if (!intserv)
@@ -322,8 +323,9 @@ static void pseries_remove_processor(struct device_node *np)
cpu_maps_update_begin();
for (i = 0; i < nthreads; i++) {
+ thread = be32_to_cpu(intserv[i]);
for_each_present_cpu(cpu) {
- if (get_hard_smp_processor_id(cpu) != intserv[i])
+ if (get_hard_smp_processor_id(cpu) != thread)
continue;
BUG_ON(cpu_online(cpu));
set_cpu_present(cpu, false);
@@ -332,7 +334,7 @@ static void pseries_remove_processor(struct device_node *np)
}
if (cpu >= nr_cpu_ids)
printk(KERN_WARNING "Could not find cpu to remove "
- "with physical id 0x%x\n", intserv[i]);
+ "with physical id 0x%x\n", thread);
}
cpu_maps_update_done();
}
--
1.8.5.2
^ permalink raw reply related
* [PATCH v2 1/2] pseries: Fix endian issues in onlining cpu threads
From: Thomas Falcon @ 2014-09-12 19:11 UTC (permalink / raw)
To: mpe; +Cc: Thomas Falcon, linuxppc-dev
The ibm,ppc-interrupt-server#s property is in big endian format.
These values need to be converted when used by little endian
architectures.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
Changes in v2:
Followed suggestions from Michael Ellerman
conversion of intserv values occur once
---
arch/powerpc/platforms/pseries/dlpar.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index c2806c8..9e9f30b2 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -363,7 +363,8 @@ static int dlpar_online_cpu(struct device_node *dn)
int rc = 0;
unsigned int cpu;
int len, nthreads, i;
- const u32 *intserv;
+ const __be32 *intserv;
+ u32 thread;
intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
if (!intserv)
@@ -373,8 +374,9 @@ static int dlpar_online_cpu(struct device_node *dn)
cpu_maps_update_begin();
for (i = 0; i < nthreads; i++) {
+ thread = be32_to_cpu(intserv[i]);
for_each_present_cpu(cpu) {
- if (get_hard_smp_processor_id(cpu) != intserv[i])
+ if (get_hard_smp_processor_id(cpu) != thread)
continue;
BUG_ON(get_cpu_current_state(cpu)
!= CPU_STATE_OFFLINE);
@@ -388,7 +390,7 @@ static int dlpar_online_cpu(struct device_node *dn)
}
if (cpu == num_possible_cpus())
printk(KERN_WARNING "Could not find cpu to online "
- "with physical id 0x%x\n", intserv[i]);
+ "with physical id 0x%x\n", thread);
}
cpu_maps_update_done();
--
1.8.5.2
^ permalink raw reply related
* Re: [PATCH 2/2] pseries: Fix endian issues in cpu hot-removal
From: Thomas Falcon @ 2014-09-12 19:05 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <1410512019.17540.12.camel@concordia>
On 09/12/2014 03:53 AM, Michael Ellerman wrote:
> On Wed, 2014-09-10 at 17:41 -0500, Thomas Falcon wrote:
>> When removing a cpu, this patch makes sure that values
>> gotten from or passed to firmware are in the correct
>> endian format.
>>
>> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/platforms/pseries/dlpar.c | 14 +++++++-------
>> arch/powerpc/platforms/pseries/hotplug-cpu.c | 8 ++++----
>> 2 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
>> index cd425dc..c5ecfdb 100644
>> --- a/arch/powerpc/platforms/pseries/dlpar.c
>> +++ b/arch/powerpc/platforms/pseries/dlpar.c
>> @@ -442,7 +442,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
>> int rc = 0;
>> unsigned int cpu;
>> int len, nthreads, i;
>> - const u32 *intserv;
>> + const __be32 *intserv;
>>
>> intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
>> if (!intserv)
>> @@ -453,7 +453,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
>> cpu_maps_update_begin();
>> for (i = 0; i < nthreads; i++) {
> Can you please do the conversion once here for each value of i.
>
> You can call the converted value "thread" ?
>
>> for_each_present_cpu(cpu) {
>> - if (get_hard_smp_processor_id(cpu) != intserv[i])
>> + if (get_hard_smp_processor_id(cpu) != be32_to_cpu(intserv[i]))
>> continue;
> Rather than doing it for every cpu in the system for every value of i.
>
> Not that performance is really an issue, but it's just ugly.
>
> And obviously the other places that use it in the loop should use the converted
> value.
>
>
>> @@ -494,7 +494,7 @@ out:
>> static ssize_t dlpar_cpu_release(const char *buf, size_t count)
>> {
>> struct device_node *dn;
>> - const u32 *drc_index;
>> + const __be32 *drc_index;
>> int rc;
>>
>> dn = of_find_node_by_path(buf);
>> @@ -513,7 +513,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
>> return -EINVAL;
>> }
> Here again you should do the conversion once.
>
> Better still use of_property_read_u32().
>
>> - rc = dlpar_release_drc(*drc_index);
>> + rc = dlpar_release_drc(be32_to_cpup(drc_index));
>> if (rc) {
>> of_node_put(dn);
>> return rc;
>> @@ -521,7 +521,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
>>
>> rc = dlpar_detach_node(dn);
>> if (rc) {
>> - dlpar_acquire_drc(*drc_index);
>> + dlpar_acquire_drc(be32_to_cpup(drc_index));
>> return rc;
>> }
> cheers
Thanks for the feedback. Sending patches with your suggested changes.
tom
>
^ permalink raw reply
* Re: [PATCH V3] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Nicolin Chen @ 2014-09-12 18:33 UTC (permalink / raw)
To: Shengjiu Wang, timur
Cc: alsa-devel, tiwai, Li.Xiubo, lgirdwood, perex, broonie, mpa,
linuxppc-dev, linux-kernel
In-Reply-To: <894383e00876763f22988fc5f3f9f232f939f923.1410517971.git.shengjiu.wang@freescale.com>
On Fri, Sep 12, 2014 at 06:35:15PM +0800, Shengjiu Wang wrote:
> Check if ipg clock is in clock-names property, then we can move the
> ipg clock enable and disable operation to startup and shutdown, that
> is only enable ipg clock when ssi is working and keep clock is disabled
> when ssi is in idle.
> But when the checking is failed, remain the clock control as before.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
The patch looks fine to me. I tested the has_ipg_clk_name == true
case, and it works fine. As long as there's no further objection,
I can give an Acked-by. (I think Timur and Markus may like to have
a test as well.)
Thank you
Nicolin
^ permalink raw reply
* Re: [PATCH v2] deb-pkg: Add support for powerpc little endian
From: Michal Marek @ 2014-09-12 14:12 UTC (permalink / raw)
To: Ben Hutchings, Michael Neuling
Cc: linux-kbuild, linux-kernel, Thadeu Lima de Souza Cascardo,
Leann Ogasawara, linuxppc-dev, Anton Blanchard
In-Reply-To: <1410057728.7389.24.camel@decadent.org.uk>
On 2014-09-07 04:42, Ben Hutchings wrote:
> On Fri, 2014-09-05 at 09:09 -0300, Thadeu Lima de Souza Cascardo wrote:
>> On Fri, Sep 05, 2014 at 05:55:18PM +1000, Michael Neuling wrote:
>>> On Fri, 2014-09-05 at 09:13 +0200, Gabriel Paubert wrote:
>>>> On Fri, Sep 05, 2014 at 03:28:47PM +1000, Michael Neuling wrote:
>>>>> The Debian powerpc little endian architecture is called ppc64le. This
>>>>
>>>> Huh? ppc64le or ppc64el?
>>>
>>> ppc64el. Commit message is wrong. Fixed below.
>>>
>>> Mikey
>>>
>>>
>>
>> What about ppc64?
>>
>> Also, I sent that already a month ago. Both linuxppc-dev and Michal
>> Marek were on cc.
>>
>> http://marc.info/?l=linux-kernel&m=140744360328562&w=2
>
> Anyone using powerpc (32-bit) will then need to add ppc64 as a foreign
> architecture before they can install a 64-bit custom kernel. This is
> fine in principle, except that ppc64 is not an official Debian port and
> its packages are not mirrored on the same servers.
[...]
> So I think Michael's version, leaving big-endian kernels as powerpc by
> default, is preferable for now.
I applied v2 of Michael's patch to kbuild.git#misc.
Michal
^ permalink raw reply
* [PATCH v4 0/3] sched: Always check the integrity of the canary
From: Aaron Tomlin @ 2014-09-12 13:16 UTC (permalink / raw)
To: peterz
Cc: dzickus, jcastillo, riel, x86, akpm, minchan, bmr, prarit, oleg,
rostedt, linux-kernel, hannes, mingo, aneesh.kumar, atomlin, jgh,
linuxppc-dev, tglx, akpm
Hi Peter,
Please let me know if this iteration is satisfactory. Thanks.
Currently in the event of a stack overrun a call to schedule()
does not check for this type of corruption. This corruption is
often silent and can go unnoticed. However once the corrupted
region is examined at a later stage, the outcome is undefined
and often results in a sporadic page fault which cannot be
handled.
The first patch adds a canary to init_task's end of stack.
While the second patch provides a helper to determine the
integrity of the canary. The third checks for a stack
overrun and takes appropriate action since the damage
is already done, there is no point in continuing.
Changes since v3:
* Add Michael Ellerman's Acked-by to first patch
(for powerpc)
* Fix compiler error - Michael Ellerman
* Set default Kconfig option to n - Michael Ellerman
Changes since v2:
* Use BUG_ON in schedule_debug() - Peter Zijlstra
* Use a more explicit function
name for setting the canary - Chuck Ebbert
Changes since v1:
* Rebased against v3.17-rc4
* Add a canary to init_task - Oleg Nesterov
* Fix various code formatting issues - Peter Zijlstra
* Introduce Kconfig option - Peter Zijlstra
Aaron Tomlin (3):
init/main.c: Give init_task a canary
sched: Add helper for task stack page overrun checking
sched: BUG when stack end location is over written
arch/powerpc/mm/fault.c | 5 +----
arch/x86/mm/fault.c | 5 +----
include/linux/sched.h | 4 ++++
init/main.c | 1 +
kernel/fork.c | 12 +++++++++---
kernel/sched/core.c | 3 +++
kernel/trace/trace_stack.c | 4 +---
lib/Kconfig.debug | 12 ++++++++++++
8 files changed, 32 insertions(+), 14 deletions(-)
--
1.9.3
^ permalink raw reply
* [PATCH v4 1/3] init/main.c: Give init_task a canary
From: Aaron Tomlin @ 2014-09-12 13:16 UTC (permalink / raw)
To: peterz
Cc: dzickus, jcastillo, riel, x86, akpm, minchan, bmr, prarit, oleg,
rostedt, linux-kernel, hannes, mingo, aneesh.kumar, atomlin, jgh,
linuxppc-dev, tglx, akpm
In-Reply-To: <1410527779-8133-1-git-send-email-atomlin@redhat.com>
Tasks get their end of stack set to STACK_END_MAGIC with the
aim to catch stack overruns. Currently this feature does not
apply to init_task. This patch removes this restriction.
Note that a similar patch was posted by Prarit Bhargava [1]
some time ago but was never merged.
[1]: http://marc.info/?l=linux-kernel&m=127144305403241&w=2
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/fault.c | 3 +--
arch/x86/mm/fault.c | 3 +--
include/linux/sched.h | 2 ++
init/main.c | 1 +
kernel/fork.c | 12 +++++++++---
kernel/trace/trace_stack.c | 4 +---
6 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 51ab9e7..35d0760c 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -30,7 +30,6 @@
#include <linux/kprobes.h>
#include <linux/kdebug.h>
#include <linux/perf_event.h>
-#include <linux/magic.h>
#include <linux/ratelimit.h>
#include <linux/context_tracking.h>
@@ -538,7 +537,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
regs->nip);
stackend = end_of_stack(current);
- if (current != &init_task && *stackend != STACK_END_MAGIC)
+ if (*stackend != STACK_END_MAGIC)
printk(KERN_ALERT "Thread overran stack, or stack corrupted\n");
die("Kernel access of bad area", regs, sig);
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index a241946..bc23a70 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -3,7 +3,6 @@
* Copyright (C) 2001, 2002 Andi Kleen, SuSE Labs.
* Copyright (C) 2008-2009, Red Hat Inc., Ingo Molnar
*/
-#include <linux/magic.h> /* STACK_END_MAGIC */
#include <linux/sched.h> /* test_thread_flag(), ... */
#include <linux/kdebug.h> /* oops_begin/end, ... */
#include <linux/module.h> /* search_exception_table */
@@ -710,7 +709,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
show_fault_oops(regs, error_code, address);
stackend = end_of_stack(tsk);
- if (tsk != &init_task && *stackend != STACK_END_MAGIC)
+ if (*stackend != STACK_END_MAGIC)
printk(KERN_EMERG "Thread overran stack, or stack corrupted\n");
tsk->thread.cr2 = address;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5c2c885..7ef34b7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -57,6 +57,7 @@ struct sched_param {
#include <linux/llist.h>
#include <linux/uidgid.h>
#include <linux/gfp.h>
+#include <linux/magic.h>
#include <asm/processor.h>
@@ -2636,6 +2637,7 @@ static inline unsigned long stack_not_used(struct task_struct *p)
return (unsigned long)n - (unsigned long)end_of_stack(p);
}
#endif
+extern void set_task_stack_end_magic(struct task_struct *tsk);
/* set thread flags in other task's structures
* - see asm/thread_info.h for TIF_xxxx flags available
diff --git a/init/main.c b/init/main.c
index bb1aed9..5fc3fc7 100644
--- a/init/main.c
+++ b/init/main.c
@@ -508,6 +508,7 @@ asmlinkage __visible void __init start_kernel(void)
* lockdep hash:
*/
lockdep_init();
+ set_task_stack_end_magic(&init_task);
smp_setup_processor_id();
debug_objects_early_init();
diff --git a/kernel/fork.c b/kernel/fork.c
index 0cf9cdb..adf9583 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -294,11 +294,18 @@ int __weak arch_dup_task_struct(struct task_struct *dst,
return 0;
}
+void set_task_stack_end_magic(struct task_struct *tsk)
+{
+ unsigned long *stackend;
+
+ stackend = end_of_stack(tsk);
+ *stackend = STACK_END_MAGIC; /* for overflow detection */
+}
+
static struct task_struct *dup_task_struct(struct task_struct *orig)
{
struct task_struct *tsk;
struct thread_info *ti;
- unsigned long *stackend;
int node = tsk_fork_get_node(orig);
int err;
@@ -328,8 +335,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
setup_thread_stack(tsk, orig);
clear_user_return_notifier(tsk);
clear_tsk_need_resched(tsk);
- stackend = end_of_stack(tsk);
- *stackend = STACK_END_MAGIC; /* for overflow detection */
+ set_task_stack_end_magic(tsk);
#ifdef CONFIG_CC_STACKPROTECTOR
tsk->stack_canary = get_random_int();
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 8a4e5cb..1636e41 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -13,7 +13,6 @@
#include <linux/sysctl.h>
#include <linux/init.h>
#include <linux/fs.h>
-#include <linux/magic.h>
#include <asm/setup.h>
@@ -171,8 +170,7 @@ check_stack(unsigned long ip, unsigned long *stack)
i++;
}
- if ((current != &init_task &&
- *(end_of_stack(current)) != STACK_END_MAGIC)) {
+ if (*end_of_stack(current) != STACK_END_MAGIC) {
print_max_stack();
BUG();
}
--
1.9.3
^ permalink raw reply related
* [PATCH v4 2/3] sched: Add helper for task stack page overrun checking
From: Aaron Tomlin @ 2014-09-12 13:16 UTC (permalink / raw)
To: peterz
Cc: dzickus, jcastillo, riel, x86, akpm, minchan, bmr, prarit, oleg,
rostedt, linux-kernel, hannes, mingo, aneesh.kumar, atomlin, jgh,
linuxppc-dev, tglx, akpm
In-Reply-To: <1410527779-8133-1-git-send-email-atomlin@redhat.com>
This facility is used in a few places so let's introduce
a helper function to improve code readability.
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
arch/powerpc/mm/fault.c | 4 +---
arch/x86/mm/fault.c | 4 +---
include/linux/sched.h | 2 ++
kernel/trace/trace_stack.c | 2 +-
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 35d0760c..99b2f27 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -507,7 +507,6 @@ bail:
void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
{
const struct exception_table_entry *entry;
- unsigned long *stackend;
/* Are we prepared to handle this fault? */
if ((entry = search_exception_tables(regs->nip)) != NULL) {
@@ -536,8 +535,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n",
regs->nip);
- stackend = end_of_stack(current);
- if (*stackend != STACK_END_MAGIC)
+ if (task_stack_end_corrupted(current))
printk(KERN_ALERT "Thread overran stack, or stack corrupted\n");
die("Kernel access of bad area", regs, sig);
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index bc23a70..6240bc7 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -648,7 +648,6 @@ no_context(struct pt_regs *regs, unsigned long error_code,
unsigned long address, int signal, int si_code)
{
struct task_struct *tsk = current;
- unsigned long *stackend;
unsigned long flags;
int sig;
@@ -708,8 +707,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
show_fault_oops(regs, error_code, address);
- stackend = end_of_stack(tsk);
- if (*stackend != STACK_END_MAGIC)
+ if (task_stack_end_corrupted(tsk))
printk(KERN_EMERG "Thread overran stack, or stack corrupted\n");
tsk->thread.cr2 = address;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7ef34b7..a80e35d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2615,6 +2615,8 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
}
#endif
+#define task_stack_end_corrupted(task) \
+ (*(end_of_stack(task)) != STACK_END_MAGIC)
static inline int object_is_on_stack(void *obj)
{
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 1636e41..16eddb3 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -170,7 +170,7 @@ check_stack(unsigned long ip, unsigned long *stack)
i++;
}
- if (*end_of_stack(current) != STACK_END_MAGIC) {
+ if (task_stack_end_corrupted(current)) {
print_max_stack();
BUG();
}
--
1.9.3
^ permalink raw reply related
* [PATCH v4 3/3] sched: BUG when stack end location is over written
From: Aaron Tomlin @ 2014-09-12 13:16 UTC (permalink / raw)
To: peterz
Cc: dzickus, jcastillo, riel, x86, akpm, minchan, bmr, prarit, oleg,
rostedt, linux-kernel, hannes, mingo, aneesh.kumar, atomlin, jgh,
linuxppc-dev, tglx, akpm
In-Reply-To: <1410527779-8133-1-git-send-email-atomlin@redhat.com>
Currently in the event of a stack overrun a call to schedule()
does not check for this type of corruption. This corruption is
often silent and can go unnoticed. However once the corrupted
region is examined at a later stage, the outcome is undefined
and often results in a sporadic page fault which cannot be
handled.
This patch checks for a stack overrun and takes appropriate
action since the damage is already done, there is no point
in continuing.
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
kernel/sched/core.c | 3 +++
lib/Kconfig.debug | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ec1a286..6ed1a24 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2660,6 +2660,9 @@ static noinline void __schedule_bug(struct task_struct *prev)
*/
static inline void schedule_debug(struct task_struct *prev)
{
+#ifdef CONFIG_SCHED_STACK_END_CHECK
+ BUG_ON(unlikely(task_stack_end_corrupted(prev)));
+#endif
/*
* Test if we are atomic. Since do_exit() needs to call into
* schedule() atomically, we ignore that path. Otherwise whine
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a285900..e58163d 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -824,6 +824,18 @@ config SCHEDSTATS
application, you can say N to avoid the very slight overhead
this adds.
+config SCHED_STACK_END_CHECK
+ bool "Detect stack corruption on calls to schedule()"
+ depends on DEBUG_KERNEL
+ default n
+ help
+ This option checks for a stack overrun on calls to schedule().
+ If the stack end location is found to be over written always panic as
+ the content of the corrupted region can no longer be trusted.
+ This is to ensure no erroneous behaviour occurs which could result in
+ data corruption or a sporadic crash at a later stage once the region
+ is examined. The runtime overhead introduced is minimal.
+
config TIMER_STATS
bool "Collect kernel timers statistics"
depends on DEBUG_KERNEL && PROC_FS
--
1.9.3
^ permalink raw reply related
* [PATCH] cpuidle/powernv: Enter fastsleep on checking if deep idle states are allowed
From: Preeti U Murthy @ 2014-09-12 11:01 UTC (permalink / raw)
To: mikey, mpe, rjw, linux-kernel, benh, linuxppc-dev; +Cc: linux-pm
Today the procfs interface /proc/sys/kernel/powersave-nap is used to control
entry into deep idle states beyond snooze. Check for the value of this
parameter before entering fastsleep. We already do this check for nap in
power7_idle().
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
---
drivers/cpuidle/cpuidle-powernv.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
index a64be57..b8ba52e 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -69,6 +69,12 @@ static int fastsleep_loop(struct cpuidle_device *dev,
unsigned long old_lpcr = mfspr(SPRN_LPCR);
unsigned long new_lpcr;
+ /*
+ * Verify if snooze is the only valid cpuidle state
+ */
+ if (!(powersave_nap > 0))
+ return index;
+
if (unlikely(system_state < SYSTEM_RUNNING))
return index;
^ permalink raw reply related
* Re: [PATCH v3 3/3] sched: BUG when stack end location is over written
From: Mike Galbraith @ 2014-09-12 10:58 UTC (permalink / raw)
To: Aaron Tomlin
Cc: dzickus, jcastillo, riel, prarit, pzijlstr, peterz, bmr, x86,
oleg, rostedt, linux-kernel, minchan, mingo, tglx, aneesh.kumar,
hannes, akpm, linuxppc-dev, jgh, akpm
In-Reply-To: <20140912094419.GD1873@atomlin.usersys.redhat.com>
On Fri, 2014-09-12 at 10:44 +0100, Aaron Tomlin wrote:
> On Fri, Sep 12, 2014 at 02:06:57PM +1000, Michael Ellerman wrote:
> > On Thu, 2014-09-11 at 16:41 +0100, Aaron Tomlin wrote:
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index a285900..2a8280a 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -824,6 +824,18 @@ config SCHEDSTATS
> > > application, you can say N to avoid the very slight overhead
> > > this adds.
> > >
> > > +config SCHED_STACK_END_CHECK
> > > + bool "Detect stack corruption on calls to schedule()"
> > > + depends on DEBUG_KERNEL
> > > + default y
> >
> > Did you really mean default y?
> >
> > Doing so means it will be turned on more or less everywhere, which defeats the
> > purpose of having a config option in the first place.
>
> Only if Kconfig CONFIG_DEBUG_KERNEL is enabled in the first place.
Which is likely enabled just about everywhere on the planet.
-Mike
^ permalink raw reply
* Re: [PATCH V2] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Shengjiu Wang @ 2014-09-12 10:40 UTC (permalink / raw)
To: Markus Pargmann
Cc: alsa-devel, lgirdwood, tiwai, Li.Xiubo, timur, perex,
Nicolin Chen, broonie, linuxppc-dev, linux-kernel
In-Reply-To: <20140912085446.GA8844@pengutronix.de>
On Fri, Sep 12, 2014 at 10:54:46AM +0200, Markus Pargmann wrote:
> On Fri, Sep 12, 2014 at 03:14:28PM +0800, Shengjiu Wang wrote:
> > On Fri, Sep 12, 2014 at 08:17:06AM +0200, Markus Pargmann wrote:
> > > Hi,
> > >
> > > On Fri, Sep 12, 2014 at 10:01:12AM +0800, Shengjiu Wang wrote:
> > > > On Thu, Sep 11, 2014 at 03:57:37PM -0700, Nicolin Chen wrote:
> > > > > On Thu, Sep 11, 2014 at 01:38:29PM +0800, Shengjiu Wang wrote:
> > > > > > Move the ipg clock enable and disable operation to startup and shutdown,
> > > > > > that is only enable ipg clock when ssi is working. Keep clock is disabled
> > > > > > when ssi is in idle.
> > > > > > otherwise, _fsl_ssi_set_dai_fmt function need to be called in probe,
> > > > > > so add ipg clock control for it.
> > > > >
> > > > > It seems to be no objection so far against my last suggestion to
> > > > > use regmap's mmio_clk() for named ipg clk only. So you may still
> > > > > consider about that.
> > > > >
> > > > I think mmio_clk() can be put to another patch. and this patch only for clk_enable()
> > > > and clk_disable() operation.
> > >
> > > I would also prefer Nicolin's suggestion using regmap's mmio clk. I
> > > think it may be better to not add this particular patch at all and just
> > > go with the mmio_clk patch. It should be easy enough to just add the
> > > clock names to the devicetrees. That way we can avoid all those clock
> > > enable/disable function calls.
> > >
> > I considered if use Nicolin's suggestion, I still need ot add those
> > enable/disable function calls, because I want to remove the enable/disable
> > function call in fsl_ssi_imx_probe, then I need to add enable/disable
> > function call in _fsl_ssi_set_dai_fmt(), which is called in fsl_ssi_probe().
> > _fsl_ssi_set_dai_fmt() need to access the registers.
>
> I think Nicolin's suggestion was to check for a clock named "ipg". If it
> exists, you can simply use devm_regmap_init_mmio_clk(). Otherwise you
> could fallback to the old behaviour and get the first clock and enable
> it without disabling it after the probe function.
>
> After that, you could add the clock-names property to the devicetrees
> and have the same result.
>
Ok, I have sent V3 for review. please check.
wang shengjiu
> >
> > > >
> > > > > Anyway, I'd like to do thing in parallel. So I just simply tested
> > > > > it on my side and its works fine, it may still need to be tested
> > > > > by others though.
> > > > >
> > > > > Nicolina
> > > >
> > > > Hi Markus
> > > >
> > > > could you please review it, and share your comments?
> > >
> > > I think the clock enabling for AC97 is missing in your patch.
> > >
> > I add clock enable in fsl_ssi_startup(), I think it is enough for AC97, does it?
>
> No. We export ac97 read/write ops for the whole AC97 stuff. These may be
> used outside of the usual startup/shutdown which is done for substreams.
> It may work to have the ipg clock enabled in
> fsl_ssi_ac97_read/fsl_ssi_ac97_write.
>
> Best regards,
>
> Markus
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply
* [PATCH V3] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Shengjiu Wang @ 2014-09-12 10:35 UTC (permalink / raw)
To: timur, nicoleotsuka, Li.Xiubo, lgirdwood, broonie, perex, tiwai,
mpa
Cc: alsa-devel, linuxppc-dev, linux-kernel
Check if ipg clock is in clock-names property, then we can move the
ipg clock enable and disable operation to startup and shutdown, that
is only enable ipg clock when ssi is working and keep clock is disabled
when ssi is in idle.
But when the checking is failed, remain the clock control as before.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
V3 change log:
update patch according Nicolin and markus's comments
sound/soc/fsl/fsl_ssi.c | 53 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2fc3e66..6d1dfd5 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -169,6 +169,7 @@ struct fsl_ssi_private {
u8 i2s_mode;
bool use_dma;
bool use_dual_fifo;
+ bool has_ipg_clk_name;
unsigned int fifo_depth;
struct fsl_ssi_rxtx_reg_val rxtx_reg_val;
@@ -530,6 +531,11 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct fsl_ssi_private *ssi_private =
snd_soc_dai_get_drvdata(rtd->cpu_dai);
+ int ret;
+
+ ret = clk_prepare_enable(ssi_private->clk);
+ if (ret)
+ return ret;
/* When using dual fifo mode, it is safer to ensure an even period
* size. If appearing to an odd number while DMA always starts its
@@ -544,6 +550,21 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
}
/**
+ * fsl_ssi_shutdown: shutdown the SSI
+ *
+ */
+static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct fsl_ssi_private *ssi_private =
+ snd_soc_dai_get_drvdata(rtd->cpu_dai);
+
+ clk_disable_unprepare(ssi_private->clk);
+
+}
+
+/**
* fsl_ssi_set_bclk - configure Digital Audio Interface bit clock
*
* Note: This function can be only called when using SSI as DAI master
@@ -1043,6 +1064,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
.startup = fsl_ssi_startup,
+ .shutdown = fsl_ssi_shutdown,
.hw_params = fsl_ssi_hw_params,
.hw_free = fsl_ssi_hw_free,
.set_fmt = fsl_ssi_set_dai_fmt,
@@ -1168,17 +1190,22 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
u32 dmas[4];
int ret;
- ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
+ if (ssi_private->has_ipg_clk_name)
+ ssi_private->clk = devm_clk_get(&pdev->dev, "ipg");
+ else
+ ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(ssi_private->clk)) {
ret = PTR_ERR(ssi_private->clk);
dev_err(&pdev->dev, "could not get clock: %d\n", ret);
return ret;
}
- ret = clk_prepare_enable(ssi_private->clk);
- if (ret) {
- dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
- return ret;
+ if (!ssi_private->has_ipg_clk_name) {
+ ret = clk_prepare_enable(ssi_private->clk);
+ if (ret) {
+ dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
+ return ret;
+ }
}
/* For those SLAVE implementations, we ingore non-baudclk cases
@@ -1236,8 +1263,9 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
return 0;
error_pcm:
- clk_disable_unprepare(ssi_private->clk);
+ if (!ssi_private->has_ipg_clk_name)
+ clk_disable_unprepare(ssi_private->clk);
return ret;
}
@@ -1246,7 +1274,8 @@ static void fsl_ssi_imx_clean(struct platform_device *pdev,
{
if (!ssi_private->use_dma)
imx_pcm_fiq_exit(pdev);
- clk_disable_unprepare(ssi_private->clk);
+ if (!ssi_private->has_ipg_clk_name)
+ clk_disable_unprepare(ssi_private->clk);
}
static int fsl_ssi_probe(struct platform_device *pdev)
@@ -1321,8 +1350,16 @@ static int fsl_ssi_probe(struct platform_device *pdev)
return -ENOMEM;
}
- ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
+ ret = of_property_match_string(np, "clock-names", "ipg");
+ if (ret < 0) {
+ ssi_private->has_ipg_clk_name = false;
+ ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
&fsl_ssi_regconfig);
+ } else {
+ ssi_private->has_ipg_clk_name = true;
+ ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
+ "ipg", iomem, &fsl_ssi_regconfig);
+ }
if (IS_ERR(ssi_private->regs)) {
dev_err(&pdev->dev, "Failed to init register map\n");
return PTR_ERR(ssi_private->regs);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH v3 3/3] sched: BUG when stack end location is over written
From: Aaron Tomlin @ 2014-09-12 9:50 UTC (permalink / raw)
To: Michael Ellerman
Cc: dzickus, jcastillo, riel, prarit, peterz, bmr, x86, oleg, rostedt,
linux-kernel, minchan, mingo, tglx, aneesh.kumar, hannes, akpm,
linuxppc-dev, jgh, akpm
In-Reply-To: <1410501891.17540.6.camel@concordia>
On Fri, Sep 12, 2014 at 04:04:51PM +1000, Michael Ellerman wrote:
> On Thu, 2014-09-11 at 16:41 +0100, Aaron Tomlin wrote:
> > Currently in the event of a stack overrun a call to schedule()
> > does not check for this type of corruption. This corruption is
> > often silent and can go unnoticed. However once the corrupted
> > region is examined at a later stage, the outcome is undefined
> > and often results in a sporadic page fault which cannot be
> > handled.
> >
> > This patch checks for a stack overrun and takes appropriate
> > action since the damage is already done, there is no point
> > in continuing.
> >
> > Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
> > ---
> > kernel/sched/core.c | 3 +++
> > lib/Kconfig.debug | 12 ++++++++++++
> > 2 files changed, 15 insertions(+)
> >
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index ec1a286..0b70b73 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -2660,6 +2660,9 @@ static noinline void __schedule_bug(struct task_struct *prev)
> > */
> > static inline void schedule_debug(struct task_struct *prev)
> > {
> > +#ifdef CONFIG_SCHED_STACK_END_CHECK
> > + BUG_ON(unlikely(task_stack_end_corrupted(prev)))
> > +#endif
>
> Spot the bug? Please compile your code in future.
Oops! Sorry about that.
--
Aaron Tomlin
^ permalink raw reply
* Re: [PATCH v3 3/3] sched: BUG when stack end location is over written
From: Aaron Tomlin @ 2014-09-12 9:44 UTC (permalink / raw)
To: Michael Ellerman
Cc: dzickus, jcastillo, riel, prarit, pzijlstr, peterz, bmr, x86,
oleg, rostedt, linux-kernel, minchan, mingo, tglx, aneesh.kumar,
hannes, akpm, linuxppc-dev, jgh, akpm
In-Reply-To: <1410494817.17540.4.camel@concordia>
On Fri, Sep 12, 2014 at 02:06:57PM +1000, Michael Ellerman wrote:
> On Thu, 2014-09-11 at 16:41 +0100, Aaron Tomlin wrote:
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index a285900..2a8280a 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -824,6 +824,18 @@ config SCHEDSTATS
> > application, you can say N to avoid the very slight overhead
> > this adds.
> >
> > +config SCHED_STACK_END_CHECK
> > + bool "Detect stack corruption on calls to schedule()"
> > + depends on DEBUG_KERNEL
> > + default y
>
> Did you really mean default y?
>
> Doing so means it will be turned on more or less everywhere, which defeats the
> purpose of having a config option in the first place.
Only if Kconfig CONFIG_DEBUG_KERNEL is enabled in the first place.
--
Aaron Tomlin
^ permalink raw reply
* Re: [PATCH V2] powerpc/eeh: Fix kernel crash when passing through VF
From: Wei Yang @ 2014-09-12 9:35 UTC (permalink / raw)
To: Gavin Shan; +Cc: Wei Yang, linuxppc-dev
In-Reply-To: <20140912050518.GA17933@shangw>
On Fri, Sep 12, 2014 at 03:05:18PM +1000, Gavin Shan wrote:
>On Fri, Sep 12, 2014 at 01:55:23PM +1000, Michael Ellerman wrote:
>>On Thu, 2014-09-11 at 11:42 +0800, Wei Yang wrote:
>>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
>>> index 4a45ba8..403445e 100644
>>> --- a/arch/powerpc/kernel/eeh.c
>>> +++ b/arch/powerpc/kernel/eeh.c
>>> @@ -625,7 +625,7 @@ int eeh_pci_enable(struct eeh_pe *pe, int function)
>>> int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
>>> {
>>> struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
>>> - struct eeh_pe *pe = edev->pe;
>>> + struct eeh_pe *pe = edev ? edev->pe : NULL;
>>>
>>> if (!pe) {
>>> pr_err("%s: No PE found on PCI device %s\n",
>>
>>
>>We seem to do this or something similar in a few places. Is it worth having a
>>pci_dev_to_eeh_pe() inline?
>>
>
>Yes, maybe we just need a eeh_dev_to_pe() because converting
>pci_dev to eeh_dev is already coverred by pci_dev_to_eeh_dev().
>
>With eeh_dev_to_pe(), it looks like this:
>
>struct pci_dev *pdev;
>struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev);
>struct eeh_pe *pe = eeh_dev_to_pe(edev);
>
>Or another case:
>
>struct device_node *dn;
>struct eeh_dev *edev = of_node_to_eeh_dev(dn);
>struct eeh_pe *pe = eeh_dev_to_pe(edev);
With these helper, it would be more consolidate to jump between those data.
Gavin,
You would add these helpers? Or would like me to add them?
>
>Thanks,
>Gavin
>
>>cheers
>>
>>
--
Richard Yang
Help you, Help me
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox