Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3696891rdh; Tue, 28 Nov 2023 00:59:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHS2QQMeqOsx5tv25K2nFeJp48kBYquZFFsqUkvIY8lPq4UoN1tjBkM8Yc//mdniGy2xUDq X-Received: by 2002:a17:90b:4d8b:b0:27d:9f6:47a3 with SMTP id oj11-20020a17090b4d8b00b0027d09f647a3mr16970750pjb.31.1701161952150; Tue, 28 Nov 2023 00:59:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701161952; cv=none; d=google.com; s=arc-20160816; b=FSYFAFzOTWJOfNF4R7NPyFKmg3chrcXmC3xUXnynFq40Ykqr8DT0x4pk0/u/gxiFJR IixiwGB0DLHsqemZ/Pb5tKDfP2F5fxgHYByP8vWwanv/AhXv+O2GFnAzdjUiSjAhughO 9q/PRxS/h97b2D7qEaOhj4Il4YhbnRqISeeuv27gYghkWb/2lghai055rX8yT1Sp8OYm hZgasj1wNGAOOXgzhp+/uQve73kUEe3/I/3UeHVa42w3CSZpoiGxkuzOSsaKITFSS0MS v4fU4ZGb18myUZqIQ032YwpJZpE46AlYt3O/hrpLqkuoeMTQNCg0lkA0FSpDlI/emrqf 3//w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZoLpAFqGPNeS9MrV0uEMJZFb9NoJTtQ5VVbSwayxYvw=; fh=SmWYJObpKfeHZ0g+Yjxxjsw+s5Q+XkU1Gds4FgF63Y8=; b=XcLKghqY3N8hJfyelw4wLy9H7/Zpwwa37Gry11Kyt9MPIqz/vYsV9C7ZfqCZ+M6qJZ i05G5/YQV6cqqShgZqI6GRITZP1WK2TJMNx37H/ianWwfWrm3qfY0WZqvYhQcDsRv3sp MkKfD87Y4dpyeIq0R957R4905vZJ6SU3A/jUiTGDRm4kPv2QKIWxUSguI88AeRlkDvD3 AJQ8CanrZwRf7Jyg29lRbh5y5mdqw4n4gZWmhaQSncEegUZYZWVLCQyETJ0vXf90RTrb GZZTMkttYHFLEtpiQ/4dkHcuvQ/TAbk+m1xuxhp0Sp1w6s9NM47Sb8KNQavVMTsWCxM7 1tgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id c7-20020a170902724700b001cff3a03c8bsi1382225pll.496.2023.11.28.00.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:59:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C45B4805191E; Tue, 28 Nov 2023 00:59:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344322AbjK1I6w (ORCPT + 99 others); Tue, 28 Nov 2023 03:58:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231902AbjK1I6v (ORCPT ); Tue, 28 Nov 2023 03:58:51 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0919C194 for ; Tue, 28 Nov 2023 00:58:57 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A965D21987; Tue, 28 Nov 2023 08:58:55 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 90A6213763; Tue, 28 Nov 2023 08:58:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id pOlCIM+rZWXNUwAAD6G6ig (envelope-from ); Tue, 28 Nov 2023 08:58:55 +0000 Date: Tue, 28 Nov 2023 09:58:46 +0100 From: Michal Hocko To: Pingfan Liu Cc: Jiri Bohac , Tao Liu , Baoquan He , Vivek Goyal , Dave Young , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/4] kdump: crashkernel reservation from CMA Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Level: Authentication-Results: smtp-out1.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: A965D21987 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:59:09 -0800 (PST) On Tue 28-11-23 10:07:08, Pingfan Liu wrote: > On Sun, Nov 26, 2023 at 5:24 AM Jiri Bohac wrote: > > > > Hi Tao, > > > > On Sat, Nov 25, 2023 at 09:51:54AM +0800, Tao Liu wrote: > > > Thanks for the idea of using CMA as part of memory for the 2nd kernel. > > > However I have a question: > > > > > > What if there is on-going DMA/RDMA access on the CMA range when 1st > > > kernel crash? There might be data corruption when 2nd kernel and > > > DMA/RDMA write to the same place, how to address such an issue? > > > > The crash kernel CMA area(s) registered via > > cma_declare_contiguous() are distinct from the > > dma_contiguous_default_area or device-specific CMA areas that > > dma_alloc_contiguous() would use to reserve memory for DMA. > > > > Kernel pages will not be allocated from the crash kernel CMA > > area(s), because they are not GFP_MOVABLE. The CMA area will only > > be used for user pages. > > > > User pages for RDMA, should be pinned with FOLL_LONGTERM and that > > would migrate them away from the CMA area. > > > > But you're right that DMA to user pages pinned without > > FOLL_LONGTERM would still be possible. Would this be a problem in > > practice? Do you see any way around it? > > > > I have not a real case in mind. But this problem has kept us from > using the CMA area in kdump for years. Most importantly, this method > will introduce an uneasy tracking bug. Long term pinning is something that has changed the picture IMHO. The API had been breweing for a long time but it has been established and usage spreading. Is it possible that some driver could be doing remote DMA without the long term pinning? Quite possible but this means such a driver should be fixed rather than preventing cma use for this usecase TBH. > For a way around, maybe you can introduce a specific zone, and for any > GUP, migrate the pages away. I have doubts about whether this approach > is worthwhile, considering the trade-off between benefits and > complexity. No, a zone is definitely not an answer to that because because a) userspace would need to be able to use that memory and userspace might pin memory for direct IO and others. So in the end longterm pinning would need to be used anyway. -- Michal Hocko SUSE Labs