Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4971365rwd; Tue, 23 May 2023 15:54:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FQPB22m17/rkHex+IOpPBskUF93x8xE/wlI/MdouO6CnTY+wvKXoULDsPS7c/7bYBCVUa X-Received: by 2002:a17:902:7d8d:b0:1a6:dba5:2e60 with SMTP id a13-20020a1709027d8d00b001a6dba52e60mr14277822plm.25.1684882482178; Tue, 23 May 2023 15:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684882482; cv=none; d=google.com; s=arc-20160816; b=szpREe5o07l/T7f91CgaP3yQrItAg+wBy9qf0jc6WMPo8G7cQ7U4KYLwNhN5w7UJ16 f+YvHh07cu5m8GgKGoYwM4RciBQ0+mZuQyeNh1SNsNK7IK2cswUFBUltuvWH0WoolXKe DlK7MonXPg3qhuGW91ehJtal/zPoCdaNgpkIL3ljfXkW7ksmZetEwvYmhA9Id/vdZ/YQ lCAyhRej50mrqRKZgzRrQmLagUQW9EL0ASd2cDFq4wH3ZRM44QbIaUONN4V842PlgGbm Aa0Ccjn1GVnyG/ilGRB8oVjKBiR4KAQ7wd7fPJyBKVsdpzqfWuemZcAgcI0sHxt57Sqg YR3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vF0Se+EHsdVAKD4T31VyNkYXBW5LnbWG0WvnuSLi/xw=; b=C5HBSs9k10M1XHWfqYxYAm1+lRYMxPAPvqKv6aFHgDSIGXYixElthj0yBeJIjobNJf MBkmRXhPYYsH9bFsI8YoNkACZ5tchhxJJRL18lfLRInn5arSIa3En5dAY665eu8j7n7M 4d6YeS4/Jm4GjpMeAg7+NHmazUMQItALFzEiCdmcHX0a3mVpl7Id4ISX6Oh2ekca5U7v FEC+DDo/bzJmUa2JZRoDiQ7Qu9Cn99TFcGa5Nr7jgGvx4iopHHWHlwxP2Qm5iYGqSn5D HFHkNM8X9lBKvav8nk4fOaoS5TtIMiGTmnmM7MYYjwj2XkHOPKURf+w/qCksVWVWszV5 Mpog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VMc3rVFL; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170902e5ce00b001ab012a1ba9si7088195plf.402.2023.05.23.15.54.30; Tue, 23 May 2023 15:54:42 -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=@intel.com header.s=Intel header.b=VMc3rVFL; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238710AbjEWWnW (ORCPT + 99 others); Tue, 23 May 2023 18:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238682AbjEWWnR (ORCPT ); Tue, 23 May 2023 18:43:17 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86E82DA; Tue, 23 May 2023 15:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684881796; x=1716417796; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=J+jN9q7cfTT3mtaA3PEXaYDQb1DYIjMPr3zxn/71cmw=; b=VMc3rVFLNymAOU36KMq7Jr2mP8nBKqBrgAX7xGBx66DA+vxMYgbstnyH yuc884XQ+gORx4uL0Hd7L8oz6umihB/rcan0FjXZE3cSB3jGKBMuroqd4 hHQHl9K/qgQIDTCvBSygpUKdxTAVRTo3F2PB9TWC4veuTDtld6XnKKoRX 49HJFCe59t+SFI+uriOvf9NaI2GiuiaX+mD0h8Vy4AIqCnC1tF45lNgY8 5Y/m/sUzfF2gKit8UsKUfYRhlragKE3vuk0koSprJybLVsan/cj++G5Gl cvo8xZGmElhhM6UqR1IagUH+hARUWHSGlgIv7hY1wGmPBoeK2IMnSWIZR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="337967443" X-IronPort-AV: E=Sophos;i="6.00,187,1681196400"; d="scan'208";a="337967443" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 15:43:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="848473138" X-IronPort-AV: E=Sophos;i="6.00,187,1681196400"; d="scan'208";a="848473138" Received: from nalipour-mobl.amr.corp.intel.com (HELO [10.212.250.202]) ([10.212.250.202]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 15:43:14 -0700 Message-ID: <2d96a23f-a16a-50e1-7960-a2d4998ce52f@intel.com> Date: Tue, 23 May 2023 15:43:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v6 2/6] x86/tdx: Support vmalloc() for tdx_enc_status_changed() Content-Language: en-US To: kirill.shutemov@linux.intel.com 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, 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, seanjc@google.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 References: <20230504225351.10765-1-decui@microsoft.com> <20230504225351.10765-3-decui@microsoft.com> <9e466079-ff27-f928-b470-eb5ef157f048@intel.com> <20230523223750.botogigv6ht7p2zg@box.shutemov.name> From: Dave Hansen In-Reply-To: <20230523223750.botogigv6ht7p2zg@box.shutemov.name> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 5/23/23 15:37, kirill.shutemov@linux.intel.com wrote: >> 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? > Alias processing in __change_page_attr_set_clr() will change direct > mapping if you call it on vmalloc()ed memory. I think we are safe wrt > load_unaligned_zeropad() here. We're *eventually* OK: > /* Notify hypervisor that we are about to set/clr encryption attribute. */ > x86_platform.guest.enc_status_change_prepare(addr, numpages, enc); > > ret = __change_page_attr_set_clr(&cpa, 1); But what about in the middle between enc_status_change_prepare() and __change_page_attr_set_clr()? Don't the direct map and the shared/private status of the page diverge in there?