Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp304965rdb; Thu, 30 Nov 2023 05:28:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvYGQfV03fOQUjQZUIo6hb/ASu3UxNsIhoWPFqoyxZpgLYRBjFW14dbYEtXpL1+A54nSMg X-Received: by 2002:a05:6a20:54a1:b0:187:5302:4b21 with SMTP id i33-20020a056a2054a100b0018753024b21mr27486227pzk.46.1701350929899; Thu, 30 Nov 2023 05:28:49 -0800 (PST) Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x2-20020a170902ec8200b001c36018fdaasi1286375plg.219.2023.11.30.05.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 05:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RCpSzzN8; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 712D68031013; Thu, 30 Nov 2023 05:28:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345545AbjK3N2X (ORCPT + 99 others); Thu, 30 Nov 2023 08:28:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345535AbjK3N2V (ORCPT ); Thu, 30 Nov 2023 08:28:21 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF4D1D6C; Thu, 30 Nov 2023 05:28:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701350907; x=1732886907; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=y+mIEM7jOdGR274ZmVAx52/YO4u+jAzoblsGMtfZEEs=; b=RCpSzzN8Qw9zgIGUlaXHYJWt0ZB5BJU8w4HHoC9tOMTTWXyLGKxi6Vjn 4Cl/E+snxrFJQRn+HWPmP61O/VkiKiKCUlUTtLy6gD4GlS+sQpnx+cjMs cp0cPKcLUMmUEgqpFnZuzgUl9lhgv5CRujDoJKEC8BI8cRMKjyn0YZmb0 r75DbpcQEgETvvJr9OxC2nWZVRijzrhvRyw3VV5RfcAvMnU3hlFiWh4/H Ur+1nCA17zEe88Mwvibb6EH/pVGVnUNXetB+BhOydvkeXOhdQl7ydVvP3 AZT92sNfXL++DdKEfLD1RIgDuRIIjySG/UisQepfTbA46rjkMENOiB0vk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="390485859" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="390485859" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 05:28:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="839795075" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="839795075" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 30 Nov 2023 05:28:23 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 30 Nov 2023 05:28:22 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 30 Nov 2023 05:28:21 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Thu, 30 Nov 2023 05:28:21 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Thu, 30 Nov 2023 05:28:14 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gukUfWPkxZ2/xTLcqrLER4FvA8HEQn/FbBv1FgKv1FJpL+i4ZfGV7D/y7FWwZcLdA9LbmxbrlZq+BDa4I57jUBrBfMvI4/+aDQdQPxw24ULnj89kk1zn8Ayljk8m6EUrXUaJfCSBX8pLJmmw5BHxgcF/8y0dnSYbpFRdeS331BoXYjyhInzGH+e45V2vFar7WkZGL3PBDER8xA55FvbguP7Hk1vcDiw5EiB2jr8ncH+Tc/Cqh3H7qc6jrQHPOPTzp20mCQa+ZLnzd9plZlnVLLu5Xg9+Dq8r+b0VVwbK4hc/Ka0oXY6sybGAdNHRCI4zYBvy5j6bjz815XG9J7owkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y+mIEM7jOdGR274ZmVAx52/YO4u+jAzoblsGMtfZEEs=; b=AbKgON91sSV+jGQYp0kR9QNb5Qk4zV/5B4Jq1FqawSzxB2DeYrD6lnrE3TIRZ+YjQQIp2B87vzq47sxZF/ml1dzHxCwgHZAWxqgBz9HGLfKLKd2/aGL9h2tvIv9wRwcrekOrcbdlcgS0CUeYyxy19i1511troL1qPx2CNseifVxq3NP8gRSi/KUJcUPzL6Ut1LOZXTq0ObKQyObqu1htcBlwftkkz6s0hx6SLXjzqmQmLHiO6cHFGMVkt+BjiB4S+3FS0K5iLd3NURvmLN4TxHqUUb2n0Scs6AHunm8mlQUZGQ/pzuyMvtQ0BOaN8nJ8Ef0nTJRCb9otinDrlvFxpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB4965.namprd11.prod.outlook.com (2603:10b6:510:34::7) by PH8PR11MB6951.namprd11.prod.outlook.com (2603:10b6:510:225::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.24; Thu, 30 Nov 2023 13:28:12 +0000 Received: from PH0PR11MB4965.namprd11.prod.outlook.com ([fe80::ea04:122f:f20c:94e8]) by PH0PR11MB4965.namprd11.prod.outlook.com ([fe80::ea04:122f:f20c:94e8%2]) with mapi id 15.20.7046.024; Thu, 30 Nov 2023 13:28:11 +0000 Message-ID: Date: Thu, 30 Nov 2023 21:28:02 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 05/26] x86/fpu/xstate: Introduce fpu_guest_cfg for guest FPU configuration To: "Edgecombe, Rick P" CC: "Gao, Chao" , "Hansen, Dave" , "seanjc@google.com" , "peterz@infradead.org" , "john.allen@amd.com" , "linux-kernel@vger.kernel.org" , "mlevitsk@redhat.com" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" References: <20231124055330.138870-1-weijiang.yang@intel.com> <20231124055330.138870-6-weijiang.yang@intel.com> <742a95cece1998673aa360be10036c82c0c535ec.camel@intel.com> Content-Language: en-US From: "Yang, Weijiang" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0012.apcprd01.prod.exchangelabs.com (2603:1096:4:191::8) To PH0PR11MB4965.namprd11.prod.outlook.com (2603:10b6:510:34::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB4965:EE_|PH8PR11MB6951:EE_ X-MS-Office365-Filtering-Correlation-Id: 77e2ad79-37d8-414c-d709-08dbf1a832d7 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B/SipWWkD0j4DD+swDh/On4Q7xlDRpaJnQ48Sjjni2+LUPZqE5OaP/nAWAYvM4d87B9WV1k/BtADs6KDWRxghDRlZYV441hnVGxHTxUrxrkJq/0Jc2jeYMT8lH83NvjX9OBlJhwMIlMJmu9no/xAMtDW4lnsyuMJ3qIgNh0LiHgaqRx/gCUUh9bVX1IQju2F+EPK5Pe2ZTmeNszQphqJJyB4ePq3+y1KKLaWFqHzZc4kmljGdNKlFqpNFXlk03T7v2+SwIMGHGiR+HUhTCrfw9CoJBB4L+25UIZMu907C2LJuSFvGLi8I1TzBjtYrjHgqxqsYl2YrQEEnCDB6DUQXNE5TbgOi2yo17D1T3g9PJINJbVC1nQhoFcQ+0K4QFwjz/E1IscAHQ9BB9G3bUPk1vdwTQEXpgTsifAVlH6nC4pqP0YlrJ3YgF9lMpa0/eA/We8U1OfwGZ9uZBHEHliWjkkbTCjOE4CfDFUa+RVgd1yfkkHXE3/X5CZwqrPYdj8anyUjSS9sYSZTeH+VtTPUQM4aJGs/wGNTyyGDaci2mzSWNJLTRMDBG82EZGUrKw3zBdwKG1tNWvfyl6NyNBDBORQ5+9M2lu7J8okoL85Jqf1Avy6NyTa+5RPPVDzhBO43Fn8m1E4m5Vquh88j4M5v8w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB4965.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(39860400002)(396003)(376002)(136003)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(86362001)(5660300002)(31696002)(316002)(6636002)(37006003)(66946007)(54906003)(66476007)(66556008)(8676002)(6862004)(8936002)(4326008)(41300700001)(36756003)(4001150100001)(2906002)(26005)(2616005)(82960400001)(6512007)(53546011)(6506007)(31686004)(38100700002)(6666004)(478600001)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aUdqbkZqNUFYeFRHMGFGcnlPVnAvRnAyYXNJZWZJZ1ozT0FpcHB1aS91UG8x?= =?utf-8?B?MkUraDhzN2RoeVJHNHV6ZVlmdGpkaVlCRHJEenRLbllwTllkVjdYUTBjdE82?= =?utf-8?B?b2dYU21tZ01sTklqVzBwZDBsL3F1b2o2NllJb0J5c3hOcGxyVTVRM3hldnRB?= =?utf-8?B?dm1uVENQKzBYK01qemRDaS9iamVUaW85ODlBTlhsQU1wbHQ5cVRwRCt3V1FJ?= =?utf-8?B?bm12SWdicmhIMVJSbnBQd3B0Z2pRL1F5bXNpZmhqNnU3dU1Ba1pMQnZwTlRh?= =?utf-8?B?QUx3STJxc3gzSlA4d29kSys2NC9uK3QzZDNBQ0xwa3FG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utf-8?B?UW82WHJIOVZrQ0xycnRUem8xWTJzTFZjL1JvT3RWems1d2ZxaTVlT1JVODVi?= =?utf-8?B?TFE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 77e2ad79-37d8-414c-d709-08dbf1a832d7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4965.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 13:28:11.6639 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xq4UEhslau6TDlPEcCXFXh5Bw+0WRJeBnUKWmCOTwlS09VdAbuVuqQUiUSZyWS+NYhD4DvsRsTjrKL7fzQDOvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB6951 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 30 Nov 2023 05:28:46 -0800 (PST) On 11/30/2023 1:08 AM, Edgecombe, Rick P wrote: > On Wed, 2023-11-29 at 22:12 +0800, Yang, Weijiang wrote: >> On 11/28/2023 10:58 PM, Edgecombe, Rick P wrote: >>> On Fri, 2023-11-24 at 00:53 -0500, Yang Weijiang wrote: >>>> +       /* >>>> +        * Set guest's __user_state_size to >>>> fpu_user_cfg.default_size >>>> so that >>>> +        * existing uAPIs can still work. >>>> +        */ >>>> +       fpu->guest_perm.__user_state_size = >>>> fpu_user_cfg.default_size; >>> It seems like an appropriate value, but where does this come into >>> play >>> exactly for guest FPUs? >> I don't see there's special usage of this field for vCPU in VMM >> userspace(QEMU). >> Maybe it's mainly for AMX resulted usespace fault handling? For vCPU >> thread, >> it's only  referenced when AMX is enabled via __xfd_enable_feature() >> . >> > In that case the "so that existing uAPIs can still work" comment seems > misleading. Maybe "this doesn't come into play for guest FPUs, but set > it to a reasonable value"? Ah, I mistook it for uabi_size and added comments. Will reword it properly. Thank you for bringing it up!