Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp944565ybl; Thu, 22 Aug 2019 07:14:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIS8XnXgCs46eGIqO/uwmcm+0e1hlardnpGh8EFBckEXFZO85MVa7dhQRyp2wwYmPauvid X-Received: by 2002:a17:90a:e654:: with SMTP id ep20mr690795pjb.38.1566483250049; Thu, 22 Aug 2019 07:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566483250; cv=none; d=google.com; s=arc-20160816; b=lhbL3SN/9lCTmvQijrgUS4dgDSW8yVCNnxO8f7oYy+NZhh6Z2mjQxC6UzyDOf3Xd7Q DkVPBJTmZ8tB0Uc7b9NbTmTMTN0XzyePx7JRojp2611DI9xQyzmcbaaCtMbyjtaSn2RO ENun4iBPRJWIw57rBt4gHWfTf3WsIgKCPFCTqH1td9eH0s08P36U7TP8YbRtLJEeb/vE iWVGP1TftObSTJtuqPcG9zb6L6vx1pYwuv1kHqVeEDe8eut5dNHNLea4QHShtZQxT5xg YmVlSdhQ+C4YMi/2rC5ovcEniC+Pmojlq1obQ+7We+en8nAHGS0b29NALrDoO9xVs1D7 wK8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=nPP0mWjgvuvkGH5POV+rahm27Z9u4nGC6uBAzdn/wm0=; b=bfgiA9AR8YW7ARdIhDD5StVg9OXiiSQ4HnRKaSKsDk4UbbHhzW3gy/VfFTEBGhiu9C 4tS+7nCKWwIsO5rRTEr3LbldSFdjlltRQMfpD3pscqcuke8vLrJQDz630gFh6/Yh4daj ll0o7Ixp7qPlgiaR5DsBTu3cKUKTtp6nMa1kq3/EtEfozbgLskReIM3kqq18jNL6+pQL uqXDUwACwLuEsV9G2fcb6DS7Lj0eLFUy9cOauPe4pdrwxp11JuXVgGm1/xEAX4lMuS/d dVp5hDSQoBCOCgQWgL6AMHbWWFwtiRNxcLS7LXeJOL6ZlCdRnipPnBPy0bTwQC695ekc utvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si2552834pjz.23.2019.08.22.07.13.53; Thu, 22 Aug 2019 07:14:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387979AbfHVLA7 (ORCPT + 99 others); Thu, 22 Aug 2019 07:00:59 -0400 Received: from foss.arm.com ([217.140.110.172]:43850 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731126AbfHVLA6 (ORCPT ); Thu, 22 Aug 2019 07:00:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3F691596; Thu, 22 Aug 2019 04:00:57 -0700 (PDT) Received: from [10.1.196.133] (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5B673F246; Thu, 22 Aug 2019 04:00:55 -0700 (PDT) Subject: Re: [PATCH v3 05/10] KVM: arm64: Support stolen time reporting via shared structure To: Jonathan Cameron Cc: Mark Rutland , kvm@vger.kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Marc Zyngier , Suzuki K Pouloze , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , James Morse , Julien Thierry , Catalin Marinas , Paolo Bonzini , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org References: <20190821153656.33429-1-steven.price@arm.com> <20190821153656.33429-6-steven.price@arm.com> <20190822113942.0000701f@huawei.com> From: Steven Price Message-ID: <301610cc-ba04-89d6-a0b6-d37ecf4a717a@arm.com> Date: Thu, 22 Aug 2019 12:00:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190822113942.0000701f@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/08/2019 11:39, Jonathan Cameron wrote: > On Wed, 21 Aug 2019 16:36:51 +0100 > Steven Price wrote: > >> Implement the service call for configuring a shared structure between a >> VCPU and the hypervisor in which the hypervisor can write the time >> stolen from the VCPU's execution time by other tasks on the host. >> >> The hypervisor allocates memory which is placed at an IPA chosen by user >> space. The hypervisor then updates the shared structure using >> kvm_put_guest() to ensure single copy atomicity of the 64-bit value >> reporting the stolen time in nanoseconds. >> >> Whenever stolen time is enabled by the guest, the stolen time counter is >> reset. >> >> The stolen time itself is retrieved from the sched_info structure >> maintained by the Linux scheduler code. We enable SCHEDSTATS when >> selecting KVM Kconfig to ensure this value is meaningful. >> >> Signed-off-by: Steven Price > > One totally trivial comment inline... Feel free to ignore :) > [...] >> +int kvm_hypercall_stolen_time(struct kvm_vcpu *vcpu) >> +{ >> + u64 ret; >> + int err; >> + >> + /* >> + * Start counting stolen time from the time the guest requests >> + * the feature enabled. >> + */ >> + vcpu->arch.steal.steal = 0; >> + vcpu->arch.steal.last_steal = current->sched_info.run_delay; >> + >> + err = kvm_update_stolen_time(vcpu, true); >> + >> + if (err) >> + ret = SMCCC_RET_NOT_SUPPORTED; > > Trivial by why not > return SMCCC_RET_NOT_SUPPORTED; > > return vcpu->kvm->arch.pvtime.st_base + > ... > Drops the indentation a bit and puts the error handling out of > line which is slightly nicer to read (to my eyes). Yes that's a nice change - drops the extra "ret" variable too. Thanks, Steve