From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D4CEC282C5 for ; Mon, 3 Mar 2025 12:33:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A826A6B007B; Mon, 3 Mar 2025 07:33:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A33D66B0083; Mon, 3 Mar 2025 07:33:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FA626B0085; Mon, 3 Mar 2025 07:33:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 71AAC6B007B for ; Mon, 3 Mar 2025 07:33:33 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2428380846 for ; Mon, 3 Mar 2025 12:33:33 +0000 (UTC) X-FDA: 83180180706.03.217851B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf29.hostedemail.com (Postfix) with ESMTP id 1D27212000C for ; Mon, 3 Mar 2025 12:33:30 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf29.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741005211; a=rsa-sha256; cv=none; b=cDBlXkPHdA2IhaNRUaxELSaFdBSVUrmoR5QBUfXEUgNXGCWsmFot5ZIaqZf2M3NF+p6qVt WeByml11L/S17Hza5Bn5PFH3b0I2s0MRaFK/4bCsptsnmjDwH9gfXlVY6loqhOCYZ5R65L RselKp+V4YTLAgabv+vKC61vt8rGc8k= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf29.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741005211; h=from:from:sender: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=+9Sf78uyRyAlzq1GcXsT4BAq04JMrjscS55GfNp05pA=; b=UUD9OPz1eHtzli66dImRkZiBayHXqTB4m0j3R5jkuNE1m1W/2QgnPkpNVuO0v6fQcQVX8L xnk2WNdINBUOP1tLUYCwQo6K4P+Cbirq2rAbc09x0Q29JMpZ/ZBnf9vZlvngkiH3ahYxnF 143N/12RF7OIpsfSqc3L+xwny+7vcHE= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58026106F; Mon, 3 Mar 2025 04:33:44 -0800 (PST) Received: from [10.1.26.155] (XHFQ2J9959.cambridge.arm.com [10.1.26.155]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E4DD33F673; Mon, 3 Mar 2025 04:33:27 -0800 (PST) Message-ID: <8b218b95-f0e3-424c-815f-5131e3e54031@arm.com> Date: Mon, 3 Mar 2025 12:33:26 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 4/4] Revert "x86/xen: allow nesting of same lazy mode" Content-Language: en-GB To: David Hildenbrand , Andrew Morton , "David S. Miller" , Andreas Larsson , Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "Matthew Wilcox (Oracle)" , Catalin Marinas Cc: linux-mm@kvack.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org References: <20250302145555.3236789-1-ryan.roberts@arm.com> <20250302145555.3236789-5-ryan.roberts@arm.com> <75031fe1-50d7-48d0-87bb-9c5c88f3b41c@redhat.com> From: Ryan Roberts In-Reply-To: <75031fe1-50d7-48d0-87bb-9c5c88f3b41c@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 1D27212000C X-Stat-Signature: mcos8u48xgyn31dp9sqxcmjzqnnz53nd X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1741005210-842560 X-HE-Meta: U2FsdGVkX18khKdO1jpzqVN48+lFxyYMKW1DfWj/Y/MTxAsNtbTqmutK7o651Qjtfr0rE3cCmXiz6SF51XJilBvAG+L8x7VYnR0IznvvEn9sv+/VTzhX7eb2duVKi11eXlXsfzKcj4kK/lu9VrqA0qmlDOzx6W7M2u58l4Om0AjsQtbrzg0eHwF/p0287+PTWYhw/OtNykAuHZmzRcvlx7gx/F5lEYi8orsy4RqsXda3awl51CupaawDsZSVn9g972e5xjIGgaMTXXSze8mBpTUnewE8HXLf2CY4X348CO2p1BXvdaBbMz08zCZR0DsNcvBwxBbvKeOBApDq1INfn2CzeI0RahVwg9Ko6wE1KE3Gj1XN6K1HDXWyEAuZCccCqf5pOVzUAXFZIh4mABGXWGY2HO2VAOEnyGdppmwkc2OMpRh5PN9ZOKV/nwjUSm1JInxy0A+p3umjZZh5vNcVu76vKr5XOCKhZCgba3KkFTEPT0e79H75CuQgDzcx4/UvXLn5LaW+KNAt8Skg36xZr5N7zuBvkS+gGdAk26FjtqOAAD9fxBJrqWVzoMYCg4JNXq3Oyhs83sSIXvQ0pKJdjQxPMFKhfnbup+kpB66cmVkiREOjbv1dwKyy7C3etruohumHIY+yBTBYlCqhWgnJY6w/8P53LfOikOj1d1qJ5E6L5yjLuLCFVPH6vgOII+gs6QutAvqwzrfk7d49euhosYIyfKqPXQMhWyePI1rjfJt1+TLpSzuEYrX3yJSXMh1hgm9X6XFyYz1SCOP57VKobXWsO5iFzsfhz5QkAn3ldIG6YetnstTilOj9Vxgwpfy8sBk27sUr+iQ/jrJY6yyp2ct75wE2uf2zrHfMLicemfdIJuZWLkVjUX//5cvGCFqvWHf6s2NYaJ1f1dZJ4fBRQhF4XkZT/FHDvNyympVKuyQTw4qEmNE+HNuIkkpM3XdBAxm9bhYepe0sZ7Ue0Fz SfKVci6x o4Ffd0oeR+i2F/vNTgH9aPQu/P6oqVgGhFLtaI59IBimwGDk/ugqspSfjUXPHYHwjdRtLQXn2x3Yumy9SADA4mYJ23eot3xqkFoX6ruKDfLR2BoD3HnAIA1yqiSSHOOohHgFKfXs7t53Z1+AginGhTz9bnCs8K7P9es2dPLSDdhrjx44EJEAvvyp7G3vrgDPoMXktNdI9W1wZ3d6HYP7t3r9jiLDxXFLojO3i X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 03/03/2025 11:52, David Hildenbrand wrote: > On 02.03.25 15:55, Ryan Roberts wrote: >> Commit 49147beb0ccb ("x86/xen: allow nesting of same lazy mode") was >> added as a solution for a core-mm code change where >> arch_[enter|leave]_lazy_mmu_mode() started to be called in a nested >> manner; see commit bcc6cc832573 ("mm: add default definition of >> set_ptes()"). >> >> However, now that we have fixed the API to avoid nesting, we no longer >> need this capability in the x86 implementation. >> >> Additionally, from code review, I don't believe the fix was ever robust >> in the case of preemption occurring while in the nested lazy mode. The >> implementation usually deals with preemption by calling >> arch_leave_lazy_mmu_mode() from xen_start_context_switch() for the >> outgoing task if we are in the lazy mmu mode. Then in >> xen_end_context_switch(), it restarts the lazy mode by calling >> arch_enter_lazy_mmu_mode() for an incoming task that was in the lazy >> mode when it was switched out. But arch_leave_lazy_mmu_mode() will only >> unwind a single level of nesting. If we are in the double nest, then >> it's not fully unwound and per-cpu variables are left in a bad state. >> >> So the correct solution is to remove the possibility of nesting from the >> higher level (which has now been done) and remove this x86-specific >> solution. >> >> Fixes: 49147beb0ccb ("x86/xen: allow nesting of same lazy mode") > > Does this patch here deserve this tag? IIUC, it's rather a cleanup now that it > was properly fixed elsewhere. Now that nesting is not possible, yes it is just a cleanup. But when nesting was possible, as far as I can tell it was buggy, as per my description. So it's a bug bug that won't ever trigger once the other fixes are applied. Happy to remove the Fixes and then not include it for stable for v2. That's probably simplest. > >> Signed-off-by: Ryan Roberts > > Acked-by: David Hildenbrand >