Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1975661rwb; Fri, 28 Jul 2023 19:42:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlHVVGtrNkiRu5nouxbvVc7WeV/gBIqMt6D9+XVJ2x6AObZ1dQwWM3VgKq5gleRp5O3moyme X-Received: by 2002:a17:90a:ac03:b0:263:f72f:491 with SMTP id o3-20020a17090aac0300b00263f72f0491mr3475502pjq.43.1690598535666; Fri, 28 Jul 2023 19:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690598535; cv=none; d=google.com; s=arc-20160816; b=HI15R0W58/J/729Md7f68vrLjK7rNwvw/sZeGw8HIoAAbLAzQR20+pSk/2qmRN0lId G5PlRVQHBDjrrFZQMXZ5lUu+c33JEorkEiL88idGeY12CsOlk/dYeoHT9QeiHd40T8DJ eWCsmkzhxeufLXhgLpwBX8fMmuyj0/Q77SF7hvcpCx/iK/C+67eGuXoO+ddNkv7jRIrc b1SPfI4IQY72JmAmxt7r3tFqSpLjYKa0R9eZb5yEh0MyLJQ41/N+/mKWZmRfxj7cryHY kNhJVTW1J+22ePyTMEzC2VJofTICmPsRHOwSzDtyAMn2MwSjQITthIs9pGajIwOVKV4E k4pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=MTnhp9X0lvYUZIL9WzwgJz1fC/FCDEfshbcoz/56eco=; fh=Ctt0ydInMKwei8YFBFbw7rU4p8H0G/T51ZI/KkO6Md4=; b=bkHoSAFqssIxGR/Vobbf4AyMISnuJGvt+UI3uyHPdjjjwebsdeAVqNwAjnCS0DKo9/ ENnp4ijYqCHK6hXjm0ueSJMr0ddyT2dQCKr7FxakSWI4Bshx3cXuq9mPi7bgMseHS5zn CEdFZqWqJj7bncnoksnTCs6FBk0uMXoPx07nTeCvgVDB65xwQZ76TbB7GaM4xnx6Lv6R G23REhUSypRifAAQgqXr6sxo0BmGfahh36UWH2hdVqIbt49psyP01UROV/t1vW6McpBj deeqkzxK//P9zbScJKxwh+XFb563UlsBn2h6v2Ad4CcVx+9GTP1btVazIEasbRVu4HEU GIgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=lx0KZzEt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a17090a6a8900b002633c436f4esi4134165pjj.34.2023.07.28.19.42.04; Fri, 28 Jul 2023 19:42:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=lx0KZzEt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236473AbjG2AiY (ORCPT + 99 others); Fri, 28 Jul 2023 20:38:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236525AbjG2Ahw (ORCPT ); Fri, 28 Jul 2023 20:37:52 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C704EC0 for ; Fri, 28 Jul 2023 17:37:06 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5840614b107so28129797b3.1 for ; Fri, 28 Jul 2023 17:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690591025; x=1691195825; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=MTnhp9X0lvYUZIL9WzwgJz1fC/FCDEfshbcoz/56eco=; b=lx0KZzEtIsU0AdZ9qnXZlqbpjsDtaC9HcUC6zEB5z+kgdFIehygXDlCxd/jAA0wTwd 4gRgNK3LibVhKtGBS+OwiXCm8B21jgDt2+6DxZvJ76oM47lhWAHJHFB0tKxpVNtgeF+B RMIjaJHwQQvB52Sgbeem3LaxJb7s8wsgeNOUhXWjnrzAyjFTAF0QPmYoh9DFE9SHjp9N WYQ7gSBDcpm+zTFhDttDC7VO88WNVZrNOtJn/gyTAZoWDTKtnoLkUSHxC6+D3Ctlvpda PH1Z199C1u+Cu7YlHc7/jYTzKlazFn0t0RJr3GmJfdmakqJtYgm5QBnYq03xGWhI10A8 DNdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591025; x=1691195825; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MTnhp9X0lvYUZIL9WzwgJz1fC/FCDEfshbcoz/56eco=; b=WRAIlQh0Uz0MsIZ+ng5VtORJ/hJh92Poyy5Ix5fgA8psx5EMefQ7i3DO+O5Pevs4BV 4d9yOgNwTkYWbUxGUBAA35/9L5gXn+BIqh6VozBi3UxUKy0R0l6lWDIkIBhCKxnJ0OLz l9nCbddHjsSIi+zHado4EwKfOuYkySFj6SVKQK1UsNB2yDDL0uKVgr8uZ6FVAa/V7rt+ 8Yap499y1XgDPBcW7D0suU6OIY+PGZwOCmXQjgKQsuswN3nBSyFrwoolukjGeXSmOUBl gnYs2zXSrscDFlZ1nnHl+BY0FjClexHS2MH+HvXNuZ7XZp4Pp4/I5CHIhF1bFwo3kKEh 0C3Q== X-Gm-Message-State: ABy/qLYzh1IpC99Vik8f0mDA4Z5gzVCbWJZbuv+v3anPn7hhIexnIxG8 13keurAom/tyMA8eDcdeo4EeNSCLmjs= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:ad42:0:b0:56f:f62b:7a11 with SMTP id l2-20020a81ad42000000b0056ff62b7a11mr22723ywk.8.1690591025745; Fri, 28 Jul 2023 17:37:05 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 28 Jul 2023 17:36:19 -0700 In-Reply-To: <20230729003643.1053367-1-seanjc@google.com> Mime-Version: 1.0 References: <20230729003643.1053367-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230729003643.1053367-11-seanjc@google.com> Subject: [PATCH v4 10/34] KVM: selftests: Convert aarch_timer to printf style GUEST_ASSERT From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Sean Christopherson , Thomas Huth , "=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=" , Aaron Lewis Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert ARM's aarch_timer test to use printf-based GUEST_ASSERT(). To maintain existing functionality, manually print the host information, e.g. stage and iteration, to stderr prior to reporting the guest assert. Signed-off-by: Sean Christopherson --- .../selftests/kvm/aarch64/arch_timer.c | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/kvm/aarch64/arch_timer.c b/tools/testing/selftests/kvm/aarch64/arch_timer.c index 8ef370924a02..b53bcf126e6a 100644 --- a/tools/testing/selftests/kvm/aarch64/arch_timer.c +++ b/tools/testing/selftests/kvm/aarch64/arch_timer.c @@ -19,6 +19,7 @@ * * Copyright (c) 2021, Google LLC. */ +#define USE_GUEST_ASSERT_PRINTF 1 #define _GNU_SOURCE @@ -155,11 +156,13 @@ static void guest_validate_irq(unsigned int intid, xcnt_diff_us = cycles_to_usec(xcnt - shared_data->xcnt); /* Make sure we are dealing with the correct timer IRQ */ - GUEST_ASSERT_2(intid == timer_irq, intid, timer_irq); + GUEST_ASSERT_EQ(intid, timer_irq); /* Basic 'timer condition met' check */ - GUEST_ASSERT_3(xcnt >= cval, xcnt, cval, xcnt_diff_us); - GUEST_ASSERT_1(xctl & CTL_ISTATUS, xctl); + __GUEST_ASSERT(xcnt >= cval, + "xcnt = 0x%llx, cval = 0x%llx, xcnt_diff_us = 0x%llx", + xcnt, cval, xcnt_diff_us); + __GUEST_ASSERT(xctl & CTL_ISTATUS, "xcnt = 0x%llx", xcnt); WRITE_ONCE(shared_data->nr_iter, shared_data->nr_iter + 1); } @@ -192,8 +195,7 @@ static void guest_run_stage(struct test_vcpu_shared_data *shared_data, TIMER_TEST_ERR_MARGIN_US); irq_iter = READ_ONCE(shared_data->nr_iter); - GUEST_ASSERT_2(config_iter + 1 == irq_iter, - config_iter + 1, irq_iter); + GUEST_ASSERT_EQ(config_iter + 1, irq_iter); } } @@ -243,13 +245,9 @@ static void *test_vcpu_run(void *arg) break; case UCALL_ABORT: sync_global_from_guest(vm, *shared_data); - REPORT_GUEST_ASSERT_N(uc, "values: %lu, %lu; %lu, vcpu %u; stage; %u; iter: %u", - GUEST_ASSERT_ARG(uc, 0), - GUEST_ASSERT_ARG(uc, 1), - GUEST_ASSERT_ARG(uc, 2), - vcpu_idx, - shared_data->guest_stage, - shared_data->nr_iter); + fprintf(stderr, "Guest assert failed, vcpu %u; stage; %u; iter: %u\n", + vcpu_idx, shared_data->guest_stage, shared_data->nr_iter); + REPORT_GUEST_ASSERT(uc); break; default: TEST_FAIL("Unexpected guest exit\n"); -- 2.41.0.487.g6d72f3e995-goog