Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1576264rdb; Thu, 7 Dec 2023 03:14:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGh2Df11ngmzREakD4g87RJ3hcYxrWRHtkuzaBo88VrhbxTDqmbD2YNHuQKU3fkbhhM0d8l X-Received: by 2002:aa7:9d9a:0:b0:6ce:63ff:50f0 with SMTP id f26-20020aa79d9a000000b006ce63ff50f0mr2333150pfq.37.1701947657312; Thu, 07 Dec 2023 03:14:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701947657; cv=none; d=google.com; s=arc-20160816; b=0ydbevm3OAP+fP0b+0fA38gXsbY68MdMbDvPJYLAEHMxe/Ggpp3KW2Itgyx5viD/xO z6zweO7JUAlITfIkRGSQmS2T7mkuvW8R33/Wy69/zIbKQdFW9gt22zxictalZ6VoK1Qv ZjMmem6CmPRSzSbRMQPv/gAolAP0KCCjkbuKEakQkKHqv87U2Gi2M1xFXZcGmzbSxxEa DNaBkEVE0MPG44OywH/sj0JjXGk5t0ivHqow7x0yWbiuhJngp0F5HCiZEdTfJthF8D8R a+FG6ycfdPz03zn8ArbybB2xbyC8oy1UeYwXpVDp64xYULVtHcw1teLgFKGkM3Ydshdd wxow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=yEnLporZicOdwXzovzLImpcCBG07E/v0woo+yYuLxfQ=; fh=iGkimpge5THjcKljFOjXF7Y85hWVuFjty+8dneGTFM4=; b=JAhl4C93ZXPDOvd7uljWs2v5js49G0ck10QgEnZFe01HQiczW0iZ6n93HnwzCt13jY 4KxheyfNH5bkaPEK7IE/z8fCqO8/TxGJkCUuw9C7mFWwuENuhvAVSEikk3uR2Q+AW/8J 8lUBs8r/k6z2SL+aHmzb3F0JZIKLGV0NHa+XNSExNcQS2Tse4+JdIs/MtUlZoB/eKIVE aRBPx8OlkiV/RctcLe4/pZDEwSG2PcFul9UexT3AY4CiTx9YJdtjvxlC9yZLZ4G7lpHR DjsSuHS4elUiJbt79FJY0Wj62DEHMqGOhRzQ36u2+Tfn7eH4P2gKW5GQ6iRWsI0O5D7m fWZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bk0a1NWS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id by23-20020a056a02059700b005bd0432d9b0si1075236pgb.100.2023.12.07.03.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:14:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bk0a1NWS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 803F58054617; Thu, 7 Dec 2023 03:14:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232398AbjLGLNo (ORCPT + 99 others); Thu, 7 Dec 2023 06:13:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378965AbjLGLNd (ORCPT ); Thu, 7 Dec 2023 06:13:33 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B2EA10D4 for ; Thu, 7 Dec 2023 03:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701947618; 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; bh=yEnLporZicOdwXzovzLImpcCBG07E/v0woo+yYuLxfQ=; b=bk0a1NWSWKhpRq4SN2lSpj5DY3reCh7TMF6R6FBcF3swKyIAFfqGoisK1L1SZV7Sr21VnL adjn2bfnxJ6bOxZwseNBKB3C4k3XQitNBKOuACo4bnG+oovqSP7ZKPEngVQoyeSKQK9h+6 K268YmTH51UFhbk72Da4Swq7nuV/oIY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-ZijdJiQQOamHdkna9Z4FVw-1; Thu, 07 Dec 2023 06:13:35 -0500 X-MC-Unique: ZijdJiQQOamHdkna9Z4FVw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 A1270862FDF; Thu, 7 Dec 2023 11:13:34 +0000 (UTC) Received: from rotkaeppchen (unknown [10.39.192.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25BAD40C6EB9; Thu, 7 Dec 2023 11:13:33 +0000 (UTC) Date: Thu, 7 Dec 2023 12:13:31 +0100 From: Philipp Rudo To: Michal Hocko Cc: Baoquan He , 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: <20231207121331.59c7e370@rotkaeppchen> In-Reply-To: References: <20231201123353.2b3db7fa@rotkaeppchen> <20231201165113.43211a48@rotkaeppchen> <20231206120805.4fdcb8ab@rotkaeppchen> Organization: Red Hat inc. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:14:14 -0800 (PST) On Wed, 6 Dec 2023 16:19:51 +0100 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. Right that is the scenario we need to prevent. > 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? Please see my other mail. > > 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. Right, it _should_ terminate all transfers. But here we are back at the shitty device drivers that don't have a working shutdown method. That's why we have already seen the problem you describe above with kexec. And please believe me that debugging such a scenario is an absolute pain. Especially when it's a proprietary, out-of-tree driver that caused the mess. Thanks Philipp