Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2242573imu; Thu, 24 Jan 2019 09:26:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4R+84BESUx8HHtJlSy+U4JOAhhk+jw7oXRFObKWpSS/J01A3mpJQqlNbJqeyBYN8KyP0M4 X-Received: by 2002:a63:8149:: with SMTP id t70mr6857571pgd.172.1548350802108; Thu, 24 Jan 2019 09:26:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548350802; cv=none; d=google.com; s=arc-20160816; b=koxkcMU9z13u4aHvA2wleZC3DtEs6K1zXcYT9a7KIhsCgE0smYg6HqYgVA9KZVcOMF QjXx5pRnxY5JvPeR6q/TWqR2faekAoBTPb/E96/CPHYlq5kIWysCNaHfkpqzxw6gr1mn G6tnjn1DjySEhKYB8D32ZfctaNK0TW756zzwfF9TuVAjiEWFg5RCxqCVZF+DAB9xE1xN 8mdOU5DNsKyzyq6alOoXwsoxpwg5cXiphQWHFHF8VkC83xp3lQ1lw9DvgyIGk03P0vhM 9+dIingF7sqaOKO/vI2P5AC99U8LGaCqXD09K+E5LhgW8uJnoX362gWUBLbMzJFV7Qhg 3H0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=uSu+zjfXyfWkq2SLB9ZHTqr+pUtShzQyJekM05yfqYU=; b=MdAfD6O0O2jRXnnV7oQtYtTPBZqGyt9atbm4XgVRE9GYSD6ZXlTRQuVhoueHjYgO03 o0VT6BYKM5IEbaWsP7qpzB2sB5Bu4mAVco2MhJiIPrhnadM4uDC38au87h5HfCMd9Tl6 xy46pyC04XGxGHWiCTJd1pMg2B/NeBofUh9kV1k3JFeW1Dpc5SXy0oShdwylpAzRA8FN 1huLXkwqkbMM9LO62mTgKvFsnWXPbiRUCbjsXhilYYuJjs76iYAjLuNatJr9DxF0iJ6z 0QTX4W1w1hyOFsOJ/jfivuBj9q1Z1z5QAALFwQTkqwGZtpMyxYUMfDiu4fES/hBg8t2H m/Ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x64si21210992pfx.87.2019.01.24.09.26.25; Thu, 24 Jan 2019 09:26:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729005AbfAXR0G (ORCPT + 99 others); Thu, 24 Jan 2019 12:26:06 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37924 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728610AbfAXR0G (ORCPT ); Thu, 24 Jan 2019 12:26:06 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0OHGutS029174 for ; Thu, 24 Jan 2019 12:26:05 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q7f3at1v3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 Jan 2019 12:26:04 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Jan 2019 17:25:59 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 24 Jan 2019 17:25:56 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0OHPtLW65732742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Jan 2019 17:25:55 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BFB5DA4054; Thu, 24 Jan 2019 17:25:55 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1F10FA405C; Thu, 24 Jan 2019 17:25:55 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.102]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 24 Jan 2019 17:25:55 +0000 (GMT) Date: Thu, 24 Jan 2019 19:25:53 +0200 From: Mike Rapoport To: Mark Rutland Cc: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v14 02/12] powerpc/irq: use memblock functions returning virtual address References: <1c8e658c094022a15e4b9f5ef5c191caab3c0dff.1548346225.git.christophe.leroy@c-s.fr> <20190124165153.GB5531@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124165153.GB5531@lakrids.cambridge.arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19012417-0008-0000-0000-000002B58564 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19012417-0009-0000-0000-00002221BAE8 Message-Id: <20190124172553.GE13790@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-24_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901240121 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > Acked-by: Mike Rapoport > > Signed-off-by: Christophe Leroy > > [...] > > > +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 > > Thanks, > Mark. > -- Sincerely yours, Mike.