From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 132891EF0B2 for ; Mon, 3 Mar 2025 08:25:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740990340; cv=none; b=tFPjnPd5d3CCTktBa3NFi/0VYENmmF7hBtuzzY/v9CpmrQlH0J5PBuWZ8noCP2a3hk5YvfjceQjxNk/YWj7j9EzIrM0/rLpMeFFTkliUZFaScu/bIm3QSwvjpJfv4LUcn4OPVTIYM1WLHnhkhj3XZSpBxad/vgkF30N5bxhlplk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740990340; c=relaxed/simple; bh=JTyTHNloR3xDUjK8RymDbJ0QEbLzHy1TcN78c7jPexM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bwWPUg3e7J0dAvuNOrxlzE5ZDwHV1j0jiEKfq+uw5QDubE5ORiBgctTyeXrZjGmT3bTa7FqIs7Bs93Qnp4BnloPlOQb/wTgVExhq9yuK7KggcgV7aalrcjrn30j0ppOPJzwqqmBkUi2igHlJm3TFo7Kx/GlnDoWTgJ1L7luIOKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=E3E9ZHE9; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E3E9ZHE9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740990334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=xQJa5hq33EwCeIlC6ZAKrgfFf28o5I5tCi+O9hYDtj8=; b=E3E9ZHE9kCvnipyvx23aB5gJ7pYxS2lvbTXnwHRvUWumEAvzA8hBdm7HVznxFKIRga6L6w 1KcrW+5LkJHVE3RKxdw5NabvNzZwJ3l6r1CyGWcSIarejdDxGY0YrSIgTrHv2vnjO5xqgn L84OESvimKgoYNHLC6UKZgrbxB9ImB8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-7rn24ahwOIWaFeR4rCDOfA-1; Mon, 03 Mar 2025 03:25:33 -0500 X-MC-Unique: 7rn24ahwOIWaFeR4rCDOfA-1 X-Mimecast-MFC-AGG-ID: 7rn24ahwOIWaFeR4rCDOfA_1740990332 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-390e003c1easo1843565f8f.1 for ; Mon, 03 Mar 2025 00:25:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740990332; x=1741595132; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=xQJa5hq33EwCeIlC6ZAKrgfFf28o5I5tCi+O9hYDtj8=; b=K6r+0CzOMWZWUczHd324Xe3fxYWrUxQj1Eyfd8bXbfD8LbAjRJ1H5FQKiYEwUOatVw SqhH9xvU4J92lC6cqloRjUMuh8D4X9U2MhZ8RvbepzxjXgocWANfI+H4Mxa/TCqriDvz s1CVNwF0W3TwKzRjsmvJihXOCXU2DuXnnd/F5eytc03jW8c9XsO8vTdi9FzWSWqBAwja /9LVLBc4pHZnYmg3A8jKftMocMyxBmaT+0nofZ/OOY+N2j/+ACZvBCB17puf1zE3vVl/ UlgAImexwFvBqAtzIUEHyXcqS8cSNijYTmqg/DtzviRsq7x6pDPDMWqslbKmgd9Ifc2m Fh4g== X-Forwarded-Encrypted: i=1; AJvYcCXqT/AONl1opMphiqqMaMqAruOc9CQvldmpUTUKszh/MpR/hKsDkvRRI1YMRjKMs411SieZd/Onoq7vzzM=@vger.kernel.org X-Gm-Message-State: AOJu0YwRkjd8Q+1wulo/1qT7MN4XlC9RxNlQC+AjhqVwwWALxvSSItYC m9KtN2Qb42vDaPP4z8rRDkn62Vj0X6hgO3KtXxyyBScvG+nV7KBzIn2TY4urRhFliP0hpV1FAOl /4I1wK0O6IAbqU00EqteBUk6ETYsHwXf9MXXvQIMfWmuRcfTGuCuJzcXHbREJ4Q== X-Gm-Gg: ASbGncveziaOIg8pCyNNEyyOkSZ9p8t9c4V22TZWNTG/eVzabwhmRxakvtXETLPht9U y0wK9kZc5UGqumJh9jdTNe2KTbTmr58ZjzaP5jA0/BqrwLVnUvVy3oXPsKD0HsBl2WymMoIg1wt A03do8pUK5IKN08GtjCrsHP1PBS9FuQnA2Fki/gCJsO5etRNOPjwf/zovasrelpgXdyN7nY6SBs mACkBEpt+l4yMhS+0Y59odX5RfkxNT7zphGQja7rpJE8TVdQmTCNb67Nt8ACwo2Oi+CVV/3KL0N Q4uNdISPsS8CuVPqRPGG6PKSmrkIeeFlneQCg6AmrgQOLKXPWocqebv1G+1iEnPmOpJLpossfb5 fq4wkl2D8bRmpGQ+Q0tpjWCC8BLDq/gdI5+a/bJeF8Xo= X-Received: by 2002:a5d:5f96:0:b0:38d:afc8:954e with SMTP id ffacd0b85a97d-390e168d26amr12598019f8f.11.1740990332280; Mon, 03 Mar 2025 00:25:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHXdEcK466k9cymsnu6lkTJiaTmjAeBQ+6arxNNNOBmOvsqU6SoLHa6hs0wN1owqcbaCRBJg== X-Received: by 2002:a5d:5f96:0:b0:38d:afc8:954e with SMTP id ffacd0b85a97d-390e168d26amr12597996f8f.11.1740990331870; Mon, 03 Mar 2025 00:25:31 -0800 (PST) Received: from ?IPV6:2003:cb:c734:9600:af27:4326:a216:2bfb? (p200300cbc7349600af274326a2162bfb.dip0.t-ipconnect.de. [2003:cb:c734:9600:af27:4326:a216:2bfb]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bad347823sm96630265e9.0.2025.03.03.00.25.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Mar 2025 00:25:31 -0800 (PST) Message-ID: <04904e86-5b5f-4aa1-a120-428dac119189@redhat.com> Date: Mon, 3 Mar 2025 09:25:30 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/5] kdump: crashkernel reservation from CMA To: Jiri Bohac , Baoquan He , Vivek Goyal , Dave Young , kexec@lists.infradead.org Cc: Philipp Rudo , Donald Dutile , Pingfan Liu , Tao Liu , linux-kernel@vger.kernel.org, David Hildenbrand , Michal Hocko References: From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+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yVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20.02.25 17:48, Jiri Bohac wrote: > Hi, > > this series implements a way to reserve additional crash kernel > memory using CMA. > > Link to the v1 discussion: > https://lore.kernel.org/lkml/ZWD_fAPqEWkFlEkM@dwarf.suse.cz/ > See below for the changes since v1 and how concerns from the > discussion have been addressed. > > Currently, all the memory for the crash kernel is not usable by > the 1st (production) kernel. It is also unmapped so that it can't > be corrupted by the fault that will eventually trigger the crash. > This makes sense for the memory actually used by the kexec-loaded > crash kernel image and initrd and the data prepared during the > load (vmcoreinfo, ...). However, the reserved space needs to be > much larger than that to provide enough run-time memory for the > crash kernel and the kdump userspace. Estimating the amount of > memory to reserve is difficult. Being too careful makes kdump > likely to end in OOM, being too generous takes even more memory > from the production system. Also, the reservation only allows > reserving a single contiguous block (or two with the "low" > suffix). I've seen systems where this fails because the physical > memory is fragmented. > > By reserving additional crashkernel memory from CMA, the main > crashkernel reservation can be just large enough to fit the > kernel and initrd image, minimizing the memory taken away from > the production system. Most of the run-time memory for the crash > kernel will be memory previously available to userspace in the > production system. As this memory is no longer wasted, the > reservation can be done with a generous margin, making kdump more > reliable. Kernel memory that we need to preserve for dumping is > never allocated from CMA. User data is typically not dumped by > makedumpfile. When dumping of user data is intended this new CMA > reservation cannot be used. Hi, I'll note that your comment about "user space" is currently the case, but will likely not hold in the long run. The assumption you are making is that only user-space memory will be allocated from MIGRATE_CMA, which is not necessarily the case. Any movable allocation will end up in there. Besides LRU folios (user space memory and the pagecache), we already support migration of some kernel allocations using the non-lru migration framework. Such allocations (which use __GFP_MOVABLE, see __SetPageMovable()) currently only include * memory balloon: pages we never want to dump either way * zsmalloc (->zpool): only used by zswap (-> compressed LRU pages) * z3fold (->zpool): only used by zswap (-> compressed LRU pages) Just imagine if we support migration of other kernel allocations, such as user page tables. The dump would be missing important information. Once that happens, it will become a lot harder to judge whether CMA can be used or not. At least, the kernel could bail out/warn for these kernel configs. > > There are five patches in this series: > > The first adds a new ",cma" suffix to the recenly introduced generic > crashkernel parsing code. parse_crashkernel() takes one more > argument to store the cma reservation size. > > The second patch implements reserve_crashkernel_cma() which > performs the reservation. If the requested size is not available > in a single range, multiple smaller ranges will be reserved. > > The third patch updates Documentation/, explicitly mentioning the > potential DMA corruption of the CMA-reserved memory. > > The fourth patch adds a short delay before booting the kdump > kernel, allowing pending DMA transfers to finish. What does "short" mean? At least in theory, long-term pinning is forbidden for MIGRATE_CMA, so we should not have such pages mapped into an iommu where DMA can happily keep going on for quite a while. But that assumes that our old kernel is not buggy, and doesn't end up mapping these pages into an IOMMU where DMA will just continue. I recall that DRM might currently be a problem, described here [1]. If kdump starts not working as expected in case our old kernel is buggy, doesn't that partially destroy the purpose of kdump (-> debug bugs in the old kernel)? [1] https://lore.kernel.org/all/Z6MV_Y9WRdlBYeRs@phenom.ffwll.local/T/#u -- Cheers, David / dhildenb