From: Mike Rapoport <rppt@linux.ibm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-kernel@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v14 02/12] powerpc/irq: use memblock functions returning virtual address
Date: Thu, 24 Jan 2019 19:25:53 +0200 [thread overview]
Message-ID: <20190124172553.GE13790@rapoport-lnx> (raw)
In-Reply-To: <20190124165153.GB5531@lakrids.cambridge.arm.com>
On Thu, Jan 24, 2019 at 04:51:53PM +0000, Mark Rutland wrote:
> On Thu, Jan 24, 2019 at 04:19:33PM +0000, Christophe Leroy wrote:
> > Since only the virtual address of allocated blocks is used,
> > lets use functions returning directly virtual address.
> >
> > Those functions have the advantage of also zeroing the block.
> >
> > Suggested-by: Mike Rapoport <rppt@linux.ibm.com>
> > Acked-by: Mike Rapoport <rppt@linux.ibm.com>
> > Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>
> [...]
>
> > +static void *__init alloc_stack(void)
> > +{
> > + void *ptr = memblock_alloc(THREAD_SIZE, THREAD_SIZE);
> > +
> > + if (!ptr)
> > + panic("cannot allocate stacks");
> > +
> > + return ptr;
> > +}
>
> I believe memblock_alloc() will panic() if it cannot allocate memory,
> since that goes:
>
> memblock_alloc()
> -> memblock_alloc_try_nid()
> -> panic()
>
> So you can get rid of the panic() here, or if you want a custom panic
> message, you can use memblock_alloc_nopanic().
As we've already discussed it in [1], I'm working on removing the
_nopanic() versions and dropping the panic() calls from memblock_alloc()
and friends.
I've posted v2 of the patches earlier this week [2].
> [...]
[1] https://lore.kernel.org/lkml/20190108143428.GB14063@rapoport-lnx/
[2] https://lore.kernel.org/lkml/1548057848-15136-1-git-send-email-rppt@linux.ibm.com/
> > static void *__init alloc_stack(unsigned long limit, int cpu)
> > {
> > - unsigned long pa;
> > + void *ptr;
> >
> > BUILD_BUG_ON(STACK_INT_FRAME_SIZE % 16);
> >
> > - pa = memblock_alloc_base_nid(THREAD_SIZE, THREAD_SIZE, limit,
> > - early_cpu_to_node(cpu), MEMBLOCK_NONE);
> > - if (!pa) {
> > - pa = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
> > - if (!pa)
> > - panic("cannot allocate stacks");
> > - }
> > + ptr = memblock_alloc_try_nid(THREAD_SIZE, THREAD_SIZE,
> > + MEMBLOCK_LOW_LIMIT, limit,
> > + early_cpu_to_node(cpu));
> > + if (!ptr)
> > + panic("cannot allocate stacks");
>
> The same applies here -- memblock_alloc_try_nid() will panic itself
> rather than returning NULL.
>
> Otherwise, this looks like a nice cleanup. With the panics removed (or
> using the _nopanic() allocators), feel free to add:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
>
> Thanks,
> Mark.
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2019-01-24 17:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 16:19 [PATCH v14 00/12] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 01/12] powerpc/32: Fix CONFIG_VIRT_CPU_ACCOUNTING_NATIVE for 40x/booke Christophe Leroy
2019-01-30 8:08 ` Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 02/12] powerpc/irq: use memblock functions returning virtual address Christophe Leroy
2019-01-24 16:51 ` Mark Rutland
2019-01-24 17:25 ` Mike Rapoport [this message]
2019-01-24 17:28 ` Mark Rutland
2019-01-24 16:19 ` [PATCH v14 03/12] book3s/64: avoid circular header inclusion in mmu-hash.h Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 04/12] powerpc: Only use task_struct 'cpu' field on SMP Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 05/12] powerpc: prep stack walkers for THREAD_INFO_IN_TASK Christophe Leroy
2019-01-24 17:04 ` Mark Rutland
2019-01-24 16:19 ` [PATCH v14 06/12] powerpc: Prepare for moving thread_info into task_struct Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 07/12] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK Christophe Leroy
2019-01-24 17:18 ` Mark Rutland
2019-01-24 16:19 ` [PATCH v14 08/12] powerpc: regain entire stack space Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 09/12] powerpc: 'current_set' is now a table of task_struct pointers Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 10/12] powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 11/12] powerpc/64: Remove CURRENT_THREAD_INFO Christophe Leroy
2019-01-24 16:19 ` [PATCH v14 12/12] powerpc: clean stack pointers naming Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190124172553.GE13790@rapoport-lnx \
--to=rppt@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark.rutland@arm.com \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).