From patchwork Thu Feb 8 20:48:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 198586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp460675dyd; Thu, 8 Feb 2024 13:23:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXT8IFpW1fqnqtRQs27N80T5gPkJqDLyypQ2mbZsM2yZxFzi9UXIDd0RePx4k5ArVOJc6/JyjmeV/W9aNFsA1OL6/MVeA== X-Google-Smtp-Source: AGHT+IFPFWDbSlnWGLd3nKuxmYbApYTFliSCQ8fk6T00bUPcDsTTFjM/xLON8/ykv6JOCKHn0oNG X-Received: by 2002:a05:6a20:428c:b0:19e:31dd:3ac2 with SMTP id o12-20020a056a20428c00b0019e31dd3ac2mr1053193pzj.10.1707427424275; Thu, 08 Feb 2024 13:23:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427424; cv=pass; d=google.com; s=arc-20160816; b=G7i0cMYNscFiQ/OFiBbAblitbo6Z8LHq/kb1vHSQnhrWXTGYr/tvFnVEbnv0BTelGi bQLuiTQrNhWc9rVKZc8ImIgp1gKOeHieGYTVNs/CMRUYcqVeBD663oRxtDPw2XLB6mdd mnvmP+QVAU5KmpvycU+tcu5bZ1rcHtBrkH6wIaC9j97o9p8qc13376Yp8/O5auN6Onj6 icwRge+0M8ItMyU1HQUyBkwqp4KXhQMi3tBV/0xY/+YWjEaQyiek/vFWOnyzZnM/GSxD 0ALx4pmcYn246yj8AJmR4MgbgdLtaScDx+liuYhyG/s5gH1OYSYoAWDkKXORQkbdFX1b 4y/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=N1jX8xaWWAWnTKGIXa8/O/uSBdB1VqMshiJadSRg6EY=; fh=pUfaeQRneivrA1VlIZMm8mV3z1GulsrDidfHperyfTM=; b=gSNpQOAN/9pwtheMmm4Gb+utPP6FxF6aGGvvjT8JbDlIH10mYHB3TVWsEFskAR1XP6 rQdNiDu7Pn8EoveSyIb8ITPH4NMZk7Dr4y1SJd7I/Kp6bbpmrPK6RmuCrPqJGijdkz25 dTNxV22obQcaA88yU+SMH2YfVZfCdBPrGQJ9Al+VshonkkUMzNKqiE3Z5WLDU799YTmu eISjsaPuSijGkThUhXlSyiFbCKaL3tXOK0Yv84DblwnKW0tYwNuyv14mZDwbkvrbaruC LBDWo61xjtOvLFfc/0fqaPKiVwtuZrk87HVRSz0z5fNaa+paGMU55J8cbXnpsX5+uQ1x QK9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PadS8ww8; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-58679-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58679-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCXfpqtmYVbSWdDSw5nsyqcGngJtPZHnKqXXJ7f3Zs8exXmgr8lwcO962n8esh6z3bXIw9uLsr08s45n7YT2D2DM903O2Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z37-20020a056a001da500b006e04369998fsi369175pfw.15.2024.02.08.13.23.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58679-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PadS8ww8; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-58679-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58679-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0986EB2918F for ; Thu, 8 Feb 2024 20:50:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C10414F88D; Thu, 8 Feb 2024 20:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PadS8ww8" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 857894C3BF for ; Thu, 8 Feb 2024 20:48:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425337; cv=none; b=Lsr0U4Edum8H/BE/WTdmB+0AgToFOuBp8rVuLU/p5r0Eoqqit9QYGVSHLaLQbBKSp/C2neRnFeHzjS6M/Q0bjEnN1X6Jx4q0eKjhtqSZCHqNjGed2/c3eez3pG/XELJptOs6ERaNYv3n7XvgixSk2mAuBtQnzNY2etPiKn21REY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425337; c=relaxed/simple; bh=6P5K6g9DoGyrYeskFG3ZTud2y0Jy5ES1/MaotkbmBnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RZE/5xmrLXbH9o57KHtN38WAIASKMvV+idgHy0uFM1IZOUWH/+/0hTnNMkD7gmCdCTUJc1rrBB3PUz9+oqdw/md0AGDETi4uwUCJ3Q+E9CipoPVqVdkcxsFBIDSxft12b1xyRODa6VoV1JUEysTlpvWcPsAg0vnQQ1Ydds5LpN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PadS8ww8; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707425334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N1jX8xaWWAWnTKGIXa8/O/uSBdB1VqMshiJadSRg6EY=; b=PadS8ww8zu+L0pjttN8FGTPMENowjujMFGXb9aalsZZZcq+ymD4Y8yo1pAHM1S59xDusZ/ 3XxM4RDsD6IJSRrRXIu7CnoE/x0AVr7Ihb2KDAu/Y80efKvj74DA3pY/oHAprzXWvjp8G0 dF++rfHuxuar/SM0WYfSuXOOcIZeaus= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-241-0BBqA1kPNaKq99Sr2-FHuA-1; Thu, 08 Feb 2024 15:48:52 -0500 X-MC-Unique: 0BBqA1kPNaKq99Sr2-FHuA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7FE3A8432A0; Thu, 8 Feb 2024 20:48:51 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id A63531C10C0C; Thu, 8 Feb 2024 20:48:49 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Sean Christopherson Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Andrew Jones Subject: [PATCH v3 2/8] KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it Date: Thu, 8 Feb 2024 21:48:38 +0100 Message-ID: <20240208204844.119326-3-thuth@redhat.com> In-Reply-To: <20240208204844.119326-1-thuth@redhat.com> References: <20240208204844.119326-1-thuth@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790367419165892717 X-GMAIL-MSGID: 1790367419165892717 The regs structure just accidentally contains the right values from the previous test in the spot where we want to change rbx. It's cleaner if we properly initialize the structure here before using it. Suggested-by: Sean Christopherson Signed-off-by: Thomas Huth --- tools/testing/selftests/kvm/x86_64/sync_regs_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c b/tools/testing/selftests/kvm/x86_64/sync_regs_test.c index 8c3898cf79b31..1cd19dfa0046c 100644 --- a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c +++ b/tools/testing/selftests/kvm/x86_64/sync_regs_test.c @@ -315,6 +315,7 @@ int main(int argc, char *argv[]) run->kvm_valid_regs = 0; run->kvm_dirty_regs = 0; run->s.regs.regs.rbx = 0xAAAA; + vcpu_regs_get(vcpu, ®s); regs.rbx = 0xBAC0; vcpu_regs_set(vcpu, ®s); vcpu_run(vcpu);