Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3051636rwj; Mon, 19 Dec 2022 12:18:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgyaP5C7rxUg732YU7Cb2bM9vZRKNWtR4Qm1UgRdBeXryCeSUzOnMhWUPyn3l/SZPHFMml X-Received: by 2002:a17:902:8c90:b0:188:70ff:5d86 with SMTP id t16-20020a1709028c9000b0018870ff5d86mr10079608plo.24.1671481081083; Mon, 19 Dec 2022 12:18:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671481081; cv=none; d=google.com; s=arc-20160816; b=VRg30JlKECd9sKpGqHdgRLqGhxrJ6fZR/zDLPzWa85qOa6aNLG4XTczxUUcix7bBeV j1elkRVGmGayReicxMnm9Z+J8TyU66AYMyC+80XljjzkHe41n2anNvNPWkcycTgeXMhI 2VReQ94S8g5+AS35VsSKDKxYGpYMd4RTR7iD2O1/45ptE51U+/j/T0EoQl5y/bCcuHLw lDf8O6i0ggkufgZSrfAzg8WNIV2JxQAqyipwm0zs1MHtnrIIsVrjhH80o1Klvj54LF6A kcEBS6gBoRqVzl4UoAuyYukehj28V5CrBPEE4MnvSRzbEU7Aj+tqJUVSfv1dvbSwPUgT eLSw== 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=lrxhiTTF/whrwIYbK5JLyaQ/VG3LtXMAICiu0E+hLIM=; b=YFl/C1yp1BSs9xuOuPGJJ2z7H4T76UbgElxOH1gb1hgDS5FXC1As44YCuhhm6y/ye0 QicnIo9N4qQ0YUwkHh6lAFixBe00+CZ4zE+1Fo30EblmNqfuk8RKHvEbJf+nHb6Iulz6 0sE5h8Z8/OaLIwQF0hHfbmD4OkLHZSmBEMr+esvINblgd8s/zViVau6ry2s0fGPXwZF0 Tuc5udMtNEJndDZSjNU3pf/gjnT4VU50xXcL5KccLM3nU7paMLWkaA7NBldWcQA6/N19 m5HrCD4odxCyIOkLmPUugtOUTG44NixeFnmY5lD2/kUFMdP2dYj+FcvEbaXJB5oU/dlc GBUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=CPfVndn+; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a170903124500b0017dcda20fefsi12385842plh.232.2022.12.19.12.17.44; Mon, 19 Dec 2022 12:18:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=@alien8.de header.s=dkim header.b=CPfVndn+; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232054AbiLSUJB (ORCPT + 99 others); Mon, 19 Dec 2022 15:09:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232532AbiLSUIj (ORCPT ); Mon, 19 Dec 2022 15:08:39 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0EE14026; Mon, 19 Dec 2022 12:08:37 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 803F81EC06BB; Mon, 19 Dec 2022 21:08:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1671480516; 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:in-reply-to:in-reply-to: references:references; bh=lrxhiTTF/whrwIYbK5JLyaQ/VG3LtXMAICiu0E+hLIM=; b=CPfVndn+VkW6ZTjP2XUvlPrNlTglu5FlJdPvPusIvXkI+AKI73wrD/UnBGU+ZFq9G9BDBX 1YNpBXsM6I/noQiW3niuawwNR7ZLs0XqfnUxMgMGzXliFX1+Jr8KiQJ2FfC20aOgOhl9gd vH/ng88yULsTbeLMMEWrlt3tMWlBIzc= Date: Mon, 19 Dec 2022 21:08:31 +0100 From: Borislav Petkov To: Michael Roth Cc: Ashish Kalra , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, jarkko@kernel.org Subject: Re: [PATCH Part2 v6 07/49] x86/sev: Invalid pages from direct map when adding it to RMP table Message-ID: References: <243778c282cd55a554af9c11d2ecd3ff9ea6820f.1655761627.git.ashish.kalra@amd.com> <20221219150026.bltiyk72pmdc2ic3@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221219150026.bltiyk72pmdc2ic3@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-crypto@vger.kernel.org On Mon, Dec 19, 2022 at 09:00:26AM -0600, Michael Roth wrote: > We implemented this approach for v7, but it causes a fairly significant > performance regression, particularly for the case for npages > 1 which > this change was meant to optimize. > > I still need to dig in a big but I'm guessing it's related to flushing > behavior. Well, AFAICT, change_page_attr_set_clr() flushes once at the end. Don't you need to flush when you modify the direct map? > It would however be nice to have a set_direct_map_default_noflush() > variant that accepted a 'npages' argument, since it would be more > performant here and also would potentially allow for restoring the 2M > direct mapping in some cases. Will look into this more for v8. set_pages_direct_map_default_noflush() I guess. Although the name is a mouthful so I wouldn't mind having those shortened. In any case, as long as that helper is properly defined and documented, I don't mind. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette