Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3993352pxb; Mon, 8 Feb 2021 05:34:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTI7dXLLgh+kAGf37vTFMTIosNolX9KCcMnP2rItzsqSQDN1RFAz/psVvKDBRU519noAp4 X-Received: by 2002:a17:906:d8a1:: with SMTP id qc1mr17438323ejb.523.1612791272854; Mon, 08 Feb 2021 05:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612791272; cv=none; d=google.com; s=arc-20160816; b=MIJuuI86kml8XTzK3sambxHNqedG5ZnEMdYvqkkIMPNmdABy4m/zvSaH6SFUKD9Sgc u96RXtvPZhTyU2fZ9UGudxy9P5gwQTKDPYCMYYlt/5dd00BUvtH65J7J2Vr70RaOLdNo 1NbrqnESbQe3P/1f6t9Tqgsc1ByZ4M+m6GqZe24F51PJTbQmYQLnFvZr7B7iEdifrtCG cbXpNZ1aQPjDyLETA9pZTz4mS45CBd1s4QgHMVm7wjuDHxr1klxNksOcuZsZTXdd784X gSrSywb2Y17oGUcxBTTDDRT78jYEcTc3oAq1fWO5tkrJ24ePfJH6+iu6tUy5FaP2LN06 R9Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=RyLwPT3GHw6JYmtTI8M0PyhX/t7afEssKqL/jTmTA/w=; b=vpbWCMEr2mZW71C2eQFxGZvho8qnOQJZhC+xDxKg7vmfl+GUYiQMrHsVEKn48zFtie EBI1OtGPVaSvn8j9m72SZz7fF9ovC/qfcuJY7G0X66KLa7j62JxIioX/K3Dbq5YatOxC eSwqw2PNBX2t0mx3OWuucyXCNSXj0834lTNDmUAWTv99w37oKyZFRIkyVGPEq6IUb3rO aUqjHZNZQwQsrGK8OMG8mgy1FfSmFQQKiV0D4IDdK7p8riRPlFG/SQqBAmYuJXPerTzR t86ftEUVhbQOcPVYMazhCaMhC/+R6bJqdJm+ryl2opPNbCgRR2IFZlA0EYizG6PcGuUj zluQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EHnCAVxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id he39si10858821ejc.512.2021.02.08.05.34.05; Mon, 08 Feb 2021 05:34:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EHnCAVxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230034AbhBHNaO (ORCPT + 99 others); Mon, 8 Feb 2021 08:30:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbhBHNaJ (ORCPT ); Mon, 8 Feb 2021 08:30:09 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FFCC06178A; Mon, 8 Feb 2021 05:29:28 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id b2so22262240lfq.0; Mon, 08 Feb 2021 05:29:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RyLwPT3GHw6JYmtTI8M0PyhX/t7afEssKqL/jTmTA/w=; b=EHnCAVxivzOfmrOhaDUYBJyzfNrySt8i0cZZD2d2goY15qOIQmGlAcucOfuYzQG1xh YhwOf6lpZt/i2mj8BnVzubwiahPCfnGcT4l6xMwZHI/4cM8A2B88ijqSEbntq/Q2oInD P1/P9MMwWCR+mdTjLx1qR6cHocfiEYE3uh4GjbxkryFfvjaTtbuaa4PzMTP2TcxbjuWo OoaiU6gbK/gShxwKEmsakDlOMwLSLvFuhMwqRE8WxUVmTuKaK8EnFGT+dzS+RIg4NcyG wtTqipo2fz/iWZL2dHQP1T/5j6uO38s+HealdetTsjkhBPKx3CCQ/PBsw2Y4x/ZL9Pd+ hIeQ== 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=RyLwPT3GHw6JYmtTI8M0PyhX/t7afEssKqL/jTmTA/w=; b=qyrBYHDDXKPYtqfj+Zh4MKD98qJrQa1e3jRAVu1SI78f4bGMtMCoXlO0t21lceXDjt RpJmbP9d46i6d8CD3y2adfj60o03vXM//gF6eO4jpsQPprWHVRdKsHmxx/UJwXNTv0vO /1yrRulllzOvEtrc01w1VBoG727PlfWLAtXG7ZkXmzGZqukZAxp6tThOgM0yLEmgSw4v Fjf+uZQhv/JuRfuJTMpKQ5DpI5CjngHAVqxhJkDxZAb2olARmxqdWF3OmsUHVtdYwslF GzSkAFIso1xc5HAlzH8mZrxa1ozhUXgAXXURuReW8B1dvSx1XrEuF7ep7LVLE+qZ/8Zr ADtg== X-Gm-Message-State: AOAM532zbKR3T+B53JADpKbGVUMTYRa12XnnDhw+9GocyNBFhpVc7h/M va5OcuUBilR8bkNNiqZiRhQ= X-Received: by 2002:a05:6512:2201:: with SMTP id h1mr10001623lfu.480.1612790967001; Mon, 08 Feb 2021 05:29:27 -0800 (PST) Received: from ikhorn (ip-0439.rusanovka-net.kiev.ua. [94.244.4.57]) by smtp.gmail.com with ESMTPSA id f25sm2093050lfk.218.2021.02.08.05.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 05:29:26 -0800 (PST) Date: Mon, 8 Feb 2021 15:29:24 +0200 From: Ivan Khoronzhuk To: Mike Rapoport Cc: Ivan Khoronzhuk , linux-mips@vger.kernel.org, tsbogend@alpha.franken.de, linux-kernel@vger.kernel.org, yangtiezhu@loongson.cn Subject: Re: [PATCH] mips: kernel: setup: fix crash kernel resource allocation Message-ID: <20210208132923.GB4740@ikhorn> Mail-Followup-To: Mike Rapoport , Ivan Khoronzhuk , linux-mips@vger.kernel.org, tsbogend@alpha.franken.de, linux-kernel@vger.kernel.org, yangtiezhu@loongson.cn References: <20210206125940.111766-1-ikhoronz@cisco.com> <20210207091842.GU242749@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210207091842.GU242749@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 07, 2021 at 11:18:42AM +0200, Mike Rapoport wrote: >On Sat, Feb 06, 2021 at 12:59:40PM +0000, Ivan Khoronzhuk wrote: >> In order to avoid crash kernel corruption, its memory is reserved >> early in memblock and as result, in time when resources are inited >> it's not present in memblock.memory, so crash kernel memory is out >> of ranges listed with for_each_mem_range(). To avoid it and still >> keep memory reserved lets reseve it out of loop by inserting it in >> iomem_resource. > >Unless I misread the code, the crash kernel memory is actually allocated >from memblock (memblock_find_in_range + memblock_reserve), but for some >reason memblock_reserve() is called outside >mips_parse_crashkernel(). So the crash kernel memory is surely in both >memblock.memory and memblock.reserved and it will be covered by >for_each_mem_range(). > >The mips_parse_crashkernel() function and the following reservation of >crash kernel memory should be merged, IMO, and this can be further >simplified with memblock_alloc() helpers. > >Is there a particular issue you are trying to fix? Yes, sorry, according to local code, seems like memory was not added (was reverted memblock_find_in_range for some other reson while porting), so I had only reserve. The issue is in another place, so ignoe this patch, for now. > >> Fixes: a94e4f24ec83 ("MIPS: init: Drop boot_mem_map") >> Signed-off-by: Ivan Khoronzhuk >> --- >> Based on linux-next/master >> >> arch/mips/kernel/setup.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c >> index 3785c72bc3bc..25e376ef2f2a 100644 >> --- a/arch/mips/kernel/setup.c >> +++ b/arch/mips/kernel/setup.c >> @@ -473,14 +473,15 @@ static void __init mips_parse_crashkernel(void) >> crashk_res.end = crash_base + crash_size - 1; >> } >> >> -static void __init request_crashkernel(struct resource *res) >> +static void __init request_crashkernel(void) >> { >> int ret; >> >> if (crashk_res.start == crashk_res.end) >> return; >> >> - ret = request_resource(res, &crashk_res); >> + /* The crashk resource shoud be located in normal mem */ >> + ret = insert_resource(&iomem_resource, &crashk_res); >> if (!ret) >> pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n", >> (unsigned long)(resource_size(&crashk_res) >> 20), >> @@ -734,8 +735,9 @@ static void __init resource_init(void) >> request_resource(res, &code_resource); >> request_resource(res, &data_resource); >> request_resource(res, &bss_resource); >> - request_crashkernel(res); >> } >> + >> + request_crashkernel(); >> } >> >> #ifdef CONFIG_SMP >> -- >> 2.23.1 >> > >-- >Sincerely yours, >Mike. -- Regards, Ivan Khoronzhuk