[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 8/8] ARM: make nr_irqs a constant

Hi Andre,

On 01/02/18 13:43, Andre Przywara wrote:
On 30/01/18 14:36, Roger Pau Monné wrote:
On Wed, Jan 24, 2018 at 06:10:58PM +0000, Andre Przywara wrote:
On ARM the maximum number of IRQs is a constant, but we share it being
a variable to match x86. Since we are not supposed to alter it, let's
mark it as "const" to avoid accidental change.

Suggested-by: Julien Grall <julien.grall@xxxxxxxxxx>
Signed-off-by: Andre Przywara <andre.przywara@xxxxxxxxxx>
  xen/arch/arm/irq.c        | 2 +-
  xen/include/asm-arm/irq.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 62103a20e3..d229cb6871 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -27,7 +27,7 @@
  #include <asm/gic.h>
  #include <asm/vgic.h>
-unsigned int __read_mostly nr_irqs = NR_IRQS;
+const unsigned int __read_mostly nr_irqs = NR_IRQS;

Shouldn't you remove the __read_mostly attribute, so the symbol it's
placed at the .rodata section by the compiler?

Yes, makes sense, thanks for pointing this out!
const ... __read_mostly sounds somewhat redundant.

It looks like the compiler does the right thing anyway, as I can't find
nr_irqs in the ELF in any case. Both with and without __read_mostly it
results into the very same binary, actually even without the const.

Really? I was expecting const data to be in the section.rodata. Are you suggesting this is landing in the section .data instead?


Julien Grall

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.