Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] EDAC/altera: Use fast register IO for S10 IRQs
@ 2019-11-20 17:38 thor.thayer
  2019-11-20 18:07 ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: thor.thayer @ 2019-11-20 17:38 UTC (permalink / raw)
  To: stable, bp, mchehab
  Cc: tony.luck, james.morse, rrichter, linux-edac, linux-kernel,
	Thor Thayer, Meng Li

From: Thor Thayer <thor.thayer@linux.intel.com>

When an irq occurs in altera edac driver, regmap_xxx() is invoked
in atomic context. Regmap must indicate register IO is fast so
that a spinlock is used instead of a mutex to avoid sleeping
in atomic context.

Fixes mutex-lock error
   lock_acquire+0xfc/0x288
   __mutex_lock+0x8c/0x808
   mutex_lock_nested+0x3c/0x50
   regmap_lock_mutex+0x24/0x30
   regmap_write+0x40/0x78
   a10_eccmgr_irq_unmask+0x34/0x40
   unmask_irq.part.0+0x30/0x50
   irq_enable+0x74/0x80
   __irq_startup+0x80/0xa8
   irq_startup+0x70/0x150
   __setup_irq+0x650/0x6d0
   request_threaded_irq+0xe4/0x180
   devm_request_threaded_irq+0x7c/0xf0
   altr_sdram_probe+0x2c4/0x600
<snip>

Upstream fix pending [1] (common code uses fast mode)
[1] https://lkml.org/lkml/2019/11/7/1014

Fixes: 3dab6bd52687 ("EDAC, altera: Add support for Stratix10 SDRAM EDAC")
Cc: stable@vger.kernel.org
Reported-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
---
 drivers/edac/altera_edac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 59319f0c873b..647b3a5ef095 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -561,6 +561,7 @@ static const struct regmap_config s10_sdram_regmap_cfg = {
 	.reg_write = s10_protected_reg_write,
 	.use_single_read = true,
 	.use_single_write = true,
+	.fast_io = true,
 };
 
 /************** </Stratix10 EDAC Memory Controller Functions> ***********/
-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] EDAC/altera: Use fast register IO for S10 IRQs
  2019-11-20 17:38 [PATCH] EDAC/altera: Use fast register IO for S10 IRQs thor.thayer
@ 2019-11-20 18:07 ` Borislav Petkov
  2019-11-20 18:52   ` Thor Thayer
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2019-11-20 18:07 UTC (permalink / raw)
  To: thor.thayer
  Cc: stable, mchehab, tony.luck, james.morse, rrichter, linux-edac,
	linux-kernel, Meng Li

On Wed, Nov 20, 2019 at 11:38:01AM -0600, thor.thayer@linux.intel.com wrote:
> From: Thor Thayer <thor.thayer@linux.intel.com>
> 
> When an irq occurs in altera edac driver, regmap_xxx() is invoked
> in atomic context. Regmap must indicate register IO is fast so
> that a spinlock is used instead of a mutex to avoid sleeping
> in atomic context.
> 
> Fixes mutex-lock error
>    lock_acquire+0xfc/0x288
>    __mutex_lock+0x8c/0x808
>    mutex_lock_nested+0x3c/0x50
>    regmap_lock_mutex+0x24/0x30
>    regmap_write+0x40/0x78
>    a10_eccmgr_irq_unmask+0x34/0x40
>    unmask_irq.part.0+0x30/0x50
>    irq_enable+0x74/0x80
>    __irq_startup+0x80/0xa8
>    irq_startup+0x70/0x150
>    __setup_irq+0x650/0x6d0
>    request_threaded_irq+0xe4/0x180
>    devm_request_threaded_irq+0x7c/0xf0
>    altr_sdram_probe+0x2c4/0x600
> <snip>
> 
> Upstream fix pending [1] (common code uses fast mode)
> [1] https://lkml.org/lkml/2019/11/7/1014

I don't understand - I picked those up and are already queued for 5.5:

https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git/log/?h=edac-for-next

What is that patch for?

Are you saying, I should stick it before the two patches above so that
it gets backported to stable so that you have older kernels addressed?

But then the above ones won't apply anymore because

EDAC/altera: Use the Altera System Manager driver

removes s10_sdram_regmap_cfg.

What I can offer you is to remove the two patches and apply this one so
that it goes in next week. Then, you can send me the two rediffed after
5.5-rc1 is out. Ok?

> Fixes: 3dab6bd52687 ("EDAC, altera: Add support for Stratix10 SDRAM EDAC")
> Cc: stable@vger.kernel.org
> Reported-by: Meng Li <Meng.Li@windriver.com>
> Signed-off-by: Meng Li <Meng.Li@windriver.com>

What does Meng's SOB mean?

> Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] EDAC/altera: Use fast register IO for S10 IRQs
  2019-11-20 18:07 ` Borislav Petkov
@ 2019-11-20 18:52   ` Thor Thayer
  2019-11-20 19:13     ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Thor Thayer @ 2019-11-20 18:52 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: stable, mchehab, tony.luck, james.morse, rrichter, linux-edac,
	linux-kernel, Meng Li

Hi Boris,

On 11/20/19 12:07 PM, Borislav Petkov wrote:
> On Wed, Nov 20, 2019 at 11:38:01AM -0600, thor.thayer@linux.intel.com wrote:
>> From: Thor Thayer <thor.thayer@linux.intel.com>
>>
>> When an irq occurs in altera edac driver, regmap_xxx() is invoked
>> in atomic context. Regmap must indicate register IO is fast so
>> that a spinlock is used instead of a mutex to avoid sleeping
>> in atomic context.
>>
>> Fixes mutex-lock error
>>     lock_acquire+0xfc/0x288
>>     __mutex_lock+0x8c/0x808
>>     mutex_lock_nested+0x3c/0x50
>>     regmap_lock_mutex+0x24/0x30
>>     regmap_write+0x40/0x78
>>     a10_eccmgr_irq_unmask+0x34/0x40
>>     unmask_irq.part.0+0x30/0x50
>>     irq_enable+0x74/0x80
>>     __irq_startup+0x80/0xa8
>>     irq_startup+0x70/0x150
>>     __setup_irq+0x650/0x6d0
>>     request_threaded_irq+0xe4/0x180
>>     devm_request_threaded_irq+0x7c/0xf0
>>     altr_sdram_probe+0x2c4/0x600
>> <snip>
>>
>> Upstream fix pending [1] (common code uses fast mode)
>> [1] https://lkml.org/lkml/2019/11/7/1014
> 
> I don't understand - I picked those up and are already queued for 5.5:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git/log/?h=edac-for-next
> 
> What is that patch for?
> 
> Are you saying, I should stick it before the two patches above so that
> it gets backported to stable so that you have older kernels addressed?
> 
> But then the above ones won't apply anymore because
> 
> EDAC/altera: Use the Altera System Manager driver
> 
> removes s10_sdram_regmap_cfg.
> 
> What I can offer you is to remove the two patches and apply this one so
> that it goes in next week. Then, you can send me the two rediffed after
> 5.5-rc1 is out. Ok?
> 
>> Fixes: 3dab6bd52687 ("EDAC, altera: Add support for Stratix10 SDRAM EDAC")
>> Cc: stable@vger.kernel.org
>> Reported-by: Meng Li <Meng.Li@windriver.com>
>> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> 
> What does Meng's SOB mean?
> 
>> Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
> 
> Thx.
> 

Sorry, I didn't explain this well enough. The patches you have queued 
will fix this for the next 5.5 branch.

This patch should to be applied to the stable branches to fix the issue 
in older branches. Although I knew the To: had to be to 
stable@vger.kernel.org, I wasn't sure how that worked with the EDAC 
reviewers. This was a weird situation where I couldn't fix the upstream 
because it had already been fixed a different way.

Meng sent me the notification and the patch with a SOB so I put Meng 
first in the order.

Sorry for the confusion,

Thor


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] EDAC/altera: Use fast register IO for S10 IRQs
  2019-11-20 18:52   ` Thor Thayer
@ 2019-11-20 19:13     ` Borislav Petkov
  2019-11-20 19:28       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2019-11-20 19:13 UTC (permalink / raw)
  To: Thor Thayer
  Cc: stable, mchehab, tony.luck, james.morse, rrichter, linux-edac,
	linux-kernel, Meng Li

On Wed, Nov 20, 2019 at 12:52:18PM -0600, Thor Thayer wrote:
> This patch should to be applied to the stable branches to fix the issue in
> older branches.

Do stable folks pick up stable fixes which are not upstream?

AFAIK, a patch needs to be upstream to be backported to stable first.

> Although I knew the To: had to be to stable@vger.kernel.org,
> I wasn't sure how that worked with the EDAC reviewers. This was a weird
> situation where I couldn't fix the upstream because it had already been
> fixed a different way.

Yah.

> Meng sent me the notification and the patch with a SOB so I put Meng first
> in the order.

If he sent you the patch, then he's the author and you need to keep his

From: Meng Li <Meng.Li@windriver.com>

at the beginning of the file so that git preserves his authorship.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] EDAC/altera: Use fast register IO for S10 IRQs
  2019-11-20 19:13     ` Borislav Petkov
@ 2019-11-20 19:28       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2019-11-20 19:28 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Thor Thayer, stable, mchehab, tony.luck, james.morse, rrichter,
	linux-edac, linux-kernel, Meng Li

On Wed, Nov 20, 2019 at 08:13:35PM +0100, Borislav Petkov wrote:
> On Wed, Nov 20, 2019 at 12:52:18PM -0600, Thor Thayer wrote:
> > This patch should to be applied to the stable branches to fix the issue in
> > older branches.
> 
> Do stable folks pick up stable fixes which are not upstream?

Not at all.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 17:38 [PATCH] EDAC/altera: Use fast register IO for S10 IRQs thor.thayer
2019-11-20 18:07 ` Borislav Petkov
2019-11-20 18:52   ` Thor Thayer
2019-11-20 19:13     ` Borislav Petkov
2019-11-20 19:28       ` Greg KH

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git