From patchwork Fri Jul 9 04:37:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12366659 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 3EF14C07E99 for ; Fri, 9 Jul 2021 04:39:40 +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 0998F61437 for ; Fri, 9 Jul 2021 04:39:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0998F61437 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ifw7Nk5/8huWRoS8UntYU1CNu1kGqbCEv48UVmNaXNA=; b=xHWDZnHi1NAqOI IBWuW8dlt3lJ6OLFBgjRp+ybCWV+GhAXhNa3fD2jOx+z01m79meZiHGisJ8yW7OwOO5MbVWE5Rst3 IMtx3krWs3uBvJvpOyHaXzP4MJGHa35wXuCAODfdW0d+p9XXOUsK1imJzS51gw3fYCkzH0owxK/0o 17BCeaDt1xGOO6Y/hrhODhMvNRjR0wbQ8kcarP/IgEqMrjvPHibol9njQEZ+k7obO4/Eq2WZOGvwO 1gsdURQmeF1QpeR4X+C7UA6ahQ1GXAGecFf8Xg5+unD1twqIqir9G/XVChJJyMpEG3fqbtOe61jaH SoCNhpYpB7yRidlqCm1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1iGh-000k4C-Hz; Fri, 09 Jul 2021 04:37:39 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1iGd-000k3O-Kx for linux-arm-kernel@lists.infradead.org; Fri, 09 Jul 2021 04:37:37 +0000 Received: by mail-pj1-x1033.google.com with SMTP id oj10-20020a17090b4d8ab0290172f77377ebso5401748pjb.0 for ; Thu, 08 Jul 2021 21:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H/LklQaJdTOXWeUT+mprxaDKrVkD8A9UO7oJUzmViNQ=; b=BG8tocLa4Fc6GVIjbj/83MmQ562w43ne1yivFCQz30vkd1c2tWv5D71ctj9JMn0a/s 3wZbh/hEhgz+vSrVvnrhuxUH9Rizx7klC2gPGSSX658M5KU/uGIgxQsLZ4tLgMU56Apd b3soeKez7tuOdGuGTWH0hrCgVZXgsByXKESZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H/LklQaJdTOXWeUT+mprxaDKrVkD8A9UO7oJUzmViNQ=; b=S3b+KgGsaUWsGtXbSONEb9d2s5hQWBAt48Tb4scEstE9Zj/6IupoCGKLT82IN2JC2S N00apJ5o8g/5w6To2oqbmh+2Ye/hsBSwEPbSWVeOuFGWEg1dJi5ff/uUjqj/E1w5bKu7 Jcqt6dHKMLqQhTjoLGh4j4bHDLuxtW03zSe0MmFUHI00o7Fz3etZcu/fA+oyQ9eJmsoG o0qYBL7zHDwvxxrEUKTyEszf9Co/3nXaCoUQHNQKk1bssqGzHhGckhrsTB+xKYnN6vJK 7wmcMaMonBuSYPlFgFMpg4n48lStDRphzpv5xUqCh2ZrfFkiHjqANDnrzG/5aCXY/lt/ 27kg== X-Gm-Message-State: AOAM533dsNU6ALagr0XWXYgWKyu0MLi7Gome6Nix3YJ+YS9xrOrLLcAh z1YCgElUlHVhU1Slyh0wfnGJoA== X-Google-Smtp-Source: ABdhPJwQ4+9mQudHLFskGBug4FzGh1FHXv+U9yzd3L1gcLu6YE9FOXHurMSqd0ktQwQkYJA/TWJ0/Q== X-Received: by 2002:a17:90a:ff0d:: with SMTP id ce13mr2922178pjb.157.1625805453217; Thu, 08 Jul 2021 21:37:33 -0700 (PDT) Received: from senozhatsky.flets-east.jp ([2409:10:2e40:5100:a30d:fc4:7834:ee08]) by smtp.gmail.com with ESMTPSA id y4sm4420760pfa.14.2021.07.08.21.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 21:37:32 -0700 (PDT) From: Sergey Senozhatsky To: Marc Zyngier , Will Deacon Cc: Suleiman Souhlal , Joel Fernandes , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Sergey Senozhatsky Subject: [PATCHv2 0/4] arm64:kvm: teach guest sched that VCPUs can be preempted Date: Fri, 9 Jul 2021 13:37:09 +0900 Message-Id: <20210709043713.887098-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210708_213735_747971_753470AE X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello, This patch set adds a simple vcpu_is_preempted() implementation so that scheduler can make better decisions when it search for the idle (v)CPU. For sched benchmarks please refer to [0]. [0] https://github.com/sergey-senozhatsky/arm64-vcpu_is_preempted v2: - 5.13 rebase (static calls, etc) - simplified and reworked some bits Sergey Senozhatsky (4): arm64: smccc: Add SMCCC pv-vcpu-state function call IDs arm64: add guest pvstate support arm64: do not use dummy vcpu_is_preempted() arm64: add host pv-vcpu-state support arch/arm64/include/asm/kvm_host.h | 23 ++++++++ arch/arm64/include/asm/paravirt.h | 19 +++++++ arch/arm64/include/asm/spinlock.h | 18 +++--- arch/arm64/kernel/paravirt.c | 94 +++++++++++++++++++++++++++++++ arch/arm64/kernel/smp.c | 4 ++ arch/arm64/kvm/Makefile | 3 +- arch/arm64/kvm/arm.c | 3 + arch/arm64/kvm/hypercalls.c | 11 ++++ arch/arm64/kvm/pv-vcpu-state.c | 64 +++++++++++++++++++++ include/linux/arm-smccc.h | 18 ++++++ 10 files changed, 248 insertions(+), 9 deletions(-) create mode 100644 arch/arm64/kvm/pv-vcpu-state.c