Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4713898rwb; Mon, 31 Jul 2023 10:59:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlE2I9wBoBdxplIu+r1CVsvorK2H4ennVpfjn49G44lBRHNvN0123YCPMIUs83qmyktaqXke X-Received: by 2002:a05:6a20:9151:b0:13b:9cf1:a779 with SMTP id x17-20020a056a20915100b0013b9cf1a779mr12647317pzc.37.1690826370055; Mon, 31 Jul 2023 10:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690826370; cv=none; d=google.com; s=arc-20160816; b=L6V2f1j+DOp0QV9ufHBZ6O/jazGxUS0ylATNmZog3K0y0/kfLekMF9ntaCMFzFic0I Jvj90kdJSpiMKxKiAEfo8duJItMrG4anXR7P1z/LJWUPc9VmgySQhm+8XV+JmZOjnBxk 8ZFCIWfLABZAnnUui49EIfT+E30JPNbhFZMH16ZFazhBmdMJBV67bnPiaiDsHyw2Q3m2 gTTLUVw+PtEsC8s/NPzwSI9EeQ+XvqHYhqMfqsBog+QeHDecgWqCM6LJwRTAm1vlxQuz wBgcL2eHfzynd9N+lwMz4rAHJgs9S2EixX4oDJ7VG7vXgQDxlYlidN493BO4oSACvPhT J7EA== 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:dkim-signature; bh=KfSgWNMsFhJfp3i+4pg02RKqbKjloChlJGxRUeeMH+8=; fh=/TNYuqyJaHDu/0kZUJbo7zgHHI2NHNIgNWX3dLaR1iw=; b=UmNB7aU0YS8daSE6Z8K/WV0u0BPtgAAGhe/oplwq+s5eDzVBBsZNcxWCIA11Fe8TIL FBJSyngeRF97Z4WwZHvn7fMBc+g8VlFtlkcZX9d9cUJd0iUsJdl6DCek9alsdIW7PaR7 Ppjzes3MZ/aAnDxqnndc8b+tJgoFueDLeEmjrx2NvUpx/X9r9z4kgZumxKSEAiGJYqin G84w0/4Awr6nDLmNGCEwU2Hjf9bD0vyVyqybEA1LsSkS1UcH95mWbi0hc6dUcejS2yOg bKQN+oxgpn5PGxrX7ApEsQajXWx56R6lJ6yBsY3T7kYEDVEg5yhZjFHqQqwTpOUtpzN1 jp0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=XmxsSZ8Y; 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 cd9-20020a056a00420900b00643ba887601si7597925pfb.307.2023.07.31.10.59.17; Mon, 31 Jul 2023 10:59:30 -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=XmxsSZ8Y; 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 S233836AbjGaRFj (ORCPT + 99 others); Mon, 31 Jul 2023 13:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233911AbjGaRFA (ORCPT ); Mon, 31 Jul 2023 13:05:00 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 878C019A1 for ; Mon, 31 Jul 2023 10:04:07 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d3563cb3748so520802276.0 for ; Mon, 31 Jul 2023 10:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690823044; x=1691427844; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KfSgWNMsFhJfp3i+4pg02RKqbKjloChlJGxRUeeMH+8=; b=XmxsSZ8YI1gTXEnTcgvYTdFsp7D/Gtnnl+yTAX1w8hl10rqnm0I2V0S1CRpdRB0nIq DbUwMq/ZmN1VWeIcZgVvFGltYhB6Xf0Dr9C5TLMvkQU4xTHNB1OHqklHixYf/XqiRiL8 D+efNUrTdedEpvVEg6ZlmoO1BhLwXwzhYaFQ2Kji8qkCvEBH/m/mUxuHBcrR/kXMtxUW 8GiV3bb9VhJjaJ2zKE596RYBDeSSbSKtkVq9Z9tTnW+Jnl7/Bk+2hncZuuZyzXycRMoG E6WZIFuMQhTTsoJXgRaSgq9ARNAcGMJDvJ0POZ4SMvMbH8RN5fkcH/U4Lm0JuR47ecd/ 2WnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823044; x=1691427844; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KfSgWNMsFhJfp3i+4pg02RKqbKjloChlJGxRUeeMH+8=; b=lA9lzDMzsXVm3y6ixEBxHw50gYlYFqMURGhLvk4epy3ibEr/dI39BkXXYKNpNVGRh7 +k2P0I6UmOAnzJI/JPYBTsUdkZCBHkZgROaA0IzDSvYQ6r+FoeVkEwcotQeRfUG4h7SV ppqgFktHXbmUnF8lmWu1YgTuLvMXDuR3H1wAHwmUIPbjRDMXZpAcces+0S6sLcKvZlq6 +twiLQob4vRO1KRzJ19IznVFo9O3uengM+BiuSabs7KFnXwHFSvfbJsHD1Cz6ey3YISe JsLPC/01PNXp08Dl2UB2dPZvm4fTDqsFwRdw8/vJHeKPp76tYM0CwxxqF9YUB2dC5Ekx U1Qw== X-Gm-Message-State: ABy/qLYNWDSEq6hkJmmD9wBtZ3TS1i6yAq6Gr93OBE8lPtuZuq2bvvRn A56wGdSfAjw4SSLPB43jo028nH80580= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:11ca:b0:d09:b19:fe2c with SMTP id n10-20020a05690211ca00b00d090b19fe2cmr63513ybu.12.1690823044560; Mon, 31 Jul 2023 10:04:04 -0700 (PDT) Date: Mon, 31 Jul 2023 10:04:02 -0700 In-Reply-To: <20230731-91b64a6b787ba7e23b285785@orel> Mime-Version: 1.0 References: <20230729003643.1053367-1-seanjc@google.com> <20230729003643.1053367-10-seanjc@google.com> <20230731-91b64a6b787ba7e23b285785@orel> Message-ID: Subject: Re: [PATCH v4 09/34] KVM: selftests: Add a selftest for guest prints and formatted asserts From: Sean Christopherson To: Andrew Jones Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Huth , "Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?=" , Aaron Lewis Content-Type: text/plain; charset="us-ascii" 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=ham 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 On Mon, Jul 31, 2023, Andrew Jones wrote: > On Fri, Jul 28, 2023 at 05:36:18PM -0700, Sean Christopherson wrote: > > From: Aaron Lewis > > > > Add a test to exercise the various features in KVM selftest's local > > snprintf() and compare them to LIBC's snprintf() to ensure they behave > > the same. > > > > This is not an exhaustive test. KVM's local snprintf() does not > > implement all the features LIBC does, e.g. KVM's local snprintf() does > > not support floats or doubles, so testing for those features were > > excluded. > > > > Testing was added for the features that are expected to work to > > support a minimal version of printf() in the guest. > > > > Signed-off-by: Aaron Lewis > > Signed-off-by: Sean Christopherson > > --- > > tools/testing/selftests/kvm/Makefile | 1 + > > .../testing/selftests/kvm/guest_print_test.c | 223 ++++++++++++++++++ > > 2 files changed, 224 insertions(+) > > create mode 100644 tools/testing/selftests/kvm/guest_print_test.c > > I added this diff to this patch > > diff --git a/tools/testing/selftests/kvm/guest_print_test.c b/tools/testing/selftests/kvm/guest_print_test.c > index 3a9a5db9794e..602a23ea9f01 100644 > --- a/tools/testing/selftests/kvm/guest_print_test.c > +++ b/tools/testing/selftests/kvm/guest_print_test.c > @@ -115,7 +115,7 @@ static void run_test(struct kvm_vcpu *vcpu, const char *expected_printf, > while (1) { > vcpu_run(vcpu); > > - TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, > + TEST_ASSERT(run->exit_reason == UCALL_EXIT_REASON, > "Unexpected exit reason: %u (%s),\n", > run->exit_reason, > exit_reason_str(run->exit_reason)); > @@ -161,7 +161,7 @@ static void test_limits(void) > run = vcpu->run; > vcpu_run(vcpu); > > - TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, > + TEST_ASSERT(run->exit_reason == UCALL_EXIT_REASON, > "Unexpected exit reason: %u (%s),\n", > run->exit_reason, > exit_reason_str(run->exit_reason)); > diff --git a/tools/testing/selftests/kvm/include/ucall_common.h b/tools/testing/selftests/kvm/include/ucall_common.h > index 4cf69fa8bfba..4adf526dc378 100644 > --- a/tools/testing/selftests/kvm/include/ucall_common.h > +++ b/tools/testing/selftests/kvm/include/ucall_common.h > @@ -6,8 +6,19 @@ > */ > #ifndef SELFTEST_KVM_UCALL_COMMON_H > #define SELFTEST_KVM_UCALL_COMMON_H > +#include > #include "test_util.h" > > +#if defined(__aarch64__) > +#define UCALL_EXIT_REASON KVM_EXIT_MMIO > +#elif defined(__x86_64__) > +#define UCALL_EXIT_REASON KVM_EXIT_IO > +#elif defined(__s390x__) > +#define UCALL_EXIT_REASON KVM_EXIT_S390_SIEIC > +#elif defined(__riscv) > +#define UCALL_EXIT_REASON KVM_EXIT_RISCV_SBI > +#endif > + > /* Common ucalls */ > enum { > UCALL_NONE, > > and then compiled the test for riscv and it passed. I also ran all other > riscv tests successfully. Can I have your SoB for the ucall_common.h patch? I'll write a changelog and fold in a separate prep patch for that change. > > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile > > index f65889f5a083..f2a8b3262f17 100644 > > --- a/tools/testing/selftests/kvm/Makefile > > +++ b/tools/testing/selftests/kvm/Makefile > > @@ -123,6 +123,7 @@ TEST_GEN_PROGS_x86_64 += access_tracking_perf_test > > TEST_GEN_PROGS_x86_64 += demand_paging_test > > TEST_GEN_PROGS_x86_64 += dirty_log_test > > TEST_GEN_PROGS_x86_64 += dirty_log_perf_test > > +TEST_GEN_PROGS_x86_64 += guest_print_test Argh, this is why ARM didn't fail for me, the test was only built for x86. I'll double check that ARM works with the above, and also enable the test for all architectures. If the printf stuff doesn't work on s390, then we definitely want to know before this is fully merged. Thanks Drew!