Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2569710pxb; Sun, 5 Sep 2021 23:41:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/3FKp5iqQKGmVe8MNXTPFHg2x+fl8S1B9IdR2teD/igfX1h6ZiRO89s/A6MKGawJZXxiu X-Received: by 2002:a02:c48c:: with SMTP id t12mr9487588jam.82.1630910471057; Sun, 05 Sep 2021 23:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630910471; cv=none; d=google.com; s=arc-20160816; b=idKeF2E1YMi2MVsb5RAE2+D7cXjCAFJikd0PjdyFM5uXS7s5Vyz+hjN8kIq7DjvW+1 AmFu4VL6fXVnuhg5t6LjbYkFcyc6f22YMgnc/gCOlX9z5/nkI+8WmijpsOROSER4bfCw RlHQBEN6eA74OThdzk7uEGixHQw21YZn9Ixng9Hl+IGesp6SRH8N+lNiN6n9VqRkrkgr 3OoTHr4h62eyb6VtJJN5H0i+2tw2tZj59MOLPsVz8v5IeZRp6guJ5Yy1VYgX/5TH/C9t OxpKMfxG07G3xGnwbMUfxpXYWP1W+3QbHMWtpGE6bn/xlXHdOjzVN7yD6zGUTU3odR66 U7fg== 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=pFZpAGoXWqtD1eNY9zjgxvjbpkWIm9fS1Q1YaYaJFgM=; b=dKMo+5JQr5z2NQyZ/wlSmQOhW/GZbCOcpzYVBEjuWcQf2F6RT+eJ1/0zy7YtMa9pDB 200i1eFouYpnhH7OAzxp7mZM1hY55465NG4YDq7s3WPEFvT3QViFA3k2nCoFLpqBqrbj FqJRZ52sE49S/W2AVIpfzq7nrxqvKYSGnclMbLsV5W2itXaEXr5A+vLFKv+1WCfwKHwU XsvumjXlkFUUMAeYS3htIn3O09nURTsjUuC/ZZA9z1ki/Z+J/3TXcwpPsz+y5ZTvF/FG OgsPPA0khHmzGZw5DeJ2R+wvGO6JcECNa78brgUgfcHVCXahdjzHKh5HRjMmQry2GAV+ kUcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OBZ1bQil; 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 t42si5965012jal.13.2021.09.05.23.40.59; Sun, 05 Sep 2021 23:41:11 -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=OBZ1bQil; 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 S239648AbhIFGkP (ORCPT + 99 others); Mon, 6 Sep 2021 02:40:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26711 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239633AbhIFGkM (ORCPT ); Mon, 6 Sep 2021 02:40:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630910345; 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=pFZpAGoXWqtD1eNY9zjgxvjbpkWIm9fS1Q1YaYaJFgM=; b=OBZ1bQilztxl4te6PG57UvNVqo6kIW1jESOeTAr3soI9DA5bjMl7K54uPJ1ANHaF0Q4AN2 ePo8CZvny2AhHhlB5I0t/BS4GGYx9xlFU43dzJrVWEdaUAr7fD3eTC2QBciMkNrK3yl4yP vXPrkFT1VrEzLq3qSsJ2el/OrVm4xyk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-MKRDUdjtOq29q9OjldWf_w-1; Mon, 06 Sep 2021 02:39:03 -0400 X-MC-Unique: MKRDUdjtOq29q9OjldWf_w-1 Received: by mail-ed1-f70.google.com with SMTP id a23-20020aa7cf17000000b003caffcef4beso3189141edy.5 for ; Sun, 05 Sep 2021 23:39:03 -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=pFZpAGoXWqtD1eNY9zjgxvjbpkWIm9fS1Q1YaYaJFgM=; b=UUHWy6NJjy+4b8JLPL9BEYH8UR7rEVIBvqbjT16ZBVwd6gcc8SBXlpCLkK/qdluI6y wqhRUH1CoVjxQZLKYr/6EUxeRg+WFGdoaj7ir5xpPzPSJ7pqOyU9ervh5dxRLOUiBmJF j09OhQzJ36gLjS8J9EJQtMmECl0c8OLud8ybxi8agu+Xrwz5twLKmNzMbe4evQQHcdKD pNuX7gPS7Vdc4lzIkBSoEgERcoG9s+a57eOV/HWPDKeKDtsy5OGJ2flXbWpwOAtVTWBG 9Av2kOo+WrHYVba/LPYTgpCmQCE789ZhTw3qE+C/V5jKSUr5/Zl0waa43GWMgrIWI+OF kvDQ== X-Gm-Message-State: AOAM533GKJZAPt8DrquJKZiwWRQH8rMU/2IznZUeLJYoCKyn+UE+0pA1 6Yo9rG9WrhUrrXHzVuWjEbLkBKfLY2/l4OG2j1OqP+vP4CNPeMzNDli5iS1Z/7shPYPdlAElA6w DQMuGLh2g38N5GsVxtE8P3P49 X-Received: by 2002:a05:6402:4404:: with SMTP id y4mr11919679eda.52.1630910342564; Sun, 05 Sep 2021 23:39:02 -0700 (PDT) X-Received: by 2002:a05:6402:4404:: with SMTP id y4mr11919656eda.52.1630910342402; Sun, 05 Sep 2021 23:39:02 -0700 (PDT) Received: from gator.home (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id i13sm3885374edc.48.2021.09.05.23.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 23:39:02 -0700 (PDT) Date: Mon, 6 Sep 2021 08:39:00 +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: <20210906063900.t6rbykpwyau5u32s@gator.home> References: <20210901211412.4171835-1-rananta@google.com> <20210901211412.4171835-13-rananta@google.com> <20210903110514.22x3txynin5hg46z@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 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. Thanks, drew