Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4802307imu; Tue, 8 Jan 2019 06:36:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN5MGjXCpJr0QAAU/RcAuVwr7GxrAAOaHn/FJwNtpApQ4nUNzNM2p+/EFOzO6S4sprzGNIYK X-Received: by 2002:a17:902:50e3:: with SMTP id c32mr2041936plj.318.1546958169816; Tue, 08 Jan 2019 06:36:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546958169; cv=none; d=google.com; s=arc-20160816; b=x27D2dlK0idepsgGJQgH+9RS1bs5Obax2rYAvSO6n1ppKN9HPbS22/U3UiiOBfmv/Q M7caAXHd/C6zISP3LZMgG14fmMeXPsBEdsf2ZT6LTDELPRuhv3Hmvqs60RtRQ6Jtj0St Rbr6RSnasTRd3r6NcPVS21w1V47ktnToi6ORq+ZXtv7ZCQCcwoYYFNbLGF7UN+XOtDX3 WaB6HS/LlctjIhXUTah1MrX5Fd60ILZ01RYzwPb9Mzvn0yFTe6uiW3Z4u1ZNUXgYgV3i Tur6NIZHOvwp00vf2Gk8D5+BIy7kHGXRam+B8F+CupTTG3kA6ePMYhtPnFYySBhKpq1K yiRQ== 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=X5iQOyg6sfWeIQojF/wIacVyJWRiqzAJHTPC9f4c08E=; b=cJy3G6wVcP+1EiH982fOwFxJtHk/GCfo0m82GVir2ZbFgjhnn5vedAJ2W7nlUvjiL0 qOwaec1jVxjXX0LxM5cKTvJle2T4pttI2rdIK774hurGxuI6C/wL35xYxCDzg4eWGNpd 4het/gg1fNFBg3JmF3eLzldMKbnoHSfkcls99sxOovUFMoZk9ZuOF0eB6vj0tgpVVUQu 2B5n5kQmXOnHtPOcofy9mreSZq/vmb+vZXRQz7TMIKlC/AfsCNVKKirSFAAVZTO4NI1j l2Mw+Qf0AMYPq54wZXnkU2T5CAv0eUc7tAa8C0dfUvwA08weYqqZ7xkI2wD/MnQ7n9wl o+vg== 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 az11si3001685plb.386.2019.01.08.06.35.54; Tue, 08 Jan 2019 06:36:09 -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 S1727656AbfAHOek (ORCPT + 99 others); Tue, 8 Jan 2019 09:34:40 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49866 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728846AbfAHOej (ORCPT ); Tue, 8 Jan 2019 09:34:39 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x08EUa8a151480 for ; Tue, 8 Jan 2019 09:34:38 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pvva451vh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 Jan 2019 09:34:37 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jan 2019 14:34:35 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 8 Jan 2019 14:34:32 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x08EYVFx59768884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 8 Jan 2019 14:34:31 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63E2B4C050; Tue, 8 Jan 2019 14:34:31 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C43764C040; Tue, 8 Jan 2019 14:34:30 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.241]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 8 Jan 2019 14:34:30 +0000 (GMT) Date: Tue, 8 Jan 2019 16:34:29 +0200 From: Mike Rapoport To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v12 01/10] powerpc/irq: use memblock functions returning virtual address References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19010814-0028-0000-0000-00000335FC81 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19010814-0029-0000-0000-000023F30A09 Message-Id: <20190108143428.GB14063@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-08_08:,, 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-1901080120 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Jan 08, 2019 at 01:43:09PM +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 > Signed-off-by: Christophe Leroy > --- > @Mike: Part of this is taken from your serie. It seems you've found some places I've missed :) Note that my series was merged to mmotm, so you may get a conflict with it. > I was not sure how to include you in the commit log, I used > Suggested-by: but could use any other property, so if you prefer > something different just tell me. Also, if you could review this patch, > it would be nice. Suggested-by sounds reasonable. > arch/powerpc/kernel/irq.c | 5 ----- > arch/powerpc/kernel/setup_32.c | 15 +++++---------- > arch/powerpc/kernel/setup_64.c | 16 ++-------------- > 3 files changed, 7 insertions(+), 29 deletions(-) > > diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c > index 916ddc4aac44..4a44bc395fbc 100644 > --- a/arch/powerpc/kernel/irq.c > +++ b/arch/powerpc/kernel/irq.c > @@ -725,18 +725,15 @@ void exc_lvl_ctx_init(void) > #endif > #endif > > - memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE); > tp = critirq_ctx[cpu_nr]; > tp->cpu = cpu_nr; > tp->preempt_count = 0; > > #ifdef CONFIG_BOOKE > - memset((void *)dbgirq_ctx[cpu_nr], 0, THREAD_SIZE); > tp = dbgirq_ctx[cpu_nr]; > tp->cpu = cpu_nr; > tp->preempt_count = 0; > > - memset((void *)mcheckirq_ctx[cpu_nr], 0, THREAD_SIZE); > tp = mcheckirq_ctx[cpu_nr]; > tp->cpu = cpu_nr; > tp->preempt_count = HARDIRQ_OFFSET; > @@ -754,12 +751,10 @@ void irq_ctx_init(void) > int i; > > for_each_possible_cpu(i) { > - memset((void *)softirq_ctx[i], 0, THREAD_SIZE); > tp = softirq_ctx[i]; > tp->cpu = i; > klp_init_thread_info(tp); > > - memset((void *)hardirq_ctx[i], 0, THREAD_SIZE); > tp = hardirq_ctx[i]; > tp->cpu = i; > klp_init_thread_info(tp); > diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c > index 947f904688b0..bfe1b46a26dc 100644 > --- a/arch/powerpc/kernel/setup_32.c > +++ b/arch/powerpc/kernel/setup_32.c > @@ -203,10 +203,8 @@ void __init irqstack_early_init(void) > /* interrupt stacks must be in lowmem, we get that for free on ppc32 > * as the memblock is limited to lowmem by default */ > for_each_possible_cpu(i) { > - softirq_ctx[i] = (struct thread_info *) > - __va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE)); > - hardirq_ctx[i] = (struct thread_info *) > - __va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE)); > + softirq_ctx[i] = memblock_alloc(THREAD_SIZE, THREAD_SIZE); > + hardirq_ctx[i] = memblock_alloc(THREAD_SIZE, THREAD_SIZE); > } > } > > @@ -224,13 +222,10 @@ void __init exc_lvl_early_init(void) > hw_cpu = 0; > #endif > > - critirq_ctx[hw_cpu] = (struct thread_info *) > - __va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE)); > + critirq_ctx[hw_cpu] = memblock_alloc(THREAD_SIZE, THREAD_SIZE); > #ifdef CONFIG_BOOKE > - dbgirq_ctx[hw_cpu] = (struct thread_info *) > - __va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE)); > - mcheckirq_ctx[hw_cpu] = (struct thread_info *) > - __va(memblock_phys_alloc(THREAD_SIZE, THREAD_SIZE)); > + dbgirq_ctx[hw_cpu] = memblock_alloc(THREAD_SIZE, THREAD_SIZE); > + mcheckirq_ctx[hw_cpu] = memblock_alloc(THREAD_SIZE, THREAD_SIZE); > #endif > } > } > diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c > index 236c1151a3a7..943503f1e2c0 100644 > --- a/arch/powerpc/kernel/setup_64.c > +++ b/arch/powerpc/kernel/setup_64.c > @@ -634,19 +634,10 @@ __init u64 ppc64_bolted_size(void) > > static void *__init alloc_stack(unsigned long limit, int cpu) > { > - unsigned long pa; > - > 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"); > - } > - > - return __va(pa); > + return memblock_alloc_try_nid(THREAD_SIZE, THREAD_SIZE, MEMBLOCK_LOW_LIMIT, > + limit, early_cpu_to_node(cpu)); I'd prefer if you would keep the return value check and panic() here, as I'm working on removing the panic() from memblock_alloc*(). Other than that, everything seems right, at least from the memblock perspective. So, with panic retained feel free to add Acked-by: Mike Rapoport > } > > void __init irqstack_early_init(void) > @@ -739,20 +730,17 @@ void __init emergency_stack_init(void) > struct thread_info *ti; > > ti = alloc_stack(limit, i); > - memset(ti, 0, THREAD_SIZE); > emerg_stack_init_thread_info(ti, i); > paca_ptrs[i]->emergency_sp = (void *)ti + THREAD_SIZE; > > #ifdef CONFIG_PPC_BOOK3S_64 > /* emergency stack for NMI exception handling. */ > ti = alloc_stack(limit, i); > - memset(ti, 0, THREAD_SIZE); > emerg_stack_init_thread_info(ti, i); > paca_ptrs[i]->nmi_emergency_sp = (void *)ti + THREAD_SIZE; > > /* emergency stack for machine check exception handling. */ > ti = alloc_stack(limit, i); > - memset(ti, 0, THREAD_SIZE); > emerg_stack_init_thread_info(ti, i); > paca_ptrs[i]->mc_emergency_sp = (void *)ti + THREAD_SIZE; > #endif > -- > 2.13.3 > -- Sincerely yours, Mike.