[PATCH] powerpc/mpic: Cleanup irq vector accounting

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE2938d

4 messages, 3 authors, 2018-07-23 · open the first message on its own page

[PATCH] powerpc/mpic: Cleanup irq vector accounting

From: Bharat Bhushan <hidden>
Date: 2018-06-29 10:28:54

Available vector space accounts ipis and timer interrupts
while spurious vector was not accounted. Also later
mpic_setup_error_int() escape one more vector, seemingly it
assumes one spurious vector.

Signed-off-by: Bharat Bhushan <redacted>
---
 arch/powerpc/sysdev/fsl_mpic_err.c | 2 +-
 arch/powerpc/sysdev/mpic.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_mpic_err.c b/arch/powerpc/sysdev/fsl_mpic_err.c
index 488ec45..2a98837 100644
--- a/arch/powerpc/sysdev/fsl_mpic_err.c
+++ b/arch/powerpc/sysdev/fsl_mpic_err.c
@@ -76,7 +76,7 @@ int mpic_setup_error_int(struct mpic *mpic, int intvec)
 	mpic->flags |= MPIC_FSL_HAS_EIMR;
 	/* allocate interrupt vectors for error interrupts */
 	for (i = MPIC_MAX_ERR - 1; i >= 0; i--)
-		mpic->err_int_vecs[i] = --intvec;
+		mpic->err_int_vecs[i] = intvec--;
 
 	return 0;
 }
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 1d4e0ef6..e098d1e 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1380,12 +1380,12 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 		 * global vector number space, as in case of ipis
 		 * and timer interrupts.
 		 *
-		 * Available vector space = intvec_top - 12, where 12
+		 * Available vector space = intvec_top - 13, where 13
 		 * is the number of vectors which have been consumed by
-		 * ipis and timer interrupts.
+		 * ipis, timer interrupts and spurious.
 		 */
 		if (fsl_version >= 0x401) {
-			ret = mpic_setup_error_int(mpic, intvec_top - 12);
+			ret = mpic_setup_error_int(mpic, intvec_top - 13);
 			if (ret)
 				return NULL;
 		}
-- 
1.9.3

Re: [PATCH] powerpc/mpic: Cleanup irq vector accounting

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-07-04 13:27:22

Bharat Bhushan [off-list ref] writes:
Available vector space accounts ipis and timer interrupts
while spurious vector was not accounted.
OK. What is the symptom of that? Nothing? Total system crash?

Looks like this can be tagged:

Fixes: 0a4081641d72 ("powerpc/mpic: FSL MPIC error interrupt support.")

Which added the code that uses "12".
Also later
mpic_setup_error_int() escape one more vector, seemingly it
assumes one spurious vector.
Ah right, I get it now.

So there is no bug. It's just a disagreement about whether the "intvec"
argument to mpic_setup_error_int() indicates the first number that's
free to use or the last number that has been allocated.

Right?

cheers
quoted hunk
Signed-off-by: Bharat Bhushan <redacted>
---
 arch/powerpc/sysdev/fsl_mpic_err.c | 2 +-
 arch/powerpc/sysdev/mpic.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_mpic_err.c b/arch/powerpc/sysdev/fsl_mpic_err.c
index 488ec45..2a98837 100644
--- a/arch/powerpc/sysdev/fsl_mpic_err.c
+++ b/arch/powerpc/sysdev/fsl_mpic_err.c
@@ -76,7 +76,7 @@ int mpic_setup_error_int(struct mpic *mpic, int intvec)
 	mpic->flags |= MPIC_FSL_HAS_EIMR;
 	/* allocate interrupt vectors for error interrupts */
 	for (i = MPIC_MAX_ERR - 1; i >= 0; i--)
-		mpic->err_int_vecs[i] = --intvec;
+		mpic->err_int_vecs[i] = intvec--;
 
 	return 0;
 }
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 1d4e0ef6..e098d1e 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1380,12 +1380,12 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 		 * global vector number space, as in case of ipis
 		 * and timer interrupts.
 		 *
-		 * Available vector space = intvec_top - 12, where 12
+		 * Available vector space = intvec_top - 13, where 13
 		 * is the number of vectors which have been consumed by
-		 * ipis and timer interrupts.
+		 * ipis, timer interrupts and spurious.
 		 */
 		if (fsl_version >= 0x401) {
-			ret = mpic_setup_error_int(mpic, intvec_top - 12);
+			ret = mpic_setup_error_int(mpic, intvec_top - 13);
 			if (ret)
 				return NULL;
 		}
-- 
1.9.3

RE: [PATCH] powerpc/mpic: Cleanup irq vector accounting

From: Bharat Bhushan <hidden>
Date: 2018-07-05 15:42:52

-----Original Message-----
From: Michael Ellerman [mailto:mpe@ellerman.id.au]
Sent: Wednesday, July 4, 2018 6:57 PM
To: Bharat Bhushan <redacted>;
benh@kernel.crashing.org; paulus@samba.org; robh@kernel.org;
geoff@infradead.org; tyreld@linux.vnet.ibm.com; linuxppc-
dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
Cc: Bharat Bhushan <redacted>
Subject: Re: [PATCH] powerpc/mpic: Cleanup irq vector accounting
=20
Bharat Bhushan [off-list ref] writes:
=20
quoted
Available vector space accounts ipis and timer interrupts while
spurious vector was not accounted.
=20
OK. What is the symptom of that? Nothing? Total system crash?
=20
Looks like this can be tagged:
=20
Fixes: 0a4081641d72 ("powerpc/mpic: FSL MPIC error interrupt support.")
=20
Which added the code that uses "12".
=20
quoted
Also later
mpic_setup_error_int() escape one more vector, seemingly it assumes
one spurious vector.
=20
Ah right, I get it now.
=20
So there is no bug. It's just a disagreement about whether the "intvec"
argument to mpic_setup_error_int() indicates the first number that's free=
 to
use or the last number that has been allocated.
=20
Right?
Yes, it is not any bug fix. This is minor cleanup where passing rather than=
 passing "last intvec used" to "intvec to be used" in mpic_setup_error_int(=
).

Thanks
-Bharat
=20
cheers
=20
quoted
Signed-off-by: Bharat Bhushan <redacted>
---
 arch/powerpc/sysdev/fsl_mpic_err.c | 2 +-
 arch/powerpc/sysdev/mpic.c         | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_mpic_err.c
b/arch/powerpc/sysdev/fsl_mpic_err.c
index 488ec45..2a98837 100644
--- a/arch/powerpc/sysdev/fsl_mpic_err.c
+++ b/arch/powerpc/sysdev/fsl_mpic_err.c
@@ -76,7 +76,7 @@ int mpic_setup_error_int(struct mpic *mpic, int
intvec)
quoted
 	mpic->flags |=3D MPIC_FSL_HAS_EIMR;
 	/* allocate interrupt vectors for error interrupts */
 	for (i =3D MPIC_MAX_ERR - 1; i >=3D 0; i--)
-		mpic->err_int_vecs[i] =3D --intvec;
+		mpic->err_int_vecs[i] =3D intvec--;

 	return 0;
 }
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 1d4e0ef6..e098d1e 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1380,12 +1380,12 @@ struct mpic * __init mpic_alloc(struct
device_node *node,
quoted
 		 * global vector number space, as in case of ipis
 		 * and timer interrupts.
 		 *
-		 * Available vector space =3D intvec_top - 12, where 12
+		 * Available vector space =3D intvec_top - 13, where 13
 		 * is the number of vectors which have been consumed by
-		 * ipis and timer interrupts.
+		 * ipis, timer interrupts and spurious.
 		 */
 		if (fsl_version >=3D 0x401) {
-			ret =3D mpic_setup_error_int(mpic, intvec_top - 12);
+			ret =3D mpic_setup_error_int(mpic, intvec_top - 13);
 			if (ret)
 				return NULL;
 		}
--
1.9.3

Re: powerpc/mpic: Cleanup irq vector accounting

From: Michael Ellerman <hidden>
Date: 2018-07-23 15:11:20

On Fri, 2018-06-29 at 10:24:32 UTC, Bharat Bhushan wrote:
Available vector space accounts ipis and timer interrupts
while spurious vector was not accounted. Also later
mpic_setup_error_int() escape one more vector, seemingly it
assumes one spurious vector.

Signed-off-by: Bharat Bhushan <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/fca7bf946e31688edce446fdaa571c

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help