Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2640267rdb; Mon, 4 Dec 2023 03:32:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYLzhsyE44myTm/mHENcgu1UTfAvOllR4dm9osqy2V1P8Jjel79o6IVa6Eeqy3oFcrKl09 X-Received: by 2002:a05:6a20:4427:b0:18b:5100:4aac with SMTP id ce39-20020a056a20442700b0018b51004aacmr32312161pzb.13.1701689565860; Mon, 04 Dec 2023 03:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701689565; cv=none; d=google.com; s=arc-20160816; b=sSz+MUxMLl4tiKgdmx0Q+Yfbu8gH4fjqceCdXhEljkAQx3MJDFIIZ+hWOhHlj6iYu/ tzI8Z2IeP2KrWzINYBfv69IEXPm08SQdxfHp8VSFnk4HBn74bicQtuohkDaIey/eqvAN oRqVsvaQyaQnUDP0lcGCdLxs5bIRS6leCiCwf3lwlxAItaHejId5U7mQEACtiuZlUFEq c9gVzMh9CELprQp6gVkv4nApqCn03v/UzwVxECNEqB5gAYPvK+2SqiYiMmyzzoUYlvKs xmUyolDGIb3Nrjxypjxg080qW8foVmcwuaFHtz3rZir0qy+qVqVhJJSGgJaxxtd9kAdP 8s/w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=k24kTPlVkd21kNiwlx5AXtWzxUb1iLhkKqVaC17WY/Y=; fh=gnyG4/ZJZz7iWY1S9dRbpvHDTxx0AR4NPQpVgRpROkk=; b=FQK7amfDHxcSqk8+kBg9kLLI7F1sfdAmn78SQPkzBcWtXBHYq5D/QYj4oLCouJA8CV 6pIi5Z20TShW0Ny9LII4dyjQ8HrX0A8+ZJrZf15xquTi8OKxj81sYEeR9YCo2HaSfW/O iWOz9nYGv0ts67/FJgDQqXvHYu73mUeY5vqVBFhGuuf27Gj4gGJ+I1LSzaf9m39+Vb5U BX7VP8tgHwSfKBTunXIUBuNXcwO4w42qBW4vXiY3gnirPIZEB3o56te6cnbmqJV+2CG9 +g/v2wXGC5IEiZJyGpafwgjbJu0q/ny3JrFCo8pbXIiTkMMT9cmZX37H9K2tfcQozES3 9cpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=DgEI5Nwv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id z6-20020a636506000000b005c1b2d93e52si7795196pgb.368.2023.12.04.03.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 03:32:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=DgEI5Nwv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4B1EE8057E3C; Mon, 4 Dec 2023 03:32:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbjLDLcY (ORCPT + 99 others); Mon, 4 Dec 2023 06:32:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbjLDLcX (ORCPT ); Mon, 4 Dec 2023 06:32:23 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B65AB0 for ; Mon, 4 Dec 2023 03:32:27 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40bd5eaa66eso23410175e9.3 for ; Mon, 04 Dec 2023 03:32:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1701689545; x=1702294345; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=k24kTPlVkd21kNiwlx5AXtWzxUb1iLhkKqVaC17WY/Y=; b=DgEI5NwvqWa1JxsCZlJaR1i7usMgEBVTqktWA5lLzSpDAcg/9u9JHtn97EJw7SLWs0 NzN5cuU73wiRRJJbEjCVKgWXaZrf9H6A43Sq0++8tMDK7x0mosDfCklfJKB8YGXQX/A1 buqijPUs8ySkWxQE80o7Ok3tINXSBmNi+12DjRuoYi8uROW6Sf7yv9bV8Wt7JL2pAG5n T8p+eda8XEiBS9DWIAnNuAiuuzunEyRrivbf1+x2BMz2TEnRhIlqdTxbDBttfHSqJmuM x1oFRM0fsN+q8UyLBJJ2O19jsoCODfZU/3WbkZbs0d3qHxdcC8znQr9p+E35Eis280MY 5eyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701689545; x=1702294345; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k24kTPlVkd21kNiwlx5AXtWzxUb1iLhkKqVaC17WY/Y=; b=VEATU+GWUZPnsi9Dl5ikptat5Tdzf4Pru6wgocJsH34NZXsTznvlHdHv6ETFVyBifS UlMkCrDecm6I9drMH/4MEVySTbvA7YDs2vQyILkd8YD0JAveHEyndmwLo+HWGRXra4ln BliLQyD33fxp3DREQji2eaQKCLP0L8XEYLfSheO7quHtrq/AjpSPWRzme4OPPfFr2Q0E a5JoS0rp61ivfvJDL9c7mEVvZw9DFXIB00RO7OeLLyyJOmQvR5h+BS+0VftRI/14pi3P G2zvsQSIglQMAmYK8KSWJKA2/2hP47UZkU2pIMnZIvM7E5xc/+yIScv/jzMdSjTfqeeH hh6A== X-Gm-Message-State: AOJu0Yz0MqcRxBdAvXsOuXXlY3ddRIq/XR0ZnRxlp3Xe7rVRMC8KDjtO GrF3/14bU+6em+dGtG11b9Hr+A== X-Received: by 2002:a05:600c:5d5:b0:40b:5e21:ec33 with SMTP id p21-20020a05600c05d500b0040b5e21ec33mr2310718wmd.101.1701689545469; Mon, 04 Dec 2023 03:32:25 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id u2-20020a05600c138200b00405d9a950a2sm18390025wmf.28.2023.12.04.03.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 03:32:24 -0800 (PST) Date: Mon, 4 Dec 2023 12:32:24 +0100 From: Andrew Jones To: Haibo Xu 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 Subject: Re: [PATCH v3 9/9] KVM: riscv: selftests: Add sstc timer test Message-ID: <20231204-980c95cca344f718ac6a48b6@orel> References: <64e0637cd6f22dd7557ed44bd2242001e7830d1c.1694421911.git.haibo1.xu@intel.com> <20230914-d2e594e7d84503ad14036e2d@orel> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 03:32:43 -0800 (PST) On Mon, Dec 04, 2023 at 10:42:24AM +0800, Haibo Xu wrote: > On Fri, Sep 15, 2023 at 2:21 PM Haibo Xu wrote: > > > > On Thu, Sep 14, 2023 at 5:52 PM 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 >= 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 = false; for (i = 0; i < 10; i++) { udelay(100); if (check(...)) { pass = true; break; } } assert(pass); We could try that approach here too. Thanks, drew