Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp938898rdb; Fri, 1 Dec 2023 02:46:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsVQcXVU4A6uvPPJWW+4lDvZ6P/AMoJLmLD3R1qJl8Uq0QcYTkx/TWphSGtoOm9HQ23izD X-Received: by 2002:a05:6a20:258b:b0:18c:4811:cf69 with SMTP id k11-20020a056a20258b00b0018c4811cf69mr27190988pzd.61.1701427610924; Fri, 01 Dec 2023 02:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701427610; cv=none; d=google.com; s=arc-20160816; b=X/MjCpK2RrzFBvC5Hmi4M+iS+/R7mxn2vtrhIVe2etnaVzesoo/yqWEIpWq0vD4kN7 PCeaRasWSnPMelhZR6SvFenWLADsKsL7ddPIonh6VmqTz5svq8AFjX5P5nOaai2cz0Ez QlIS664+O3wVgFKyM3yPVaG8O7v9O+Ai2hwuZ2i874UKIybO6FdnbTUjmmWshjFAnQMB AYNuuUDha72uBy3kE6hFsjxCcPFgP3oTcimUVqblytFliQSkNRXab9HtB4NeyuyuMNxO dIQ8OLjlkn23XZ5vqVAFntJV7g4qtmPHuzzo5IIJsv39OsgBxJPj+4nEt5l5kd+3LfgD D51w== 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 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h20-20020a63f914000000b005b90af1943asi3051670pgi.807.2023.12.01.02.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 02:46:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; 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 2620:137:e000::3:6 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 6879482E3304; Fri, 1 Dec 2023 02:46:44 -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 Content-Transfer-Encoding: 8bit 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:44 -0800 (PST) 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 -- 2.39.2