RE: [PATCH v3] irqchip: gicv3-its: Use NUMA aware memory allocation for ITS tables
From: Shameerali Kolothum Thodi
Date: Fri Jan 11 2019 - 05:35:01 EST
Hi Suzuki,
> -----Original Message-----
> From: Suzuki K Poulose [mailto:suzuki.poulose@xxxxxxx]
> Sent: 11 January 2019 09:42
> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@xxxxxxxxxx>;
> marc.zyngier@xxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Cc: shankerd@xxxxxxxxxxxxxx; ganapatrao.kulkarni@xxxxxxxxxx;
> Robert.Richter@xxxxxxxxxx; Guohanjun (Hanjun Guo)
> <guohanjun@xxxxxxxxxx>; John Garry <john.garry@xxxxxxxxxx>;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; Linuxarm <linuxarm@xxxxxxxxxx>
> Subject: Re: [PATCH v3] irqchip: gicv3-its: Use NUMA aware memory allocation
> for ITS tables
>
[...]
> > drivers/irqchip/irq-gic-v3-its.c | 20 ++++++++++++--------
> > 1 file changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> > index db20e99..ab01061 100644
> > --- a/drivers/irqchip/irq-gic-v3-its.c
> > +++ b/drivers/irqchip/irq-gic-v3-its.c
> > @@ -1749,7 +1749,8 @@ static int its_setup_baser(struct its_node *its,
> struct its_baser *baser,
> > order = get_order(GITS_BASER_PAGES_MAX * psz);
> > }
> >
> > - base = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
> > + base = (void *)page_address(alloc_pages_node(its->numa_node,
> > + GFP_KERNEL | __GFP_ZERO, order));
>
> If alloc_pages_node() fails, the page_address() could crash the system.
>
> > - its->cmd_base = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
> > - get_order(ITS_CMD_QUEUE_SZ));
> > + its->cmd_base = (void
> *)page_address(alloc_pages_node(its->numa_node,
> > + GFP_KERNEL | __GFP_ZERO,
> > + get_order(ITS_CMD_QUEUE_SZ)));
>
> Similarly here. We may want to handle it properly.
Ah..good catch. I will change it and rebase on top of 5.0-rc1 as suggested by Marc.
Thanks,
Shameer