From patchwork Sat Feb 4 01:45:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Sharma X-Patchwork-Id: 4955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1153300wrn; Fri, 3 Feb 2023 17:47:55 -0800 (PST) X-Google-Smtp-Source: AK7set+LScoUx8TWCvJ2OFjNZ0UwA+VQIH2E+pZpbChQ+ykF3atlb3uxdiKQxTtKnXG9GZPJJcgj X-Received: by 2002:a17:906:3885:b0:877:6a03:9ad4 with SMTP id q5-20020a170906388500b008776a039ad4mr11146086ejd.56.1675475275636; Fri, 03 Feb 2023 17:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675475275; cv=none; d=google.com; s=arc-20160816; b=kgiFW/bRv0yde8gMlGcXY3J5zZqx8AYJdTPt4QYYRkhg9SLCPXxT7u6uckkz2P5AIq s73lNBL/du20G+Ggv/e/DCIZpzsf66+jXXo1cVXVN71xiMwIiC8mnFmfvX4Ei1Kg0yCl wXWm2+DPIaMTnHSiX6klOmhgRMgp9dANEGJM1GLCHXN7CxOdCfaPuok+ZRoJaHAEBPdC 9HhpoOEwdDb9bR/2id3FaKzCtsHybf8A+l2P/iOms9mahTUn1ZvAUQ21xOh0RPNe1cSj P4TPDBjxslMvB3QrD9Ge1bEv4ZEBTXIiXygd5YKeB+vFwO45ThzudslQGRCzCwT75/CW K7xw== 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:mime-version:date :dkim-signature; bh=CjIJEhAYbMSv6XJ6YPRSrYusHoPT/o7sKHbXDwqrZAg=; b=Hp8FbIs7EG9vsbIR5NxlAAxYbeuynPTL8ppXK0/dDjSAdzDw3x0ZSpu3V7FFz77rAo pxKqAVd9p4o2RNDCuJ7m43m74Eo7F+bj+cEevos0TQboEr0hT4pxyBBrMJDvOrV8b/SL fW35guXy8Hb20cb9jWdpyqPiq2I1Em3I5AzQLM+llW5Xt+0srDy9DT98R3QL7eRwNMvV 4/PC7jKRiAkjeE+isZaafI20OG+4wO9GmSShfuILBfPFwfmv6kNIbGf04pSseqFkw0L0 4/Od2kmSZE3uqq4JO6gH+LiJtnyQMyxtuZe+4m01WW8ztJKegEqATJVIzWVSBSf9a+IR OENA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QecYNx8O; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wj4-20020a170907050400b00878809a6a96si4218033ejb.755.2023.02.03.17.47.31; Fri, 03 Feb 2023 17:47:55 -0800 (PST) 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=20210112 header.b=QecYNx8O; 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 S232480AbjBDBp7 (ORCPT + 99 others); Fri, 3 Feb 2023 20:45:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbjBDBp5 (ORCPT ); Fri, 3 Feb 2023 20:45:57 -0500 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89E9BA07E3 for ; Fri, 3 Feb 2023 17:45:55 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id z7-20020aa79587000000b00593f19705d5so3516424pfj.10 for ; Fri, 03 Feb 2023 17:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=CjIJEhAYbMSv6XJ6YPRSrYusHoPT/o7sKHbXDwqrZAg=; b=QecYNx8Ora54T0SLOnSkFDljXnyyMtJNe3ass//2WlUOCd5RflFrtCU9Q575bcu2LT Qaq0JzEv9jMiY6uyoNi2VZrLAoomU6ZmSMsN3cR8M2MqZIYktpZ/VDgL4aLEJJ8KF8Wm bHTQF0ThYIIR48wEc5y3Fqp2X3DothPzD3xLLKaagSfnuSR7MlYO3XacK9+UxxqI0Ysa rjNY34G6CcMp54S3yrXX6eJDU1uSzpYPpbVIWkul2zPoVRCCDwAwSjJTkbxIJGrEwUJf v0En1igEE9Xi3/JwJpmWLLJ+smT/gwaX7JCTTz2vaYBx4zBMIQcHByzwsfSdnquXgaZR mxCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CjIJEhAYbMSv6XJ6YPRSrYusHoPT/o7sKHbXDwqrZAg=; b=bBpJNIzcROhBAviURBykMCSDoP0D1a+invn8JaNNHve4xDKAo399KhYnRScAkYOZ6R EBOnqLnqysccbM2rL9CdJx85n54vdhUOwTcCbE6ADrlQBBo9FZi0JWsI7PLgld/dbSk+ 7c45/I4Mcv2KXNeiNclRkM5NxDqMovhfcqcmpFs8K8zA9fmHf+PhzhL0QlJZXR+oAtox 4EJu8/yEkqmSfeUATJDgap+F0NSPIU/frFYGPUz0rW/uT8drXEh2usrXe1QcLxtt0nKe HEhkn+Hr1fBs9n4VmMKggTtJeEmwpE1N2IqR0DoC5FsXGXrMoO3dp+yWzFIPoxSvuaAf FbVw== X-Gm-Message-State: AO0yUKVX0Z0VekMWVfJThX3Zp5IgepuKB6acrzf874y6vrUCe02o52OB 8xT6jSz/rkooHpl9U9JNvnioWEfUODpM X-Received: from vipin.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:479f]) (user=vipinsh job=sendgmr) by 2002:a17:902:c94c:b0:196:77f2:559d with SMTP id i12-20020a170902c94c00b0019677f2559dmr2884957pla.18.1675475154953; Fri, 03 Feb 2023 17:45:54 -0800 (PST) Date: Fri, 3 Feb 2023 17:45:43 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog Message-ID: <20230204014547.583711-1-vipinsh@google.com> Subject: [Patch v2 0/4] Common KVM exit reason test assertions and exit reason sync From: Vipin Sharma To: seanjc@google.com, pbonzini@redhat.com, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com Cc: dmatlack@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vipin Sharma 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756863162562891252?= X-GMAIL-MSGID: =?utf-8?q?1756863162562891252?= Hi, This patch seris is extracted from https://lore.kernel.org/lkml/20221212183720.4062037-1-vipinsh@google.com/ series. Specifically, patch 12 is taken out from there and now expanded in to this series. This patch series contains following changes: Patch 1 & 2: Make a macro to clean up all KVM exit reason test assertion. There are few places where explicit run->exit_reason are used but they cannot be replaced with current macro. I used following command KVM selftests directory and changed each occurrence: grep "run->exit_reason" -nir ./ Patch 3: This is from Sean Christopherson. Adding a macro to generate KVM exit strings. Patch 4: Sync KVM_EXIT_* reasons to sefltests. Many reasons are not present in selftest code. v2: - Improve test assert message. - Add macro to generate KVM_EXIT_* reason strings. - Update selftests KVM_EXIT_ reasons to latest version. v1: https://lore.kernel.org/lkml/20221212183720.4062037-13-vipinsh@google.com/ Sean Christopherson (1): KVM: selftests: Add macro to generate KVM exit reason strings Vipin Sharma (3): KVM: selftests: Make vCPU exit reason test assertion common KVM: selftests: Print expected and actual exit reason in KVM exit reason assert KVM: selftests: Sync KVM exit reasons in selftests .../testing/selftests/kvm/aarch64/psci_test.c | 4 +- .../testing/selftests/kvm/include/test_util.h | 9 +++ tools/testing/selftests/kvm/lib/kvm_util.c | 66 ++++++++++++------- .../kvm/lib/s390x/diag318_test_handler.c | 3 +- .../selftests/kvm/s390x/sync_regs_test.c | 15 +---- .../selftests/kvm/set_memory_region_test.c | 6 +- tools/testing/selftests/kvm/x86_64/amx_test.c | 8 +-- .../kvm/x86_64/cr4_cpuid_sync_test.c | 8 +-- .../testing/selftests/kvm/x86_64/debug_regs.c | 2 +- .../selftests/kvm/x86_64/flds_emulation.h | 5 +- .../selftests/kvm/x86_64/hyperv_clock.c | 7 +- .../selftests/kvm/x86_64/hyperv_evmcs.c | 8 +-- .../selftests/kvm/x86_64/hyperv_features.c | 14 +--- .../testing/selftests/kvm/x86_64/hyperv_ipi.c | 6 +- .../selftests/kvm/x86_64/hyperv_svm_test.c | 7 +- .../selftests/kvm/x86_64/hyperv_tlb_flush.c | 14 +--- .../selftests/kvm/x86_64/kvm_clock_test.c | 5 +- .../selftests/kvm/x86_64/kvm_pv_test.c | 5 +- .../selftests/kvm/x86_64/monitor_mwait_test.c | 9 +-- .../kvm/x86_64/nested_exceptions_test.c | 5 +- .../selftests/kvm/x86_64/platform_info_test.c | 14 +--- .../kvm/x86_64/pmu_event_filter_test.c | 6 +- tools/testing/selftests/kvm/x86_64/smm_test.c | 9 +-- .../testing/selftests/kvm/x86_64/state_test.c | 8 +-- .../selftests/kvm/x86_64/svm_int_ctl_test.c | 8 +-- .../kvm/x86_64/svm_nested_shutdown_test.c | 7 +- .../kvm/x86_64/svm_nested_soft_inject_test.c | 6 +- .../selftests/kvm/x86_64/svm_vmcall_test.c | 6 +- .../selftests/kvm/x86_64/sync_regs_test.c | 25 ++----- .../kvm/x86_64/triple_fault_event_test.c | 9 +-- .../selftests/kvm/x86_64/tsc_scaling_sync.c | 6 +- .../kvm/x86_64/ucna_injection_test.c | 22 ++----- .../selftests/kvm/x86_64/userspace_io_test.c | 6 +- .../kvm/x86_64/userspace_msr_exit_test.c | 22 ++----- .../kvm/x86_64/vmx_apic_access_test.c | 11 +--- .../kvm/x86_64/vmx_close_while_nested_test.c | 5 +- .../selftests/kvm/x86_64/vmx_dirty_log_test.c | 7 +- .../vmx_exception_with_invalid_guest_state.c | 4 +- .../x86_64/vmx_invalid_nested_guest_state.c | 4 +- .../kvm/x86_64/vmx_nested_tsc_scaling_test.c | 6 +- .../kvm/x86_64/vmx_preemption_timer_test.c | 8 +-- .../kvm/x86_64/vmx_tsc_adjust_test.c | 6 +- .../selftests/kvm/x86_64/xapic_ipi_test.c | 6 +- .../selftests/kvm/x86_64/xen_shinfo_test.c | 7 +- .../selftests/kvm/x86_64/xen_vmcall_test.c | 5 +- 45 files changed, 111 insertions(+), 318 deletions(-)