Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1784751lqg; Mon, 4 Mar 2024 03:56:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVdKF8QWDdEw2g7Xa4edgLDrxYB8tV2eFyRh0e0cot/qKaaKujX3nEBrNwHMhAFgW3rWSMkB63jDTQWDBXuznzuDcWyXdy9jcXXWy98sg== X-Google-Smtp-Source: AGHT+IFgwgAaqj/i/TkuDGDwhnLtmlA3IOMlsEGfv0NeknDR8eyQvLUxQ9WA20QqnFM6yESDlPzP X-Received: by 2002:a17:906:f0d0:b0:a44:6b6b:bae3 with SMTP id dk16-20020a170906f0d000b00a446b6bbae3mr7118747ejb.59.1709553384134; Mon, 04 Mar 2024 03:56:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709553384; cv=pass; d=google.com; s=arc-20160816; b=F4ML91UD0TdZKmvavYdDBR6FjTDABW7x+WZL6DjzjPV7PdSLe2EEbR3GHvpQOkzDqg 2Fi14x29/Jx8Aq7eRk8S9r9l8PKZD/aBRfYkVq/SyH5TLEARW/Xz+PMCacEUe6Lv117B uoEBaCVrHh1sz8S78NI0GBJvEAhDueWfidAd/heXpieYEeywvnJ2DlLkrRhtVKrtH9tM K61iwMv7k6XMnZbm9hXj6qEWdOlOomyaN4M4e0EVpUHsjX0CWdxsr5yiL3ioHhDc3Gch IsvURPIg/BB423SFj02PhWGxz3elD+FPqIV3TNhInUwZ761g3gpUIPNa8mDTQsLzKiSm 2pqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:cc:to:references :in-reply-to:from:organization:dkim-signature; bh=GqekJtMmWl332KPa2AiO9KOFfmzHxStTJwB9RAe/2jE=; fh=GegFhrHyTPI0ZAaR1ls9tHjEAVZDJB3qsWt4OHvAXEs=; b=gsFY2YQuFLB5t0R3jX7r6Eal7xO55PYE7qIEPbl0pQ7+alU6lDGOAANhUl1t0oH8BY hg7cr17khWGL7mJRztrm2XhfQ6TursqlyfbxQeHRDHv1JVYKVgZZfakOusUnTW6AAW1S ANZZhgvJMSs1zm6i706PBmlbSAKXKiNbhEPbfBv899ke1NjNBd1bxbrCbYyinypeGdwE Sb7w5IoJhCfiWX5a+kvIqIf40p0LvgH3fFyCGaxYQQpSNImqbF/CLg85SdS3WzaBoKa1 8LDlzw2ZBHtRe6mNym7b9at2bvXUwRezPFc5stGfSiRqdJE+s2brNT4msiW87b0uXPKJ 1llA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iR8aRbl+; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-90538-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90538-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gn27-20020a1709070d1b00b00a4587464b8fsi50699ejc.125.2024.03.04.03.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 03:56:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90538-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iR8aRbl+; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-90538-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90538-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id D90701F22A10 for ; Mon, 4 Mar 2024 11:56:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB8D63B780; Mon, 4 Mar 2024 11:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iR8aRbl+" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 78D163A1A6 for ; Mon, 4 Mar 2024 11:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709553377; cv=none; b=gGbbKapsWu30bsiAK/WkSrAsxwJUJsVef+De1/6fWNn8nogsIShTnxwHnlmLzCUl3guJoaxFjC7O+iVEPid7V0PAsP8BTKnZSUvQrRj0TKl1Y78awaWZypqiT7rBDE6eg+WoGqLSROgQlvXMdeKNt+rGWymBBtBd58cwIIdNUTQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709553377; c=relaxed/simple; bh=1pxGewzqlg410BVrMDyNZyMJwDst5u/9e4GvFoWghQ8=; h=From:In-Reply-To:References:To:Cc:Subject:MIME-Version: Content-Type:Date:Message-ID; b=bbhFlJ8BrLPFHqdlw5Jf3GeVS++cU7n8hbdhapojHNTQFndbYsGEM7JY1cmUPok8wzSA/5E5KbLVVfLsn+Ty4yhHV3TIFuLUDXCTI6b1uEgkTPivIpQAQyk9AM9TUH2Rio8pNF0Kzv/kAN/cNpBVqW7RsYrNrrOXy8RihbEa+NA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iR8aRbl+; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709553374; 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=GqekJtMmWl332KPa2AiO9KOFfmzHxStTJwB9RAe/2jE=; b=iR8aRbl+67cozs6ePJj2zLL84h1GyGIpOwm7efK0+kPl0dIl3yVC6imp6Vemd22K6dgi13 ikDttAnUfFnyoT6TWhswo/u4ynH//jtTnL6HvMtFTcn0i3umYOSM0XsPtzrUMnN4ibyg3s XQekM8hcPG0D7rvmL+I7J4FLV7ULqXY= 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-636-08FLQKdmPZGagpUscxRpgQ-1; Mon, 04 Mar 2024 06:56:12 -0500 X-MC-Unique: 08FLQKdmPZGagpUscxRpgQ-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 36E213816B4B; Mon, 4 Mar 2024 11:56:11 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id A53AA40C6EBA; Mon, 4 Mar 2024 11:56:07 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20230925120309.1731676-1-dhowells@redhat.com> <20230925120309.1731676-8-dhowells@redhat.com> <4e80924d-9c85-f13a-722a-6a5d2b1c225a@huawei.com> To: Linus Torvalds Cc: dhowells@redhat.com, Tong Tiangen , Al Viro , Jens Axboe , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kefeng Wang Subject: Re: [bug report] dead loop in generic_perform_write() //Re: [PATCH v7 07/12] iov_iter: Convert iterate*() to inline funcs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <769020.1709553367.1@warthog.procyon.org.uk> Date: Mon, 04 Mar 2024 11:56:07 +0000 Message-ID: <769021.1709553367@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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. 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. David