Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1455917rdd; Wed, 10 Jan 2024 22:35:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8zO6ckFb0/zrW3DT6SXs2xJIhGDDLUku9eYGszgu0OWgrbHXUP9aHMXllsFLlKd6LX9oK X-Received: by 2002:a17:906:b088:b0:a26:90a0:695f with SMTP id x8-20020a170906b08800b00a2690a0695fmr189538ejy.83.1704954931883; Wed, 10 Jan 2024 22:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704954931; cv=none; d=google.com; s=arc-20160816; b=uS6qAB1MSTIoLbBcS/bZDLWbGA+pNDThZnuIReWiNM4KLKdN++8E+6fUwOhTv2YfrD ROCELpdwRESbFCZAqXN5jlwBC42x2mBrIxGyteuOXZ0z0VdwBPEhhiHgsQVSYdx1ysqk rjydB2O4fGfzWZOGG22iCc4lD6i1acEYu32MFkOhYZNabGJFtUNRvQ8LwzBEVyaGNDi+ GeW+C1wQTpw5fUwwGlfWsOBul0HNozi+Rjaysw97o5UI17i4JZObR1EFRtGSup9hEKQD JJXaE01gVPPBptnTVRbpd3uBKoWuzL/n3sCLZkEnQsSSDrp3tvn30DWeSc321pXsndnM TByQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=thread-topic:thread-index:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject :message-id:cc:to:from:date; bh=JI+tp7P9OqbjV2sF76R7bjiRv1P12OTa+E5khRUCwUQ=; fh=fyT/+mSEBbEsAUa0+ALZHIfy31HfXOe1sVlM9LX4Hq4=; b=VWDCvQ8Y6evQJMjzflHV597QgNA1Ye5jFyJF/sgxQKFyB3gepAL6Gxwl8Uy1NcHR4W yST0xa+DtFMFQsTGERPQmgb+lx6alqEeCJCmJxa2GUMCc+ljlz4f5jogGe5fqQUJw+ee 1tqwgm48tr0WqRMP2emNzMQAe9w2gxAjyjROAiticwmQfUQ27RCiqgrj/TmU66vRD6ss GszBM7iCNFIMVUNynVJjnGEIGf4zNIqvRpZxsR4RkzdpTLJBjAmKbVd8+4BWmTQh0PoB nlrkCFkkXimWDN4vpwFi4E959V92BPcWnLvBP7UyGLcqIjDNVYwV5la0WQfAnYaLx9zc j8rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23101-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d23-20020a170906371700b00a2a9a1b0598si209274ejc.886.2024.01.10.22.35.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 22:35:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23101-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A4FF51F27226 for ; Thu, 11 Jan 2024 06:35:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45861E574; Thu, 11 Jan 2024 06:35:22 +0000 (UTC) Received: from smtp238.sjtu.edu.cn (smtp238.sjtu.edu.cn [202.120.2.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF351E546 for ; Thu, 11 Jan 2024 06:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sjtu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sjtu.edu.cn Received: from mta90.sjtu.edu.cn (unknown [10.118.0.90]) by smtp238.sjtu.edu.cn (Postfix) with ESMTPS id 3C6959CB3; Thu, 11 Jan 2024 14:35:09 +0800 (CST) Received: from mstore135.sjtu.edu.cn (unknown [10.118.0.135]) by mta90.sjtu.edu.cn (Postfix) with ESMTP id 0173437C87C; Thu, 11 Jan 2024 14:35:08 +0800 (CST) Date: Thu, 11 Jan 2024 14:35:08 +0800 (CST) From: Zheyun Shen To: Jason Wang , mst Cc: linux-kernel , virtualization , david , xuanzhuo Message-ID: <1824181559.1228150.1704954908335.JavaMail.zimbra@sjtu.edu.cn> Subject: Re: [PATCH] driver/virtio: Add Memory Balloon Support for SEV/SEV-ES Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Zimbra 10.0.5_GA_4574 (ZimbraWebClient - GC120 (Win)/10.0.5_GA_4574) Thread-Index: l+gZfqyZiAOpiygeFB9+OsBBxO8d6Q== Thread-Topic: driver/virtio: Add Memory Balloon Support for SEV/SEV-ES On Wed, Jan 10, 2024 at 4:01=E2=80=AFPM Michael S. Tsirkin = wrote: > Sorry I don't get what you are saying at all. > Please format the commit log along the following lines: > Currently ..... > This is bad because ... > To fix ... > As a result ... > No way I am going to spead CONFIG_AMD_MEM_ENCRYPT all over the place=20 > like this. I will try to find out a solution with fewer macros and send patch V2 with a more perspicuous commit log. On Thur, Jan 11, 2024 at 11:20=E2=80=AFAM Jason Wang = wrote: > > For now, SEV pins guest's memory to avoid swapping or > > moving ciphertext, but leading to the inhibition of > > Memory Ballooning. > > > > In Memory Ballooning, only guest's free pages will be relocated > > in balloon inflation and deflation, so the difference of plaintext > > doesn't matter to guest. > This seems only true if the page is zeroed, is this true here? Sorry, I cannot figure out why the pages should be zeroed. I think both host kernel and guest kernel assume that the pages are not=20 zeroed and will use kzalloc or manually zero them in real applications, which is same as non-SEV environments.=20 I have tested in SEV-ES, reclaiming memory by balloon inflation and reuse= =20 them after balloon deflation both works well with the patch. Hypervisor=20 can normally give the reclaimed memory from one CVM to another, or give=20 back to the origin CVM.