Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp383726rdb; Tue, 19 Dec 2023 22:50:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGH3J2IOUWmX68XI215XoebbammVawWTG9C1QqyLTfF15HY8RA2rmNxeyKb95AifTBag8+p X-Received: by 2002:a17:906:191:b0:a23:333b:12fc with SMTP id 17-20020a170906019100b00a23333b12fcmr1525184ejb.54.1703055030038; Tue, 19 Dec 2023 22:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703055030; cv=none; d=google.com; s=arc-20160816; b=Ft1AevU0KlqrX6Z7uNmjIqguOagY5RD9HQxqBzhybRa07iRMZWNXw2k+f0CulUna7S YwgorNuzpkk7dpABYnXfc9tTgXq8SwJgX3Ca80UN1Kuc84YiL+IH1pFbQtRgoRIZ4+s8 P0ntiIbYpIrXQFDInx5zwjlCztw8y1uNXW++6EHiSfw53dxEFmrFkseeWZlTvkkUPqDg DiH9B5L3m+8zQgysvAJgcq7zVu4tSvVluMlRGaiS7PDcbDDQJKFVUWBjbGzL7OxkJ0Pd HfQsDKkaXGTjcIq3Q0s+/BbOSOTTJMNbYiX6/YIZJg86LzKAntlMHIvii84UD+cJpwjs JmKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IloV9gHlRpc9SD2YCXR7E/7T42jMVfD74Pty8sLbHvY=; fh=w6eFdHAuZsAGf0b2QwNmPQNEgPvhwmunmxCCwlMfGLc=; b=cmH/rpkU7uidLcuty59F/1bNoXrSmt34UtN0CTGrYGi5iJGZ5S0lYogS3uJx8880E2 UqJKgOyba+/K30sMxzKr4JWNh3VMnu4nJ2py4x8ztmG3TNYloVQ2q1RYwL//l5af58UM aT/JFZjc9XfsOMzs2caPtVIHOL0n3GFUl5BecQbSxXpMvwfZ/rS6p9J4fH5cw8ZgZCfz L+/GGv7Eh0o7rDWdx0ghW8hPA/4BayhwZ8ABoH98Oag4Xgtp4DrzTUaqAbCO7qwGfuDD MT3EDy27BY6fJ+/DPyvpmjNW+XpZRx1bgH50PBCwSuyTQ145pRxjQ/8MoUM0/7kCZJKS /04A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YBtA0US3; spf=pass (google.com: domain of linux-kernel+bounces-6438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jp20-20020a170906f75400b00a2357e799f0si2474426ejb.1014.2023.12.19.22.50.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 22:50:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6438-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=@gmail.com header.s=20230601 header.b=YBtA0US3; spf=pass (google.com: domain of linux-kernel+bounces-6438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 9F99E1F2629A for ; Wed, 20 Dec 2023 06:50:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AA951428B; Wed, 20 Dec 2023 06:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YBtA0US3" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 242BB15496; Wed, 20 Dec 2023 06:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2cc5e48779aso47440151fa.2; Tue, 19 Dec 2023 22:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703055015; x=1703659815; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IloV9gHlRpc9SD2YCXR7E/7T42jMVfD74Pty8sLbHvY=; b=YBtA0US3frW0Vzy5nLl8FnXaHxMswBZmnKrl9G3/uZOQQ4GveJYNLyGsV5+gcDXI9V J+ga22b2F3ZGQbpYEP/cYv+55S06vo6ADryV8pJmAJ66zEGv7wsnB46zF+C6oU0hkYM9 /6um/pYXfH4h66Sxhk69FdCqoGrzt7StX6YSTikAk4sWwoZGuF3VP6RLVYXs6t0EBfHJ gU0eU8f+ToLWBTDTpU9GJ1UL1tDiR/eYDkz99GCPc+Xpyc5iQM3Lzxp4VbfXfH3lz/bX gjhEzsKnXFnU5BqR2kyMHk2uZi3rOYtY5ulBxULSFpIAs12cHcJqMLUulTGlKhc7yrJJ 3oqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703055015; x=1703659815; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IloV9gHlRpc9SD2YCXR7E/7T42jMVfD74Pty8sLbHvY=; b=QwWG5ZTwMoOLKkjbe2c95tg9UihY8ARFMIAVx725A5NT/po8CyfduIUpEmUatEo4ZW f+fNAulBqhF029fFyPjrLP564W9jnlmpv/JuO/VwMJI226OHPgW6apiUqMM3zoKPvA6O C3iwwu7aXwbHmQmRgXWvDs+NZ3BBnhfK4xs/h1cwil4X43lv8yX3MVafTJ9wCbZh3rWu 4SF+MHDCJ07wuDhlbLP6Upr0op4nr29zxQuNGi+hwxjU+/6RtDL0tYUZMLSD0LkYPFkf JPmYermAM4gx/vEf97ia0RDTV+e//aJsxGChVtEvTUi0M1Wd6UOtugm/H4mg2ZsV7UuI 0XXw== X-Gm-Message-State: AOJu0YxvEG9AoYgICe6ozrgI4u2WMrLaOjY5r4fzztBLeid8YDkSPIl9 Z2dpEZ6IbIW48YGK6Et9maYIUUwB7n0/Mp8FX/A= X-Received: by 2002:a2e:b0dc:0:b0:2cc:895c:5de3 with SMTP id g28-20020a2eb0dc000000b002cc895c5de3mr338259ljl.207.1703055014949; Tue, 19 Dec 2023 22:50:14 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <0343a9e4bfa8011fbb6bca0286cee7eab1f17d5d.1702371136.git.haibo1.xu@intel.com> <8734vy832j.wl-maz@kernel.org> In-Reply-To: <8734vy832j.wl-maz@kernel.org> From: Haibo Xu Date: Wed, 20 Dec 2023 14:50:03 +0800 Message-ID: Subject: Re: [PATCH v4 11/11] KVM: selftests: Enable tunning of err_margin_us in arch timer test To: Marc Zyngier 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 20, 2023 at 2:22=E2=80=AFAM 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 =3D atoi_non_negative= ("Frequency", optarg); > > break; > > + case 'e': > > + test_args.timer_err_margin_us =3D atoi_non_negati= ve("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 =3D strtol(optarg, NULL,= 0); > > test_args.reserved =3D 0; > > diff --git a/tools/testing/selftests/kvm/include/timer_test.h b/tools/t= esting/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 mar= gin. 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); Thanks, Haibo > M. > > -- > Without deviation from the norm, progress is not possible.