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 0EFBBC3ABBC for ; Mon, 12 May 2025 11:00:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFB176B00E6; Mon, 12 May 2025 07:00:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0D276B00E9; Mon, 12 May 2025 07:00:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7183B6B00E7; Mon, 12 May 2025 07:00:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5185C6B00E6 for ; Mon, 12 May 2025 07:00:26 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 62507BE52A for ; Mon, 12 May 2025 11:00:26 +0000 (UTC) X-FDA: 83433962052.22.EE4904F Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf05.hostedemail.com (Postfix) with ESMTP id C8321100015 for ; Mon, 12 May 2025 11:00:24 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of cmarinas@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1747047624; 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: in-reply-to:in-reply-to:references:references; bh=goCNdIPXpmd9jytDCbA84Bed0KYNF17gS9Ylbu3Iw54=; b=lFTdZ/xKQDbSQLDFmUSjxCqPOH5VVpOxgCxIs9OnOp7ddt4H1J/6O1AjhqT6x9erZ3da8M fLH25/UvW+EDrn5UKX/5x2847rxZ07F2iUMz+YAp2YlRQwaHVt7LH6UkkrY+Kv108woHNY FOzm9CyEQm+C/RCHj+RKkl2wfLfjT0I= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of cmarinas@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1747047624; a=rsa-sha256; cv=none; b=RSZ36+yY/t9QdCkseZ91UMmMhADkM8Y9/IX6f8s/D6KnP5hT/MbZKAve7dtf/QxEXymYva eqZlCMr++NOk07XJ9LzsJSuG29APVHnqebFXdmeJVkIoH9JdIZQdYMjvuLyBjySTXSfWwJ gcDUS+79pP8IeORukYOrb9++USoxmec= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 00F24629C6; Mon, 12 May 2025 11:00:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B7EFC4CEEF; Mon, 12 May 2025 11:00:20 +0000 (UTC) Date: Mon, 12 May 2025 12:00:17 +0100 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Pasha Tatashin , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , David Hildenbrand , "Matthew Wilcox (Oracle)" , Mark Rutland , Anshuman Khandual , Alexandre Ghiti , Kevin Brodsky , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, syzbot+5c0d9392e042f41d45c5@syzkaller.appspotmail.com Subject: Re: [PATCH] arm64/mm: Disable barrier batching in interrupt contexts Message-ID: References: <20250512102242.4156463-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250512102242.4156463-1-ryan.roberts@arm.com> X-Stat-Signature: nrjy5x47uboh991ombze411jigtztsum X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C8321100015 X-HE-Tag: 1747047624-260115 X-HE-Meta: U2FsdGVkX18rhx12rZ15+gpvSXooaiNZNAhM/KKJE4p1XVn/DlF/X7Ia4LiugO7/U+FqTiTLvtjKnFMiwn3T1uDrMfwo8SmIgfhkx8F9ympFBBojSqMvGPLDNtblTqxAH0NmUypeMG4Eos4b+bUMD7UJG2JXhvB47erS8eEsE0NW2IRGfXrLpm9chfmeFkHguBf4UjLkFOfwmqXpQF/ioDRx0ibfzfY5lViEQ/yHbfxu7KmdtIHOqYiCep6DW0GWkePrqmDM+2b26n4ZyvQnnsiVEbnvSpMb1azfEKxL+eExrFW+ayU3zZ+8EFiXElWBrcu6g7sMu563pPYfVbdm6DQy8PrpZRrjIGzazlQPbQKl3I957LUi0RU0VDTiM5t/j3LD32ti7ZzweHkds37TLwf7Pk+w/wqx+wwO5Ih+/lgMyQuDJDglXYTTnkgtCufAJvY50ICGFUb8ykWAkBmXoVGgrCt/TAAPqa3siu6GZk7+mj/4cuvpV3/kOkpdsc4fQPiYyznLGonVY+U/r0tngtfEAtEt9lLNjs+e5/9jIAgPnluFvjXYK+YdZwCpgH4Koh8NM/KYiYsnJoO5jD20N4iwc31SHpNAUNVDUPDqu6gm3hqLI5w+/IP6Hpn+spkSxNcNQO5Ip+wJBgjq+4PRxn75Eg1Cm0iTs3FaFRA7QMqrP0QXUboE4m/PpdEeuxKZEemxNLMNMhYf3v8UqNJhz20XoZ4DzxpjfnOhRBwcc2JptT/fFs+oEqnkZ+cn2df4kw+0zirQuadqiiQrkC87x3Vq9g59a0oknuXNspzM+P+Y6UWAJ2OXWOHsIT5CA5gCyfZXZAJZlnFs8nctQZQ+up/hvqqwX5b6p2qWIYaCtiL1bLZeyCzmnxoIvwUAk7NPJnrYJtTMxpyVLMEwdnaWmCvYH4aqFkk6v9eTa+gjCriRQ3ODBY1OvasO81j1VIz/SyA+CcjkFDNXBVNrjTb DVBI2Q9G AWFCfvpCRkTvz2HMDami8yg3YuI4l3LYeqPsQKgqHpkf0aRBeds5uNKBSsb84koimSAB7oMcc3xLXdU733w7C8140yfxs1DZTbKwsORiY4f6nCNXZm9tBFjOy7Fz+aPX7e/YoJjoLV0N1ILWqWO34GxSrFhXbRrxP+nO3NqGxyTBU+ssQkqeYXFNlfYJd/+sHhbuS0QANojO+hq/lRiWhQBdrZ6xkw7sBNVLQpjT5KLjbTpBKUJmg2dk+EQSFQ/PIqQ2ptyJo6SUjDJYRNQtyNdSKKUI3HgdLe8/2txyN7oUKRLGLzla9P6fdP9XI5BDNFu8MukEzXn9mDKC7c8XuwIZenii4C/qdDrudJCNZxZwK3+P8ana30gAQ133Gp/s5HwYOYlUoYVapUKxEGWMGhAVy1kgjKR1YetudtAV2lrcOn/HBqsp8vmkZDCO+IA2l+fbWv0KJ7F+tmXPrUaDEGDFyAUFgPt4NF3fuGaTGYlQvHK5mR8uPHqxnwlNckKVLzcPAUVELbnbGC4jRiQ4lGuibFV6Cw7Gv9m8PUsXaGxhXkiCGh04TrvFEZ5K9PL2ZKE6Qf+zmyfhUNX6myT8Wnfewhgv0plfDRXpn 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 Mon, May 12, 2025 at 11:22:40AM +0100, Ryan Roberts wrote: > Commit 5fdd05efa1cd ("arm64/mm: Batch barriers when updating kernel > mappings") enabled arm64 kernels to track "lazy mmu mode" using TIF > flags in order to defer barriers until exiting the mode. At the same > time, it added warnings to check that pte manipulations were never > performed in interrupt context, because the tracking implementation > could not deal with nesting. > > But it turns out that some debug features (e.g. KFENCE, DEBUG_PAGEALLOC) > do manipulate ptes in softirq context, which triggered the warnings. > > So let's take the simplest and safest route and disable the batching > optimization in interrupt contexts. This makes these users no worse off > than prior to the optimization. Additionally the known offenders are > debug features that only manipulate a single PTE, so there is no > performance gain anyway. > > There may be some obscure case of encrypted/decrypted DMA with the > dma_free_coherent called from an interrupt context, but again, this is > no worse off than prior to the commit. > > Some options for supporting nesting were considered, but there is a > difficult to solve problem if any code manipulates ptes within interrupt > context but *outside of* a lazy mmu region. If this case exists, the > code would expect the updates to be immediate, but because the task > context may have already been in lazy mmu mode, the updates would be > deferred, which could cause incorrect behaviour. This problem is avoided > by always ensuring updates within interrupt context are immediate. > > Fixes: 5fdd05efa1cd ("arm64/mm: Batch barriers when updating kernel mappings") > Reported-by: syzbot+5c0d9392e042f41d45c5@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/linux-arm-kernel/681f2a09.050a0220.f2294.0006.GAE@google.com/ > Signed-off-by: Ryan Roberts As per the request in the original report, please also add: Reported-by: syzbot+5c0d9392e042f41d45c5@syzkaller.appspotmail.com I'll give it a try as well with my configurations and let you know if there are any problems. In the meantime: Reviewed-by: Catalin Marinas