Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp500241rwb; Sun, 6 Nov 2022 09:04:13 -0800 (PST) X-Google-Smtp-Source: AMsMyM4hhd6KdGbSc9TcKsRv+1MqqOuY+7uNdXw5OnCXhmNJffVYDhwmzG/UkiLIxfE1sno2berf X-Received: by 2002:a17:90a:2a02:b0:214:247a:c185 with SMTP id i2-20020a17090a2a0200b00214247ac185mr26077879pjd.226.1667754253542; Sun, 06 Nov 2022 09:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667754253; cv=none; d=google.com; s=arc-20160816; b=kLkrfJmtLmcX55+fvDzyyS+UySD7LSGyw88BJLr6Ev43UD30/B56kFAGIF3wil1s8Y iU1lefWt4+U6dtKmsZC1pKtImG+tD0UDVXBYhYZtjwpLKh8Dni+tniBirL/JsJEqj0Ju fEYmWkCG9YOp3ygK9KOMYlpxp64F5QgANmnzU7WzjHTIJvWIObtPAtdFvjkwJeimJus+ Lsaz6irHFIJtKp6HwFvUuObyTXTidbBZMpjDJWBU8iUDkjoTU+IOe2fhPETfrzT/03aT 5Hn90VIrJcGxs9LRdZWR3ds832XmzEXnZwgDOIgcks161K0eCNOjPLv2VNBlvn8HF03M x1vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=zO136uSjiVsRhdyZG9Bmh5vAhX064/7w/yI3k8o3nv4=; b=nM7AZy75bhLbkrYra++66ovupzChMiXNwkM5zfg2ICFj6pls36hDTu3fMc3wecwFMR nj3CaItocJx4CrWY+yTDiPXa8wuIJgBa6gF5mB6meCfw/gN4AKy+57s+zZ2DALJVOAHW gkCskHNrGP6g1OPxgwoJUivCMMsSVhehOf2ZDWApe2lW1bDEMaoo/VcVAIOaGngS3R/R wnsuPi6DRJcHwLBIgMRqoGglw+go0Uule/1gzoZK3qlB4NcnShdHoY+p9YInajhCn+Nz Dp+l+Ffj8uEn4NBeN+FjOuPhWkEvkUtsQyscquXR810h4qi5yKz2bJcZAg86zLJoVlkM lUkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I+G48P9X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a17090ab28800b001f31f339134si10176289pjr.152.2022.11.06.09.04.01; Sun, 06 Nov 2022 09:04:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I+G48P9X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbiKFQf5 (ORCPT + 97 others); Sun, 6 Nov 2022 11:35:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbiKFQfz (ORCPT ); Sun, 6 Nov 2022 11:35:55 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E729AE46; Sun, 6 Nov 2022 08:35:55 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id 6BFDCCE09CB; Sun, 6 Nov 2022 16:35:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EBF5C433D6; Sun, 6 Nov 2022 16:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667752551; bh=yNfuDfXWA0vsDbKXvNaTminJH2Wz10lrgd6JPh43Wz0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=I+G48P9XkJFyZHA+9m6Wt55mjwTEeQSRdJ13v8ynfjJDMk2/WFt1uGnTcNoxR+Bm+ uMKazx0BUfghbhA+ZxWjgNyL/qmfKuQE/V71hUlhD/CIWUMoLpAJWteycn59+Eew2X NVfAWezc+wXtHPj3eqXuX1o1EXP6JXj8HO/PleCdz5ITWsrHxDixtBfSWEN3T1LZU5 OJLa/wq+qWCCmgQdxPBGf2DmMrji48zvcsLc/du8IshwleTW1Ta8+RYyU6EcRN1Bak CiIXVD3ll+KOt2sCn57mYlP1uy5QKAO8/vJzyp5TpS2d8B9ny1yMqtoEuFeiRjkFIG KkDbRMYRCYQjw== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.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 1oricf-004DkL-2N; Sun, 06 Nov 2022 16:35:49 +0000 Date: Sun, 06 Nov 2022 16:35:21 +0000 Message-ID: <87k048f3cm.wl-maz@kernel.org> From: Marc Zyngier To: Usama Arif Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux-foundation.org, linux@armlinux.org.uk, yezengruan@huawei.com, catalin.marinas@arm.com, will@kernel.org, steven.price@arm.com, mark.rutland@arm.com, bagasdotme@gmail.com, fam.zheng@bytedance.com, liangma@liangbit.com, punit.agrawal@bytedance.com Subject: Re: [v2 0/6] KVM: arm64: implement vcpu_is_preempted check In-Reply-To: <20221104062105.4119003-1-usama.arif@bytedance.com> References: <20221104062105.4119003-1-usama.arif@bytedance.com> 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/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: usama.arif@bytedance.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux-foundation.org, linux@armlinux.org.uk, yezengruan@huawei.com, catalin.marinas@arm.com, will@kernel.org, steven.price@arm.com, mark.rutland@arm.com, bagasdotme@gmail.com, fam.zheng@bytedance.com, liangma@liangbit.com, punit.agrawal@bytedance.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 04 Nov 2022 06:20:59 +0000, Usama Arif wrote: > > This patchset adds support for vcpu_is_preempted in arm64, which > allows the guest to check if a vcpu was scheduled out, which is > useful to know incase it was holding a lock. vcpu_is_preempted can > be used to improve performance in locking (see owner_on_cpu usage in > mutex_spin_on_owner, mutex_can_spin_on_owner, rtmutex_spin_on_owner > and osq_lock) and scheduling (see available_idle_cpu which is used > in several places in kernel/sched/fair.c for e.g. in wake_affine to > determine which CPU can run soonest): [...] > pvcy shows a smaller overall improvement (50%) compared to > vcpu_is_preempted (277%). Host side flamegraph analysis shows that > ~60% of the host time when using pvcy is spent in kvm_handle_wfx, > compared with ~1.5% when using vcpu_is_preempted, hence > vcpu_is_preempted shows a larger improvement. And have you worked out *why* we spend so much time handling WFE? M. -- Without deviation from the norm, progress is not possible.