Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp581521pxj; Fri, 14 May 2021 10:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGaJ5dEYQwXrDrXUANYCkGkcRP0hsL4naVYtWSJOJxKsCNXRpaGD/1wGKpdzwXIt0xwx6U X-Received: by 2002:a17:906:5617:: with SMTP id f23mr17820040ejq.298.1621013037187; Fri, 14 May 2021 10:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621013037; cv=none; d=google.com; s=arc-20160816; b=jT/zcW4mGp516Ss6sci9WsvOUatXXDuqP/8yEpX5t+BqaoMZ5VGINX8K0ABEshIqGG yLEZnwY/Wl9+Ng17K/kQyvz0b00y21IyMj/smVp1btcwxoGDqDHjmgt0gk9GNlaVBFLV RlfBd3JlMHEynrF3sJwhIIrV/wp1qjPJ/4hLqH6ljYl1NI8UxrA/yMxePyh7Y2xNemJU WkVM5c8b1vKJfCXdDhRE3MmppPFzMc//VIU81liV5dKCLO3uNWYv2NULYtw5+n6Jn1us jTP5nwKiGrcFTIL4wYp9ypae3tDf72LukwEeaS1IHM9d8cEQ9spSI0M9xyJD1cF0U0Sd sbPg== 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=rLpwvEOD+SNcjjXRD4phEAovRMr9hdeOp4DAy+p8b70=; b=G0sFRISbT+c4eNO2QTlUm+nYKSjgzsBuTjTpv+G/C8ZHN/43RHOI0h/yqOdY5VIQ0i qpEYlLoA/dZ+FPTujRFbBLrJ+wr3jSjPLyfsdPRRyzu2vYztk8FqScW2lpuO+u+yp1qW mwlBEyIF084tzJqwvzDE9Dr4nwHeZ38iZtW6jCln29QAUnId+2i16PEBcf2+XqlJ2VGb gOdtZcBwrjYE5OKML+nFH9iDs09jjUVhy4uBMUIrXPD/MpzzM/ujKhndRmu5Tk+oFgoP YUoGt0XED4SjMZtVL+BPIeEk2d7Qp+/SDcjCs9k+xGXyGfaPIdwdKBcudL5D6qTSknvh Eveg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=LkMUW4pF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si5337112edw.414.2021.05.14.10.23.32; Fri, 14 May 2021 10:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=LkMUW4pF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S231830AbhENKjp (ORCPT + 99 others); Fri, 14 May 2021 06:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbhENKjo (ORCPT ); Fri, 14 May 2021 06:39:44 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F5EDC061574; Fri, 14 May 2021 03:38:33 -0700 (PDT) Received: from zn.tnic (p200300ec2f0b2c00e75fd5d24a8a460d.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:2c00:e75f:d5d2:4a8a:460d]) (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 092671EC03A0; Fri, 14 May 2021 12:38:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1620988712; 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=rLpwvEOD+SNcjjXRD4phEAovRMr9hdeOp4DAy+p8b70=; b=LkMUW4pF2xxHQYTCTnka0bu5Wz9HyZm2q49dv7dJinrd3+TwB3aBK4lXadYs8DDmEVUz2U F0hsFhKj4CLsJ/kG5zDikpqQHGtb6UUiGiKcpnqPxaYKWvq+PvLfpqd/NSrq/BHIXDlgkB 8+TeVAvDSD9oTvljXGDLRcYCU97MKJI= Date: Fri, 14 May 2021 12:38:27 +0200 From: Borislav Petkov To: Ashish Kalra Cc: Paolo Bonzini , seanjc@google.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, joro@8bytes.org, thomas.lendacky@amd.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, srutherford@google.com, venu.busireddy@oracle.com, brijesh.singh@amd.com Subject: Re: [PATCH v2 2/4] mm: x86: Invoke hypercall when page encryption status is changed Message-ID: References: <20210513043441.GA28019@ashkalra_ubuntu_server> <7ac12a36-5886-cb07-cc77-a96daa76b854@redhat.com> <20210514090523.GA21627@ashkalra_ubuntu_server> <20210514100519.GA21705@ashkalra_ubuntu_server> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210514100519.GA21705@ashkalra_ubuntu_server> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 10:05:19AM +0000, Ashish Kalra wrote: > No, actually notify_addr_enc_status_changed() is called whenever a range > of memory is marked as encrypted or decrypted, so it has nothing to do > with migration as such. > > This is basically modifying the encryption attributes on the page tables > and correspondingly also making the hypercall to inform the hypervisor about > page status encryption changes. The hypervisor will use this information > during an ongoing or future migration, so this information is maintained > even though migration might never be initiated here. Doh, ofcourse. This doesn't make it easier. > The error value cannot be propogated up the callchain directly > here, Yeah, my thinking was way wrong here - sorry about that. > but one possibility is to leverage the hypercall and use Sean's > proposed hypercall interface to notify the host/hypervisor to block/stop > any future/ongoing migration. > > Or as from Paolo's response, writing 0 to MIGRATION_CONTROL MSR seems > more ideal. Ok. So to sum up: notify_addr_enc_status_changed() should warn but not because of migration but because regardless, we should tell the users when page enc attributes updating fails as that is potentially hinting at a bigger problem so we better make sufficient noise here. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette