From patchwork Fri Dec 1 10:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 17399 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1025870vqy; Fri, 1 Dec 2023 02:46:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFh3vn9nXzUsMUKueYtQMsXuC2c3Wq/BHD8USOk1r6cmslOM5TU2s8UU5qgO9p4ps0Y3Eu1 X-Received: by 2002:a05:6a00:18a8:b0:6cb:6cac:71d7 with SMTP id x40-20020a056a0018a800b006cb6cac71d7mr29709423pfh.31.1701427596049; Fri, 01 Dec 2023 02:46:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701427596; cv=none; d=google.com; s=arc-20160816; b=Pgbnd4zkVpeLU/W+ewfJHiOWGQAG+RS7w9YGX/O103VRZBa+dofw2kaZ/IEJoRf0c8 VQ6or83wDz40+p7cRbALYNVLQlg8D5LXN27z3YsWvHYngcjxHH4nRUknAEI7/NwqQ1sj 2g8LVpMbYYfSU+oWNqDOJ2F4BGkP8FobBnlmW2I9SkhphthqNJWitfkXSBSAOvs6vyao wTazy/Dp42skoUNCEu7hbx7fI/D21f5t/E/hQcb6D2cHIzTBVWW64MW1yarLOusYd6aw u19XDnMmCW6t65HHcpvrr5Hl67jGGdDmP4EmXQyfnVzTF+SKw7docEBnN9qhEsn2enWS 0mRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=djbPckzM3W8M21CN4MQGvDbZA8H4KJVF34YSsULAd7Y=; fh=Cum1qOF0YrAzH/5yQjcCBfU63B+V0l01YtzsDBRUOAc=; b=aqnetawdIQbeFjJd0D20dpYQw2CfUXZksxUj674EtWe5QXXdr2Yd5p1CBaI0BpAQXv lS0silTDgZlIRPWn+eB5hCWKtrQu5DEbq1PKlKLiKf7PuQa7M0uLf0BhkwgvYxABb0db ZtYIP/BVJnaSaNk/w7BnLix5/zDKRUTdvGJti9FS3sfB3wCLs4G7DlLsEJm9vrY9d+CR nIINWvfiH4rD1K5yaJXh9pijqOFz6vB0Ks4mVqgeFpl2M9qMA1tFimrlw1gjLHGqd7C4 Wv1SfL/ZdVDd46/PrWLMvqHe3jkfB2HYrw5Yowo9QCrK1FYRzeGV9VuRv19eRKH8aGKC lRWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=1XnU2BSg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id v7-20020a655c47000000b005893c5bd119si3016878pgr.425.2023.12.01.02.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 02:46:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=1XnU2BSg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B5EC483D9B63; Fri, 1 Dec 2023 02:46:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378378AbjLAKqN (ORCPT + 99 others); Fri, 1 Dec 2023 05:46:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378325AbjLAKqN (ORCPT ); Fri, 1 Dec 2023 05:46:13 -0500 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8A0110E2; Fri, 1 Dec 2023 02:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:To:From; bh=djbPckzM3W8M21CN4MQGvDbZA8H4KJVF34YSsULAd7Y=; b=1XnU2BSgd jkHVu0upJ6DzjhKYsC6CnrOJce8U/LN2D+wjcL2uypovLY7JGoD2W5bYxb72A0a3KCb7KsDk7zA0e EUSj3olGjhszJvcv+bLNT8IY+PH/bpRO7Zx0wgoqagNZ0ekFy29FS95gYw3mUxIjR1g1ZIk6FLV9m weqId714=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r911r-0005P2-1y; Fri, 01 Dec 2023 10:45:51 +0000 Received: from 54-240-197-231.amazon.com ([54.240.197.231] helo=REM-PW02S00X.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r911q-0003dT-Nx; Fri, 01 Dec 2023 10:45:50 +0000 From: Paul Durrant To: David Woodhouse , Paul Durrant , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] KVM: xen: update shared_info when long_mode is set Date: Fri, 1 Dec 2023 10:45:34 +0000 Message-Id: <20231201104536.947-1-paul@xen.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 02:46:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784076142796696782 X-GMAIL-MSGID: 1784076142796696782 From: Paul Durrant This series is based on my v9 of my "update shared_info and vcpu_info handling" series [1] and fixes an issue that was latent before the "allow shared_info to be mapped by fixed HVA" patch of that series allowed a VMM to set up shared_info before the VM booted and then leave it alone. The problem was noticed when the guest wallclock apparently reverted to the Unix epoch. This was because, when the shared_info was set up the guest's long_mode flag was unset and hence the wallclock was intialized in the place where a 32-bit guest would expect to find it. The 64-bit guest being tested instead found zero-ed out memory. Fix the the issue by first separating the initialization of the shared_info content from setting its location (by HVA or GPA) and then (re-)initializing the content any time the long_mode flag is changed. [1] https://lore.kernel.org/kvm/20231122121822.1042-1-paul@xen.org/ Paul Durrant (2): KVM: xen: separate initialization of shared_info cache and content KVM: xen: (re-)initialize shared_info if guest (32/64-bit) mode is set arch/x86/kvm/xen.c | 84 ++++++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 32 deletions(-) base-commit: 369e9826edfd346f259471e521c03e12bb0ab476