Thread (19 messages) 19 messages, 3 authors, 2019-01-30

Re: [PATCH v14 02/12] powerpc/irq: use memblock functions returning virtual address

flat view

From: Mark Rutland <mark.rutland@arm.com>
Date: 2019-01-24 17:28:48
Also in: lkml

On Thu, Jan 24, 2019 at 07:25:53PM +0200, Mike Rapoport wrote:
On Thu, Jan 24, 2019 at 04:51:53PM +0000, Mark Rutland wrote:
quoted
On Thu, Jan 24, 2019 at 04:19:33PM +0000, Christophe Leroy wrote:
quoted
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 <redacted>
Acked-by: Mike Rapoport <redacted>
Signed-off-by: Christophe Leroy <redacted>
[...]
quoted
+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].
 
quoted
[...]
[1] https://lore.kernel.org/lkml/20190108143428.GB14063@rapoport-lnx/ (local) 
[2] https://lore.kernel.org/lkml/1548057848-15136-1-git-send-email-rppt@linux.ibm.com/ (local)
Fair enough.

Feel free to take the ack regardless, then!

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