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 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF51FC636C9 for ; Wed, 21 Jul 2021 12:20:11 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 74A8961222 for ; Wed, 21 Jul 2021 12:20:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74A8961222 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 275ED4B0EF; Wed, 21 Jul 2021 08:20:11 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@chromium.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZGKuRFprEs6Q; Wed, 21 Jul 2021 08:20:10 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3D9894B145; Wed, 21 Jul 2021 08:20:06 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C0BC14AEE2 for ; Wed, 21 Jul 2021 06:38:47 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qMxMukimS3NR for ; Wed, 21 Jul 2021 06:38:46 -0400 (EDT) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id B54A04AED4 for ; Wed, 21 Jul 2021 06:38:46 -0400 (EDT) Received: by mail-pf1-f175.google.com with SMTP id j199so1899176pfd.7 for ; Wed, 21 Jul 2021 03:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EIbOGymDYcRaNQxjueCe6a1zJ8aY0naaP0fQUkEZuv8=; b=Ov5r12ynseBnyTNRKsKx9w8I9twMbxcSJ1f73zH2iop1yQASsh3BfriyZofnrwgGPb JWsBYE6ZU5a3lBHKbfhG01blBS2BP/AHgilqkL+QG/cbbprBm/Aw4GR7gpJVVtkbNURP IGrlGE+9rwKA79Of6P2jRijrEqbvnRi+5RyzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EIbOGymDYcRaNQxjueCe6a1zJ8aY0naaP0fQUkEZuv8=; b=S26HZTUVqRCIFNbFUTVmT2V7X+AYArrjRzZZPskNOEoTofjiU2G9+WEiGIs+lSj+Tc Lz42H6weqAl16DO2u6xDVjHwLL5vecEaajS4bK5SPiy6+6riJ1jbPuzsPFuabD20IQv/ wrIQf8HWVAg8fKJfwCbPzvdOLlleyXO3Rsq6/U7Mm8+A9e5oXYY36xRdiCG2f2JtX45k s0zscHCWXNOA+9GAneZhKVOtA/dKAqZN25hVtIyp9YYOCAR5+ZFBC3WGyadV4DABsD75 RapZzmcO/XLubKeRkJGVflNfopK/NoN3MwY5A+DEEFgLPLUbw4ot6xCk0ePvLwC7+e5+ ri0Q== X-Gm-Message-State: AOAM532t4ugoXCWipzVZVSRW8ImiDp16WMxrHCaZH1FN48b7RxY7Wt3z U9BCKIpHwUUEjl5lh4sZ4SrTBQ== X-Google-Smtp-Source: ABdhPJwG3zXjqu/tpj5VxqRx6FmJchnrD4hFB2OoBNGmAOcVyTAxWZv9VdpXTlSzk5yhFw1PCfmBEw== X-Received: by 2002:aa7:81c5:0:b029:2f7:d4e3:78e9 with SMTP id c5-20020aa781c50000b02902f7d4e378e9mr36527927pfn.31.1626863925613; Wed, 21 Jul 2021 03:38:45 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:f1b2:269f:996b:b71a]) by smtp.gmail.com with ESMTPSA id z16sm5586915pgu.21.2021.07.21.03.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 03:38:45 -0700 (PDT) Date: Wed, 21 Jul 2021 19:38:40 +0900 From: Sergey Senozhatsky To: Marc Zyngier Subject: Re: [PATCHv2 4/4] arm64: add host pv-vcpu-state support Message-ID: References: <20210709043713.887098-1-senozhatsky@chromium.org> <20210709043713.887098-5-senozhatsky@chromium.org> <874kcz33g5.wl-maz@kernel.org> <87h7go2h69.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87h7go2h69.wl-maz@kernel.org> X-Mailman-Approved-At: Wed, 21 Jul 2021 08:20:04 -0400 Cc: Joel Fernandes , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Sergey Senozhatsky , Suleiman Souhlal , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On (21/07/21 09:40), Marc Zyngier wrote: > > > > Can that be cured by just checking vcpu->preempted before calling > > kvm_update_vcpu_preempted() ? > > It isn't obvious to me that this is the right thing to do. > vcpu->preempted is always updated on sched-out from the preempt > notifier if the vcpu was on the run-queue, so my guess is that it will > always be set when switching to another task. > > What you probably want is to check whether the vcpu is blocked by > introspecting the wait-queue with: > > scuwait_active(kvm_arch_vcpu_get_wait(vcpu) > > which will tell you whether you are blocking or not. We are already > using a similar construct for arming a background timer in this case. Can we examine if vcpu->run->exit_reason == WFE/WFI and avoid setting preempted state if so? _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E86CC07E9B for ; Wed, 21 Jul 2021 10:40:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ECDAA61009 for ; Wed, 21 Jul 2021 10:40:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECDAA61009 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j8s7jx1awhqbjouDgTl/Z7f0Ev40CDcBaEybXF0ykxw=; b=25/t81RvVZmq5t TVgXU+W9IDrpuiF9rd86soog2T1JZ3Vd8hMTGjvcmeUCzJpUscJ72wDnP/EEOhXoP3UtN2ZctDmox Mgcc4DU83lvBJJYdO215crlPS1+kqq1kixyHAzYKqlBRsOmOVJ2UiQ+r+hrrPGnOuXKtf3qLL+trS a3/We0EPl7CAZabJUQfvwIAuh1odKK9UgK6KTv+ncUFvQ0cydf+rOZhrgDrVU97wD/IujoSVmXxHQ bsi8iMZgd19rjWzYqFrnE23S52974sTV0TwpdOgJRRRU9Adm3pHO8cs1cdRXGB+XyDZKqIWSOq2ZG 9Fn2xOqryF3BACyv928g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m69co-00FGcL-Lv; Wed, 21 Jul 2021 10:38:50 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m69ck-00FGbw-Tn for linux-arm-kernel@lists.infradead.org; Wed, 21 Jul 2021 10:38:48 +0000 Received: by mail-pg1-x52d.google.com with SMTP id s18so1450613pgg.8 for ; Wed, 21 Jul 2021 03:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EIbOGymDYcRaNQxjueCe6a1zJ8aY0naaP0fQUkEZuv8=; b=Ov5r12ynseBnyTNRKsKx9w8I9twMbxcSJ1f73zH2iop1yQASsh3BfriyZofnrwgGPb JWsBYE6ZU5a3lBHKbfhG01blBS2BP/AHgilqkL+QG/cbbprBm/Aw4GR7gpJVVtkbNURP IGrlGE+9rwKA79Of6P2jRijrEqbvnRi+5RyzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EIbOGymDYcRaNQxjueCe6a1zJ8aY0naaP0fQUkEZuv8=; b=L4fLr2/3pp25jQE5GYGwrmB5xD8PeDFWgazQE7z4FNHCVmTz7R1nSapK8V+/PVxskw 7Sej6duvConA+WvcI/igi2wAM2XxmSLz2SOZc3kQ21HX3GsiYnDO3hZYJG0itu/bFzVl atwcZy1YRDfLJkr0HqhgKBMc/Fg/KQsA2epgjeLD/yInm8aVjEMRxXcoUKujkgriL2Lg chI3YPqM3tE/2EMfzKeZ5yosEVdgmcBQK552+Am6wYCRMY8fwRTJx8L8z/jM01SZFoEv tiV5Djh/shfxuAVmtAnjqubpe7C/JIt6qxhDeNFoHpG84UI7PwTwYes5bDmoYSheZeMC F4jQ== X-Gm-Message-State: AOAM532RDOVa1pR/9uVxWudsRhO6G3VYIs1Qr6TaFvNeV5UWxflgYzVF w7PjhgUUaw/XwAP1CQACjU1weQ== X-Google-Smtp-Source: ABdhPJwG3zXjqu/tpj5VxqRx6FmJchnrD4hFB2OoBNGmAOcVyTAxWZv9VdpXTlSzk5yhFw1PCfmBEw== X-Received: by 2002:aa7:81c5:0:b029:2f7:d4e3:78e9 with SMTP id c5-20020aa781c50000b02902f7d4e378e9mr36527927pfn.31.1626863925613; Wed, 21 Jul 2021 03:38:45 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:f1b2:269f:996b:b71a]) by smtp.gmail.com with ESMTPSA id z16sm5586915pgu.21.2021.07.21.03.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 03:38:45 -0700 (PDT) Date: Wed, 21 Jul 2021 19:38:40 +0900 From: Sergey Senozhatsky To: Marc Zyngier Cc: Joel Fernandes , Sergey Senozhatsky , Will Deacon , Suleiman Souhlal , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCHv2 4/4] arm64: add host pv-vcpu-state support Message-ID: References: <20210709043713.887098-1-senozhatsky@chromium.org> <20210709043713.887098-5-senozhatsky@chromium.org> <874kcz33g5.wl-maz@kernel.org> <87h7go2h69.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87h7go2h69.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210721_033847_036480_5842E044 X-CRM114-Status: GOOD ( 15.57 ) 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 (21/07/21 09:40), Marc Zyngier wrote: > > > > Can that be cured by just checking vcpu->preempted before calling > > kvm_update_vcpu_preempted() ? > > It isn't obvious to me that this is the right thing to do. > vcpu->preempted is always updated on sched-out from the preempt > notifier if the vcpu was on the run-queue, so my guess is that it will > always be set when switching to another task. > > What you probably want is to check whether the vcpu is blocked by > introspecting the wait-queue with: > > scuwait_active(kvm_arch_vcpu_get_wait(vcpu) > > which will tell you whether you are blocking or not. We are already > using a similar construct for arming a background timer in this case. Can we examine if vcpu->run->exit_reason == WFE/WFI and avoid setting preempted state if so? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A5CC12002 for ; Wed, 21 Jul 2021 10:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 632FE61245 for ; Wed, 21 Jul 2021 10:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239415AbhGUKF3 (ORCPT ); Wed, 21 Jul 2021 06:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237184AbhGUJ7W (ORCPT ); Wed, 21 Jul 2021 05:59:22 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DF9C061762 for ; Wed, 21 Jul 2021 03:38:46 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id y17so1436625pgf.12 for ; Wed, 21 Jul 2021 03:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EIbOGymDYcRaNQxjueCe6a1zJ8aY0naaP0fQUkEZuv8=; b=Ov5r12ynseBnyTNRKsKx9w8I9twMbxcSJ1f73zH2iop1yQASsh3BfriyZofnrwgGPb JWsBYE6ZU5a3lBHKbfhG01blBS2BP/AHgilqkL+QG/cbbprBm/Aw4GR7gpJVVtkbNURP IGrlGE+9rwKA79Of6P2jRijrEqbvnRi+5RyzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EIbOGymDYcRaNQxjueCe6a1zJ8aY0naaP0fQUkEZuv8=; b=hu0A9Dw6ODdTdQgDOJyfBNxERKXCSlCU9C03C+7Zi8x0RTu3t/MQ49t2m6rn/lrvS0 924cDeEFXEWm9S5GTGuhMTup04OuTnpO9mNcWr+3FIGENt9XPlHiCxErjRU6I6AhZmnD IPv0NMRh7+XJGkn1bNIjafDJ5u40QQlFXT2N0hsOCXvqcWIcMtZGmQrWYdNDXeUU7fPa 2fkF0pWgZ2bH3JAj3EzhiO7ewOQxrymo42lsoMiffk+itia1kmePNuSjHDX89YErNHr4 VACNYFTspwstHx6ikY3zyyB5GbpVYmco4HT5pelklqD7VPNxUUhFjAoisuxP6VayrGq+ YukA== X-Gm-Message-State: AOAM531fB2QBaUuV5k1FnCrsTJm02jBXtdXOAthnsrJccHK34JYSouqa CBr7p/bLv+atNquRicD+MF13Pg== X-Google-Smtp-Source: ABdhPJwG3zXjqu/tpj5VxqRx6FmJchnrD4hFB2OoBNGmAOcVyTAxWZv9VdpXTlSzk5yhFw1PCfmBEw== X-Received: by 2002:aa7:81c5:0:b029:2f7:d4e3:78e9 with SMTP id c5-20020aa781c50000b02902f7d4e378e9mr36527927pfn.31.1626863925613; Wed, 21 Jul 2021 03:38:45 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:f1b2:269f:996b:b71a]) by smtp.gmail.com with ESMTPSA id z16sm5586915pgu.21.2021.07.21.03.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 03:38:45 -0700 (PDT) Date: Wed, 21 Jul 2021 19:38:40 +0900 From: Sergey Senozhatsky To: Marc Zyngier Cc: Joel Fernandes , Sergey Senozhatsky , Will Deacon , Suleiman Souhlal , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCHv2 4/4] arm64: add host pv-vcpu-state support Message-ID: References: <20210709043713.887098-1-senozhatsky@chromium.org> <20210709043713.887098-5-senozhatsky@chromium.org> <874kcz33g5.wl-maz@kernel.org> <87h7go2h69.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h7go2h69.wl-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (21/07/21 09:40), Marc Zyngier wrote: > > > > Can that be cured by just checking vcpu->preempted before calling > > kvm_update_vcpu_preempted() ? > > It isn't obvious to me that this is the right thing to do. > vcpu->preempted is always updated on sched-out from the preempt > notifier if the vcpu was on the run-queue, so my guess is that it will > always be set when switching to another task. > > What you probably want is to check whether the vcpu is blocked by > introspecting the wait-queue with: > > scuwait_active(kvm_arch_vcpu_get_wait(vcpu) > > which will tell you whether you are blocking or not. We are already > using a similar construct for arming a background timer in this case. Can we examine if vcpu->run->exit_reason == WFE/WFI and avoid setting preempted state if so?