Skip to contentSkip to conversation

linux-next: Tree for Sep 1

DISCUSSION Applied Mark Brown 8 participants 29 messages Sep 1, 2014 – Sep 19, 2014

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

Changes since 20140829:

The akpm-current gained a conflict against Linus' tree.

Non-merge commits (relative to Linus' tree): 2553

 2686 files changed, 98625 insertions(+), 79475 deletions(-)

I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git . If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master.

You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with an allmodconfig for x86_64 and a multi_v7_defconfig for arm.

Below is a summary of the state of the merge.

I am currently merging 214 trees (counting Linus' and 30 trees of patches pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of Stephen's local build tests will be at
http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds.

#1 lore raw

Hi,

Quoted 24 lines · Mark Brown

Changes since 20140829:

The akpm-current gained a conflict against Linus' tree.

Non-merge commits (relative to Linus' tree): 2553

 2686 files changed, 98625 insertions(+), 79475 deletions(-)

I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git . If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master.

You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with an allmodconfig for x86_64 and a multi_v7_defconfig for arm.

Below is a summary of the state of the merge.

I am currently merging 214 trees (counting Linus' and 30 trees of patches pending for Linus' tree).

Quoted 7 lines

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of Stephen's local build tests will be at
http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds.

I need following patch to make it boot on ODROID U3 board (ARM Exynos4412 SoC based). next-20140825 was good, next-20140828 is bad (I haven't tried next-20140826 and next-20140827).

Acked-by Kyungmin Park
#2 lore raw
In reply to Mark Brown

[ this time with the patch and right cc: list, sorry for the noise ]

Hi,

Quoted 24 lines · Mark Brown

Changes since 20140829:

The akpm-current gained a conflict against Linus' tree.

Non-merge commits (relative to Linus' tree): 2553

 2686 files changed, 98625 insertions(+), 79475 deletions(-)

I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git . If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master.

You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with an allmodconfig for x86_64 and a multi_v7_defconfig for arm.

Below is a summary of the state of the merge.

I am currently merging 214 trees (counting Linus' and 30 trees of patches pending for Linus' tree).

Quoted 7 lines

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of Stephen's local build tests will be at
http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds.

I need following patch to make it boot on ODROID U3 board (ARM Exynos4412 SoC based). next-20140825 was good, next-20140828 is bad (I haven't tried next-20140826 and next-20140827).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [RFC PATCH] irqchips: gic_get_percpu_base() fix

Commit 532d0d0690d1 ("irqchips: Replace __this_cpu_ptr uses") incorrectly converted *__this_cpu_ptr() to raw_cpu_read() instead of *raw_cpu_ptr(). Fix it.

Fixes following panic on ODROID U3 board (using ARM Exynos4412 SoC):

Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = c0004000
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.17.0-rc2-next-20140828-dirty #837
task: c05ece28 ti: c05e2000 task.ti: c05e2000
PC is at gic_init_bases+0x170/0x380
LR is at gic_init_bases+0x170/0x380
pc : [<c05b12bc>]    lr : [<c05b12bc>]    psr: 600001d3

sp : c05e3f18 ip : 00000004 fp : c05edd7c
r10: c05ea560 r9 : c05ea488 r8 : 00000010
r7 : 00004000 r6 : c05ea93c r5 : c05ea93c r4 : c05ea93c r3 : 2a1a0000 r2 : ffffffff r1 : 00000008 r0 : 00000000
Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: 4000404a DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0xc05e2240)

Stack: (0xc05e3f18 to 0xc05e4000)

3f00: c05e3f88 c040b2bc
3f20: c061c3b8 ffffffff 00000004 c05e3f64 00000000 ea7a3b20 c05c5ff0 00000000 3f40: f8820000 f8810000 c05de880 00200200 c05e3f88 c05b157c 00004000 ea7a3b20 3f60: c061c3b8 00004000 ea0027c0 ea002800 c05e3f80 00000000 00100100 c05b89c8 3f80: ea002800 ea002800 c05e3f88 c05e3f88 413fc090 c05c3f50 ffffffff c0626600 3fa0: c05c3f60 eb7ff780 413fc090 00000000 00000000 c05a2e80 c05c3f50 c059e1c4 3fc0: 00000001 c059ba24 ffffffff ffffffff c059b600 00000000 00000000 c05c3f60 3fe0: c06269d4 c05ea47c c05c3f5c c05edeac 4000406a 40008074 00000000 00000000 [<c05b12bc>] (gic_init_bases) from [<c05b157c>] (gic_of_init+0xb0/0x118) [<c05b157c>] (gic_of_init) from [<c05b89c8>] (of_irq_init+0x164/0x29c) [<c05b89c8>] (of_irq_init) from [<c05a2e80>] (exynos_init_irq+0x8/0x50) [<c05a2e80>] (exynos_init_irq) from [<c059e1c4>] (init_IRQ+0x24/0x74) [<c059e1c4>] (init_IRQ) from [<c059ba24>] (start_kernel+0x200/0x384) [<c059ba24>] (start_kernel) from [<40008074>] (0x40008074)

Code: e59f61d8 e5953594 e1a00006 e12fff33 (e5907004) 
---[ end trace cb88537fdc8fa200 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task!

---
I'm not sure that it is a correct fix but some other *__this_cpu_ptr() usages were not converted to raw_cpu_read() but also to *raw_cpu_ptr() (like arch_local_irqs_enabled() in arch/tile/include/asm/irqflags.h).

 drivers/irqchip/irq-gic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic.c +1 -1
Index: b/drivers/irqchip/irq-gic.c
===================================================================
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return *raw_cpu_ptr(base->percpu_base);
 }
 
 static void __iomem *gic_get_common_base(union gic_base *base)
#3 lore raw
Quoted 3 lines · Bartlomiej Zolnierkiewicz

Commit 532d0d0690d1 ("irqchips: Replace __this_cpu_ptr uses") incorrectly converted *__this_cpu_ptr() to raw_cpu_read() instead of *raw_cpu_ptr(). Fix it.

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

Quoted 15 lines

Index: b/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return *raw_cpu_ptr(base->percpu_base);
 }
 
 static void __iomem *gic_get_common_base(union gic_base *base)
#4 lore raw
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

drivers/irqchip/irq-gic.c +1 -1
Index: linux/drivers/irqchip/irq-gic.c
===================================================================
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);
 }
 
 static void __iomem *gic_get_common_base(union gic_base *base)
#5 lore raw

Hi,

Quoted 5 lines · Christoph Lameter
Quoted 3 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Quoted 8 lines
Quoted 4 lines

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Yes, it fixes the problem. Thank you.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 20 lines

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);
 }
 
 static void __iomem *gic_get_common_base(union gic_base *base)
#6 lore raw
In reply to Christoph Lameter
Quoted 12 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 5 lines
drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Thanks.

Signature · 1 line
tejun
#7 lore raw

Tejun, Christoph,

Quoted 8 lines · Tejun Heo
Quoted 7 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Could Thomas and I get a pointer to the original patch and thread that caused the error?

thx,

Jason.

#8 lore raw
Quoted 25 lines · Jason Cooper

Tejun, Christoph,

Quoted 8 lines · Tejun Heo
Quoted 7 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Quoted 2 lines

Could Thomas and I get a pointer to the original patch and thread that caused the error?

http://thread.gmane.org/gmane.linux.kernel/1769201/focus=1769204
http://thread.gmane.org/gmane.linux.kernel.next/32601/focus=32606

Thanks.

Signature · 1 line
tejun
#9 lore raw
In reply to Tejun Heo
Quoted 2 lines · Tejun Heo

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Russell and Nicolas were cced. This is arm specific.

#10 lore raw
Quoted 6 lines · Christoph Lameter
Quoted 2 lines · Tejun Heo

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Russell and Nicolas were cced. This is arm specific.

Sorry, but I don't have much to do with ARM IRQ stuff anymore - everything that gets moved out of arch/arm has responsibility automatically transferred to someone else without any referral to me.

Hence, it's up to the genirq/irqchip maintainers now.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
#11 lore raw
In reply to Tejun Heo
Quoted 8 lines · Tejun Heo
Quoted 7 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Christoph, please drive this forward.

Thanks.

Signature · 1 line
tejun
#12 lore raw
Quoted 23 lines · Tejun Heo
Quoted 8 lines · Tejun Heo
Quoted 7 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Quoted 1 line

Christoph, please drive this forward.

CCing IRQ subsystem and IRQCHIP drivers maintainers.

#13 lore raw

Christoph,

Quoted 24 lines · Christoph Lameter
Quoted 23 lines · Tejun Heo
Quoted 21 lines · Tejun Heo
Quoted 12 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 5 lines
drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Quoted 3 lines
Quoted 1 line

Christoph, please drive this forward.

CCing IRQ subsystem and IRQCHIP drivers maintainers.

Thanks Chris. I'm a bit behind on irqchip stuff, so I may have missed something here... Did we get Cc'd on the original patch that caused the regression? I'm fairly certain I haven't seen it to Ack it.

It wouldn't be an issue worth mentioning if it were a vendor-specific driver, however, the gic is used by damn near every major ARM SoC. Tejun (I think) was kind enough to post the links to the email thread for the original patch, so I'll try to get to this soon-ish.

thx,

Jason.

#14 lore raw
Quoted 29 lines · Jason Cooper

Christoph,

Quoted 26 lines · Christoph Lameter
Quoted 24 lines · Tejun Heo
Quoted 8 lines · Tejun Heo
Quoted 7 lines · Christoph Lameter

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

I suppose this should go through percpu/for-3.18-consistent-ops? Can we please cc irq folks and get acks?

Christoph, please drive this forward.

Quoted 8 lines
Quoted 1 line

CCing IRQ subsystem and IRQCHIP drivers maintainers.

Thanks Chris. I'm a bit behind on irqchip stuff, so I may have missed something here... Did we get Cc'd on the original patch that caused the regression? I'm fairly certain I haven't seen it to Ack it.

It wouldn't be an issue worth mentioning if it were a vendor-specific driver, however, the gic is used by damn near every major ARM SoC.

In fact the problematic code lives in a code path that very few platform use i.e. CONFIG_GIC_NON_BANKED set by CONFIG_ARCH_EXYNOS4.

And I did ask for a clarification on the proposed fix which produced no answer so far.

Nicolas

#15 lore raw
Quoted 2 lines · Nicolas Pitre

And I did ask for a clarification on the proposed fix which produced no answer so far.

What clarification is needed?

#16 lore raw
In reply to Jason Cooper
Quoted 4 lines · Jason Cooper

Thanks Chris. I'm a bit behind on irqchip stuff, so I may have missed something here... Did we get Cc'd on the original patch that caused the regression? I'm fairly certain I haven't seen it to Ack it.

This is a trivial fix to the original patch in linux-next that introduced a bug by dropping one level of indirection.

#17 lore raw
In reply to Christoph Lameter
Quoted 27 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 5 lines
drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

Nicolas

#18 lore raw
Quoted 5 lines · Nicolas Pitre

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 2 lines
drivers/irqchip/irq-gic.c +1 -1
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

It looks like percpu_base is a regular pointer to an offset. This is the correct way to refer to get the offset and load the value that the offset points to.

#19 lore raw
In reply to Nicolas Pitre
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

I think this is correct.

Let's start from the depths of raw_cpu_read(), where the pointer is verified to be the correct type:

#define __verify_pcpu_ptr(ptr)                                          \
do {                                                                    \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
        (void)__vpp_verify;                                             \

} while (0)

So, "ptr" should be of type "const void __percpu *" (note the __percpu annotation there, which makes it sparse-checkable.)

The next level up is this:

#define __pcpu_size_call_return(stem, variable)                         \
({                                                                      \
        typeof(variable) pscr_ret__;                                    \
        __verify_pcpu_ptr(&(variable));                                 \

So, we pass the address of the variable to the verification function. That makes it a void-typed variable - "const void __percpu".

#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)

So this also makes "pcp" a "const void __percpu".

Now, what type is base->percpu_base?

        void __percpu * __iomem *percpu_base;

The thing we want to be per-cpu is a "void __iomem *" pointer. However, we have a pointer to the per-cpu instance. That's the "void __percpu *" bit.

So, for this to match the requirements for raw_cpu_read(), we need to do one dereference to end up with "void __percpu".

Hence, to me, the patch looks correct.

Whether it works or not is a /completely/ different matter. As has been pointed out, the only place this code gets used is on a very small number of platforms, which I don't have, and that gives me zero way to test it. If it's Exynos which is affected by this, we need to call on Samsung to test this patch.

Now, this code was introduced by Marc Zyngier in order to support Exynos, probably the result of another patch on the mailing list from Samsung. (I've added Marc and another Samsung guy to the Cc list.) Whatever, *someone* needs to verify this but it needs to be done with the affected hardware. Whether Marc can, or whether it has to be someone from Samsung, I don't care which.

/Or/ we deem the code unmaintained, broken, and untestable, and we start considering ripping it out of the mainline kernel on the basis that no one cares about it anymore.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
Acked-by
#20 lore raw
Quoted 71 lines · Russell King - ARM Linux
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

I think this is correct.

Let's start from the depths of raw_cpu_read(), where the pointer is verified to be the correct type:

#define __verify_pcpu_ptr(ptr)                                          \
do {                                                                    \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
        (void)__vpp_verify;                                             \

} while (0)

So, "ptr" should be of type "const void __percpu *" (note the __percpu annotation there, which makes it sparse-checkable.)

The next level up is this:

#define __pcpu_size_call_return(stem, variable)                         \
({                                                                      \
        typeof(variable) pscr_ret__;                                    \
        __verify_pcpu_ptr(&(variable));                                 \

So, we pass the address of the variable to the verification function. That makes it a void-typed variable - "const void __percpu".

#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)

So this also makes "pcp" a "const void __percpu".

Now, what type is base->percpu_base?

        void __percpu * __iomem *percpu_base;
Quoted 8 lines

The thing we want to be per-cpu is a "void __iomem *" pointer. However, we have a pointer to the per-cpu instance. That's the "void __percpu *" bit.

So, for this to match the requirements for raw_cpu_read(), we need to do one dereference to end up with "void __percpu".

Hence, to me, the patch looks correct.

Good, I now agree. If needed:

Quoted 5 lines

Whether it works or not is a /completely/ different matter. As has been pointed out, the only place this code gets used is on a very small number of platforms, which I don't have, and that gives me zero way to test it. If it's Exynos which is affected by this, we need to call on Samsung to test this patch.

AFAICS it was tested already and confirmed working.

Quoted 10 lines

Now, this code was introduced by Marc Zyngier in order to support Exynos, probably the result of another patch on the mailing list from Samsung. (I've added Marc and another Samsung guy to the Cc list.) Whatever, *someone* needs to verify this but it needs to be done with the affected hardware. Whether Marc can, or whether it has to be someone from Samsung, I don't care which.

/Or/ we deem the code unmaintained, broken, and untestable, and we start considering ripping it out of the mainline kernel on the basis that no one cares about it anymore.

The problem was reported by someone who tested linux-next on the affected platform, so it must still be used.

Nicolas

#21 lore raw

Hi,

Quoted 86 lines · Nicolas Pitre
Quoted 71 lines · Russell King - ARM Linux
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

I think this is correct.

Let's start from the depths of raw_cpu_read(), where the pointer is verified to be the correct type:

#define __verify_pcpu_ptr(ptr)                                          \
do {                                                                    \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
        (void)__vpp_verify;                                             \

} while (0)

So, "ptr" should be of type "const void __percpu *" (note the __percpu annotation there, which makes it sparse-checkable.)

The next level up is this:

#define __pcpu_size_call_return(stem, variable)                         \
({                                                                      \
        typeof(variable) pscr_ret__;                                    \
        __verify_pcpu_ptr(&(variable));                                 \

So, we pass the address of the variable to the verification function. That makes it a void-typed variable - "const void __percpu".

#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)

So this also makes "pcp" a "const void __percpu".

Now, what type is base->percpu_base?

        void __percpu * __iomem *percpu_base;
Quoted 8 lines

The thing we want to be per-cpu is a "void __iomem *" pointer. However, we have a pointer to the per-cpu instance. That's the "void __percpu *" bit.

So, for this to match the requirements for raw_cpu_read(), we need to do one dereference to end up with "void __percpu".

Hence, to me, the patch looks correct.

Good, I now agree. If needed:

Quoted 7 lines
Quoted 5 lines

Whether it works or not is a /completely/ different matter. As has been pointed out, the only place this code gets used is on a very small number of platforms, which I don't have, and that gives me zero way to test it. If it's Exynos which is affected by this, we need to call on Samsung to test this patch.

AFAICS it was tested already and confirmed working.

Yes, it was tested on ODROID U3 board (ARM Exynos4412 SoC based):

https://lkml.org/lkml/2014/9/3/552

FWIW:

Quoted 7 lines
Quoted 7 lines

Now, this code was introduced by Marc Zyngier in order to support Exynos, probably the result of another patch on the mailing list from Samsung. (I've added Marc and another Samsung guy to the Cc list.) Whatever, *someone* needs to verify this but it needs to be done with the affected hardware. Whether Marc can, or whether it has to be someone from Samsung, I don't care which.

Quoted 6 lines
Quoted 3 lines

/Or/ we deem the code unmaintained, broken, and untestable, and we start considering ripping it out of the mainline kernel on the basis that no one cares about it anymore.

The problem was reported by someone who tested linux-next on the affected platform, so it must still be used.

Yes, the issue was reported by me originally together with a proposed fix (different than the final one done by Christoph):

https://lkml.org/lkml/2014/9/2/261

FWIW:

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#22 lore raw
In reply to Russell King - ARM Linux

Hi Russell,

Quoted 86 lines · Russell King - ARM Linux
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

I think this is correct.

Let's start from the depths of raw_cpu_read(), where the pointer is verified to be the correct type:

#define __verify_pcpu_ptr(ptr)                                          \
do {                                                                    \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
        (void)__vpp_verify;                                             \

} while (0)

So, "ptr" should be of type "const void __percpu *" (note the __percpu annotation there, which makes it sparse-checkable.)

The next level up is this:

#define __pcpu_size_call_return(stem, variable)                         \
({                                                                      \
        typeof(variable) pscr_ret__;                                    \
        __verify_pcpu_ptr(&(variable));                                 \

So, we pass the address of the variable to the verification function. That makes it a void-typed variable - "const void __percpu".

#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)

So this also makes "pcp" a "const void __percpu".

Now, what type is base->percpu_base?

        void __percpu * __iomem *percpu_base;

The thing we want to be per-cpu is a "void __iomem *" pointer. However, we have a pointer to the per-cpu instance. That's the "void __percpu *" bit.

So, for this to match the requirements for raw_cpu_read(), we need to do one dereference to end up with "void __percpu".

Hence, to me, the patch looks correct.

Whether it works or not is a /completely/ different matter. As has been pointed out, the only place this code gets used is on a very small number of platforms, which I don't have, and that gives me zero way to test it. If it's Exynos which is affected by this, we need to call on Samsung to test this patch.

Quoted 6 lines

Now, this code was introduced by Marc Zyngier in order to support Exynos, probably the result of another patch on the mailing list from Samsung. (I've added Marc and another Samsung guy to the Cc list.) Whatever, *someone* needs to verify this but it needs to be done with the affected hardware. Whether Marc can, or whether it has to be someone from Samsung, I don't care which.

Thanks for looping me in. I indeed introduced this as an alternative to an utterly broken patch that was submitted at the time.

As far as I can tell, and by reading your analysis, this patch looks perfectly sensible.

Now, I have long given up on trying to run *anything* on a Samsung platform other than my Chromebook - the various maintainers don't seem to care at all. I may be able to revive an Origen board though (I think I have one collecting the proverbial dust in a cupboard), assuming I can locate a bootloader for it.

Quoted 3 lines

/Or/ we deem the code unmaintained, broken, and untestable, and we start considering ripping it out of the mainline kernel on the basis that no one cares about it anymore.

That's an alternative. I personally wouldn't shed a tear.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#23 lore raw

Hi,

Quoted 99 lines · Marc Zyngier

Hi Russell,

Quoted 86 lines · Russell King - ARM Linux
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

I think this is correct.

Let's start from the depths of raw_cpu_read(), where the pointer is verified to be the correct type:

#define __verify_pcpu_ptr(ptr)                                          \
do {                                                                    \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
        (void)__vpp_verify;                                             \

} while (0)

So, "ptr" should be of type "const void __percpu *" (note the __percpu annotation there, which makes it sparse-checkable.)

The next level up is this:

#define __pcpu_size_call_return(stem, variable)                         \
({                                                                      \
        typeof(variable) pscr_ret__;                                    \
        __verify_pcpu_ptr(&(variable));                                 \

So, we pass the address of the variable to the verification function. That makes it a void-typed variable - "const void __percpu".

#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)

So this also makes "pcp" a "const void __percpu".

Now, what type is base->percpu_base?

        void __percpu * __iomem *percpu_base;

The thing we want to be per-cpu is a "void __iomem *" pointer. However, we have a pointer to the per-cpu instance. That's the "void __percpu *" bit.

So, for this to match the requirements for raw_cpu_read(), we need to do one dereference to end up with "void __percpu".

Hence, to me, the patch looks correct.

Whether it works or not is a /completely/ different matter. As has been pointed out, the only place this code gets used is on a very small number of platforms, which I don't have, and that gives me zero way to test it. If it's Exynos which is affected by this, we need to call on Samsung to test this patch.

Quoted 6 lines

Now, this code was introduced by Marc Zyngier in order to support Exynos, probably the result of another patch on the mailing list from Samsung. (I've added Marc and another Samsung guy to the Cc list.) Whatever, *someone* needs to verify this but it needs to be done with the affected hardware. Whether Marc can, or whether it has to be someone from Samsung, I don't care which.

Thanks for looping me in. I indeed introduced this as an alternative to an utterly broken patch that was submitted at the time.

Quoted 8 lines

As far as I can tell, and by reading your analysis, this patch looks perfectly sensible.

Now, I have long given up on trying to run *anything* on a Samsung platform other than my Chromebook - the various maintainers don't seem to care at all. I may be able to revive an Origen board though (I think I have one collecting the proverbial dust in a cupboard), assuming I can locate a bootloader for it.

Well, I'm not a maintainer but I try keep linux-next working on at least:

Origen (Exynos4210)
Origen Quad (Exynos4412)
ODROID U3 (Exynos4412)
Trats2 (Exynos4412)
Arndale (Exynos5250)

If you have problems booting linux-next on any of the above boards please let me know.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

#24 lore raw

Hi Bartlomiej,

Quoted 114 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 99 lines · Marc Zyngier

Hi Russell,

Quoted 86 lines · Russell King - ARM Linux
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 13 lines

drivers/irqchip/irq-gic.c static struct gic_chip_data gic_data[MAX · line 105

Quoted 10 lines

Index: linux/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -1
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);

Isn't the pointer dereference supposed to be performed _outside_ the per CPU accessor?

I think this is correct.

Let's start from the depths of raw_cpu_read(), where the pointer is verified to be the correct type:

#define __verify_pcpu_ptr(ptr)                                          \
do {                                                                    \
        const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
        (void)__vpp_verify;                                             \

} while (0)

So, "ptr" should be of type "const void __percpu *" (note the __percpu annotation there, which makes it sparse-checkable.)

The next level up is this:

#define __pcpu_size_call_return(stem, variable)                         \
({                                                                      \
        typeof(variable) pscr_ret__;                                    \
        __verify_pcpu_ptr(&(variable));                                 \

So, we pass the address of the variable to the verification function. That makes it a void-typed variable - "const void __percpu".

#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)

So this also makes "pcp" a "const void __percpu".

Now, what type is base->percpu_base?

        void __percpu * __iomem *percpu_base;

The thing we want to be per-cpu is a "void __iomem *" pointer. However, we have a pointer to the per-cpu instance. That's the "void __percpu *" bit.

So, for this to match the requirements for raw_cpu_read(), we need to do one dereference to end up with "void __percpu".

Hence, to me, the patch looks correct.

Whether it works or not is a /completely/ different matter. As has been pointed out, the only place this code gets used is on a very small number of platforms, which I don't have, and that gives me zero way to test it. If it's Exynos which is affected by this, we need to call on Samsung to test this patch.

Quoted 6 lines

Now, this code was introduced by Marc Zyngier in order to support Exynos, probably the result of another patch on the mailing list from Samsung. (I've added Marc and another Samsung guy to the Cc list.) Whatever, *someone* needs to verify this but it needs to be done with the affected hardware. Whether Marc can, or whether it has to be someone from Samsung, I don't care which.

Thanks for looping me in. I indeed introduced this as an alternative to an utterly broken patch that was submitted at the time.

Quoted 8 lines

As far as I can tell, and by reading your analysis, this patch looks perfectly sensible.

Now, I have long given up on trying to run *anything* on a Samsung platform other than my Chromebook - the various maintainers don't seem to care at all. I may be able to revive an Origen board though (I think I have one collecting the proverbial dust in a cupboard), assuming I can locate a bootloader for it.

Well, I'm not a maintainer but I try keep linux-next working on at least:

Quoted 8 lines

Origen (Exynos4210)
Origen Quad (Exynos4412)
ODROID U3 (Exynos4412)
Trats2 (Exynos4412)
Arndale (Exynos5250)

If you have problems booting linux-next on any of the above boards please let me know.

My first problem is getting mainline u-boot to work on the Origen (the 4210 flavour). I compiled "something", but how you get that to run is a mystery. If I can get that to work, then I'll try to move on to the kernel...

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Acked-by
#25 lore raw
In reply to Christoph Lameter

Christoph,

Quoted 15 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Quoted 6 lines

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

thx,

Jason.

Acked-by Jason Cooper
#26 lore raw

Tejun,

Could you please merge Christoph's patch to your percpu tree (the patch is attached below for your convenience, it is a fixup for "irqchips: Replace __this_cpu_ptr uses" patch present in for-3.18-consistent-ops and for-next branches)?

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 23 lines · Jason Cooper

Christoph,

Quoted 20 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Quoted 7 lines
Quoted 1 line

thx,

Jason.

From: Christoph Lameter <[email protected]>
Subject: [PATCH] irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

b.zolnierkie:
This fixes kernel panic on ARM Exynos4 SoCs (i.e. ODROID U3 board).

---

drivers/irqchip/irq-gic.c +1 -1
Index: linux/drivers/irqchip/irq-gic.c
===================================================================
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return raw_cpu_read(*base->percpu_base);
 }
 
 static void __iomem *gic_get_common_base(union gic_base *base)
Applied
#27 lore raw
In reply to Christoph Lameter
Quoted 15 lines · Christoph Lameter
Quoted 7 lines · Christoph Lameter

Oww.. This is double indirection deal there. A percpu offset pointing to a pointer?

Generally the following is true (definition from include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):

#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))

I think what the issue is that we dropped the fetch of the percpu offset in the patch. Instead we are using the address of the variable that contains the offset. Does this patch fix it?

Quoted 6 lines

Subject: irqchip: Properly fetch the per cpu offset

The raw_cpu_read() conversion dropped the fetch of the offset from base->percpu_base in gic_get_percpu_base.

Applied to percpu/for-3.18-consistent-ops.

Thanks.

Signature · 1 line
tejun
#28 lore raw
In reply to Bartlomiej Zolnierkiewicz

Christopher,

Quoted 49 lines · Bartlomiej Zolnierkiewicz

[ this time with the patch and right cc: list, sorry for the noise ]

Hi,

Quoted 24 lines · Mark Brown

Changes since 20140829:

The akpm-current gained a conflict against Linus' tree.

Non-merge commits (relative to Linus' tree): 2553

 2686 files changed, 98625 insertions(+), 79475 deletions(-)

I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git . If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master.

You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with an allmodconfig for x86_64 and a multi_v7_defconfig for arm.

Below is a summary of the state of the merge.

I am currently merging 214 trees (counting Linus' and 30 trees of patches pending for Linus' tree).

Quoted 7 lines

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of Stephen's local build tests will be at
http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds.

I need following patch to make it boot on ODROID U3 board (ARM Exynos4412 SoC based). next-20140825 was good, next-20140828 is bad (I haven't tried next-20140826 and next-20140827).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 6 lines

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [RFC PATCH] irqchips: gic_get_percpu_base() fix

Commit 532d0d0690d1 ("irqchips: Replace __this_cpu_ptr uses") incorrectly converted *__this_cpu_ptr() to raw_cpu_read() instead of *raw_cpu_ptr(). Fix it.

Why were Thomas and I not Cc'd on a patch affecting irq-gic.c?

thx,

Jason.

Quoted 74 lines

Fixes following panic on ODROID U3 board (using ARM Exynos4412 SoC):

Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = c0004000
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.17.0-rc2-next-20140828-dirty #837
task: c05ece28 ti: c05e2000 task.ti: c05e2000
PC is at gic_init_bases+0x170/0x380
LR is at gic_init_bases+0x170/0x380
pc : [<c05b12bc>]    lr : [<c05b12bc>]    psr: 600001d3

sp : c05e3f18 ip : 00000004 fp : c05edd7c
r10: c05ea560 r9 : c05ea488 r8 : 00000010
r7 : 00004000 r6 : c05ea93c r5 : c05ea93c r4 : c05ea93c r3 : 2a1a0000 r2 : ffffffff r1 : 00000008 r0 : 00000000
Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: 4000404a DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0xc05e2240)

Stack: (0xc05e3f18 to 0xc05e4000)

3f00: c05e3f88 c040b2bc
3f20: c061c3b8 ffffffff 00000004 c05e3f64 00000000 ea7a3b20 c05c5ff0 00000000 3f40: f8820000 f8810000 c05de880 00200200 c05e3f88 c05b157c 00004000 ea7a3b20 3f60: c061c3b8 00004000 ea0027c0 ea002800 c05e3f80 00000000 00100100 c05b89c8 3f80: ea002800 ea002800 c05e3f88 c05e3f88 413fc090 c05c3f50 ffffffff c0626600 3fa0: c05c3f60 eb7ff780 413fc090 00000000 00000000 c05a2e80 c05c3f50 c059e1c4 3fc0: 00000001 c059ba24 ffffffff ffffffff c059b600 00000000 00000000 c05c3f60 3fe0: c06269d4 c05ea47c c05c3f5c c05edeac 4000406a 40008074 00000000 00000000 [<c05b12bc>] (gic_init_bases) from [<c05b157c>] (gic_of_init+0xb0/0x118) [<c05b157c>] (gic_of_init) from [<c05b89c8>] (of_irq_init+0x164/0x29c) [<c05b89c8>] (of_irq_init) from [<c05a2e80>] (exynos_init_irq+0x8/0x50) [<c05a2e80>] (exynos_init_irq) from [<c059e1c4>] (init_IRQ+0x24/0x74) [<c059e1c4>] (init_IRQ) from [<c059ba24>] (start_kernel+0x200/0x384) [<c059ba24>] (start_kernel) from [<40008074>] (0x40008074)

Code: e59f61d8 e5953594 e1a00006 e12fff33 (e5907004) 
---[ end trace cb88537fdc8fa200 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task!

---
I'm not sure that it is a correct fix but some other *__this_cpu_ptr() usages were not converted to raw_cpu_read() but also to *raw_cpu_ptr() (like arch_local_irqs_enabled() in arch/tile/include/asm/irqflags.h).

 drivers/irqchip/irq-gic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/irqchip/irq-gic.c
===================================================================

drivers/irqchip/irq-gic.c +1 -2
@@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
 #ifdef CONFIG_GIC_NON_BANKED
 static void __iomem *gic_get_percpu_base(union gic_base *base)
 {
-	return raw_cpu_read(base->percpu_base);
+	return *raw_cpu_ptr(base->percpu_base);
 }
 
 static void __iomem *gic_get_common_base(union gic_base *base)
 
 
--

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