From patchwork Wed Sep 11 10:32:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Anisov X-Patchwork-Id: 11140879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC13914E5 for ; Wed, 11 Sep 2019 10:34:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 981D02087E for ; Wed, 11 Sep 2019 10:34:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C9Y2hzfU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 981D02087E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7zvd-0000Bk-B7; Wed, 11 Sep 2019 10:32:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7zvc-0000BL-A9 for xen-devel@lists.xenproject.org; Wed, 11 Sep 2019 10:32:48 +0000 X-Inumbo-ID: 76e7155c-d47f-11e9-b299-bc764e2007e4 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 76e7155c-d47f-11e9-b299-bc764e2007e4; Wed, 11 Sep 2019 10:32:33 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id q64so8938613ljb.12 for ; Wed, 11 Sep 2019 03:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FeNrC6ayJRxDhm8dZguxagsFl4ax8cTGLoDLGNor5EU=; b=C9Y2hzfU687HJuQP7Y3fi8qDQl9xytXyv9Kyrme6dgV4Xs/WHWxV6XmP7oasg8VfO6 SJJvsPpb20s4iOcVESxN/NvoBjs78eXLiQ0+RzENMu9W2LZ3gcb5Mk5M5Eyxyo0AoKZk lnVlmJW40/0Lf+arcy74Gkj2/vgnabYiuCBcGVZs1akW60WVOsJfmimJHWHNr/GsW8F9 PNr25QvQAkqBGvheRa9rhIwY3EecSrT3pn2cR8yT3xdjPoE5LWhMbIgQCHWqen8Jg/dn OYUokLg9GskhtC99lkwbDYAUuA5kJmWWHI4AsJcsT5wTiehHXDmVlWH+Bgwhi2N2blie L7wA== 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:in-reply-to :references; bh=FeNrC6ayJRxDhm8dZguxagsFl4ax8cTGLoDLGNor5EU=; b=HtEQJneMhHVv+PMKfX5s+z+FnYgEFHCyTUJKmELKpdk0eppVlfpGA6jTMus8sRVR2O scbFRSE0LG+rUhq8ID58x2zkHgzowzG8NkkfzSvbk0NKa5lvKDkGkvPO0UT8WC5a7xw/ 3Pc7IiYIXG4Ib9vidrfAQy8POKA/3znxdqZjoV16Dg0X0le1nstO6l83OJXSxmAiqbAJ kwOyWcgqQD/kdH4Uo31E97hPItooAvMPHLXQ4nmwhl3bZO9V6EoTtCHD+SV/ZmySh5bD CUYumcuZMkznid6uuDFeqDkfPPFV9hMsr4D1SfmUdjPDAojdNzSQJa702XJ6xi+ZoN+e Z2wA== X-Gm-Message-State: APjAAAWrWgMp+AY95EB8ocvxcu1Mb811b+yV0xgEtCp1b7k0OjIKLtHi kIo/vA+W/Mw7myT0hXN96RbGoXSZo4A= X-Google-Smtp-Source: APXvYqz5iVXjde/moak1Zqnzh85/RxP2W4dXNPHLLSW6UjD/1QSFoiU471ZYRqoCaWuOqP1lM0sDyQ== X-Received: by 2002:a2e:9882:: with SMTP id b2mr23024769ljj.225.1568197952337; Wed, 11 Sep 2019 03:32:32 -0700 (PDT) Received: from aanisov-work.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id w27sm4585275ljd.55.2019.09.11.03.32.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 03:32:31 -0700 (PDT) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Wed, 11 Sep 2019 13:32:17 +0300 Message-Id: <1568197942-15374-5-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568197942-15374-1-git-send-email-andrii.anisov@gmail.com> References: <1568197942-15374-1-git-send-email-andrii.anisov@gmail.com> Subject: [Xen-devel] [RFC 4/9] arm64: utilize time accounting X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Andrii Anisov MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Andrii Anisov Call time accounting hooks from appropriate transition points of the ARM64 code. Signed-off-by: Andrii Anisov --- xen/arch/arm/arm64/entry.S | 39 ++++++++++++++++++++++++++++++++++++--- xen/arch/arm/domain.c | 2 ++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S index 2d9a271..6fb2fa9 100644 --- a/xen/arch/arm/arm64/entry.S +++ b/xen/arch/arm/arm64/entry.S @@ -143,12 +143,21 @@ .endm - .macro exit, hyp, compat + .macro exit, hyp, compat, tacc=1 .if \hyp == 0 /* Guest mode */ + .if \tacc == 1 + + mov x0, #1 + bl tacc_hyp + + .endif + bl leave_hypervisor_tail /* Disables interrupts on return */ + mov x0, #1 + bl tacc_guest exit_guest \compat .endif @@ -205,9 +214,15 @@ hyp_sync: hyp_irq: entry hyp=1 + mov x0,#5 + bl tacc_irq_enter msr daifclr, #4 mov x0, sp bl do_trap_irq + + mov x0,#5 + bl tacc_irq_exit + exit hyp=1 guest_sync: @@ -291,6 +306,9 @@ guest_sync_slowpath: * to save them. */ entry hyp=0, compat=0, save_x0_x1=0 + + mov x0,#1 + bl tacc_gsync /* * The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT * is not set. If a vSError took place, the initial exception will be @@ -307,6 +325,10 @@ guest_sync_slowpath: guest_irq: entry hyp=0, compat=0 + + mov x0,#6 + bl tacc_irq_enter + /* * The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT * is not set. If a vSError took place, the initial exception will be @@ -319,6 +341,8 @@ guest_irq: mov x0, sp bl do_trap_irq 1: + mov x0,#6 + bl tacc_irq_exit exit hyp=0, compat=0 guest_fiq_invalid: @@ -334,6 +358,9 @@ guest_error: guest_sync_compat: entry hyp=0, compat=1 + + mov x0,#2 + bl tacc_gsync /* * The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT * is not set. If a vSError took place, the initial exception will be @@ -350,6 +377,10 @@ guest_sync_compat: guest_irq_compat: entry hyp=0, compat=1 + + mov x0,#7 + bl tacc_irq_enter + /* * The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT * is not set. If a vSError took place, the initial exception will be @@ -362,6 +393,8 @@ guest_irq_compat: mov x0, sp bl do_trap_irq 1: + mov x0,#7 + bl tacc_irq_exit exit hyp=0, compat=1 guest_fiq_invalid_compat: @@ -376,9 +409,9 @@ guest_error_compat: exit hyp=0, compat=1 ENTRY(return_to_new_vcpu32) - exit hyp=0, compat=1 + exit hyp=0, compat=1, tacc=0 ENTRY(return_to_new_vcpu64) - exit hyp=0, compat=0 + exit hyp=0, compat=0, tacc=0 return_from_trap: msr daifset, #2 /* Mask interrupts */ diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index a9c4113..53ef630 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -51,11 +51,13 @@ static void do_idle(void) process_pending_softirqs(); local_irq_disable(); + tacc_idle(1); if ( cpu_is_haltable(cpu) ) { dsb(sy); wfi(); } + tacc_hyp(2); local_irq_enable(); sched_tick_resume();