Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jiri Bohac <jbohac@suse.cz>, Vivek Goyal <vgoyal@redhat.com>,
	Dave Young <dyoung@redhat.com>,
	kexec@lists.infradead.org, Philipp Rudo <prudo@redhat.com>,
	Donald Dutile <ddutile@redhat.com>,
	Pingfan Liu <piliu@redhat.com>, Tao Liu <ltao@redhat.com>,
	linux-kernel@vger.kernel.org,
	David Hildenbrand <dhildenb@redhat.com>,
	Michal Hocko <mhocko@suse.cz>
Subject: Re: [PATCH v5 4/5] kdump: wait for DMA to finish when using CMA
Date: Sat, 14 Jun 2025 10:41:52 +0800	[thread overview]
Message-ID: <aEzhcIouq6OfJAF6@MiWiFi-R3L-srv> (raw)
In-Reply-To: <925cdfc4-7878-4572-9a4d-9b99d149a652@redhat.com>

On 06/13/25 at 11:19am, David Hildenbrand wrote:
> On 13.06.25 01:47, Andrew Morton wrote:
> > On Thu, 12 Jun 2025 12:18:40 +0200 Jiri Bohac <jbohac@suse.cz> wrote:
> > 
> > > When re-using the CMA area for kdump there is a risk of pending DMA
> > > into pinned user pages in the CMA area.
> > > 
> > > Pages residing in CMA areas can usually not get long-term pinned and
> > > are instead migrated away from the CMA area, so long-term pinning is
> > > typically not a concern. (BUGs in the kernel might still lead to
> > > long-term pinning of such pages if everything goes wrong.)
> > > 
> > > Pages pinned without FOLL_LONGTERM remain in the CMA and may possibly
> > > be the source or destination of a pending DMA transfer.
> > > 
> > > Although there is no clear specification how long a page may be pinned
> > > without FOLL_LONGTERM, pinning without the flag shows an intent of the
> > > caller to only use the memory for short-lived DMA transfers, not a transfer
> > > initiated by a device asynchronously at a random time in the future.
> > > 
> > > Add a delay of CMA_DMA_TIMEOUT_SEC seconds before starting the kdump
> > > kernel, giving such short-lived DMA transfers time to finish before
> > > the CMA memory is re-used by the kdump kernel.
> > > 
> > > Set CMA_DMA_TIMEOUT_SEC to 10 seconds - chosen arbitrarily as both
> > > a huge margin for a DMA transfer, yet not increasing the kdump time
> > > too significantly.
> > 
> > Oh.  10s sounds a lot.  How long does this process typically take?
> > 
> > It's sad to add a 10s delay for something which some systems will never
> > do.  I wonder if there's some simple hack we can add.  Like having a
> > global flag which gets set the first time someone pins a CMA page

I have the same worry as Andrew. One system run off rails, we don't try
to slam the brake, but wait 10 seconds instead to do that. Lucky we have
noticed people the risk.

> 
> We would likely have to do that for any GUP on such a page (FOLL_GET |
> FOLL_PIN), both from gup-fast and gup-slow.

There could be such GUP page, not always? This feature is an opt-in for
users, they can decide or tune the waiting time too?

My personal opinion. I will not suggest people to use it in RHEL, while
other people feel free to try it as the risk has been warned.

> 
> Should work, but IMHO can be optimized later, on top of this series.
> 
> -- 
> Cheers,
> 
> David / dhildenb
> 



  reply	other threads:[~2025-06-14  2:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 10:11 [PATCH v5 0/5] kdump: crashkernel reservation from CMA Jiri Bohac
2025-06-12 10:13 ` [PATCH v5 1/5] Add a new optional ",cma" suffix to the crashkernel= command line option Jiri Bohac
2025-06-12 10:16 ` [PATCH v5 2/5] kdump: implement reserve_crashkernel_cma Jiri Bohac
2025-06-12 10:17 ` [PATCH v5 3/5] kdump, documentation: describe craskernel CMA reservation Jiri Bohac
2025-06-12 10:18 ` [PATCH v5 4/5] kdump: wait for DMA to finish when using CMA Jiri Bohac
2025-06-12 23:47   ` Andrew Morton
2025-06-13  9:19     ` David Hildenbrand
2025-06-14  2:41       ` Baoquan He [this message]
2025-06-19 12:46       ` Jiri Bohac
2025-06-12 10:20 ` [PATCH v5 5/5] x86: implement crashkernel cma reservation Jiri Bohac
2025-08-20 15:46 ` [PATCH v5 0/5] kdump: crashkernel reservation from CMA Breno Leitao
2025-08-20 16:20   ` Jiri Bohac
2025-08-21  8:35     ` Breno Leitao
2025-08-22 19:45       ` Jiri Bohac
2025-10-03 15:51 ` Breno Leitao
2025-10-06  8:16   ` David Hildenbrand
2025-10-06 16:25     ` Breno Leitao
2025-10-06 16:45       ` David Hildenbrand
2025-10-06 23:34         ` Tao Liu
2025-10-07  3:55         ` Baoquan He
2025-10-07  9:11           ` Jiri Bohac
2025-10-08 10:42           ` Breno Leitao
2025-10-13  4:03             ` [External] " Zhongkun He
2025-10-13  8:00               ` David Hildenbrand
2025-10-14  7:36                 ` Zhongkun He
  -- strict thread matches above, loose matches on Subject: below --
2025-05-30 20:23 [PATCH v4 " Jiri Bohac
2025-05-30 20:29 ` [PATCH v4 4/5] kdump: wait for DMA to finish when using CMA Jiri Bohac
2025-06-03 13:15   ` David Hildenbrand
2025-06-03 15:59     ` Jiri Bohac
2025-06-03 16:25       ` David Hildenbrand
2025-06-04  7:40         ` Jiri Bohac
2025-06-04  7:42           ` David Hildenbrand
2025-06-04  8:15             ` [PATCH v5 " Jiri Bohac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aEzhcIouq6OfJAF6@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=dhildenb@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=jbohac@suse.cz \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltao@redhat.com \
    --cc=mhocko@suse.cz \
    --cc=piliu@redhat.com \
    --cc=prudo@redhat.com \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox