Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp569633ybg; Tue, 28 Jul 2020 13:04:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMlv/VMC6kN9JJs8N2Z2j4nwDDlGx+z15od1bRnIlofCZyZfr2dAj28126irdI+abtOddd X-Received: by 2002:a17:906:284e:: with SMTP id s14mr27417912ejc.498.1595966646366; Tue, 28 Jul 2020 13:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595966646; cv=none; d=google.com; s=arc-20160816; b=iQw5m8st4AUhLJTXdCL7Ebu77mpNXuVmVhiZvm+inPTh+Nm86HxyS9F/HAx7+2P5v2 9I8ykD21E1ctXrXxyCdbvmtbfNfSzHrTisq/HFZPeNIgIMYwi7MC15DHVRzo+9dyE9ao O9ZnDKzNQVz/nLJDWM0PbAfI4bQYX4P/w+4G6KxZT0pif0HM+OUaUhyDvnDnsXpz3EsN rC3USFf2RbB7ppUQUlDqXrmd6E4icB76kB4BnQvg/STwUGTFQ9kHV8jjQEeGieTdMLx5 aNpVdHptyR3+IW8Zd4N+iljfPryiewewpwJUrWMFs8/eFdguTJQXRrwjbK1IH2vRhFiQ 8W/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3/aNqaX5m3rq15Dkh+vNj60GlN4ThOCZi9plYU2UcK8=; b=v25D/qOwp3Ms1YnXq2eLwHVDA5N1FFcSJd1mF/s98/a706wo0foJlLSeBLjrBhoViU BG2Jv42OGk3AkBuAMJ8CqT0GGmfH5uLPUcHNiI0oF6ukaKzpBKtbmgYEX/AyJf+QlbwN G2I5yPvPdTHIx0N9ORFsAaNUJu9Up+VqSFNfuT4XtxEbrsMj1K2/um6gI3VC5RGLfYVr iZ5FeVt1To3kGhMj7rJWZqC5w7IvVycn6icY62l+oXzdirhK6zPoiXxUZpwXC/2df0om +7AFqZIqBOQfEVRXJgfE8AFf7lZbwXnspKJuYZXhOPQ49+gTcdX2ZH3tsCU0z47HsIN4 fn7Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si6205290edx.408.2020.07.28.13.03.44; Tue, 28 Jul 2020 13:04:06 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732836AbgG1Tel (ORCPT + 99 others); Tue, 28 Jul 2020 15:34:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:61832 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729646AbgG1Tel (ORCPT ); Tue, 28 Jul 2020 15:34:41 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06SJX1aO120680; Tue, 28 Jul 2020 15:34:33 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jkw2dfpy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 15:34:32 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06SJY200123410; Tue, 28 Jul 2020 15:34:32 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jkw2dfnq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 15:34:32 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06SJOcrn028997; Tue, 28 Jul 2020 19:34:29 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma02fra.de.ibm.com with ESMTP id 32gcq0thxh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 19:34:29 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06SJYQfe27001110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 19:34:26 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFA5542045; Tue, 28 Jul 2020 19:34:26 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 930E94203F; Tue, 28 Jul 2020 19:34:23 +0000 (GMT) Received: from [9.85.75.143] (unknown [9.85.75.143]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Jul 2020 19:34:23 +0000 (GMT) Subject: Re: [RESEND PATCH v5 06/11] ppc64/kexec_file: restrict memory usage of kdump kernel To: Michael Ellerman , Andrew Morton Cc: Pingfan Liu , Kexec-ml , Mimi Zohar , Nayna Jain , Petr Tesarik , Mahesh J Salgaonkar , Sourabh Jain , lkml , linuxppc-dev , Eric Biederman , Thiago Jung Bauermann , Dave Young , Vivek Goyal References: <159579157320.5790.6748078824637688685.stgit@hbathini> <159579231812.5790.16096865978767385505.stgit@hbathini> <875za77o05.fsf@mpe.ellerman.id.au> From: Hari Bathini Message-ID: <23c4e7a2-6fbc-8007-5e9a-35c3a4d3898b@linux.ibm.com> Date: Wed, 29 Jul 2020 01:04:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <875za77o05.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-28_16:2020-07-28,2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007280139 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/07/20 7:14 pm, Michael Ellerman wrote: > Hari Bathini writes: >> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c >> index 2df6f4273ddd..8df085a22fd7 100644 >> --- a/arch/powerpc/kexec/file_load_64.c >> +++ b/arch/powerpc/kexec/file_load_64.c >> @@ -17,9 +17,21 @@ >> #include >> #include >> #include >> +#include >> #include >> +#include >> +#include >> #include >> >> +struct umem_info { >> + uint64_t *buf; /* data buffer for usable-memory property */ >> + uint32_t idx; /* current index */ >> + uint32_t size; /* size allocated for the data buffer */ > > Use kernel types please, u64, u32. > >> + /* usable memory ranges to look up */ >> + const struct crash_mem *umrngs; > > "umrngs". > > Given it's part of the umem_info struct could it just be "ranges"? True. Actually, having crash_mem_range *ranges + u32 nr_ranges and populating them seems better. Will do that.. >> + return NULL; >> + } > > um_info->size = new_size; > >> + >> + memset(tbuf + um_info->idx, 0, MEM_RANGE_CHUNK_SZ); > > Just pass __GFP_ZERO to krealloc? There are patches submitted to stable fixing a few modules that use krealloc with __GFP_ZERO. Also, this zeroing is not really needed. I will drop the memset instead.. Thanks Hari