Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4918777rwd; Tue, 23 May 2023 14:56:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44Jv3uHMCeisyQ4QuOQ1Wr7MZQikD2CitZU0VUN876b+XxYMjBMEY5kEras4VLtnow1Ux0 X-Received: by 2002:a17:90b:f91:b0:255:4f20:7ceb with SMTP id ft17-20020a17090b0f9100b002554f207cebmr8749381pjb.0.1684878977030; Tue, 23 May 2023 14:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684878977; cv=none; d=google.com; s=arc-20160816; b=SH5MWVQLBcug5BR3D2O6nh8RTNVH8gAdbCV+Pov3ytYt9j9hTPvH4FQLwCyknukMde x2NUQ6Vuu09Qs/RziNTY7i/1KaeFJzhslLezAMhqBknx42KftcTka6XoZCJBBAQAbgRe /G9DzYR7vs51pkOyiyeK35C6o1ZGWfl6Rqp1cWvjtPQEtZbEklO5QdBj6DtD/DWmsnKp wuFAzkE9+ualraeEYuJ8UC8GnSpea3sj5OhLFG68yoUjy7G/6bVaZd+nlxm/ADoGE2xA Cf9AE1ZlggZDF3IiY7HacTpnQC6i4cVL4YnaMYQRtc6keqjBeFb4njyJCabwsGbyrM+o 2/Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=XhkFXCVK7IIddxQvfyYvbxUVBVCNC01wPMYY5cCrGec=; b=hViq71wt3u9+pEdGT4ZuAQXQ9EGIhPSPj3WLbQ4HhY7TtdW8GPcHq+AhNB15g3SJU1 4VFdcJhlpxaJCFYDj0FsNNxGS9dIGSKfT/AvmQY9ZAb9tI0Ci+hjzDoVCWqhWaQbHBpq cpIvGoNGiZ0DoJxGx4+d7im/6E4E81wy016zy0x07BtwfCcekXmmUhuZ+fLV3yQU1kjC jsUjZAlwkHlM3NeEykOW/R/bhkWRRgCRD4P8B84xTHhwEVRqFywsTRRRhrs6lqtNeaO8 Edili/xOzT4M/3m9JKeS9xiEKd8WXOKNS8lG0m1TiZXd7MtSqUuBjFEUpd5w5d4vUhFl yCIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=QivLoo6a; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i23-20020a17090ad35700b00250c1397245si21828pjx.121.2023.05.23.14.56.02; Tue, 23 May 2023 14:56:17 -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=@google.com header.s=20221208 header.b=QivLoo6a; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238477AbjEWVZz (ORCPT + 99 others); Tue, 23 May 2023 17:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbjEWVZx (ORCPT ); Tue, 23 May 2023 17:25:53 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8169611A for ; Tue, 23 May 2023 14:25:52 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-2532c2c41f7so91036a91.0 for ; Tue, 23 May 2023 14:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684877152; x=1687469152; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=XhkFXCVK7IIddxQvfyYvbxUVBVCNC01wPMYY5cCrGec=; b=QivLoo6aTt7ePCsCuUzSciGYVzVkNfEjQJObWk6rpXU0sQA/5e38aC/9Y/PAkp2ug6 xMWTUG/8Jy0fzXiJMXWLVH/2rVCwS+5FBaOqeTSeqZo1/FNi9GWe43UA8o7gqrfGQ8fD B54VINXLIXwdoIoca2En2IUUNyT/l3WlMum1E8gltNqbL5Z4hcKLehaG9sWO2KqSSzyA b7/g/E7x9ZZRL2I+Gz0s8J6m5FdZexmUb08Q/y9M4iO66z0oaX5yNjop6Zgy8VSJpFMw aAl7J7cA1POhuz8TBmQYDJftF5bHnS7NV8PDY71EFtuzMKacBOHhvc/JiBVPVvV2zE+2 1iNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684877152; x=1687469152; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XhkFXCVK7IIddxQvfyYvbxUVBVCNC01wPMYY5cCrGec=; b=gazKoj7iy0hdWCdxECAFiXtIgHtri4xiu0/2z7f/eb0pEfl/7vhDQNmcM0U5ivVcNK JjliZ7cEgdNactyJF5a3qePmYannedx7BmlQdc+Od6y6ZFdMnzCUHZbZo3VY5QnGv1Az DgtnV9YWR98gljZkWDrhkW30Vp3/Kq4DuYDHPgc5R/cJc+jD9ep35YzqMjyFMsjK1Bop gp1QQ43QfSFARopd5S9/8qkLYazBsHUDGUBr25BpFidwrbBYIalXO6TVWJMquxxQ+7bY uElhpEmOhq3u/AgP4+JJK8QSuu3Q0M9RKO4zvETd0SC0ZVhJqMns5YjvSUsxvYPg95ty pDzg== X-Gm-Message-State: AC+VfDxUYgeDAiW5vV+UjcezZDtqd9+G6YijQnjK27B9Fu/arBK40Zs5 2Kt89bJueenUdtpvF4GfBphpzrH2bC0= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:890:b0:255:5a01:cc48 with SMTP id bj16-20020a17090b089000b002555a01cc48mr2274966pjb.3.1684877151953; Tue, 23 May 2023 14:25:51 -0700 (PDT) Date: Tue, 23 May 2023 14:25:50 -0700 In-Reply-To: <9e466079-ff27-f928-b470-eb5ef157f048@intel.com> Mime-Version: 1.0 References: <20230504225351.10765-1-decui@microsoft.com> <20230504225351.10765-3-decui@microsoft.com> <9e466079-ff27-f928-b470-eb5ef157f048@intel.com> Message-ID: Subject: Re: [PATCH v6 2/6] x86/tdx: Support vmalloc() for tdx_enc_status_changed() From: Sean Christopherson To: Dave Hansen Cc: Dexuan Cui , ak@linux.intel.com, arnd@arndb.de, bp@alien8.de, brijesh.singh@amd.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, haiyangz@microsoft.com, hpa@zytor.com, jane.chu@oracle.com, kirill.shutemov@linux.intel.com, kys@microsoft.com, linux-arch@vger.kernel.org, linux-hyperv@vger.kernel.org, luto@kernel.org, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org, sathyanarayanan.kuppuswamy@linux.intel.com, tglx@linutronix.de, tony.luck@intel.com, wei.liu@kernel.org, x86@kernel.org, mikelley@microsoft.com, linux-kernel@vger.kernel.org, Tianyu.Lan@microsoft.com Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Tue, May 23, 2023, Dave Hansen wrote: > On 5/4/23 15:53, Dexuan Cui wrote: > > When a TDX guest runs on Hyper-V, the hv_netvsc driver's netvsc_init_buf() > > allocates buffers using vzalloc(), and needs to share the buffers with the > > host OS by calling set_memory_decrypted(), which is not working for > > vmalloc() yet. Add the support by handling the pages one by one. > > I think this sets a bad precedent. +1 > There are consequences for converting pages between shared and private. > Doing it on a vmalloc() mapping is guaranteed to fracture the underlying > EPT/SEPT mappings. > > How does this work with load_unaligned_zeropad()? Couldn't it be > running around poking at one of these vmalloc()'d pages via the direct > map during a shared->private conversion before the page has been accepted? Would it be feasible and sensible to add a GFP_SHARED or whatever, to communicate to the core allocators that the page is destined to be converted to a shared page? I assume that would provide a common place (or two) for initiating conversions, and would hopefully allow for future optimizations, e.g. to keep shared allocation in the same pool or whatever. Sharing memory without any intelligence as to what memory is converted is going to make both the guest and host sad.