From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [81.169.146.167]) (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 3AC5918BBAE for ; Sat, 21 Feb 2026 05:30:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=81.169.146.167 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771651842; cv=pass; b=nEpMvnD8Ga/eqE2gp17rROtVrArIHMLVS5g5s6C0t1H1qOpebmCPpY1x5V7GGSJCcfdn6p2MSvvs+EmfZoGCKp9OOvpAq/1Vk9V6QuPMHjGVhAVogeeO3EstkdOGMwee+A02s93ZlaTdswAJQvagunUvsTrAXFjaHUzfUnLJxdg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771651842; c=relaxed/simple; bh=GgYg7IIESw+/Z7Ty9yZliMLPIBBlrK5OKBRa7U6u6xM=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=K3e4A6KPcmpfMy4Sct3POJWmTzsxz+Xgq6Qo3aGgYxIJPOSXdwduMByiJq3L/yoKBy0H/K7Alip16IA5rxPnx4ly1YYJ2S75thOo4Qh2Lv4xw4/S4pVSJ7eHYTfabNSvnuWHAkvlhw+i56+Wni+IDL7wZh8leOLdEkzlh97NJD0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xenosoft.de; spf=none smtp.mailfrom=xenosoft.de; dkim=pass (2048-bit key) header.d=xenosoft.de header.i=@xenosoft.de header.b=LRGnpI8/; dkim=permerror (0-bit key) header.d=xenosoft.de header.i=@xenosoft.de header.b=csbqOM7V; arc=pass smtp.client-ip=81.169.146.167 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xenosoft.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=xenosoft.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=xenosoft.de header.i=@xenosoft.de header.b="LRGnpI8/"; dkim=permerror (0-bit key) header.d=xenosoft.de header.i=@xenosoft.de header.b="csbqOM7V" ARC-Seal: i=1; a=rsa-sha256; t=1771651819; cv=none; d=strato.com; s=strato-dkim-0002; b=SfRp1dRaWeeEqpo+5Fw/kPzAAp81PAV10Xl3SfKuJNlw2xNc1bbrY/7wKHIathyIvs P1dVHl6vzK7MVFGGLEtv29p1/DVwp9VaKTeg9rYBcnEWj/Fum5u2OAzSTO4WR3X/hz/P PpJ4C0cLmdkZT0OT/7ljqWWTSVN8hJrphvKvTTa2r9/woT+McSj4VCAxosDpFx/OWjxn ZWx6PqI0Fo6U/TGy4yC6YRzHSGVEy21EeCK9aDzBIZQ/LRY4CAZR3vCeBAXZTxb+SimS 8zaE+x+vJdCCBUWU3MHglP7m7mG7g83FWeEJ/VgLSZwx15sB8c7uEXPsiEiNnsiuUzdY dheg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1771651819; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:Date:Message-ID:From:References:Cc:To:Subject:Cc:Date: From:Subject:Sender; bh=xiZA9x3OPQVYWcCMaB4GuifGnS/I0Xs2MqxxsnNhDkg=; b=TitQ7QEJWQ32r+IvuwiVOurqmoXJOoUdUG7w41vL30Ks92G91Ok+S3fIdqAAKo9O9U TP15Eu73LnUFtYCX8fUfIdpdlZMlD2tMVTjpFTDVISWiGIJ/KC8jfmQsK35HDwmKQXJ3 od2rSTYlS1p+rgT64/h33rz3Pfy/3s8a90H17LzXhCMoZnPaYv8nCyS6Kde3DrO70aFF 1MdRCVE0FmghS4+64K/m6m4UTH7imCrocgKpBTHv96FkdBzEJkB5PohGlpVudb5K77VM hP+4CRzedK1HX/hXbpEg/wjq7maGFLyiHDiC6LaKnqmJQDd4ImNmomJgA6u9cngFemvz g9Bg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1771651819; s=strato-dkim-0002; d=xenosoft.de; h=In-Reply-To:Date:Message-ID:From:References:Cc:To:Subject:Cc:Date: From:Subject:Sender; bh=xiZA9x3OPQVYWcCMaB4GuifGnS/I0Xs2MqxxsnNhDkg=; b=LRGnpI8/yHS481WpwxjWL5B/7tcjSGqvByvmBzu9km3uMpuMBk59ei81W1qfHzWUhR WID1uk1ZhMnwgpNM8Y7DGMvxCu9iOTheb/0wnqFsGHPb0g6A89vHrQH1zQnrDmnCNgGf 2mxvAIkOpZLUElxtOUhBoA6WYqslO9mV8oE9svQtvAvth2AIyG+SKQOOfHOdc70jPyz9 qisl4mPRaDiS1PxDzAjvxc80LeF4Lb0iPYEa2AjKwpXTXAE7OqcwQVAxjXeP+2dRipmw IAEUGGiJw273rX8sigy93/AcglsLmrWaenQyEHHMLzib0fi201eFGxVF0nc9DXLlaccw 23lQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1771651819; s=strato-dkim-0003; d=xenosoft.de; h=In-Reply-To:Date:Message-ID:From:References:Cc:To:Subject:Cc:Date: From:Subject:Sender; bh=xiZA9x3OPQVYWcCMaB4GuifGnS/I0Xs2MqxxsnNhDkg=; b=csbqOM7Vi04DhAntFW8BsxnGc9zeaJfPeSF/88AbgIsyuwoByIxdfyWPQQLVztbfIN kmNaj6jIfyVgK3cwB9DA== X-RZG-AUTH: ":L2QefEenb+UdBJSdRCXu93KJ1bmSGnhMdmOod1DhGN0rBVhd9dFr4thIFiqT9BURIi+m7Bzg" Received: from void-ppc.a-eon.tld by smtp.strato.de (RZmta 55.0.1 DYNA|AUTH) with ESMTPSA id e9337f21L5UIc3u (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 21 Feb 2026 06:30:18 +0100 (CET) Subject: [Linux PPC] KVM PR and KVM HV do not work if the kernel was compiled with PREEMPT To: Shrikanth Hegde , linuxppc-dev , "kvm-ppc@vger.kernel.org" , Madhavan Srinivasan Cc: "R.T.Dickinson" , hypexed@yahoo.com.au, mad skateman , Christian Zigotzky References: <185d7a42-f7b4-44e1-a129-f5989d211c74@linux.ibm.com> <40154f6a-39da-959d-e039-5ab9ff62db3c@xenosoft.de> <709b864f-9daa-4a48-b3d6-39baedce63b2@linux.ibm.com> <843b7c60-23f1-47d0-b4e8-2147c3e40c23@linux.ibm.com> <2a27e6fc-7eb4-41a5-ba88-58f6a22625b5@xenosoft.de> <1d79ec6f-ce7f-4432-80e0-a54fa1668642@linux.ibm.com> From: Christian Zigotzky Organization: A-EON Open Source Message-ID: Date: Sat, 21 Feb 2026 06:30:18 +0100 X-Mailer: BrassMonkey/33.9.1 Precedence: bulk X-Mailing-List: kvm-ppc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <1d79ec6f-ce7f-4432-80e0-a54fa1668642@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 17/02/26 12:34, Shrikanth Hegde wrote: > > > On 2/17/26 3:56 PM, Christian Zigotzky wrote: >> On 17/02/26 11:17 Madhavan Srinivasan wrote: >>> >>> On 2/17/26 3:14 PM, Christian Zigotzky wrote: >>>> On 17/02/26 10:03, Shrikanth Hegde wrote: >>>>> >>>>> >>>>> On 2/17/26 2:22 PM, Christian Zigotzky wrote: >>>>>> Hi, >>>>>> >>>>>> Thank you for your patch. I tested the latest git kernel with >>>>>> your patch today. Unfortunately the system freezes while booting >>>>>> the VM with KVM HV. >>>>>> >>>>>> Cheers, >>>>>> Christian >>>>>> >>>>>> >>>>> Would it be possible to share the console log or boot log of KVM >>>>> to the >>>>> point it freezes? >>>> >>>> Unfortunately there aren't any error messages. >>>> >>>> I also tried it with: >>>> >>>> gdb --args qemu-system-ppc64 -M ppce500 -cpu e5500 -m 1024 -kernel >>>> uImage-7.0-preempt -drive >>>> format=raw,file=void-live-powerpc-20230317- >>>> updated2.img,index=0,if=virtio -netdev user,id=mynet0 -device >>>> virtio- net,netdev=mynet0 -append "rw root=/dev/vda" -device >>>> virtio-gpu-pci - device virtio-mouse-pci -device >>>> virtio-keyboard-pci -enable-kvm -smp 4 >>>> >>>> and with gdb in the guest: >>>> >>>> qemu-system-ppc64 -s -S -M ppce500 -cpu e5500 -m 1024 -kernel >>>> uImage-7.0-preempt -drive >>>> format=raw,file=void-live-powerpc-20230317- >>>> updated2.img,index=0,if=virtio -netdev user,id=mynet0 -device >>>> virtio- net,netdev=mynet0 -append "rw root=/dev/vda" -device >>>> virtio-gpu-pci - device virtio-mouse-pci -device >>>> virtio-keyboard-pci -enable-kvm -smp 4 >>>> >>>> The system freezed without any error messages. > > Anything on host console? > >>> can you please share the config. >>> I tried kvm-hv in my power8/power9 and seems to boot fine without >>> any issues with today's upstream >>> Maddy >> Here are the configs. >> >> With PREEMPT: https://github.com/chzigotzky/kernels/blob/ >> d50d259ca63dd2b3b9a9eaabc82e5cc69c8cc9f0/configs/e5500_defconfig >> >> Without PREEMPT: https://github.com/chzigotzky/kernels/blob/main/ >> configs/e5500_defconfig >> >> - Christian > > I looked at the code. there was one more place where cond_resched was > there. > > If possible give the below try. > (Note: Didn;t replicate your issue) > > --- > > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index 7667563fb9ff..bf0ca49c9915 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -4825,10 +4825,13 @@ static int kvmppc_run_vcpu(struct kvm_vcpu *vcpu) >          vc->runner = vcpu; >          if (n_ceded == vc->n_runnable) { >              kvmppc_vcore_blocked(vc); > -        } else if (need_resched()) { > +        } else if (need_resched() || spin_needbreak(&vc->lock)) { >              kvmppc_vcore_preempt(vc); >              /* Let something else run */ > -            cond_resched_lock(&vc->lock); > +            spin_unlock(&vc->lock); > +            schedule(); > +            //cond_resched_lock(&vc->lock); > +            spin_lock(&vc->lock); >              if (vc->vcore_state == VCORE_PREEMPT) >                  kvmppc_vcore_end_preempt(vc); >          } else { > @@ -4901,7 +4904,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, > u64 time_limit, >      } > >      if (need_resched()) > -        cond_resched(); > +        schedule(); > >      kvmppc_update_vpas(vcpu); > > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > index 9a89a6d98f97..54963c1d8b58 100644 > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -86,7 +86,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu) >      while (true) { >          if (need_resched()) { >              local_irq_enable(); > -            cond_resched(); > +            schedule(); >              hard_irq_disable(); >              continue; >          } > Hello Shrikanth, I tested your patch today. The patched preempt kernel boots on my e5500 host and in an e5500 VM. Unfortunately my guest and host freeze after loading the VirtIO-GPU. Thanks for your help, Christian -- Sent with BrassMonkey 33.9.1 (https://github.com/chzigotzky/Web-Browsers-and-Suites-for-Linux-PPC/releases/tag/BrassMonkey_33.9.1)