Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3875051pxb; Tue, 7 Sep 2021 09:23:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzczOQbJazUjtpGNQ0+LSO+ptfLB/5YB4Q1DqERv/YCx1YmOfLZKHUhI/R9kz4YGpTtBSqj X-Received: by 2002:a17:906:ff41:: with SMTP id zo1mr19091257ejb.525.1631031788170; Tue, 07 Sep 2021 09:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631031788; cv=none; d=google.com; s=arc-20160816; b=dM04vsyLMqyEKzrKqc1tTJ2fLP8XN+7DTyU5oTyOpWMa0nyxhKhlgo+fz5PY7CNDAP wt+zQwOCr9cmXx8M6jQMNOZMUDMsfjkl0cdLs0HFv112lGm7TwZhKHA+PHg1wXRryVJW jsXLZS/r8Q+Nu4FIfLJm0+Pxtyy77MtbPDbds7nzdHuhFQRkLw4eyjuf0+bewy2Wxleq V+bgp2qjiBkQjjtSPNoXGUK5dkFK/lglFyaPVyHnwAI+7TLRVZh8DXhIBJi0B6IuvrG/ YcqY9T3J/leKh+HMc0gM7NjPLvAiN5meTgfbZcSOmV58XNOPykEb6q3RPyzdIaFb9iRh hERw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=s5kpwoL6JLP9VWq157hj4yt5pn95OzlSkFYcjxu+uM8=; b=O/zWfrFmEIgLJ6CuQ33N+1GvDgcL8AkvfWJebrEkOJ9ITglCqMQkAYI5RhYxMFzQSy szXzVn7ZCZXBoQJo2lZyJ0KmsOerxbirqvtjTVGMPlXGZJhR7xyl98XxJ778cAJTe2o/ eH1rqXWo0pFVW62OeMTq3yYBPynOsh05zZx7hvPGlrb8X7s9mW0Ej615Eqz1r8JS4KkD BRWuGSJpfQEGgYeJL5cjBCtHltQomPwj9dg6zL8zgPYR7nmOmJN2HkF8gY0Eug86jJ2y Xl/gh1UES8kfSF5StR/jY9ojUHM3vGTZbHycJUmcjJR03hEKFDf8ssC3vb5iYM5ulCx/ wgZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="A//GbMzV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si11439733ejq.701.2021.09.07.09.22.44; Tue, 07 Sep 2021 09:23:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="A//GbMzV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233796AbhIGQV3 (ORCPT + 99 others); Tue, 7 Sep 2021 12:21:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41574 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231961AbhIGQV2 (ORCPT ); Tue, 7 Sep 2021 12:21:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631031621; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s5kpwoL6JLP9VWq157hj4yt5pn95OzlSkFYcjxu+uM8=; b=A//GbMzVInx3sIjulM8vMA2hwvrRkGYJHTASDkQ2/e56WCkn6o1BuF9szfdJ2r4jigSVSc wBA48ke7CgXgXcBx6OKsrk26TkUfeb/89wag7B6Ls9sgoBhrSOM0noizfDUHs3UItTJwVd 4EBtaP5KQ7o9ZSGfdDuYN5UsED45+QM= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-119-gj_yjZH-OO2k8pzaFrtlzg-1; Tue, 07 Sep 2021 12:20:20 -0400 X-MC-Unique: gj_yjZH-OO2k8pzaFrtlzg-1 Received: by mail-ed1-f69.google.com with SMTP id z17-20020a05640240d100b003cac681f4f4so5430288edb.21 for ; Tue, 07 Sep 2021 09:20:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=s5kpwoL6JLP9VWq157hj4yt5pn95OzlSkFYcjxu+uM8=; b=aF3NQDz79Z+bI+vzJwHciO5hrGU9kEVlAqp2KID7NBMfanOLjPBhEtM/dMZewbL4Hq vnKVl8U5lYutngIop/KrIdgfr1XZrOaADY7P2CZvD3XWNgOAhTbTkuW2T7JDTIRfcZPx 6stwPW5TYcMrMREdI+JMbY5qCf/m8oyTXnmbi4aYhNWZEp/pDuQNuEXSuktcEOY1yc4i cBwDwZa/xu8rKA9PYeCWKWXZ6F5QtfBkOvUOwseVoJfar7RhL6gyW7yD2mCcvXNx31PN xfQQJ4XsckNzHX6joeg8B4aBgy+a9ruN1M12LQyBn76Rx+hyZjlCh4FJhpUA+JqkW/gU puSA== X-Gm-Message-State: AOAM531xqHY+1YTyh/VjELmJS/11zeLoScCinFKEwTvXTau7p2VnW2dA BptfR2U5EILMed/tlGUFSV1SO2KLmJGXne4K79HGhCZSJcFDV5rM3KyKEYq0J33mHDnIsIO5Dj5 x5yIFZuMhQsPe50HEd81q+LT9 X-Received: by 2002:aa7:d351:: with SMTP id m17mr307619edr.72.1631031618935; Tue, 07 Sep 2021 09:20:18 -0700 (PDT) X-Received: by 2002:aa7:d351:: with SMTP id m17mr307607edr.72.1631031618753; Tue, 07 Sep 2021 09:20:18 -0700 (PDT) Received: from gator.home (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id a24sm6571101edu.49.2021.09.07.09.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 09:20:18 -0700 (PDT) Date: Tue, 7 Sep 2021 18:20:16 +0200 From: Andrew Jones To: Raghavendra Rao Ananta Cc: Paolo Bonzini , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , kvm@vger.kernel.org, Catalin Marinas , Peter Shier , linux-kernel@vger.kernel.org, Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 12/12] KVM: arm64: selftests: arch_timer: Support vCPU migration Message-ID: <20210907162016.2axil4gjjvkafnkx@gator.home> References: <20210901211412.4171835-1-rananta@google.com> <20210901211412.4171835-13-rananta@google.com> <20210903110514.22x3txynin5hg46z@gator.home> <20210906063900.t6rbykpwyau5u32s@gator.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 07, 2021 at 09:14:54AM -0700, Raghavendra Rao Ananta wrote: > On Sun, Sep 5, 2021 at 11:39 PM Andrew Jones wrote: > > > > On Fri, Sep 03, 2021 at 01:53:27PM -0700, Raghavendra Rao Ananta wrote: > > > On Fri, Sep 3, 2021 at 4:05 AM Andrew Jones wrote: > > > > > > > > On Wed, Sep 01, 2021 at 09:14:12PM +0000, Raghavendra Rao Ananta wrote: > > > > > Since the timer stack (hardware and KVM) is per-CPU, there > > > > > are potential chances for races to occur when the scheduler > > > > > decides to migrate a vCPU thread to a different physical CPU. > > > > > Hence, include an option to stress-test this part as well by > > > > > forcing the vCPUs to migrate across physical CPUs in the > > > > > system at a particular rate. > > > > > > > > > > Originally, the bug for the fix with commit 3134cc8beb69d0d > > > > > ("KVM: arm64: vgic: Resample HW pending state on deactivation") > > > > > was discovered using arch_timer test with vCPU migrations and > > > > > can be easily reproduced. > > > > > > > > > > Signed-off-by: Raghavendra Rao Ananta > > > > > --- > > > > > .../selftests/kvm/aarch64/arch_timer.c | 108 +++++++++++++++++- > > > > > 1 file changed, 107 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/tools/testing/selftests/kvm/aarch64/arch_timer.c b/tools/testing/selftests/kvm/aarch64/arch_timer.c > > > > > index 1383f33850e9..de246c7afab2 100644 > > > > > --- a/tools/testing/selftests/kvm/aarch64/arch_timer.c > > > > > +++ b/tools/testing/selftests/kvm/aarch64/arch_timer.c > > > > > @@ -14,6 +14,8 @@ > > > > > * > > > > > * The test provides command-line options to configure the timer's > > > > > * period (-p), number of vCPUs (-n), and iterations per stage (-i). > > > > > + * To stress-test the timer stack even more, an option to migrate the > > > > > + * vCPUs across pCPUs (-m), at a particular rate, is also provided. > > > > > * > > > > > * Copyright (c) 2021, Google LLC. > > > > > */ > > > > > @@ -24,6 +26,8 @@ > > > > > #include > > > > > #include > > > > > #include > > > > > +#include > > > > > +#include > > > > > > > > > > #include "kvm_util.h" > > > > > #include "processor.h" > > > > > @@ -41,12 +45,14 @@ struct test_args { > > > > > int nr_vcpus; > > > > > int nr_iter; > > > > > int timer_period_ms; > > > > > + int migration_freq_ms; > > > > > }; > > > > > > > > > > static struct test_args test_args = { > > > > > .nr_vcpus = NR_VCPUS_DEF, > > > > > .nr_iter = NR_TEST_ITERS_DEF, > > > > > .timer_period_ms = TIMER_TEST_PERIOD_MS_DEF, > > > > > + .migration_freq_ms = 0, /* Turn off migrations by default */ > > > > > > > > I'd rather we enable good tests like these by default. > > > > > > > Well, that was my original idea, but I was concerned about the ease > > > for diagnosing > > > things since it'll become too noisy. And so I let it as a personal > > > preference. But I can > > > include it back and see how it goes. > > > > Break the tests into two? One run without migration and one with. If > > neither work, then we can diagnose the one without first, possibly > > avoiding the need to diagnose the one with. > > > Right. I guess that's where the test's migration switch can come in handy. > Let's turn migration ON by default. If we see a failure, we can turn > OFF migration > and run the tests. I'll try to include some verbose printing for diagnosability. > Sounds good. You can also consider using pr_debug if you feel the need to balance verbosity with diagnostics. Thanks, drew