Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp429270rdb; Wed, 20 Dec 2023 01:01:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHorXZNJMLQjjwAXKEbUGnV7zQULAiC9v3m8VCCmQdAbxEnQub0C2Pt37exxbmClJ7MwV2o X-Received: by 2002:a2e:bea0:0:b0:2cc:8832:bf with SMTP id a32-20020a2ebea0000000b002cc883200bfmr1036844ljr.89.1703062863969; Wed, 20 Dec 2023 01:01:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703062863; cv=none; d=google.com; s=arc-20160816; b=JfVOc4KLIZ7HNwbHMjEntcvASPojUbrwBJdZYl8mFGTO/SJWCg+pQ0Yrq6C2cVw3Si DcxKF1E0psReuYUfyGfFM+804cN5/p+xi5Yz/Wz0DORr8es3WgLSdp3AKs7GR3Pn4m+u Kc7eRbJ2fYL1glT+V7SkUEMvpN36ESn/87+53K83K5rzY8FJq3YJVggxoOiCMdBTyvtq U+9HiPX7gGclvDPCmpPXoFbPxRpCbDfBR4yKEYYD7OKF7HC/tBaJbCySdYX25uKEV5ug 2lWfvKxU2d5x6h5ZYqjmG7M8ZEeXtvx5cVg9S6qcyZD7+385I1Ln5339o3/oODILH0QV EvNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=FIuXZOknUqHeXasX8sHc2sPK/nFkWEmXf2u+nAn0A5Q=; fh=sHZSoRZfahgv4JHww7QVLBRLjVAHCJqkvK3REtZ018k=; b=U86AbJi53JtlrGj5feMmQmGxViv8lRvc0OUB4MfsZbLFNXiAu7BjVddCBKTYnn6DHy PpHGFbd+slx7jIbBY8wmr6jbLl3q9JVSQvNZ4VD1IAJiy8nfol5IfWTYnoG4aNr77sQM wNA40q/BGBzap3IktXA0ucITCGD5m5zbrMG+jYjG0HOthdPA4usvly1EVuMTdHVnWvwH hEn3BFDBsGH+m6MXzC5FScgT27AC1+Qr6a6rg1BXBSAPkMpBxgNZxPNRozhB/C6aqGKv xd3ODxcoSvrsyyW+iuEQYx6hGoE8W2Rtc9Msu+tAhTu4LsiPjRFdv71pG1Z3LxDPgPOi ey7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KF+fgMS9; spf=pass (google.com: domain of linux-kernel+bounces-6617-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a5-20020a509b45000000b0054cc22a2c7csi11533422edj.203.2023.12.20.01.01.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 01:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6617-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KF+fgMS9; spf=pass (google.com: domain of linux-kernel+bounces-6617-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AA9E01F21D02 for ; Wed, 20 Dec 2023 09:01:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 106B71DA27; Wed, 20 Dec 2023 09:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KF+fgMS9" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E6DF1D6B1; Wed, 20 Dec 2023 09:00:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88D58C433C7; Wed, 20 Dec 2023 09:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703062851; bh=aP+or2O2Amx3o066NoYjmEoMeqgvW6u+ehSxtWedg58=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KF+fgMS9J85VBtFxE6C+CCleuJv2Zec2Xe4q/rr8qCPuNT4X6BnizX1N/UkQkN0Uj nE3rnBnfP8GJp5JDIKnUtJT1EOslUeIc9Kz5N69A2/7m1+FIVrf69/71oD5mrDBFxI booZixCOostTgj5lokin2FLDaIOi2WdnoU8GbPtNSt+sF2yj7AclNl2tQftWrRBS7l JJyJBvH61E1GgPgIUr0Ld2sEUG0nbwpR+ldnI5O8jY1BRUmblOm5PXaKXgqHhgnQVW mA1nuVNA29MagVh7YGOQLOafINsTUpneKa1N6i2cXp2CD1Sm33c1/4UTrwQyw4bBKL qt8myFyRPxaTQ== Received: from disco-boy.misterjones.org ([217.182.43.188] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rFsRc-005chY-Hw; Wed, 20 Dec 2023 09:00:48 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Wed, 20 Dec 2023 09:00:48 +0000 From: Marc Zyngier To: Haibo Xu Cc: Haibo Xu , ajones@ventanamicro.com, Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Shuah Khan , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Anup Patel , Atish Patra , Guo Ren , Mayuresh Chitale , Greentime Hu , wchen , Conor Dooley , Heiko Stuebner , Minda Chen , Samuel Holland , Jisheng Zhang , Sean Christopherson , Peter Xu , Like Xu , Vipin Sharma , Maciej Wieczor-Retman , Aaron Lewis , Thomas Huth , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org Subject: Re: [PATCH v4 11/11] KVM: selftests: Enable tunning of err_margin_us in arch timer test In-Reply-To: References: <0343a9e4bfa8011fbb6bca0286cee7eab1f17d5d.1702371136.git.haibo1.xu@intel.com> <8734vy832j.wl-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.15 Message-ID: X-Sender: maz@kernel.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 217.182.43.188 X-SA-Exim-Rcpt-To: xiaobo55x@gmail.com, haibo1.xu@intel.com, ajones@ventanamicro.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, pbonzini@redhat.com, shuah@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, anup@brainfault.org, atishp@atishpatra.org, guoren@kernel.org, mchitale@ventanamicro.com, greentime.hu@sifive.com, waylingii@gmail.com, conor.dooley@microchip.com, heiko@sntech.de, minda.chen@starfivetech.com, samuel@sholland.org, jszhang@kernel.org, seanjc@google.com, peterx@redhat.com, likexu@tencent.com, vipinsh@google.com, maciej.wieczor-retman@intel.com, aaronlewis@google.com, thuth@redhat.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On 2023-12-20 06:50, Haibo Xu wrote: > On Wed, Dec 20, 2023 at 2:22 AM Marc Zyngier wrote: >> >> On Tue, 12 Dec 2023 09:31:20 +0000, >> Haibo Xu wrote: >> > > @@ -216,6 +221,9 @@ static bool parse_args(int argc, char *argv[]) >> > case 'm': >> > test_args.migration_freq_ms = atoi_non_negative("Frequency", optarg); >> > break; >> > + case 'e': >> > + test_args.timer_err_margin_us = atoi_non_negative("Error Margin", optarg); >> > + break; >> >> So your error margin is always unsigned... >> > > The error margin was supposed to be a non-negative [0, INT_MAX]. > (May be need to define a Max for the input, instead of INT_MAX) > >> > case 'o': >> > test_args.counter_offset = strtol(optarg, NULL, 0); >> > test_args.reserved = 0; >> > diff --git a/tools/testing/selftests/kvm/include/timer_test.h b/tools/testing/selftests/kvm/include/timer_test.h >> > index 968257b893a7..b1d405e7157d 100644 >> > --- a/tools/testing/selftests/kvm/include/timer_test.h >> > +++ b/tools/testing/selftests/kvm/include/timer_test.h >> > @@ -22,6 +22,7 @@ struct test_args { >> > int nr_iter; >> > int timer_period_ms; >> > int migration_freq_ms; >> > + int timer_err_margin_us; >> >> ... except that you are storing it as a signed value. Some consistency >> wouldn't hurt, really, and would avoid issues when passing large >> values. >> > > Yes, it's more proper to use an unsigned int for the non-negative error > margin. > Storing as signed here is just to keep the type consistent with that > of timer_period_ms > since there will be '+' operation in other places. > > tools/testing/selftests/kvm/aarch64/arch_timer.c > /* Setup a timeout for the interrupt to arrive */ > udelay(msecs_to_usecs(test_args.timer_period_ms) + > test_args.timer_err_margin_us); But that's exactly why using a signed quantity is wrong. What does it mean to have a huge *negative* margin? I don't see how you can justify this. M. -- Jazz is not dead. It just smells funny...