From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9BF4C43462 for ; Fri, 14 May 2021 10:38:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE64061459 for ; Fri, 14 May 2021 10:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231825AbhENKjp (ORCPT ); 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: kvm@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