Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1422263rdb; Wed, 6 Dec 2023 20:24:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHH3sDdRN64zRpq5I7KbYT+pBXN1qvmIaIY0htZJPQ0FQ1tI8NJYXuDHgmz6doKSbrDmpb X-Received: by 2002:a05:6358:7607:b0:170:5eb:522d with SMTP id r7-20020a056358760700b0017005eb522dmr2266806rwg.0.1701923076043; Wed, 06 Dec 2023 20:24:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701923076; cv=none; d=google.com; s=arc-20160816; b=I9rw0plMOyg2L3naBPKOk0/ACc15C39edPBklnnXZrcDZhMgYO5k2QsAtILv9mBERL JjMyqCGUQ6j3tNXptdmYRBRvb8QOSnAwQvfqTUTcZ2j2VtuwM70Tb2x8Z2UXNDtSEH5X hxiPh6YvGPXgxnDQEFRg7b66eRWaFcEaJhxllvf5DsaMctFjQMc+9Y7kFkYpWCM8O/oR p4YK16wLIQcQKXbsDvcnJtMITt/fAVS6FNrRHHceBF7KagllQPLXr//JVsZp1lKBFuGN oSIGu4Iaytk1Nd3mUqJaAijKdXMVk71aCNkf9pyK9Ab3q6xdkLK06b2UuNNzHbDUJTEy uZqA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ulgd6APR6tJoXOtI6Z0BNkxh6DNgXO1Xqt99EIAg7hA=; fh=vH+h2UJj637T9orYQM5g5sOJ2Hj78F1zOw6nRgTtjJ4=; b=Mqc3XJdJ2kBSzN8sm3PiixZjsNddp+UeakgcwjcPBOvij5a/w/j0NGwILZwcEJXaH0 xTAZBkCh0jRmpV/Z0MbSveK4QS/4MimISmQTdwkpiR5y2tv9iy8Brd0TRhyPiWZzDfRN CfQv9aL36u/zXiudPnEtOllT460yzqo63H1o3YNQUsamqBv/t7/TclWr+JP1d7Yb2FN0 TE6JckqtX0Yys6pTUTHmCVZPiVeQSjBLD2TQelVS+cq08TNZPZQKbCD/Iv4PmZ6k6cjg 3dvIOwUu5olidQ51U/p1YLO616mFnq8xVHqrMdmuJ5iNvnP4eK9cw6F2Cc6P8nC4khwO jO0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KLIoyKuI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b4-20020a17090a800400b002806cdeecc6si407108pjn.35.2023.12.06.20.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:24:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KLIoyKuI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 116D080966E6; Wed, 6 Dec 2023 20:23:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbjLGEXR (ORCPT + 99 others); Wed, 6 Dec 2023 23:23:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjLGEXP (ORCPT ); Wed, 6 Dec 2023 23:23:15 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6478CA9 for ; Wed, 6 Dec 2023 20:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701923000; 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: in-reply-to:in-reply-to:references:references; bh=Ulgd6APR6tJoXOtI6Z0BNkxh6DNgXO1Xqt99EIAg7hA=; b=KLIoyKuIwXDp1WSzW+Ay/qKvfR/JVILpaWuBGlN/LmC63j7SRsIaHOnyErHtD1oAy0wFkK LBL3SfoDeC2LHPiinxtH3tYB1v7yRo4bNKwBhkh/YrQeDvrppkDEe0Hvvi5YDJwiaCos9a gnm8baq5SvKm7OkJWqe2woSLL0w7Rn8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-SiG50LfSPIKl9dSEpEVupw-1; Wed, 06 Dec 2023 23:23:17 -0500 X-MC-Unique: SiG50LfSPIKl9dSEpEVupw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37C781C05AE8; Thu, 7 Dec 2023 04:23:17 +0000 (UTC) Received: from localhost (unknown [10.72.113.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C10C8CD0; Thu, 7 Dec 2023 04:23:16 +0000 (UTC) Date: Thu, 7 Dec 2023 12:23:13 +0800 From: Baoquan He To: Michal Hocko Cc: Philipp Rudo , Donald Dutile , Jiri Bohac , Pingfan Liu , Tao Liu , Vivek Goyal , Dave Young , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH 0/4] kdump: crashkernel reservation from CMA Message-ID: References: <20231201123353.2b3db7fa@rotkaeppchen> <20231201165113.43211a48@rotkaeppchen> <20231206120805.4fdcb8ab@rotkaeppchen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 20:23:36 -0800 (PST) On 12/06/23 at 04:19pm, Michal Hocko wrote: > On Wed 06-12-23 14:49:51, Michal Hocko wrote: > > On Wed 06-12-23 12:08:05, Philipp Rudo wrote: > [...] > > > If I understand Documentation/core-api/pin_user_pages.rst correctly you > > > missed case 1 Direct IO. In that case "short term" DMA is allowed for > > > pages without FOLL_LONGTERM. Meaning that there is a way you can > > > corrupt the CMA and with that the crash kernel after the production > > > kernel has panicked. > > > > Could you expand on this? How exactly direct IO request survives across > > into the kdump kernel? I do understand the RMDA case because the IO is > > async and out of control of the receiving end. > > OK, I guess I get what you mean. You are worried that there is > DIO request > program DMA controller to read into CMA memory > > boot into crash kernel backed by CMA > DMA transfer is done. > > DIO doesn't migrate the pinned memory because it is considered a very > quick operation which doesn't block the movability for too long. That is > why I have considered that a non-problem. RDMA on the other might pin > memory for transfer for much longer but that case is handled by > migrating the memory away. > > Now I agree that there is a chance of the corruption from DIO. The > question I am not entirely clear about right now is how big of a real > problem that is. DMA transfers should be a very swift operation. Would > it help to wait for a grace period before jumping into the kdump kernel? On system with hardware IOMMU of x86_64, people finally had fixed it after very long history of trying, arguing. Until 2014, HPE's engineer came up with a series to copy the 1st kernel's iommu page table to kdump kernel so that the on-flight DMA from 1st kernel can continue transferring. Later, these attempts and discussions were converted codes into mainline kernel. Before that, people even tried to introduce reset_devices() before jumping to kdump kernel. But that was denied immediately because any extra unnecessary actions could cause uncertain failure of kdump kernel, given 1st kernel has been in an unpredictable unstable situation. We can't guarantee how swift the DMA transfer could be in the cma, case, it will be a venture. [3] [PATCH v9 00/13] Fix the on-flight DMA issue on system with amd iommu https://lists.openwall.net/linux-kernel/2017/08/01/399 [2] [PATCH 00/19] Fix Intel IOMMU breakage in kdump kernel https://lists.openwall.net/linux-kernel/2015/06/13/72 [1] [PATCH 0/8] iommu/vt-d: Fix crash dump failure caused by legacy DMA/IO https://lkml.org/lkml/2014/4/24/836 > > > Also if direct IO is a problem how come this is not a problem for kexec > > in general. The new kernel usually shares all the memory with the 1st > > kernel. > > This is also more clear now. Pure kexec is shutting down all the devices > which should terminate the in-flight DMA transfers. Exactly. That's what I have been noticing in this thread.