From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03BDEC07E8C for ; Mon, 31 Jul 2023 17:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=CVgmtBPFaLzOdbM7mXwQ6vz41OXnX7BR8BdKhuY76yc=; b=Qlfne6QUCPggQxwQsJ1oTDFLK0 GG7WC3luI9CQjTbUl4l1mMgdLBwXxn0hpMHrwEJPQGoamqCaSbmVvAEPQijm56BZLFrkX2icJnfv0 GRyP1zM3+7oVJhcSGOwcenS3rCJ3k+icaHGrEcjie9Sy3HsguWDhfjsh1KfBwct1dlzCEcpiSnc4k g3EbFw1xMtCyqj1KH2RXU74z6EO2Dvw63vgjlcFTl5UIk34wi7PuyywTu9CQt7DGrOIm+XSxFyQlJ RBboDGwdLoG1kV8YpnEOZGnaRFiCzJcUuo95tMg5TlXATicUoL1PgP92XMOQtzwXNQ8xmNwYFmY4A COr69Q/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQWLo-00GmCj-0G; Mon, 31 Jul 2023 17:06:32 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQWJU-00GkGS-1Y for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 17:04:11 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d064a458dd5so3582349276.1 for ; Mon, 31 Jul 2023 10:04:05 -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=jOglhf6W+tgIMofppKadO+4uuQIcQDu8YvSbTb9MDW7KHgktGbOrn7wqIEXYMQqGVz kLJSJCyK5+5ZFnQoadi+evbSE5MBQpKabBVnQNFwW0+5mMO7tWAPvORH/kGOaSFrZEPG wHOG227+OlJdzzY0p056AmAPOvTUVual9QSuxjK1JpImhS1CYxQKZx61v24DYC3HbrPj wUM/XZur8ZGEpljSNUyaMDRo0x41Q7eiBVSnjQxmVWpbdLDgn78++OseJzBVuj2sbj4f HMMlrov2RWbN7xEWy74UzfXSgyzB3tVYnUN+6juY9QbkXFT1KYJT9kFKW57EkdDg83vX yayg== X-Gm-Message-State: ABy/qLZbHf4BwXLu40wxUXX/wQgGacKd7y7h9y29S/uMiD6TAAQ5DaDc gaT1k6o63Eqb8RQQrnuMaItYv6FfbsI= X-Google-Smtp-Source: APBJJlES9j9tNYULGAVq4lgAnEqvnPcEJ6pz6+LhC1e/NDHHnYuoI1LUAaGS4uysn5IBZCe1/Lm/mrJsitU= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_100408_548158_EC843BFE X-CRM114-Status: GOOD ( 28.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel