linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: Select SPARSEMEM_EXTREME for CAVIUM_OCTEON_SOC
       [not found] <20220906095943.60296-1-alexander.sverdlin@nokia.com>
@ 2022-09-06  9:59 ` Alexander A Sverdlin
  2022-09-08 21:32   ` Thomas Bogendoerfer
  2022-09-06  9:59 ` [PATCH] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() Alexander A Sverdlin
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander A Sverdlin @ 2022-09-06  9:59 UTC (permalink / raw)
  To: linux-mips; +Cc: Alexander Sverdlin, Thomas Bogendoerfer, linux-kernel

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

Commit c46173183657 ("MIPS: Add NUMA support for Loongson-3") has increased
.bss size of the Octeon kernel from 16k to 16M. Providing the conditions
for SPARSEMEM_EXTREME avoids the waste of memory.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 arch/mips/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ec21f89..79cfa1c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2669,7 +2669,7 @@ config ARCH_FLATMEM_ENABLE
 
 config ARCH_SPARSEMEM_ENABLE
 	bool
-	select SPARSEMEM_STATIC if !SGI_IP27
+	select SPARSEMEM_STATIC if MACH_LOONGSON64
 
 config NUMA
 	bool "NUMA Support"
-- 
2.10.2


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

* [PATCH] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping()
       [not found] <20220906095943.60296-1-alexander.sverdlin@nokia.com>
  2022-09-06  9:59 ` [PATCH] mips: Select SPARSEMEM_EXTREME for CAVIUM_OCTEON_SOC Alexander A Sverdlin
@ 2022-09-06  9:59 ` Alexander A Sverdlin
  2022-09-07 13:08   ` Thomas Bogendoerfer
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander A Sverdlin @ 2022-09-06  9:59 UTC (permalink / raw)
  To: linux-mips; +Cc: Alexander Sverdlin, Thomas Bogendoerfer, linux-kernel

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

For irq_domain_associate() to work the virq descriptor has to be
pre-allocated in advance. Otherwise the following happens:

WARNING: CPU: 0 PID: 0 at .../kernel/irq/irqdomain.c:527 irq_domain_associate+0x298/0x2e8
error: virq128 is not allocated
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.78-... #1
        ...
Call Trace:
[<ffffffff801344c4>] show_stack+0x9c/0x130
[<ffffffff80769550>] dump_stack+0x90/0xd0
[<ffffffff801576d0>] __warn+0x118/0x130
[<ffffffff80157734>] warn_slowpath_fmt+0x4c/0x70
[<ffffffff801b83c0>] irq_domain_associate+0x298/0x2e8
[<ffffffff80a43bb8>] octeon_irq_init_ciu+0x4c8/0x53c
[<ffffffff80a76cbc>] of_irq_init+0x1e0/0x388
[<ffffffff80a452cc>] init_IRQ+0x4c/0xf4
[<ffffffff80a3cc00>] start_kernel+0x404/0x698

Use irq_alloc_desc_at() to avoid the above problem.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 arch/mips/cavium-octeon/octeon-irq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 9cb9ed4..fd8043f 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -127,6 +127,16 @@ static void octeon_irq_free_cd(struct irq_domain *d, unsigned int irq)
 static int octeon_irq_force_ciu_mapping(struct irq_domain *domain,
 					int irq, int line, int bit)
 {
+	struct device_node *of_node;
+	int ret;
+
+	of_node = irq_domain_get_of_node(domain);
+	if (!of_node)
+		return -EINVAL;
+	ret = irq_alloc_desc_at(irq, of_node_to_nid(of_node));
+	if (ret < 0)
+		return ret;
+
 	return irq_domain_associate(domain, irq, line << 6 | bit);
 }
 
-- 
2.10.2


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

* Re: [PATCH] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping()
  2022-09-06  9:59 ` [PATCH] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() Alexander A Sverdlin
@ 2022-09-07 13:08   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2022-09-07 13:08 UTC (permalink / raw)
  To: Alexander A Sverdlin; +Cc: linux-mips, linux-kernel

On Tue, Sep 06, 2022 at 11:59:43AM +0200, Alexander A Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> For irq_domain_associate() to work the virq descriptor has to be
> pre-allocated in advance. Otherwise the following happens:
> 
> WARNING: CPU: 0 PID: 0 at .../kernel/irq/irqdomain.c:527 irq_domain_associate+0x298/0x2e8
> error: virq128 is not allocated
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.78-... #1
>         ...
> Call Trace:
> [<ffffffff801344c4>] show_stack+0x9c/0x130
> [<ffffffff80769550>] dump_stack+0x90/0xd0
> [<ffffffff801576d0>] __warn+0x118/0x130
> [<ffffffff80157734>] warn_slowpath_fmt+0x4c/0x70
> [<ffffffff801b83c0>] irq_domain_associate+0x298/0x2e8
> [<ffffffff80a43bb8>] octeon_irq_init_ciu+0x4c8/0x53c
> [<ffffffff80a76cbc>] of_irq_init+0x1e0/0x388
> [<ffffffff80a452cc>] init_IRQ+0x4c/0xf4
> [<ffffffff80a3cc00>] start_kernel+0x404/0x698
> 
> Use irq_alloc_desc_at() to avoid the above problem.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
>  arch/mips/cavium-octeon/octeon-irq.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

applied to mips-fixes.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH] mips: Select SPARSEMEM_EXTREME for CAVIUM_OCTEON_SOC
  2022-09-06  9:59 ` [PATCH] mips: Select SPARSEMEM_EXTREME for CAVIUM_OCTEON_SOC Alexander A Sverdlin
@ 2022-09-08 21:32   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2022-09-08 21:32 UTC (permalink / raw)
  To: Alexander A Sverdlin; +Cc: linux-mips, linux-kernel

On Tue, Sep 06, 2022 at 11:59:42AM +0200, Alexander A Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> Commit c46173183657 ("MIPS: Add NUMA support for Loongson-3") has increased
> .bss size of the Octeon kernel from 16k to 16M. Providing the conditions
> for SPARSEMEM_EXTREME avoids the waste of memory.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
>  arch/mips/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index ec21f89..79cfa1c 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2669,7 +2669,7 @@ config ARCH_FLATMEM_ENABLE
>  
>  config ARCH_SPARSEMEM_ENABLE
>  	bool
> -	select SPARSEMEM_STATIC if !SGI_IP27
> +	select SPARSEMEM_STATIC if MACH_LOONGSON64

removing the statement completely gives

      text       data        bss      total filename
  11874896    6019382   17304160   35198438 vmlinux-sparsemem_static
  11935172    6019702     526944   18481818 vmlinux

for a loogsoon64 kernel. And the kernel boots and works just fine.
Can you respin your patch and remove the select SPARSEMEM_STATIC ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2022-09-08 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220906095943.60296-1-alexander.sverdlin@nokia.com>
2022-09-06  9:59 ` [PATCH] mips: Select SPARSEMEM_EXTREME for CAVIUM_OCTEON_SOC Alexander A Sverdlin
2022-09-08 21:32   ` Thomas Bogendoerfer
2022-09-06  9:59 ` [PATCH] MIPS: OCTEON: irq: Fix octeon_irq_force_ciu_mapping() Alexander A Sverdlin
2022-09-07 13:08   ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).