Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2052884pxu; Tue, 24 Nov 2020 16:00:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8//YjJXI5901hxxqcsXY/qQXHXx9Iwpc0jmWafHyXXejo6xdC/sYOUQxQU7GaBEOQX7/C X-Received: by 2002:a17:906:d790:: with SMTP id pj16mr842667ejb.125.1606262402947; Tue, 24 Nov 2020 16:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606262402; cv=none; d=google.com; s=arc-20160816; b=aYjWrxU9KGQ4jgblVjlkW9J1x+XjDu3e1PSmR0fNXIj7As7fiR3r5mfoJQJIob602t h2mrZTp3y/oFwLjQJmJQVP+AOU2lugk6Btcyoaeqp5lvy7YvWZFGGgmfCegB/jZT2Gu1 mBOmPU/b5QOv3TfUAzIhQzW+gVCGt3hXknONSvL9z8W76jZ2cY9LO0NbP58O+Xq7wiT7 waguYr9Rb8AqUuVJ/CPkiithZ+hpNnDTQiev3BcKxh7Fq4qQGTIVxUYFnlQiNxRBpp/S ZZ94AM5yqvJMZC9S9u7YJ/encfxaSLeGTJl6C25BVeq1SjHWmbPPkjkoks9Xlemwpq0z Pfdw== 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=ycdBeKfDdnxlj2we2eatzJcCu25NkZg7utasfa+QCJs=; b=wC1L6KoDMBb6L/Im7r8tomAufU3kHr4V6i6E9S//+g5FKv4LCLLxwICMVDMFyTUucx XCsF9O1juYRvbBL21A9l3+n3bF4P2W8xY3GTZhoYpicIpxhQ64H+QyUyDYRKg1uzsPB3 naIXnwG8eOXOkeytjnzjCTTOObr3IEcejn4Zng215eLb/Ul1f/kGvLj0yFgxnEwRS3GH UINxzQRTSixyDBe1PZMNJepZZIcVRxaWCjDt5K+F+38aaiMkn7auBBuzWIftnBHkRluy Nad5bBnmloCfztB0Awf7Bk1AdAQCvxlYiBJQ5L4prOF7pNeBwBAX6JJEfQvT6zhQzBfC bFgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=j1YEcpcR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si166968edx.345.2020.11.24.15.59.40; Tue, 24 Nov 2020 16:00:02 -0800 (PST) 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=@google.com header.s=20161025 header.b=j1YEcpcR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732269AbgKXV1d (ORCPT + 99 others); Tue, 24 Nov 2020 16:27:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732263AbgKXV1d (ORCPT ); Tue, 24 Nov 2020 16:27:33 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDCF3C061A4D for ; Tue, 24 Nov 2020 13:27:30 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id j19so358577pgg.5 for ; Tue, 24 Nov 2020 13:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ycdBeKfDdnxlj2we2eatzJcCu25NkZg7utasfa+QCJs=; b=j1YEcpcRCjolfYVSNLeLmzuHRNxnhlKz+wYLfNMVpoq2ZqI2DBBuBRO0ixD0qzD3tC KeLaMHOuTm71wOBGHwodtG43JGmQ/uDnbRrbK1FFWk5Td49DkkdETpql2oh34ccq4SD6 7G+zsmZKba/biKWGiFY/xlEkWH+nziDRuGaRqaa/xUKKo84H0mY/qaLWRRw7SC2e96ny QTFOq6vk7UcEem8/3SuMSoV/N97Ernjs6ts18XyYnVsAVpygnI7frPOeqHNMhVmknuqb Wsc7mJroPtrz8tH6x7VyOyhgV2x6Wt3ToRvDfOKxm+pe4OgSAcD0mTj2Z6oCko7hQMkF BKRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ycdBeKfDdnxlj2we2eatzJcCu25NkZg7utasfa+QCJs=; b=ebjtxDrWzOd1fE83Lw/KNvUB7yyxXV8aD+yvThOWnjhI39q+SbQkWfwMjyfsmiWRCm 47HmP/Lk52Bnqew+Lkoeh2QPeNmWEchq7B8SKvoNKhoa+9VROs10xkvqwYhr5FLfTgEo s1ZjvX+kqrattUls47kIgE8CwS0PDkROx+UeVxnWFRstHKQQxhOIEY0JKMPiX3pTvtQj apvNLa3Cqix8eBZ8VNqhBPqgtreY+JX9KmIOKrgGBO/oVbLAzw7JzNlm1vPjLkRDDj0S l2ndhb/XwKFDm6XpVoaFwP+Bo/yzpmp7ZCX46wDZ5Sh9FsG6swQ/WYBwoir1vlEiVJl7 E//Q== X-Gm-Message-State: AOAM5328AIQI9xJuLlv/qHUUizHyWmIAad1mz9wuumhKOGTLzXnEbVIX lOs4kue5OqS3nkMpS7FAK9NssA== X-Received: by 2002:aa7:9edb:0:b029:197:f0c9:f5bc with SMTP id r27-20020aa79edb0000b0290197f0c9f5bcmr169373pfq.10.1606253250128; Tue, 24 Nov 2020 13:27:30 -0800 (PST) Received: from google.com (242.67.247.35.bc.googleusercontent.com. [35.247.67.242]) by smtp.gmail.com with ESMTPSA id j69sm11414pfd.37.2020.11.24.13.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 13:27:29 -0800 (PST) Date: Tue, 24 Nov 2020 21:27:25 +0000 From: Sean Christopherson To: Vipin Sharma Cc: David Rientjes , Janosch Frank , Christian Borntraeger , Thomas , pbonzini@redhat.com, tj@kernel.org, lizefan@huawei.com, joro@8bytes.org, corbet@lwn.net, Brijesh , Jon , Eric , gingell@google.com, kvm@vger.kernel.org, x86@kernel.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC Patch 0/2] KVM: SVM: Cgroup support for SVM SEV ASIDs Message-ID: <20201124212725.GB246319@google.com> References: <20201124191629.GB235281@google.com> <20201124194904.GA45519@google.com> <20201124210817.GA65542@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124210817.GA65542@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020, Vipin Sharma wrote: > On Tue, Nov 24, 2020 at 12:18:45PM -0800, David Rientjes wrote: > > On Tue, 24 Nov 2020, Vipin Sharma wrote: > > > > > > > Looping Janosch and Christian back into the thread. > > > > > > > > > > I interpret this suggestion as > > > > > encryption.{sev,sev_es,keyids}.{max,current,events} for AMD and Intel > > > > > > > > I think it makes sense to use encryption_ids instead of simply encryption, that > > > > way it's clear the cgroup is accounting ids as opposed to restricting what > > > > techs can be used on yes/no basis. > > > > > > > > Agreed. > > > > > > > offerings, which was my thought on this as well. > > > > > > > > > > Certainly the kernel could provide a single interface for all of these and > > > > > key value pairs depending on the underlying encryption technology but it > > > > > seems to only introduce additional complexity in the kernel in string > > > > > parsing that can otherwise be avoided. I think we all agree that a single > > > > > interface for all encryption keys or one-value-per-file could be done in > > > > > the kernel and handled by any userspace agent that is configuring these > > > > > values. > > > > > > > > > > I think Vipin is adding a root level file that describes how many keys we > > > > > have available on the platform for each technology. So I think this comes > > > > > down to, for example, a single encryption.max file vs > > > > > encryption.{sev,sev_es,keyid}.max. SEV and SEV-ES ASIDs are provisioned > > > > > > > > Are you suggesting that the cgroup omit "current" and "events"? I agree there's > > > > no need to enumerate platform total, but not knowing how many of the allowed IDs > > > > have been allocated seems problematic. > > > > > > > > > > We will be showing encryption_ids.{sev,sev_es}.{max,current} > > > I am inclined to not provide "events" as I am not using it, let me know > > > if this file is required, I can provide it then. I've no objection to omitting current until it's needed. > > > I will provide an encryption_ids.{sev,sev_es}.stat file, which shows > > > total available ids on the platform. This one will be useful for > > > scheduling jobs in the cloud infrastructure based on total supported > > > capacity. > > > > > > > Makes sense. I assume the stat file is only at the cgroup root level > > since it would otherwise be duplicating its contents in every cgroup under > > it. Probably not very helpful for child cgroup to see stat = 509 ASIDs > > but max = 100 :) > > Yes, only at root. Is a root level stat file needed? Can't the infrastructure do .max - .current on the root cgroup to calculate the number of available ids in the system?