From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0D7B2FC01A; Mon, 27 Oct 2025 13:38:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761572296; cv=none; b=G9SL6bu6QLWOz0TxGcXPKalqLNsaKtwhPgjmzEa8rSdIy1/IhjtaiEHvmuW2lqmdUhbHlFumeDmWPcxS3scLQifBWlDraOHIORC6JxerODTX9COIQ3SB6bp+B+I1puo6Cn49TOWSTwoK+BiWwZjDgP83eWKdJyEzi6jyMY6IEIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761572296; c=relaxed/simple; bh=Yg4tHkrWB8iD6I0E177EhXaJTLbrmVH+67p7EVU8ik0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KEJtbprONvRvGYGXGGVZcRBNm/zToYCHQXxBVo/q17HEKsUHtbYVdFo2u4u9HERD+ypA2+2lhcJOrtUUYcD4POgHBTH4POgCqURi4/pxQuw/nBG3BQNyEUfd4IUemkEUZ+Ydav0wGYBMP9il+gr2vQnwXz0VHJqM7N6KwebceeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 593A4175D; Mon, 27 Oct 2025 06:38:02 -0700 (PDT) Received: from [10.57.68.196] (unknown [10.57.68.196]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0FD233F673; Mon, 27 Oct 2025 06:38:02 -0700 (PDT) Message-ID: <1db69026-199c-4cee-bb3b-1217f8a3afad@arm.com> Date: Mon, 27 Oct 2025 14:38:00 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 11/13] x86/xen: use lazy_mmu_state when context-switching To: David Woodhouse , David Hildenbrand , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Alexander Gordeev , Andreas Larsson , Andrew Morton , Boris Ostrovsky , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dave Hansen , "David S. Miller" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Juergen Gross , "Liam R. Howlett" , Lorenzo Stoakes , Madhavan Srinivasan , Michael Ellerman , Michal Hocko , Mike Rapoport , Nicholas Piggin , Peter Zijlstra , Ryan Roberts , Suren Baghdasaryan , Thomas Gleixner , Vlastimil Babka , Will Deacon , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org References: <20251015082727.2395128-1-kevin.brodsky@arm.com> <20251015082727.2395128-12-kevin.brodsky@arm.com> <348e5f1c5a90e4ab0f14b4d997baf7169745bf04.camel@infradead.org> <6ed9f404-9939-4e9f-b5aa-4253bef46df1@arm.com> <7324616a8d2631aa8132f725f9f6551e3e6b21dd.camel@infradead.org> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: <7324616a8d2631aa8132f725f9f6551e3e6b21dd.camel@infradead.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 24/10/2025 17:17, David Woodhouse wrote: > On Fri, 2025-10-24 at 17:05 +0200, Kevin Brodsky wrote: >> On 24/10/2025 16:47, David Woodhouse wrote: >>> On Thu, 2025-10-23 at 22:06 +0200, David Hildenbrand wrote: >>>> On 15.10.25 10:27, Kevin Brodsky wrote: >>>>> We currently set a TIF flag when scheduling out a task that is in >>>>> lazy MMU mode, in order to restore it when the task is scheduled >>>>> again. >>>>> >>>>> The generic lazy_mmu layer now tracks whether a task is in lazy MMU >>>>> mode in task_struct::lazy_mmu_state. We can therefore check that >>>>> state when switching to the new task, instead of using a separate >>>>> TIF flag. >>>>> >>>>> Signed-off-by: Kevin Brodsky >>>>> --- >>>> Looks ok to me, but I hope we get some confirmation from x86 / xen >>>> folks. >>> I know tglx has shouted at me in the past for precisely this reminder, >>> but you know you can test Xen guests under QEMU/KVM now and don't need >>> to actually run Xen? Has this been boot tested? >> I considered boot-testing a Xen guest (considering the Xen-specific >> changes in this series), but having no idea how to go about it I quickly >> gave up... Happy to follow instructions :) > https://qemu-project.gitlab.io/qemu/system/i386/xen.html covers booting > Xen HVM guests, and near the bottom PV guests too (for which you do > need a copy of Xen to run in QEMU with '--kernel xen', and your > distro's build should suffice for that). > > Let me know if you have any trouble. Here's a sample command line which > works here... > > qemu-system-x86_64 -display none --accel kvm,xen-version=0x40011,kernel-irqchip=split -drive file=/var/lib/libvirt/images/fedora28.qcow2,if=xen -kernel ~/git/linux-2.6/arch/x86/boot/bzImage -append "root=/dev/xvda1 console=ttyS0" -serial mon:stdio Thanks this is helpful! Unfortunately lazy_mmu is only used in the PV case, so I'd need to run a PV guest. And the distro I'm using (Arch Linux) does not have a Xen package :/ It can be built from source from the AUR but that looks rather involved. Are there some prebuilt binaries I could grab and just point QEMU to? - Kevin