From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 962813314B8; Mon, 18 Aug 2025 18:29:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755541742; cv=none; b=oafztkN5ZOWs12zTu+NhEP6T6918q/f//SHe/dmuujnCHl28elFOsbYlKrkLcA8UXvzD5rbr0MwU+LRg5QnnQEymFgNBhurRWwed/zhuVDYife4WswnnZj59NiTgXFyZq7tHYq7mdiU/crX1UFG7PseerL0WinW0n7iLj0/ZEKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755541742; c=relaxed/simple; bh=ulOD+B+Fozhr1sQlfiCETJenKkFXoqPpDyjOHkygjgw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nmdSBeuLFZbPEAHPw2ESr5X+qI/EOm4+5pPBpNJ2eU7M6o89qXIquejOn7MX+X4L+qLx51vFb/YZANArEGiru9dG1Xk31Jyd36aLAScdvJrdsugBuPxizxJtNnlSuRk7FXWMN0jFx0h2K7RVn/ud6r3JhLDy06ridGedAzyzkXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5AF9C4CEEB; Mon, 18 Aug 2025 18:28:58 +0000 (UTC) Date: Mon, 18 Aug 2025 19:28:56 +0100 From: Catalin Marinas To: Arnd Bergmann Cc: Ankur Arora , linux-kernel@vger.kernel.org, Linux-Arch , linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org, Will Deacon , Peter Zijlstra , Andrew Morton , Mark Rutland , harisokn@amazon.com, "Christoph Lameter (Ampere)" , Alexei Starovoitov , Kumar Kartikeya Dwivedi , zhenglifeng1@huawei.com, xueshuai@linux.alibaba.com, Joao Martins , Boris Ostrovsky , Konrad Rzeszutek Wilk , "Rafael J . Wysocki" , Daniel Lezcano Subject: Re: [PATCH v3 1/5] asm-generic: barrier: Add smp_cond_load_relaxed_timewait() Message-ID: References: <20250627044805.945491-1-ankur.a.arora@oracle.com> <20250627044805.945491-2-ankur.a.arora@oracle.com> <877bz98sqb.fsf@oracle.com> <67b6b738-0f1c-4dd4-817d-95f55ec9272b@app.fastmail.com> <1ccb0011-d2d2-453f-afcd-dd2967bf572a@app.fastmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ccb0011-d2d2-453f-afcd-dd2967bf572a@app.fastmail.com> On Mon, Aug 18, 2025 at 01:51:28PM +0200, Arnd Bergmann wrote: > On Thu, Aug 14, 2025, at 15:00, Catalin Marinas wrote: > > On Wed, Aug 13, 2025 at 06:29:37PM +0200, Arnd Bergmann wrote: > >> On Wed, Aug 13, 2025, at 18:09, Catalin Marinas wrote: > >> and virtual machines with CPU overcommit. > > > > Not sure it helps here. With vCPU overcommit, KVM enables WFE trapping > > and the event stream no longer has any effect (it's not like it > > interrupts the host). > > I would expect a similar overhead for the WFE trapping as for the > bare-metal hardware case: When the WFE traps, the host has to > reschedule all guests that are in WFE periodically, while WFET > with event stream disabled means this can be driven by an accurate > host timer. For WFIT, yes, this works as the hypervisor either gets an interrupt or schedules a timer. It can tell what WFI* is going to be woken by. With WFET, the hypervisor cannot tell if an event was generated by another vCPU (e.g. clearing of the exclusive monitor) unless it does a WFE itself. So it can't put the vCPU to sleep based on the WFET timeout. IIUC, from kvm_handle_wfx(), the only difference is whether it returns immediately to the vCPU if it timed out or tells the core KVM to reschedule other vCPUs. > > That said, my worry is that either broken hardware or software rely on > > the event stream unknowingly, e.g. someone using WFE in a busy loop. And > > for hardware errata, we've had a few where the wakeup events don't > > propagate between clusters, though these we can toggle on a case by case > > basis. > > Don't we already support hardware without a functional architected > timer even with? Those don't use the event stream today even when > CONFIG_ARM_ARCH_TIMER_EVTSTREAM is enabled. Maybe we still have such hardware around (e.g. errata) but it shouldn't be the norm, especially if vendors try to follow the *BSA specs. -- Catalin