Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2838184iof; Wed, 8 Jun 2022 13:09:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZDLfbNyvQxTX+rA2qzA+Dfv1kvyrDWsDNIl9qI2fR14Yu7UMX/ByakdHRquxn35hbsmYP X-Received: by 2002:a05:6a00:1146:b0:4c9:ede0:725a with SMTP id b6-20020a056a00114600b004c9ede0725amr36300733pfm.35.1654718987846; Wed, 08 Jun 2022 13:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654718987; cv=none; d=google.com; s=arc-20160816; b=aYcIHoF19Rk7uiT1oAnxh/46Bx6NtFUCSWrI6QEeYsos4mVCthJ1Jb1drRAvHMYZKc nTYS4xV8NRbs7BzG7JzFLYkGd7E0SKprqpzC1VFaXnItMpwAMVLQEsiTUvpeAfMx+Nqz f7VNYqvj6pVD/78FGmqe+qCe34qVlXjjadw8rSc0aVJ/RjgSNfMRDC34877Vpe45SJd0 DW+NPE7gARIuflCR8RjkOR6qOWcepZs/N8EvLPWMWAKOXW6t77swLYjpksP3JFZKxiGR 7JE8PK1fT4m5Q02hLmMJlCIYfF/BPM+wzTbv5L3bMYrWHD3c6MGNtSGwozCl47vRAg3u QhiA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KCcIdF4bqdmfr8ubKRfkXyFIonUIza6ThNxpED8m3mo=; b=S35CVVf38r0OTji0IOpWz9+IFbf9hho9sCDWX5R45y9iAPFpi/BT+fELyQKHN6thoD RVg2JSFnmdKUzTN1GUGryiebwOtZizXXGmbdu0gAsyWH2GZAbO3wtwmQEhxICty2Kp5P WhORZxh/yiYKA+vIBLoV3MbngYLRAYJ8w3/9q8NcknqLxHjeAlA+Gp7E0ZAjX0e6764Y ad6QsAbc/smizu+0LiYpl7ucnK7Ee0seA9UvWEVSSo6VcHbK5oKLxkxYRP7VTEX3qENV WxAY3PSLun6OK4hxJYiFrIJYhp6VQvu+a1SzunbOhsRvRCeSFm3p1eLTLoRCw/NmsxmO kgOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EOXfKPxv; 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 l184-20020a6391c1000000b003fc2d55e661si4865862pge.484.2022.06.08.13.09.35; Wed, 08 Jun 2022 13:09:47 -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=20210112 header.b=EOXfKPxv; 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 S235722AbiFHT5x (ORCPT + 99 others); Wed, 8 Jun 2022 15:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbiFHT5w (ORCPT ); Wed, 8 Jun 2022 15:57:52 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FD5B3DDC2 for ; Wed, 8 Jun 2022 12:57:51 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id w13-20020a17090a780d00b001e8961b355dso7660588pjk.5 for ; Wed, 08 Jun 2022 12:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KCcIdF4bqdmfr8ubKRfkXyFIonUIza6ThNxpED8m3mo=; b=EOXfKPxvRILHWhdHwsHEIz0IgPWoErm0CvypbNn+YmMYE1wCIOPFYQLM5Pjk0r5j0U 7DrOiTQ6TZhE6eK6wCbVnTHJtVCvCSUXWFSyv81DNZrUaFNqIJysBDGR36/AQmBX7E3G Hl019QYZtmfuD77J90sL9H6QrAHCb0CaQPp9M1MNrjF5UfnRLIxbj/hCs0VRSpHP07wk d51WaCUhggbI59F99DCRy6t0iH2OGmoau9fUJp4sWnj+b1qN1xA1ZAPhTI3p+EnLSvQW DnTo1Aox2U8y8UuHD8AhXUre45jrt46WN9rUhy+NIceq3Lq6KFII62VO8LTRhy324N/I Zzpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KCcIdF4bqdmfr8ubKRfkXyFIonUIza6ThNxpED8m3mo=; b=i7hcwo8+6DY8QA1ix2N5p3EfkASqKjV7HUEi4xhG1vQH+AhXTTjD2Ybjm+nEil4DuK kObsjCXYn9z7dPj1LjOMC2M+pKGJDx7tCofQjx6O/5wcvIYLETbnRWmrTZgXistyB1h3 1EiPJu5KKVcgamMSWuKZgeMuyOFsucUUOgO4u9kIjxhPxfTdBYBMLctGL3nHjgq4rQul 07QeYrPAQiunSB51PHX7oa7+5/PrTRTLLDnrl+x4al4sidhP2XrAUmfgCQ9Yjtwm7noS onE8AvVpnwV0n60vCLYyqdAPgTuio3pYyAcIvHTKJPan2dzmmH/h4qcawGZR0rQtS9tO fFyg== X-Gm-Message-State: AOAM5310yJN1RMh1P6IHZs9eNa++bDAvrX856j4gGff8WZgM/6ifRL/4 CECln2moqpLlqpuJAFbE9LEs4A== X-Received: by 2002:a17:90b:180b:b0:1e3:2844:5f63 with SMTP id lw11-20020a17090b180b00b001e328445f63mr883477pjb.164.1654718270681; Wed, 08 Jun 2022 12:57:50 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id gq20-20020a17090b105400b001e26da0d28csm14332578pjb.32.2022.06.08.12.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 12:57:49 -0700 (PDT) Date: Wed, 8 Jun 2022 19:57:45 +0000 From: Sean Christopherson To: Vasant Karasulli Cc: linux-kernel@vger.kernel.org, jroedel@suse.de, kvm@vger.kernel.org, bp@alien8.de, x86@kernel.org, thomas.lendacky@amd.com Subject: Re: [PATCH v6 2/4] x86/tests: Add tests for AMD SEV-ES #VC handling Add KUnit based tests to validate Linux's VC handling for instructions cpuid and wbinvd. These tests: 1. install a kretprobe on the #VC handler (sev_es_ghcb_hv_call, to access GHCB before/after the resulting VMGEXIT). 2. trigger an NAE by executing either cpuid or wbinvd. 3. check that the kretprobe was hit with the right exit_code available in GHCB. Message-ID: References: <20220318094532.7023-1-vkarasulli@suse.de> <20220318094532.7023-3-vkarasulli@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 Wed, Jun 08, 2022, Vasant Karasulli wrote: > On Mi 08-06-22 14:35:55, Sean Christopherson wrote: > > On Wed, Jun 08, 2022, Vasant Karasulli wrote: > > > On Mi 06-04-22 01:22:55, Sean Christopherson wrote: > > > > > + if (ret) { > > > > > + kunit_info(test, "Could not register kretprobe. Skipping."); > > > > > + goto out; > > > > > + } > > > > > + > > > > > + test->priv = kunit_kzalloc(test, sizeof(u64), GFP_KERNEL); > > > > > > > > Allocating 8 bytes and storing the pointer an 8-byte field is rather pointless :-) > > > > > > > > > > Actually it's necessary to allocate memory to test->priv before using according to > > > https://www.kernel.org/doc/html/latest/dev-tools/kunit/tips.html > > > > If priv points at structure of some form, sure, but you're storing a simple value. > > Yes, I agree. The reason it was done this way I guess is that type of priv is a > void pointer and storing a u64 value results in a compiler warning: > cast from pointer to integer of different size [-Wpointer-to-int-cast]. An intermediate cast to "unsigned long" should make that go away.