Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1796161lqg; Mon, 4 Mar 2024 04:17:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX3ihnWE8JIEbYfIsl10YfswXLU6fX3jmVSJ5Bq4DSbyHH+qbMHUfNkjGZuYQgYbwFxVDELRn+acVp0p11YnIvUkQhETx2l0eC1Jb3gig== X-Google-Smtp-Source: AGHT+IEh3WyMqRzGpV5Mi6G0zbLqF6YJscytNRmrgilUMBJc5fAkPvpOqlQxaamHVWjZPdtXsB5t X-Received: by 2002:a17:902:eed5:b0:1db:4941:f703 with SMTP id h21-20020a170902eed500b001db4941f703mr8660726plb.15.1709554656906; Mon, 04 Mar 2024 04:17:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709554656; cv=pass; d=google.com; s=arc-20160816; b=bzsiuO2zThWpq5KSPxS3//UlFPSqBJVVPfcdNo/ekkHSAFQlw/w1mN52GAnd56dSvW rkq5tV3dVZUFQt5Q1cbGwR9Tulph08rzEM2RDzo3C2RSnF5VBHzDioDVg8YbL9sfmp6X 1aJNTdiSAdXStAt2/3Txf23NzhjQjZOvyRIWnfCoE8ZSIYqJEo86WNs8VK4KczO8faAy IUnPwHYgDx6PX8TvhplL0Xmlcip11b18NaUzDq9OSnBeFscdhXKiVJbNz5y6wAvXPPy5 Ld4FmFbopFJuXABEiixaNqXZ+6CKxsk0VeTYzVDNIVnxt+Ke0+lhFDpSOFs9DYI0zHQj 8dag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=2/OpsSfkol7Tk9j6KdIL9o+VGz/mkNNVEHFgCPAggJ8=; fh=u0Jus5M/3O64lo+2pYPzb+4usW2GwlE3YsM7pxRYvfQ=; b=T7xYc38ffddY7hzWwOknFb5eTSKFV8JVlJdTIhDQ08TbZQwzRzJoHjvRfS3+WSPdeU P83MnIQVWmF5uHEuekQpECegQygAGCen+upg5oeDEpEy7TgbmLPCi3VpLDSX3r8Bo9QL X6oQeDHvo8FSxzVK5k+Uwj1s/TKN3my2t8IaZJGVF+x1SXYAbYDX9bBFaSvfyLn0IsdO eZzs22Z7yqzF2aUYHEA3s7BmfXBPiNR9+ieZNkZ5jzJSikk4nN1qM05J3gPXgoYCV136 beSd/NPAE7lZx28F2GMiuXZVgTJbt6rWrxGzmGt4Lsxj2TJk6l5Ihtx7XB1mr+KfKNLM 3dXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-90558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u2-20020a170902e80200b001dccec27e71si3838938plg.384.2024.03.04.04.17.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 04:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-90558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 91535B21501 for ; Mon, 4 Mar 2024 12:17:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88DF73F8FF; Mon, 4 Mar 2024 12:15:15 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 8232D3C6BA; Mon, 4 Mar 2024 12:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709554515; cv=none; b=lVCp/wyoftYpCGDIlTIB8AN1aRIvKNASZ2NabD97ceCiCQ1N30b5hDN+kS7twl/VQCITx8gIvOx3ZeNkJSewZjDeGwvZGl2pf4E3XZVwyzZannMFUef6jrDj/F7Y1FBOGkcI33D8WdVxuLPZqj8E4V4xxnIE0ecOtL2xijiy7nc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709554515; c=relaxed/simple; bh=lwP4RibQzl0xJaFX0Gi7RsrGXSdIQk+HatR8ivh4sEw=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=Vb8Q9yfCVTsM36f0pNTf4Xrj5tZu161j+h8okHvVMOi3KqtOLZCo9z55EBlzEe0l5b5FNVrcwU4CQjQHW42S2VRk0x08dyii0J6HBy4TKWRDmbX0mLP7IQwXifTGbi+uiCyZe1YoxFNOLkR8wN5FESuiW+jYp7TYSe4wgYDd8z4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TpHdW29K8z2Bf7Q; Mon, 4 Mar 2024 20:12:47 +0800 (CST) Received: from kwepemm600017.china.huawei.com (unknown [7.193.23.234]) by mail.maildlp.com (Postfix) with ESMTPS id B4F691A016E; Mon, 4 Mar 2024 20:15:06 +0800 (CST) Received: from [10.174.179.234] (10.174.179.234) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 4 Mar 2024 20:15:05 +0800 Message-ID: <5c883e3c-e96c-c6ba-7797-dc48de4698ca@huawei.com> Date: Mon, 4 Mar 2024 20:15:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [bug report] dead loop in generic_perform_write() //Re: [PATCH v7 07/12] iov_iter: Convert iterate*() to inline funcs To: David Howells , Linus Torvalds CC: Al Viro , Jens Axboe , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , , , , , , Kefeng Wang References: <20230925120309.1731676-1-dhowells@redhat.com> <20230925120309.1731676-8-dhowells@redhat.com> <4e80924d-9c85-f13a-722a-6a5d2b1c225a@huawei.com> <769021.1709553367@warthog.procyon.org.uk> From: Tong Tiangen In-Reply-To: <769021.1709553367@warthog.procyon.org.uk> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600017.china.huawei.com (7.193.23.234) 在 2024/3/4 19:56, David Howells 写道: > Linus Torvalds wrote: > >> Actually, I think the right model is to get rid of that horrendous >> .copy_mc field entirely. >> >> We only have one single place that uses it - that nasty core dumping >> code. And that code is *not* performance critical. >> >> And not only isn't it performance-critical, it already does all the >> core dumping one page at a time because it doesn't want to write pages >> that were never mapped into user space. >> >> So what we can do is >> >> (a) make the core dumping code *copy* the page to a good location >> with copy_mc_to_kernel() first >> >> (b) remove this horrendous .copy_mc crap entirely from iov_iter >> >> This is slightly complicated by the fact that copy_mc_to_kernel() may >> not even exist, and architectures that don't have it don't want the >> silly extra copy. So we need to abstract the "copy to temporary page" >> code a bit. But that's probably a good thing anyway in that it forces >> us to have nice interfaces. >> >> End result: something like the attached. >> >> AGAIN: THIS IS ENTIRELY UNTESTED. >> >> But hey, so was clearly all the .copy_mc code too that this removes, so... > > I like it:-) > > I've tested it by SIGQUIT'ing a number of processes and using gdb to examine > the coredumps - which seems to work - at least without the production of any > MCEs. I'm not sure how I could test it with MCEs. I'm going to test the coredump with the MCE. > > Feel free to add: > > Reviewed-by: David Howells > Tested-by: David Howells > > That said, I wonder if: > > #ifdef copy_mc_to_kernel > > should be: > > #ifdef CONFIG_ARCH_HAS_COPY_MC > > and whether it's possible to find out dynamically if MCEs can occur at all. MCE can occur during the use of a page. So i think it occurs dynamically. Thanks, Tong > > David > > .