Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2179223iof; Tue, 7 Jun 2022 22:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzYfLR8PBRSwdDmmDj090V2hthmCRkwCuWAanU8HwiF+W9aAUKQZp/QGnDNwWpkYtrflhQ X-Received: by 2002:a17:902:f314:b0:165:ddfc:5d84 with SMTP id c20-20020a170902f31400b00165ddfc5d84mr32766562ple.171.1654665642775; Tue, 07 Jun 2022 22:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665642; cv=none; d=google.com; s=arc-20160816; b=xu+5l2Y5uZQktgYQvjTRnEodfgMeGDjcKXhPd9VumsTi62zijypvvS3XXs9ZOKoynX nvbDqC6xR5pEBFJMTISK9+Kzj0cgwNqL4MPJr5GCulmiYEaejLDHqhHLMCzesp6gTf30 KygzDASChtMb5nC5633rJGKCdFuZPNaYeldkUYkru9rpMzh+otzRVVL6SlCaGIh2b51H fVknrXJDdqrncIK/i8GOyHsyPJK6lCSrE7nApYNKuaU46OS0HMEkD9nZgtJCfzCtzkDi TQjtfs7Av70K0rRN6D2C/3xnqogS7ieB62V7jFYSV2skeynqOLCGSgoPW08qqFKu9kTb RNWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=PikFI8IuFGilq0ztM72f7JxwavOO8rV8L+cu0/Iu4x8=; b=fEy+khZQPHe0i7/a14rpjrYYnEGmhRj7mfQtqu4WJrevF61MAW7x5jlsOO2bTyEHhu 3ygDcAIPLo/5e01cY0W1Nz06Cu78+aDnCpDmRTMZR+bFkdUxnF9HICMZLY4jQCPcFDKw q+Q2v+7Z+hgIqKc6ReG0gEnXY48CZq/9HO4K/iyzkbNXE/vt4MlOQGv9JEfwdZeldgV2 V0KqVdl3qIAKPtyqLpNBBVhXRNLUPxji/OXeVOksmagycFMtSwkF8XpH02O/CP+Mqfsl V/dE9FAc9wAbr+Wke1brNO3qp9JZLFwugfRredAS/QWBUQz1RnsnBBBZJhfulMoOhrKf gjjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EtyB1LWh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y191-20020a638ac8000000b003fca31af921si26291449pgd.185.2022.06.07.22.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EtyB1LWh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EAF3C248002; Tue, 7 Jun 2022 21:48:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244280AbiFGMzJ (ORCPT + 99 others); Tue, 7 Jun 2022 08:55:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244264AbiFGMzE (ORCPT ); Tue, 7 Jun 2022 08:55:04 -0400 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 A4E8C7891F for ; Tue, 7 Jun 2022 05:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654606501; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PikFI8IuFGilq0ztM72f7JxwavOO8rV8L+cu0/Iu4x8=; b=EtyB1LWhWNfL63MlIGdNjX7xkKZh6WdCCsqcT1FhR6nbBrzqwI7jA/wQ061S55QEmUqJlM ME6XiAPavt1U6eQjEnVpklA1DWoy/tSmKkiFA89EsdtrPhPvhpcE4GaFt1QynKfhlENZA/ /vLDx8E8zee/wo7xHV8+De7ZrsLyAsU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-eC6JHXFYOyezfyOzDqmr_g-1; Tue, 07 Jun 2022 08:54:21 -0400 X-MC-Unique: eC6JHXFYOyezfyOzDqmr_g-1 Received: by mail-wm1-f70.google.com with SMTP id n18-20020a05600c3b9200b00397335edc7dso12730224wms.7 for ; Tue, 07 Jun 2022 05:54:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=PikFI8IuFGilq0ztM72f7JxwavOO8rV8L+cu0/Iu4x8=; b=FtklVp74+x7iBVZkyUiBzu+7y3ucHsiWQOhjyemnWuuU80k0sEC6B7mPgLXs5lZyUF WMt4L4tgXEpZ+k9V9P31noUCyM8ngwEaLH6XC5z3TFEBZioR/ZkAyQRyGvWvjdSuhSyu SLGlUpR/CQVLaPdfrgAFCiQlfVzlT3QoHS+HHQReM8GRtBCPo2q/pBSYkyeESeWZmwh+ 2QbYmxVGlBmxicIzzc799gZ3LxnD9PlxqPzBcvLh7XusTw57guSuC3ofj8bWWYP71ZNe jn7Fys6SFADadJy77Cj+yJeYmQIJuE1ypoqVGl96LaeTJg7ihsiw1DShsDlX/kfUCkiC dLRg== X-Gm-Message-State: AOAM532MoY06ntSGMNdEomNk6dsx99ci6b+MT4mtpSKh7x3Hip14dMaT 77o7LX4fNKOcZSXAVLOSQnnaBgwdZr8GTBbeWa5B8n/aoKhvFhDijzzxqAHXdQWh7zuzFXcAAEK RN+l6dOlseSldqZDx0xEfJjIz X-Received: by 2002:a7b:c401:0:b0:397:26fb:ebf7 with SMTP id k1-20020a7bc401000000b0039726fbebf7mr29011209wmi.90.1654606459915; Tue, 07 Jun 2022 05:54:19 -0700 (PDT) X-Received: by 2002:a7b:c401:0:b0:397:26fb:ebf7 with SMTP id k1-20020a7bc401000000b0039726fbebf7mr29011177wmi.90.1654606459567; Tue, 07 Jun 2022 05:54:19 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id g6-20020a056000118600b002183fabc53csm5233442wrx.17.2022.06.07.05.54.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 05:54:18 -0700 (PDT) Message-ID: <9d336622-6964-454a-605f-1ca90b902836@redhat.com> Date: Tue, 7 Jun 2022 14:54:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH AUTOSEL 5.16 07/28] x86/kvm/fpu: Limit guest user_xfeatures to supported bits of XCR0 Content-Language: en-US To: Peter Xu Cc: Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Leonardo Bras , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, chang.seok.bae@intel.com, luto@kernel.org, kvm@vger.kernel.org, Sean Christopherson References: <20220301201344.18191-1-sashal@kernel.org> <20220301201344.18191-7-sashal@kernel.org> <5f2b7b93-d4c9-1d59-14df-6e8b2366ca8a@redhat.com> <2d9ba70b-ac18-a461-7a57-22df2c0165c6@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/6/22 23:27, Peter Xu wrote: > On Mon, Jun 06, 2022 at 06:18:12PM +0200, Paolo Bonzini wrote: >>> However there seems to be something missing at least to me, on why it'll >>> fail a migration from 5.15 (without this patch) to 5.18 (with this patch). >>> In my test case, user_xfeatures will be 0x7 (FP|SSE|YMM) if without this >>> patch, but 0x0 if with it. >> >> What CPU model are you using for the VM? > > I didn't specify it, assuming it's qemu64 with no extra parameters. Ok, so indeed it lacks AVX and this patch can have an effect. >> For example, if the source lacks this patch but the destination has it, >> the source will transmit YMM registers, but the destination will fail to >> set them if they are not available for the selected CPU model. >> >> See the commit message: "As a bonus, it will also fail if userspace tries to >> set fpu features (with the KVM_SET_XSAVE ioctl) that are not compatible to >> the guest configuration. Such features will never be returned by >> KVM_GET_XSAVE or KVM_GET_XSAVE2." > > IIUC you meant we should have failed KVM_SET_XSAVE when they're not aligned > (probably by failing validate_user_xstate_header when checking against the > user_xfeatures on dest host). But that's probably not my case, because here > KVM_SET_XSAVE succeeded, it's just that the guest gets a double fault after > the precopy migration completes (or for postcopy when the switchover is > done). Difficult to say what's happening without seeing at least the guest code around the double fault (above you said "fail a migration" and I thought that was a different scenario than the double fault), and possibly which was the first exception that contributed to the double fault. Paolo