Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1423506rwo; Wed, 2 Aug 2023 13:59:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlGr56d7qDXrPzZxhJxkrEg25cyIUoKt+lK4ZES0ntAnp2+d6TMz+wRzZmOkAew07QA8idUZ X-Received: by 2002:a17:906:83:b0:99b:d549:834f with SMTP id 3-20020a170906008300b0099bd549834fmr5823203ejc.68.1691009950257; Wed, 02 Aug 2023 13:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691009950; cv=none; d=google.com; s=arc-20160816; b=wPYXp/6aCoBfhAl1sVx1DJ3Vts39CbRfrZjTI9l07Uq/kSCWVqUJEUJGb3hDs9ExCq OKczPh41GaZrIOuMhm/Jbe/Mt8dJvqHl2lBLCZ+zwRFe6fkcif6G5eVvW4cAgehKo+cE EkhVEI2NOwps5nJEgvc3qTO7GUZa7qaopkOOVdLhLA7ShVUhERsG7ovFNrNwvvdTpSbC mj4I+97YF1gb4AJ2wacKT9g2psvg/wdMIfoOKRrLrDGUNzF6c3PM6EbbcImx6xfJJeQ6 J7Wvv5AmzV1v5sPtXuCOzzj9I9cjP6v2K6EqJHh4NSBsTyWDZ8lNDB58OCr/sSqvLnOp Ksew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=MOq6QdWwSyNSiJG4p3dVH7hcYS3/nnvrWbnEMk1LHnQ=; fh=rbTirMI2Pimnikq47hSbgiw8ZixQEOV2OVQYu1aGLjI=; b=QjyxLz6JfSiTqo7j9gI0cB/6Gwwf7g1Haaew/p+ZIGZuRlZ4E5dI302WyjuJ9N3gCJ xko1sbpHpCaQWUnhWzt2o7TwWDglTcC0TRYz8kGU/2RNzyeuR+qNK1SMhhzV/TGjAsCj qi3c92/K2fmzX8QgCCZcVpmlIq72tylYoRksavt750g9FXNA/8zb8V94EkT0HZsMUjCh +biPgxulVgrEuxLtwD+U4OJzHh5z4BtZEaizcJyytMBPIB69QkrMuae6dQmgeCYNVyu/ qrEOsbXR2HOx5c8q+AR4IaCu8X2Fo21U9BdVO32t0mQAQKiAd2gUK1Wpn0e6gxAIUXkT WCTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=EYH+DMr1; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a1709061c1100b00998a03e00f2si10445252ejg.655.2023.08.02.13.58.45; Wed, 02 Aug 2023 13:59:10 -0700 (PDT) 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=@google.com header.s=20221208 header.b=EYH+DMr1; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbjHBTau (ORCPT + 99 others); Wed, 2 Aug 2023 15:30:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjHBTas (ORCPT ); Wed, 2 Aug 2023 15:30:48 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45DD1198B for ; Wed, 2 Aug 2023 12:30:46 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-58473c4f629so856687b3.1 for ; Wed, 02 Aug 2023 12:30:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691004645; x=1691609445; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MOq6QdWwSyNSiJG4p3dVH7hcYS3/nnvrWbnEMk1LHnQ=; b=EYH+DMr1BAPz2BjJVPI3Mkk+pPqHSmOaJlxeoMg6sTIOdidBfzNcq9Fysi48ZJZapx 6wgHnjth4rVgojXsPiAJsdMNZWpgrAlWU/vhwx8HHlHOpLkuQhiQcBIvOZo1knJMASmo Vqg5KSrbzd1v8zd2aQA0jcjLkt/ysAALAtWoIWEPfWHbgKl/MFcFKYmTnUMhyncG+C4V W03I/W0b1GcOCBwFHgzScy/e4envPk4AFmpj4kZ/Ggyir+UgN9NwclbtcjwO8jMegcU3 VAE5+zVZDC+LMVVuVJRFlwn8KEV3LZrBlnoUQsI+Rp6RbBNFus7lT3fCKiodZo66DOjE DTyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691004645; x=1691609445; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MOq6QdWwSyNSiJG4p3dVH7hcYS3/nnvrWbnEMk1LHnQ=; b=S0jHBx21KT9kxxij8Eb04QlGG0shWC1/L6u/hG3hrhKRyG1daE8NjVppUHdWgubeSW nFDOJzlddeoCAYk4Tb9Q60aO30Fk/mqadbXVgGSxw/ilgAfkWGi4JmN1zMo3JeCan4iR TbetXZ4FksA7se8C1TLY0fr2G8LBh95RG9ka7j4chXzhKK/VDaBftYlI6/wcwVpD8TMK 62YOOQvxpbZAN5W3k3k8yBeTA41JzvqO0qfwgoF4DtQPJ4tJspb0rTNi0aA4bpWJJQr9 VuG1opm80K7JJ2cEAor8HwFXmmHqi/RYN9QDegTAKs316scQbg+aViPHw4eW6Dn5Q6H7 +qsw== X-Gm-Message-State: ABy/qLZzYVHhpi1G3v9TjHcV48SmSMCc24upS9sUtq7k9X+hUfEC9XMK Lj4xPpDU0x3j3+imXcbHna2+lyaS9Kc= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:ae13:0:b0:583:a866:3450 with SMTP id m19-20020a81ae13000000b00583a8663450mr158115ywh.7.1691004645574; Wed, 02 Aug 2023 12:30:45 -0700 (PDT) Date: Wed, 2 Aug 2023 12:30:43 -0700 In-Reply-To: <20230731022405.854884-1-maobibo@loongson.cn> Mime-Version: 1.0 References: <20230731022405.854884-1-maobibo@loongson.cn> Message-ID: Subject: Re: [PATCH] KVM: selftests: use unified time type for comparison From: Sean Christopherson To: Bibo Mao Cc: Paolo Bonzini , Shuah Khan , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Upton Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 +Oliver to get input on something beyond non-x86, and because I hate anything clock related :-) On Mon, Jul 31, 2023, Bibo Mao wrote: > With test case kvm_page_table_test, start time is acquired with > time type CLOCK_MONOTONIC_RAW, however end time in function timespec_elapsed > is acquired with time type CLOCK_MONOTONIC. This will cause > inaccurate elapsed time calculation on some platform such as LoongArch. > > This patch modified test case kvm_page_table_test, and uses unified > time type CLOCK_MONOTONIC for start time. AFAICT, there's zero reason to use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC. If there are no objections, I'll take this through kvm-x86/selftests for 6.6. > Signed-off-by: Bibo Mao > --- > tools/testing/selftests/kvm/kvm_page_table_test.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/kvm/kvm_page_table_test.c b/tools/testing/selftests/kvm/kvm_page_table_test.c > index b3b00be1ef82..69f26d80c821 100644 > --- a/tools/testing/selftests/kvm/kvm_page_table_test.c > +++ b/tools/testing/selftests/kvm/kvm_page_table_test.c > @@ -200,7 +200,7 @@ static void *vcpu_worker(void *data) > if (READ_ONCE(host_quit)) > return NULL; > > - clock_gettime(CLOCK_MONOTONIC_RAW, &start); > + clock_gettime(CLOCK_MONOTONIC, &start); > ret = _vcpu_run(vcpu); > ts_diff = timespec_elapsed(start); > > @@ -367,7 +367,7 @@ static void run_test(enum vm_guest_mode mode, void *arg) > /* Test the stage of KVM creating mappings */ > *current_stage = KVM_CREATE_MAPPINGS; > > - clock_gettime(CLOCK_MONOTONIC_RAW, &start); > + clock_gettime(CLOCK_MONOTONIC, &start); > vcpus_complete_new_stage(*current_stage); > ts_diff = timespec_elapsed(start); > > @@ -380,7 +380,7 @@ static void run_test(enum vm_guest_mode mode, void *arg) > > *current_stage = KVM_UPDATE_MAPPINGS; > > - clock_gettime(CLOCK_MONOTONIC_RAW, &start); > + clock_gettime(CLOCK_MONOTONIC, &start); > vcpus_complete_new_stage(*current_stage); > ts_diff = timespec_elapsed(start); > > @@ -392,7 +392,7 @@ static void run_test(enum vm_guest_mode mode, void *arg) > > *current_stage = KVM_ADJUST_MAPPINGS; > > - clock_gettime(CLOCK_MONOTONIC_RAW, &start); > + clock_gettime(CLOCK_MONOTONIC, &start); > vcpus_complete_new_stage(*current_stage); > ts_diff = timespec_elapsed(start); > > -- > 2.27.0 >