Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp123438rdb; Mon, 4 Dec 2023 23:58:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcd3q3UQqdEssFnhhEVSH2nH80KdYcgAWRu5G6/ns4Gn9mCkrYWq0A0ghZLPQ1X650rk2f X-Received: by 2002:a05:6358:2905:b0:169:57f3:7551 with SMTP id y5-20020a056358290500b0016957f37551mr2284603rwb.23.1701763111553; Mon, 04 Dec 2023 23:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701763111; cv=none; d=google.com; s=arc-20160816; b=HprRVJtxbD3vxnEl+wipfbObMXWbihcQ0srPZlo3UzR9cq+W1v1+opryFWu71XN+PA 5/CXwVGt5Bm/BefUCcDFG6oTuECS2vjT3BPDrupHtkr3qqw8Uw2UvbYtg6880FG3fdGB T+P9dmHWkkSVfCPsLLCskZQJg8JwUQfENJ5qaExX1OJdykH4SJSdrIzATrpGmABAG/Qh uT5xTCF9O+JQQJRNGOYGUo9j9I7ieXChnqwgoAA/h+dXjnQdKCNdCNgJuLUmdMxv8zy5 JlEO/4Wy77oBj2v+5uI98g6aK8WgLaaZjTe5M4MYaHp4/cZ90yx8erJ30aPJXnfuCh92 G4Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mDaBQlGZ8UjeyvNNGC2XDs5wlZCfXV5wgyIn7Cj35I0=; fh=i9kO9nGU8XAXSktHUrF/mydeOqZ9IGD0urJtC1NEWH4=; b=CHGZ1vsOfm87+1hCxzoTG/safnDg81RjJ6jEvomeWxQ06iUWZfDbyePaRlFniW/ulo FZ+/Ox6Mkw0Ps84jSCAXFnr6z7AmMfI4dXMZ2oXGH97gOvZd0h2CghRl4veKhvomEgy/ pMUL6obyLQ0BTO/iw1n400GFzBT8up9biSItQSpPlGB4xlUuCcPalLowZq3SFlZtVxiS 81Ukc+suVSsrl/p2OM8h+oKkKAEd5k7a0pqYMlQOSYEKqoAKp99owRzzJLnfCYLU+FaQ 7l4flhrGmy1kuyOKLNZVZXBRR3rIyCh0phNmQPgV+iwHKwLKHEkCv32dAZHZadmkWr/R ciCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BUyMscos; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 24-20020a630a18000000b005be1ee5dfc7si9062208pgk.9.2023.12.04.23.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 23:58:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BUyMscos; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D3D84807C872; Mon, 4 Dec 2023 23:58:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbjLEH6M (ORCPT + 99 others); Tue, 5 Dec 2023 02:58:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbjLEH6K (ORCPT ); Tue, 5 Dec 2023 02:58:10 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3244911F; Mon, 4 Dec 2023 23:58:16 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-50bee606265so2841880e87.2; Mon, 04 Dec 2023 23:58:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701763094; x=1702367894; 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=mDaBQlGZ8UjeyvNNGC2XDs5wlZCfXV5wgyIn7Cj35I0=; b=BUyMscos3p1dIHj8yoZ2M+4nlgLPQnWZXbDD1JPkl3uZBcGbVKfQmUej0vU5u4oHgL rNbrtu9p6VamKz1EXMNagc2IwFvq2gGtFKtDrN6bknPXwH7yUWSTeklN5iqZKHETfq0Y JpTWD+Y8wu5OZjoiHhyI4NbhiVXJGvhbCMXlu/MuhQjqyDqKkbkTxNlKR4ASO5ylYsph X4uFhWE8Cwkm4iPXwx3wDdlOMTecARML++N6As+6a4UYLt4HH/T3llABCipXXTApspyv bYZDj4jzeTJNRLDODFbjCnb5CkTn2mTMG+tAoi864EsQEwSlAqUAGXoQgf3n+HSA54NB nCEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701763094; x=1702367894; 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=mDaBQlGZ8UjeyvNNGC2XDs5wlZCfXV5wgyIn7Cj35I0=; b=Y47UCR6qCuA45sS15cEm3ZXTMtjvLZzD+F0T+q/XH3rKaaFlt4aKhXvJfpVYZX+Lfl tFhpAiEzQkU7H2LWffCEX9NTc/dLBDKJJW/eXW6oTbvru42YEqX5G+S/DEn51oCHVZzz 0aEUFhcMberb2qzsk7UgiUpjIJoUIvPBFVDBUieQKAn70iaRnbNX3rxSWVVZxd++R02q xHHGSDFyMSlLC3sUSO1jDn0X4DDmV3XmzGf7QefQcCHnhpKwYz5c2S4EdpoyWYLhCtIW jSC3Nr58ULYchyDjXRcrzvbkxnfNAQ1MAvTJPYwFtxYQD+j7hWfkInFLDoRnVdhW/XHG vFhA== X-Gm-Message-State: AOJu0YxgloMmyFvCl4m8PGCpCkBGdak/0CU8wTxFqPyrfzPpU/ddhEKv AQiy7vJ+pTbbxdzIEbJcyilOE9V3k3T1ncbRHAI= X-Received: by 2002:a05:6512:3b8f:b0:50b:f019:366a with SMTP id g15-20020a0565123b8f00b0050bf019366amr2333164lfv.109.1701763094196; Mon, 04 Dec 2023 23:58:14 -0800 (PST) MIME-Version: 1.0 References: <64e0637cd6f22dd7557ed44bd2242001e7830d1c.1694421911.git.haibo1.xu@intel.com> <20230914-d2e594e7d84503ad14036e2d@orel> <20231204-980c95cca344f718ac6a48b6@orel> In-Reply-To: <20231204-980c95cca344f718ac6a48b6@orel> From: Haibo Xu Date: Tue, 5 Dec 2023 15:58:02 +0800 Message-ID: Subject: Re: [PATCH v3 9/9] KVM: riscv: selftests: Add sstc timer test To: Andrew Jones Cc: Haibo Xu , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Shuah Khan , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Anup Patel , Atish Patra , Sean Christopherson , Ricardo Koller , Vishal Annapurve , Vitaly Kuznetsov , Vipin Sharma , David Matlack , Colton Lewis , 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 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 04 Dec 2023 23:58:29 -0800 (PST) On Mon, Dec 4, 2023 at 7:32=E2=80=AFPM Andrew Jones wrote: > > On Mon, Dec 04, 2023 at 10:42:24AM +0800, Haibo Xu wrote: > > On Fri, Sep 15, 2023 at 2:21=E2=80=AFPM Haibo Xu = wrote: > > > > > > On Thu, Sep 14, 2023 at 5:52=E2=80=AFPM Andrew Jones wrote: > > > > > > > > On Thu, Sep 14, 2023 at 09:37:03AM +0800, Haibo Xu wrote: > > > > > Add a KVM selftests to validate the Sstc timer functionality. > > > > > The test was ported from arm64 arch timer test. > > > > > > > > I just tried this test out. Running it over and over again on QEMU = I see > > > > it works sometimes, but it frequently fails with the > > > > GUEST_ASSERT_EQ(config_iter + 1, irq_iter) assert and at least once= I > > > > also saw the __GUEST_ASSERT(xcnt >=3D cmp) assert. > > > > > > > > > > Good catch! > > > > > > I can also reproduce this issue and it is a common problem for both > > > arm64 and riscv because it also happens in a arm64 Qemu VM. > > > > > > It seems like a synchronization issue between host and guest shared > > > variables. Will double check the test code. > > > > > > > Thanks, > > > > drew > > > > Hi Andrew, > > > > After several rounds of regression testing, some findings: > > 1. The intermittent failure also happened on ARM64 Qemu VM, and even > > in the initial arch_timer commit(4959d8650e9f4). > > 2. it didn't happen on a ARM64 HW(but a different failure occured > > during stress test) > > 3. The failure have a close relationship with > > TIMER_TEST_ERR_MARGIN_US(default 100), and after increasing > > the macro to 300, the failure couldn't reproduced in 1000 loops > > stress test in RISC-V Qemu VM > > > > So my suggestion is we can expose the TIMER_TEST_ERR_MARGIN_US > > parameter as an arch_timer test arg parameter > > and tune it based on a specific test environment. > > > > What's your opinion? > > The concept of "timeout for an interrupt to arrive" is always going to > leave us exposed to random failures. Your suggestion of making the > timeout user configurable is probably the best we can do. I would > suggest also adding more descriptive failure text and a hint about > trying to adjust the timeout. > > Or, one thing we do in kvm-unit-tests, is to reduce typical delays while > allowing expected delays to be longer by looping over a shorter delay and > a non-fatal check, i.e. > > pass =3D false; > for (i =3D 0; i < 10; i++) { > udelay(100); > if (check(...)) { > pass =3D true; > break; > } > } > assert(pass); > > We could try that approach here too. > > Thanks, > drew Thanks for the feedback, I will send out patch set v4 soon!