Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3874063pxb; Tue, 7 Sep 2021 09:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWb66D9WMnCJDaZ/vdEOp6UP8LGvClja7ttLUA3eXVeApmEmLI9jt7bjzSDFnBoOopJcha X-Received: by 2002:a05:600c:4f0b:: with SMTP id l11mr4805724wmq.126.1631031701123; Tue, 07 Sep 2021 09:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631031701; cv=none; d=google.com; s=arc-20160816; b=QwzkMG5iVYg6HnU2Ff+7TxlYMiPl4zlexa0UL3YAc5wywLX/obHz5i6TpCYClWMXUK pZb1twK1AhHZcWkNlQN2Bp2jc8i+Q9qdeLZcydsN1jIt/1OSpTiYrwE2aFt1XsSO9glg k5D6bDitc2KtLdKvX7MqVQpku6aKTeu4EtAf26Mu+33IJsSxr8iF/4GWiq7MCcPsOoE5 N2+/CqqO26NBvQsriWNu8/FrCvo2APK+ufXCOPI2RcOzbCzT8XdmwNT4tzS+Ze0TO3Di Uq0lMOl4n0uXiyLo6xRjcrB8cBX8ykwkND0PnDhbK1J5oWXU0xO+VT+3GJdciS9cw7KU WC7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=53NoctMz48+CeLqiVC5I0V3NFwxWAgsbbnTUAzbd+hE=; b=09ND+YayNnQtuc40WgH7A8dd3VVdoj1SKRm+VWzTBx0m2TPXmygVx77QLcbQ/39rXZ DSbXaHGRZcQ9MjAHnlUut8VY10jmcFhxMjMFjFX4C1IaQxLRu/zsrSq31ygkLC2VZkXs uq//EZRDrUXKTTz+2KaQVcrjYZI+FF1omtM0/fbjY0BMz2rKHACr95R7svu0YlN7G4fx nZTsOxEbb9mZGyrgJwBIbZ7kKFaJgjzkaWL+UrLzoFGKIgCufO/xibT9dBOXaJdOPHMl f/fZrfCKLqr+w+/nldJhXFj89Mr8JqWGt/O4zst3e2wLTLvvcwEaXCqyKTnn92jG+ib6 W6BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YNYxpL3b; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yc11si11509278ejb.399.2021.09.07.09.21.17; Tue, 07 Sep 2021 09:21:41 -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=@google.com header.s=20210112 header.b=YNYxpL3b; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343508AbhIGQQf (ORCPT + 99 others); Tue, 7 Sep 2021 12:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234466AbhIGQQ2 (ORCPT ); Tue, 7 Sep 2021 12:16:28 -0400 Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 867B8C061575 for ; Tue, 7 Sep 2021 09:15:22 -0700 (PDT) Received: by mail-vs1-xe2f.google.com with SMTP id o124so691vsc.6 for ; Tue, 07 Sep 2021 09:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=53NoctMz48+CeLqiVC5I0V3NFwxWAgsbbnTUAzbd+hE=; b=YNYxpL3byJi9/i1wxvusekdfG85rJg2iAXadc+WxFxywy4oWvjMI3uXNcyWOlxxMrS EdpAOUgFjqpDIS/wwwtVDTmghSnl3ODhrbnz6soZ60h+yizjbAXAkJSf1grM7Teo2r0C vhpt1WVvz11f4Tc2cRbTDwOhKqZuJEOwhTWYAF1wvFhhF0XXyndZ4w25FOcpk2hHjbB5 N01VZ0RdH41I+q8ndIQdwd1WcNIxYSM/6oqxKhJIjLE4udbySizWK7QbUakq4v5VKJIG OjyJBm5Vl29e29rFpxmIU8FKwDKc2afSbUPg+H8twGg1Pum+7VMJAOfkHMyxuVefxNlN fl0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=53NoctMz48+CeLqiVC5I0V3NFwxWAgsbbnTUAzbd+hE=; b=EAg8nD/yIWHnM5Us5Cm8cqgg9gebW9EWp8FeTvyu9uurfuW8Q+R9ZA7bVaJVH94QXa ieSB+8RR0UMbFFDM5Wh4fUlwDlFX462cvjuH+86yBxvOyigHrJPMSrD0ChMzeiec8C3e 4sm9AmzE9csZNLFP+jFvUT7EfnUlONtLHJIg/PzgG3AMQ0XcSekeaPWHr8kBN3diglpp 2siSjUkjby9Bz/6USAfA5sEvEvWHT8X2qNxIU6WJIdiKYoZElzi8rDQ5BdpN5qx1r97v wMO1wjcy3cf1B+nVqC+yn2BvVOyVbGPtIoQ7GbPzHoE/lW0qqTm3U6+ZuXvHmZm8ErQz 1qkg== X-Gm-Message-State: AOAM531wN0UboNTo4jwX8B2O48iBaS2EvbJQA3ca9oDXeIV+rauYJyMW 7kTubdxwaTW3LbNm/MduUsqcUSsTmGQKAiU6DQHxsA== X-Received: by 2002:a67:f74a:: with SMTP id w10mr9939395vso.13.1631031306233; Tue, 07 Sep 2021 09:15:06 -0700 (PDT) MIME-Version: 1.0 References: <20210901211412.4171835-1-rananta@google.com> <20210901211412.4171835-13-rananta@google.com> <20210903110514.22x3txynin5hg46z@gator.home> <20210906063900.t6rbykpwyau5u32s@gator.home> In-Reply-To: <20210906063900.t6rbykpwyau5u32s@gator.home> From: Raghavendra Rao Ananta Date: Tue, 7 Sep 2021 09:14:54 -0700 Message-ID: Subject: Re: [PATCH v3 12/12] KVM: arm64: selftests: arch_timer: Support vCPU migration To: Andrew Jones 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Raghavendra > Thanks, > drew >