Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp686012pxb; Thu, 17 Feb 2022 12:25:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuq7Y/6AW3KkPLKcBqh5nUy1URfdJuzpg8cpX+Pi+P0ex84CRKPemtcwlsfFfpNkIwm1Pn X-Received: by 2002:a17:90a:3b05:b0:1b8:af52:e77 with SMTP id d5-20020a17090a3b0500b001b8af520e77mr9049374pjc.180.1645129517556; Thu, 17 Feb 2022 12:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645129517; cv=none; d=google.com; s=arc-20160816; b=YrEjlyCIEr3ADzSIWIqAnZKxutQWqjOYaASphElgJMrsCSrWoY8621Iej/IUYhkUXp Fe39W0lK+hg/nWT/xY+rVz4FHV8J6HBnFQ5HUau42zfyf0Gmng0DwD9/Z4NlE9VmCzRr toWiiQv8Mp9SDWH5agJw2gIvLT+ukLpmwdPgDqrsB06nQMeMl44C95blnPbA/wGk22L1 DE0zKmdHqn3Z7Yf48eF8Aj8L7ANxWv1uEXt/9Oibi4u6xzliXNSORPoinns2d2wyR6r6 bOoRB1EdlB7JW+tu/hP9Mr1OmMTKOQpziWYvfAsVFWYw1YWSvwro7uuM8AwSCCT9r6vd 7IAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kdCG/BqRA3h3SSjWYFY12VvohzTJC0/2p0AbBe0FxJA=; b=EWuV4p4Y3Wue22yHyRhmMAtnFBToma3UVxMBKtIx1bxzEeOR1W8ipFbx6Lt7nNu5qx No+ykUbnWLpTxZTl3owo3UqoSYEm39BFhg8h3Yy6059phGZJMh/wsfKwowI5dMzxOIAn hkP1lWgz+LPhAu/GVcG7oBA+8x5VHYHE8enauQKX/uMkveH650tOECm4P6aWGhaVnng5 wceadL2eYt7bfyhU7C5B66aFfFPhDhGML3bP+DVOZ9S6XLbvpPsXlOJ3LaminxeoGKz+ gxSbf3X3vkX71S2iSx9O9ujIcH8Z8ugCldNzNAh2Up1obbkoF/0RE6eR9QX/vh2Xe/f7 KnqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MLWxHYb0; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g64si8797246pgc.64.2022.02.17.12.25.01; Thu, 17 Feb 2022 12:25:17 -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=@redhat.com header.s=mimecast20190719 header.b=MLWxHYb0; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244060AbiBQSJP (ORCPT + 99 others); Thu, 17 Feb 2022 13:09:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244023AbiBQSJD (ORCPT ); Thu, 17 Feb 2022 13:09:03 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 82FA915DDFC for ; Thu, 17 Feb 2022 10:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645121323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kdCG/BqRA3h3SSjWYFY12VvohzTJC0/2p0AbBe0FxJA=; b=MLWxHYb0jUPyZmWayLKEHpH3D9tfrxgucyVl6XWkftXOlVAEqREVFpoPUrteYVqv+0AJFd vvtuTYFYmeJTBFrssgeJwCIaD1ooKLwwQh7zmiOrF/riEO9VxiC59DdkvXtVDLEPgTOd9a VCK240AuohjbX6bzcY0xCFDs96R8pFA= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-gc2d0nn-PXy4zTtSteF8Bw-1; Thu, 17 Feb 2022 13:08:42 -0500 X-MC-Unique: gc2d0nn-PXy4zTtSteF8Bw-1 Received: by mail-lj1-f199.google.com with SMTP id b27-20020a2ebc1b000000b00246209c497dso187081ljf.11 for ; Thu, 17 Feb 2022 10:08:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kdCG/BqRA3h3SSjWYFY12VvohzTJC0/2p0AbBe0FxJA=; b=GOoqvERKeqA5PCjxEScro2ENyLCMwOCLCkyOYE1q2/tzohIrmOC7a1OaqFtdAOM60Y DERZtZgBOxT0j6EUfljYgCbebpwQQXpXhvewvEKVzirsLX7hj2DJxxK5hvNQmq3+pHjR McUm33NS0a1xcsDrt1xyunqO6vZB1OeCTuDoT7tQQ6l5+C/EedPQKMcjsIg6io8CDWv1 +wWMakOgv5VxGjjX5TXyJul/5zbTl2nHqrtjJDJpUqsnlHy2YHyqpip2I3tQlOH/Jm+L sU9qBgK48h1JaTzMS2NjzW8m5KtBUNcOkJfQu5LVwZE5lPec+MfLkiB7eznTmQhUJVNy 0YtA== X-Gm-Message-State: AOAM533n5QsKpb18+vtcYTXLP4ws8X9MngGcShj8Hs17d7OEw7ajzIdU 3Jj2n8qsx+zIgcNv+mOPewgjg893lVP6y7HTZW2LXPK2QwlhqSrNn7IsZWxMSgNmDr7Jb2LXEuR nRdAYNzQIXwvlK7+peGIqmsVu0kvLMZShtFKQHyac X-Received: by 2002:a05:6512:3d90:b0:437:73cb:8e76 with SMTP id k16-20020a0565123d9000b0043773cb8e76mr2969490lfv.187.1645121320970; Thu, 17 Feb 2022 10:08:40 -0800 (PST) X-Received: by 2002:a05:6512:3d90:b0:437:73cb:8e76 with SMTP id k16-20020a0565123d9000b0043773cb8e76mr2969460lfv.187.1645121320667; Thu, 17 Feb 2022 10:08:40 -0800 (PST) MIME-Version: 1.0 References: <20220217053028.96432-1-leobras@redhat.com> <087309d0-f39c-d5d0-2b6a-2dd8595b06ea@redhat.com> In-Reply-To: <087309d0-f39c-d5d0-2b6a-2dd8595b06ea@redhat.com> From: Leonardo Bras Soares Passos Date: Thu, 17 Feb 2022 15:08:29 -0300 Message-ID: Subject: Re: [PATCH v4 0/2] x86/kvm/fpu: Fix guest migration bugs that can crash guest To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Chang S. Bae" , Andy Lutomirski , David Gilbert , Peter Xu , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Thu, Feb 17, 2022 at 11:52 AM Paolo Bonzini wrote: > > On 2/17/22 06:30, Leonardo Bras wrote: > > This patchset comes from a bug I found during qemu guest migration from a > > host with newer CPU to a host with an older version of this CPU, and thus > > having less FPU features. > > > > When the guests were created, the one with less features is used as > > config, so migration is possible. > > > > Patch 1 fix a bug that always happens during this migration, and is > > related to the fact that xsave saves all feature flags, but xrstor does > > not touch the PKRU flag. It also changes how fpstate->user_xfeatures > > is set, going from kvm_check_cpuid() to the later called > > kvm_vcpu_after_set_cpuid(). > > > > Patch 2 removes kvm_vcpu_arch.guest_supported_xcr0 since it now > > duplicates guest_fpu.fpstate->user_xfeatures. Some wrappers were > > introduced in order to make it easier to read the replaced version. > > > > Patches were compile-tested, and could fix the bug found. > > Queued, thanks (for 5.17 of course)! For patch 2, I renamed the > function to kvm_guest_supported_xcr0. > > Paolo > That's great! Thanks Paolo!