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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E9F2C54EBD for ; Thu, 12 Jan 2023 15:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=guJc9T6fOIWHP6bYtfwRG4v9WPXT+DWv51hJCO9AHUY=; b=4B7IHQkCLcIkuI 7WVeBC5zb5N5xZa6NI7f291qXOxID4HaWlrlsWWvnOoIWp8chJrlOITgHKJMzTyy/XuofO2m9wwAM 0kvSJvut1qwzrg4xBPipG2QVlnh9R5ryYf1dtyY7JezeuN0zcwbq2y8DI+wJQlOvd/LZX5FvTDcGn H8y5amMS2lfW4u6Kv/FlO9c45Ona3xJX8BlQ1IeXYtxXRmbu5PTD+slm7Clun0/KT5jw8nE+hGpER LQ7KFZGITETcEWFYlebW6Pkx7N4oJLUvWKpgTTa2JbXqRq9jjImLfl/txeqb+ZvDRd+O7JDD02Kln QhTWfVTb4PDiaMTmhItg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFzlP-00FjOF-8N; Thu, 12 Jan 2023 15:45:11 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFzl9-00FjLm-Ou for linux-arm-kernel@lists.infradead.org; Thu, 12 Jan 2023 15:45:09 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64535B81E72; Thu, 12 Jan 2023 15:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 013D9C433D2; Thu, 12 Jan 2023 15:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673538293; bh=/PZ5vXzNnZEX5lWeDeEnqyVs/kvjGL1YUm9pnpiT5hg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EuTukSA4kvNgD5mRnsEVW8yskuoL06z/Te5dbT2u10lEhHqcjd3QqSJMdRGllHBuF SRsRXGrroX2M6FsRy+NXgBd2hXTHTWzZi/4AJx/OflLX1GvF8q3rq7CW7wG0bRpxGn Tb8j7lrG2qlMzpPl6j+jjRRrBqrXH9hlFkXWtRY0xW761ffNM51QIDime/Fs8y6mPm OUzeau9rxYoyd9au5XNURvad18UyWAFIJJhCBOn3IAh4z2YF9dVHNQbKbggutCmeD7 F1oQg12x0+Ewj7+Ah4WO5356NRbeofvXnM6b0GXW8IeY/6xTCSbEcc7/YE3QCt1Sil P6CRD1jasoPPw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pFzl4-001EZU-Eh; Thu, 12 Jan 2023 15:44:50 +0000 Date: Thu, 12 Jan 2023 15:44:50 +0000 Message-ID: <86bkn3oiz1.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: James Morse , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Quentin Perret , Will Deacon , Reiji Watanabe Subject: Re: [PATCH 4/5] KVM: arm64: Correctly handle page aging notifiers for unaligned memlsot In-Reply-To: <20230111000300.2034799-5-oliver.upton@linux.dev> References: <20230111000300.2034799-1-oliver.upton@linux.dev> <20230111000300.2034799-5-oliver.upton@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, qperret@google.com, will@kernel.org, reijiw@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230112_074508_470242_B8C99F71 X-CRM114-Status: GOOD ( 21.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 11 Jan 2023 00:02:59 +0000, Oliver Upton wrote: > > Userspace is allowed to select any PAGE_SIZE aligned hva to back guest > memory. This is even the case with hugepages, although it is a rather > suboptimal configuration as PTE level mappings are used at stage-2. > > The page aging notifiers have an assumption that the spefified range > is exactly one page/block of memory, which in the aforementioned case is > not necessarily true. All together this leads to a rather obvious kernel > WARN when using an unaligned memslot: > > However, the WARN is only part of the issue as the table walkers visit > at most a single leaf PTE. For hugepage-backed memory that is at a > suboptimal alignment in the memslot, page aging entirely misses accesses > to the hugepage at an offset greater than PAGE_SIZE. > > Pass through the size of the notifier range to the table walkers and > traverse the full range of memory requested. While at it, drop the WARN > from before as it is clearly a valid condition. Rather than changing the low-level walker, with the oddity that it generates (patch #3), couldn't we instead just iterate over the range and only process one entry at a time? All we need to know is the level of the last processed entry to progress to the following block... Thoughts? M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel