Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp499948ybm; Wed, 22 May 2019 06:56:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLNUspL6dSBEKNOyFWkF0gxOJHYZqAdQjH26XmYgIfDghgdIAVagX1dYBp3Aqd4s1Wnp/a X-Received: by 2002:a17:902:9a07:: with SMTP id v7mr91576277plp.180.1558533418357; Wed, 22 May 2019 06:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558533418; cv=none; d=google.com; s=arc-20160816; b=XZ+wVtC64zeQogOA371eVOodC6aQpCEF37q3YD+n1vcw4Et/qd/vgr6390By5+tih6 8GjDcIcwvvlaL3uRLKEIcX7a4PFhGzNjPHF1hDkcEsB7hwfy6MdjauuS2EPmUjNMoGt6 INJbg05rlBLSvaDV37pKiyDa0l06WeUSOrkRkeuiwNFLH599iUaRFob8RFCfgm4juQly sT+LZIOz503LNGwb3b/WOcjpKMb11hKodesmsPUdcpeacHqGowVk3GVYA0/yePqCuDHM 22NAfqzsbo9qtbq5QLhWVJ90jrNSa+4WHQ8sb1DeCEytzkIv/wZ69cw49tGEx0QvlRRR sDBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3ZTrwMxN/5lsR/yBgeQOj8ooUaQuQVd2rlB+XWMlCww=; b=AP4jzgTBJBpiEziIGou5FLAAPDPiPBOQ2b2W+BPjSsY/EADClEDVjlnTG7FZgc91Wb Uoj5r1M52ztqdylg4U2KtDZf3wTJn+g1+fq+mIcdYfjHk53RcE4t1iU6iqB8Ln1nfzvu lHcaqg6vh5voDnJTNl5EmPABrpaYBhoekyK5FFgjnjlf2cN4zNHrq/KKi3M0tXtlcd20 X36cdpO/Ri8Yh/5iWyo/arICpvEE0Pghextudo8qFjc3PjRQy2Y0WsUW2I3Pjy2aCZg+ LbXN5CB+ZTntKNdDHHNcu2eZnSKkj0JXE8C17Oxhf0PmqaDZ72FcSy+Y9JI5TKDhSa5Y u3xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gcrno6pL; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si14806354plq.75.2019.05.22.06.56.42; Wed, 22 May 2019 06:56:58 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gcrno6pL; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728881AbfEVNyc (ORCPT + 99 others); Wed, 22 May 2019 09:54:32 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:46299 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbfEVNyb (ORCPT ); Wed, 22 May 2019 09:54:31 -0400 Received: by mail-lf1-f68.google.com with SMTP id l26so1740041lfh.13; Wed, 22 May 2019 06:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3ZTrwMxN/5lsR/yBgeQOj8ooUaQuQVd2rlB+XWMlCww=; b=gcrno6pLfvE1Y4bOELD/4ycqwW+20kE2jaeYTrHTrtfcQMlyRjjw24sDf+ht19fa6o NfDlQydamNYxgIAIg4+D/jlZJYs6YUAf4opPIpYhxss3G81n/o5MxzH3lHX3tPXATjEw OoFyO80YdiJy1KDj4X8OZLHuQuOAVlbxFGFd1JgspFLL8GsUlyOsMenh0ekW7/APgAr7 fzwJa7RM0346nVGN5677Dk71QzEZSf8kCE/E1dQAS/DlHAFzD5NbIggot6weqdBCPZGu UQEREKUk7evskL4TivJjHxYXl+09zPQB+9QTYH1WxXqcpYWjfbmzgZaOTus1Vm8d8GGv 55uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3ZTrwMxN/5lsR/yBgeQOj8ooUaQuQVd2rlB+XWMlCww=; b=XQVsa/VYTFgqZ7ZQmm2PkzbE32K7M4MjyV98zmfUZvKG5zhQQFB5602yFf47P1Hxoh 0NctO96ZZmfN9BNpo8D2dpITskD6R4DNuNVUR6tJR8Us5rQugWf60yNfneab26Bu/KQf VqgW14iBYnOcN+sdyNQbal5vGT2bvus1pytkm0veWRHUivhogbZkyUe6MV2nWT0IMYuz 56X5e8rbO2mHtSSgoDTo0bLjeCHPwGBp0fyAI3RHR6mt1OhpT8gawKQvTsqHurSPqMU7 ekk6aYB4lpkxlkLGcugfSpLYlNB+D/KNB8TiyhS3votgGlczxsJPh0olRGmjhZn2tvfh VQPw== X-Gm-Message-State: APjAAAVjEK48Sx4HJvvmtH8HmBJhFmH2obv2zHz38ERrmaHRCj1tLz0T +Y58HD3WVbN+KrNpaGW0P2k= X-Received: by 2002:ac2:43c2:: with SMTP id u2mr36442843lfl.159.1558533268909; Wed, 22 May 2019 06:54:28 -0700 (PDT) Received: from mobilestation ([83.220.237.191]) by smtp.gmail.com with ESMTPSA id w11sm1938109lfe.32.2019.05.22.06.54.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 22 May 2019 06:54:28 -0700 (PDT) Date: Wed, 22 May 2019 16:54:23 +0300 From: Serge Semin To: Geert Uytterhoeven Cc: Mike Rapoport , Ralf Baechle , Paul Burton , James Hogan , Andrew Morton , Michal Hocko , Greg Kroah-Hartman , Thomas Bogendoerfer , Huacai Chen , Stefan Agner , Stephen Rothwell , Alexandre Belloni , Juergen Gross , linux-mips@vger.kernel.org, Linux Kernel Mailing List , Atsushi Nemoto , "Maciej W. Rozycki" Subject: Re: [PATCH 04/12] mips: Reserve memory for the kernel image resources Message-ID: <20190522135422.q6w7lcvh5fgpf7a5@mobilestation> References: <20190423224748.3765-1-fancer.lancer@gmail.com> <20190423224748.3765-5-fancer.lancer@gmail.com> <20190521155309.GB24470@rapoport-lnx> <20190522080802.GA31930@rapoport-lnx> <20190522133402.duhybxf66oubx6ng@mobilestation> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qrcxxnjro5uvxfxh" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --qrcxxnjro5uvxfxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 22, 2019 at 03:44:47PM +0200, Geert Uytterhoeven wrote: > Hi Serge, > > ... > > > > > The problem might be fixed there by the next patch: > > --- > > diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c > > index 5073d2ed78bb..5a0c734b5d04 100644 > > --- a/arch/mips/dec/prom/memory.c > > +++ b/arch/mips/dec/prom/memory.c > > @@ -91,29 +91,14 @@ void __init prom_meminit(u32 magic) > > pmax_setup_memory_region(); > > else > > rex_setup_memory_region(); > > -} > > - > > -void __init prom_free_prom_memory(void) > > -{ > > - unsigned long end; > > - > > - /* > > - * Free everything below the kernel itself but leave > > - * the first page reserved for the exception handlers. > > - */ > > > > #if IS_ENABLED(CONFIG_DECLANCE) > > /* > > - * Leave 128 KB reserved for Lance memory for > > - * IOASIC DECstations. > > + * Reserve 128 KB for Lance memory for IOASIC DECstations. > > * > > * XXX: save this address for use in dec_lance.c? > > */ > > if (IOASIC) > > - end = __pa(&_text) - 0x00020000; > > - else > > + memblock_reserve(__pa_symbol(&_text), 0x00020000); > > Shouldn't that be > > memblock_reserve(__pa_symbol(&_text) - 0x00020000, 0x00020000); > > ? > Right. Thanks. The updated version of the patch is attached to this email. -Sergey > > #endif > > - end = __pa(&_text); > > - > > - free_init_pages("unused PROM memory", PAGE_SIZE, end); > > } > > --- > > > > Didn't wanna use prom_FREE_prom_memory to actually reserve a memory > > chunk, so I moved the reservation into the prom_meminit() method. > > I guess Maciej will test this on real hardware, eventually... > > > Regarding the first page for the exception handlers. We don't need > > to reserve it here, since it is already done in arch/mips/kernel/traps.c . > > Thanks for checking! That was actually something I was still wondering > about... > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds --qrcxxnjro5uvxfxh Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="fix_dec.patch" diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c index 5073d2ed78bb..031c0cd45d85 100644 --- a/arch/mips/dec/prom/memory.c +++ b/arch/mips/dec/prom/memory.c @@ -91,29 +91,14 @@ void __init prom_meminit(u32 magic) pmax_setup_memory_region(); else rex_setup_memory_region(); -} - -void __init prom_free_prom_memory(void) -{ - unsigned long end; - - /* - * Free everything below the kernel itself but leave - * the first page reserved for the exception handlers. - */ #if IS_ENABLED(CONFIG_DECLANCE) /* - * Leave 128 KB reserved for Lance memory for - * IOASIC DECstations. + * Reserve 128 KB for Lance memory for IOASIC DECstations. * * XXX: save this address for use in dec_lance.c? */ if (IOASIC) - end = __pa(&_text) - 0x00020000; - else + memblock_reserve(__pa_symbol(&_text) - 0x00020000, 0x00020000); #endif - end = __pa(&_text); - - free_init_pages("unused PROM memory", PAGE_SIZE, end); } --qrcxxnjro5uvxfxh--