Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35426059rwd; Mon, 10 Jul 2023 07:18:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEGPRmA/erv7tfoN6KJP3u2v2px1G51KBPtXYIfkEZAMOtm5rMEVUNSG8u5ZnqZ8+Fvkd1/ X-Received: by 2002:a17:906:6a1b:b0:98f:450e:fc20 with SMTP id qw27-20020a1709066a1b00b0098f450efc20mr19232711ejc.17.1688998692896; Mon, 10 Jul 2023 07:18:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688998692; cv=pass; d=google.com; s=arc-20160816; b=Tm6H99nCbl7onnOK2Ncp/Ms+LR0C5GU/vSuC8gPG3UsitJqgVKf4WEiwtEGtcNMFwZ 6uT4L3zjkdeAUoZ6XX5WAStgRmkY2rrQ0tmEbZYIr9I8d/qxp+ZPCFooGCzN+zO33ZpB Ja7kYlQ4vVBbp5vXLwSuMPFRDM6PEZGK5d3Hg1iea5ekwns+cHcBiNPhqf6VQ7sxEiJl CvrJIrkaGk7Qyjo6+M6VCpMB7rMjU/35SvWGnpZKw16XJPctkl9ZyasN0plTMEtSTfW2 ygM5xnY8nFCFU1l0XNB4Fo35CteVtDWOI1fAI1L7mywfkxc24ZMtnvLUit++wWMGi4Hb 8jeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=E+FynCTJ0dyoZEIsHDVjdi4nQbU69MAhofVfAR1TnLU=; fh=DxeVjt/KEds/iddAfGLejUV0n6ZghNM9EEylBzOzeQE=; b=nr0NQdb6mOg8e4wx6bS8+QdakgQnsRZb5Z6vKEQbg9gHt1o74fL1o/zuh9t+nbs11D 1DBQgt+DMKOWIb+bwAx6bmo/tcPmo30iTnzQOcK1GAPYs+xrS1cPXo7FTY/HQTNDDTQU hc4R0qKkds61y2Zdq+vrcYDMHCulOGHbkyYmVelXIrZ3ZaNMyhkHobXNNGBEHU1NdJMy SaxsMUYwqsA7vzaQtVD7C6W6X6VWAUnFxo8RSmTpKrHFwfiBg45bXrRxz9VS3cEJY6cZ VKIvQ1nQgWHikATtJ+JRuBat/ZBr0dAEhRIeW9gF4M60jFQCdAkDxLtFFUJbPoZ51f12 D6/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=LB3p8GdE; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qp22-20020a170907207600b0099315b29a1bsi10443012ejb.1036.2023.07.10.07.17.48; Mon, 10 Jul 2023 07:18:12 -0700 (PDT) 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=@amd.com header.s=selector1 header.b=LB3p8GdE; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbjGJN7M (ORCPT + 99 others); Mon, 10 Jul 2023 09:59:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjGJN7K (ORCPT ); Mon, 10 Jul 2023 09:59:10 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2087.outbound.protection.outlook.com [40.107.100.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C759FD2 for ; Mon, 10 Jul 2023 06:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KNqQ8R1vMgskmEZHPtG3VjEbrdFQfy+/cfAmAdOZgp4hb9vrArvE6LWfxENrwsIE6G/LgruU/yxdfLobOsfJj7dXfKSHxXq8qweWwu2kAAZI8XcHzVXvF9wQD0vOlxH/VW1KSeARM5GoPvJFPgABfQtumQRBaeApY+bwGXpbquNgpQYaKh3OHCcEPE7e34UiqH7S0LK18w0AF2fb8Ze6YhjmPJHXJ970CaKTDnZhcSaEhBqfuDk4xoCZSoL6uo/fFJu+A6AWdBTQ3bE5acKWbHyNejQ2lOZTXhjJp5hwNEvDpq5QggAOtGaAHKnFbfwmBjRFKv4K1MxlTBokssRVQQ== 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=E+FynCTJ0dyoZEIsHDVjdi4nQbU69MAhofVfAR1TnLU=; b=NdlSfIrWPk/d2s1mG6euW0WD/DHzYxTNBktTf7fCFadGhz8xr35wN4Mqz23KTBt75kgXBwG99NcLQidHNCkKDCNSE0lsN6rKaZot6QeyEx7PvLxAuzqhB8H/YxzJs3GTLTyPnwXNsgI62VbYS/SHJYAiLfhWMKqX8/55mPUciv7Kz086KORn7bLSDtAVizkRY8IbA5Km7Q59buwujQbCSnsff8JdMeoch5tIgmU+5WD1zUXpqPUi6CeyQJ2uzyKlcozNGr9xK/7TgaQsYlZY5XT5IZVz0+UmggX2j2OymQEB0gFyx/Faeobbm3RaQqfMOpEPzwsbnkPCHUCS4UT2jg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E+FynCTJ0dyoZEIsHDVjdi4nQbU69MAhofVfAR1TnLU=; b=LB3p8GdEl7Ewn4U8ZMaVU/e7o9EYYWqIpDIw8jIkU4feaJOq12c+Bkk54g0h3BT3NysWDAdQMaIrRAKuls/Vj1y81RxAXV/FsxfYY34iQM+vK0h1BzxP01EsiAAM8+IY8T3tS5CO8uldBgSpYWiccn+Od09LdGdX/0MoVQi50l8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 13:59:07 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::c440:6819:be48:f4b8]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::c440:6819:be48:f4b8%4]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 13:59:07 +0000 Message-ID: Date: Mon, 10 Jul 2023 08:59:04 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCHv3 0/3] x86/tdx: Fix one more load_unaligned_zeropad() issue Content-Language: en-US To: "Kirill A. Shutemov" , "Michael Kelley (LINUX)" Cc: "Kirill A. Shutemov" , "dave.hansen@intel.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , Dexuan Cui , "rick.p.edgecombe@intel.com" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "seanjc@google.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" References: <20230606095622.1939-1-kirill.shutemov@linux.intel.com> <20230707140633.jzuucz52d7jdc763@box.shutemov.name> <20230709060904.w3czdz23453eyx2h@box.shutemov.name> From: Tom Lendacky In-Reply-To: <20230709060904.w3czdz23453eyx2h@box.shutemov.name> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN6PR08CA0010.namprd08.prod.outlook.com (2603:10b6:805:66::23) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: 94eef198-e76c-4db7-ebe4-08db814dd400 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ttfUUjVLD7Rqgjjvo85X3LrXvqXhqu08+/0xLWW5aRuhxCYwzhu86pr28ctxm6YpN9AQUopXUe7+mDSxYRGTvgtFjoar3ssuH1/UAxMR9+Gf3p5I530J4i1Q1Ofp8JYItEzZ/H3EfInQNiDhNfZNQXEHinR9/74/Mlf1l2YJuCf6EhSqJeZu689VesKdx1u+HZxDCU5C2XpeM3UZ4xCQcM6y7U+qlbO9ivjt+VyuRQ4gC29hZ/Mj1hlC6Aii8VXqXkrtXbdK8U8IQrqTe4ZgTGnRYJI2zI48e6rEv3p8h2dGQCXbE7bvVr+XfmBBDL2H8FRhBS0gYsTc4ahi1u1Ud7VwJLwtjts2zY186lveCKW27xzZxBcA55PJsG6xtVVOoL5EItuwfJPxhScvNtPbrjq08zAvAP04Hf36IxdkvRKFCzEEYqyZ7MQShkXFbx7VGRihPDUtkAt91fNN8ZS2AD/Q9h3bGWJd/J7RhRko2jm7AU1njagUBJg2C411ub5bjsu6F7lnQTI0SXor/QE8Wh8NNgVIk5tUWPQHdtc/G6tbLcW91B+CXECdNroaqP6KLFSfEookDTGPRRy7LXZzOkE+5ic5IRfeNqdisNn1zPKp1Yez65IXd7/GseJVPqe+q4NxPt1guZsp4VYw0KTK0g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(31696002)(38100700002)(31686004)(36756003)(6666004)(6486002)(110136005)(54906003)(6506007)(53546011)(26005)(186003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(83380400001)(4326008)(41300700001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eFNZUUtDczNZbGY3VzZScFU2ZGM2QXpaZ2N4RWJJK1JobjRIcGZoVWFKSzRr?= =?utf-8?B?TWtpMFByNThTbVlIZ0RVSlBnbEhjdjU3bEY3THB3NFV4dERxS0tFY0Zwdksw?= =?utf-8?B?WERFZzVoSU1udjNvdzJVc0F6MUt5S24yOUsrT3A0K3hRMXZEbXpMUkJIV3ZQ?= =?utf-8?B?eUgvc0ZOWWdPTEl2RWhHblI3KzN3K1FBZUhBaWJsZWdRZldaVzlGVnZHREFG?= =?utf-8?B?Y1V5c2s3Y3V4MU5zT3dTbmFqdkFQM1Nzb21YNHRGQlEwM0E3a0wydzIwUjUw?= =?utf-8?B?MUNLMGtJSnJzNFkrUjgvNVhrUERiVkZ6Q25GU0xaWkNkN1hWSVg3R2FjNVB4?= =?utf-8?B?dH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riginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94eef198-e76c-4db7-ebe4-08db814dd400 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 13:59:07.4319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fZ9qKwed0EQ9FLF/WyqCUHv0ct/jZcBfa0V6AorFjGq2x9B+2TyaPrkI9osUmV4VNHvLIsUxHLIKk0RCCgEelQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 7/9/23 01:09, Kirill A. Shutemov wrote: > On Sat, Jul 08, 2023 at 11:53:08PM +0000, Michael Kelley (LINUX) wrote: >> From: Kirill A. Shutemov Sent: Friday, July 7, 2023 7:07 AM >>> >>> On Thu, Jul 06, 2023 at 04:48:32PM +0000, Michael Kelley (LINUX) wrote: >>>> From: Kirill A. Shutemov Sent: Tuesday, June 6, 2023 2:56 AM >> >> [snip] >> >>> >>> It only addresses the problem that happens on transition, but >>> load_unaligned_zeropad() is still a problem for the shared mappings in >>> general, after transition is complete. Like if load_unaligned_zeropad() >>> steps from private to shared mapping and shared mapping triggers #VE, >>> kernel should be able to handle it. >> >> I'm showing my ignorance of TDX architectural details, but what's the >> situation where shared mappings in general can trigger a #VE? How >> do such situations get handled for references that aren't from >> load_unaligned_zeropad()? >> > > Shared mappings are under host/VMM control. It can just not map the page > in shared-ept and trigger ept-violation #VE. > >>> Any comments? >> >> This looks good to me. I applied the diff to a TDX VM running on >> Hyper-V. When a load_unaligned_zeropad() occurs on a page that is >> transitioning between private and shared, the zeropad fixup is now >> done correctly via the #VE handler. (This is *without* my RFC patch to >> mark the pages invalid during a transition.) > > Great. > > I am at vacation for the next two weeks. I will prepare a proper patch > when I am back. Feel free to make patch yourself if you feel it is urgent. > Michael, Are you still pursuing the RFC patch, then? Just trying to decide whether a patch will be needed for SNP... Thanks, Tom