Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1813515rwb; Thu, 15 Dec 2022 14:59:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgA0C5w8+SKlKiuJXEqOW5fx+VHALLfTmYBfGiH1ijbWdFEGjhl43ao1iQhzUPB2rsGSdt X-Received: by 2002:a17:906:4555:b0:7c8:9f04:ae7e with SMTP id s21-20020a170906455500b007c89f04ae7emr3404898ejq.22.1671145193561; Thu, 15 Dec 2022 14:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671145193; cv=none; d=google.com; s=arc-20160816; b=Y3sburtnAIZfs2GaqofSFc2ceuWZVH1n9EmZIf3btO1j1Gi/LjZirbhqNcAetiWrvZ 2QFHV4jOGOtGwM3WzQJpX4lwUdQr6VJZBra4oeqxGZx/UaumKm6TG4KPOChWk3EhexWI fpUUrP54QjphySMWXSacF3nBBBdcAKQ/lMtzHYP7b4+j11cl0rFo2Itj4OSeovnFc56p IStI+2Mq8vFvYpb8ARDomXi2LvfElk0T3ZGy1/H6xoUWWyKEAOdx8DIRXgMNtOOdBvmJ 5qbGWl9M3ZrSY/BfkWSgbRhHCxTnckB2uzZbZfA4kQdWAOUvPjlDYYy/VKFbIlEo/3rT kCWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eBqqWBko6lQhmmKy2O6HdShYMXa+V0zYB+4SIox4AvE=; b=HFbAWPpQavpGsvQt+nhStufDgPAZvBnlzaWpPg7TW64eX729hciXXPylsRumO/kaME v/pr6j8qEZiO0HT2J3DtSR9Z4yZopPa+2ngMjVnWO7XRpOQfrGm47I7k5nCc62JgWENc fqudoY84C61IfACkedUk/WuYSoHlyzGo5faZqji7NQGxrhO45SLanw1kt+CV2EmVeZL0 QrOrYhH+O3rzDWbfaDjwK0DQGL1HmGaA7q11p3XffSmALhhYalJIhjasAvFrhb31w+aS S2I3mrMDH+RETYucbveGWWZe+5buqUdnpEZeOsAKQ/WXYkWrMmLAozaNTFaByVm0/IBh y7MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=W05t2VJB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a056402190900b0046c6e69565dsi765380edz.259.2022.12.15.14.59.34; Thu, 15 Dec 2022 14:59:53 -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=@gmail.com header.s=20210112 header.b=W05t2VJB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbiLOWKr (ORCPT + 68 others); Thu, 15 Dec 2022 17:10:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbiLOWKo (ORCPT ); Thu, 15 Dec 2022 17:10:44 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC66660D5; Thu, 15 Dec 2022 14:10:41 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id g10so404346plo.11; Thu, 15 Dec 2022 14:10:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eBqqWBko6lQhmmKy2O6HdShYMXa+V0zYB+4SIox4AvE=; b=W05t2VJBYYIMY5AOhsbNEtsIxfpd9VdaxQPdlNUO1dPRqJ6bkWHP8j639NKsLWNeqc 1yPqpIAZ3oBi+cEIrLYibOpF2gdOvZd1KYtC0x3Y9zaAFCyCSaObD3LX1BzogmVw2OK+ q7HmsjowWhak/Vc6BCEHGvusSOo2/cO/MMnps+2XzU+y1MdAAT0D3zXrAwucwPcro6LB V5L3DOTq7Qm5SRXp3BXpFBCuYQ5jHnKoVfAqhUFwc4bPEiPKlbgi3R4XgURnbIcEcQzs W3hoZC57cGcyI/DDuyfmfyoi9kf9wOyVyv8Hg3L7zglochwPbGrJyxF346ty3RueZvDi RJlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eBqqWBko6lQhmmKy2O6HdShYMXa+V0zYB+4SIox4AvE=; b=IgvNmU3Ka7fQp1qinTa/+MQA7PxsjeRI8WLW/xdhNNkhpMiqcMLML5Fhqxc87aHgYj +2lCzVir3Z83uHMnWoihtgDIJEzRzo1Nl3UbnwpdNKH5eclFqLquIr4EgVFKFg0f/xm9 6AC5vhoyw5R4nQkVq7wQlxnr6LZGdvxRzLiR0gfog4b4Z2jKm+KF8WHj4u5Qm/WW8zL1 MffhRp5tTLy0/Jp5MXLDHAgmVQy4wtJaj1pq00KHP41YRKyWIO8PvGO7x1s4BlkCddNv 6sAdrdhBTc11tVzwRDtUeo6RH+lWuB87iS6j/6FGaD821OqRN/AOi1PxNf7fWf1ZnzQm 8CtQ== X-Gm-Message-State: ANoB5pm7xddqqjxeMfCbxPuL5BRYRdfcENIVjuxN+TA0pSc1roNHFZ1j ZyR6EFQb8GYvTT94eS0Qj7o= X-Received: by 2002:a17:902:e884:b0:18f:ac9f:29f6 with SMTP id w4-20020a170902e88400b0018fac9f29f6mr23844579plg.50.1671142240799; Thu, 15 Dec 2022 14:10:40 -0800 (PST) Received: from localhost ([192.55.54.55]) by smtp.gmail.com with ESMTPSA id e5-20020a170902784500b001782aab6318sm135300pln.68.2022.12.15.14.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 14:10:40 -0800 (PST) Date: Thu, 15 Dec 2022 14:10:38 -0800 From: Isaku Yamahata To: "Huang, Kai" Cc: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Yamahata, Isaku" , "pbonzini@redhat.com" , "Shahar, Sagi" , "Aktas, Erdem" , "isaku.yamahata@gmail.com" , "dmatlack@google.com" , "Christopherson,, Sean" Subject: Re: [PATCH v10 046/108] KVM: Add flags to struct kvm_gfn_range Message-ID: <20221215221038.GH3632095@ls.amr.corp.intel.com> References: <880c1016c29624964baee580985b6a736fc7d656.1667110240.git.isaku.yamahata@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Wed, Dec 14, 2022 at 10:51:31AM +0000, "Huang, Kai" wrote: > On Sat, 2022-10-29 at 23:22 -0700, isaku.yamahata@intel.com wrote: > > From: Isaku Yamahata > > > > kvm_unmap_gfn_range() needs to know the reason of the callback for TDX. > > mmu notifier, set memattr ioctl or restrictedmem notifier. Based on the > > reason, TDX changes the behavior. For mmu notifier, it's the operation on > > shared memory slot to zap shared PTE. For set memattr, private<->shared > > conversion, zap the original PTE. For restrictedmem, it's a hint that TDX > > can ignore. > > Could you elaborate why restricted memfd notifier can be ignored? IIUC if > userspace punch a hole, the pages within the hole will be de-allocated. So why > can such notifier be ignored? Because set-memory-attribute ioctl is expected to follow the callback from restrictedmem. So set memory attributes can do de-allocation. I wanted to avoid zapping twice. With v9 UPM, the restrictedmem callback was triggered for both allocation and punch-hole. With v10 UPM, the callback is triggered only for punch-hole. With v10 callback semantics, probably this can be cleaned up slightly. -- Isaku Yamahata