Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp665035ybk; Wed, 13 May 2020 09:48:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx49o3TKG3tLuNa3l3x34Kgx68KaJtyikE9MQT4DNStKjUXjiF9bJ4FgfdNA94vAGXQtshU X-Received: by 2002:a50:d65c:: with SMTP id c28mr509603edj.21.1589388481987; Wed, 13 May 2020 09:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589388481; cv=none; d=google.com; s=arc-20160816; b=T3tWCPtQ9bv27j7g8N1+dq5NcbGLUw6Z0J0e6q46NUjYjQMBOXO1MJl2m3eEhxmHWw rXhyOqv92H2avdSvSn3SluAL+qJ+uQViyT3bvW4CkrTQLcpstKzRQxWB1IiBZVgwEQWJ EVUG7ehRJXtMfoR+WEGfw18Q+IRD+MX/7+E8vHXKMxQTH3ZJXwDO5+DWBoDxh5WDlMgD VhqIRPK7rz4qp1uo+HK/pD4knidcQ9cpgLyxlqBR/3EBSLZ+IDo1a82fB8dYbGWEewnl JR4n0sfYJTPfBegfYKCI6GNbX8R9AvG7lBB7GlXG6I7wwVvBnVlfnvOSX4uoTAF4q9Z2 Jj3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=s4qxG4meaKv0qWXbc2p3+RX1ICYDpo7oUB6r8FrVW7M=; b=SaEJEy0//u8qLdnHTOFhzdkLqIHOXA+IcQA7yXEvbXdeCn5j5VRnwrPMkw54NhIHjK wo0q5Jnznux/14r3NzJGkDAwl3mHlG/CE+0AqQ3oZu+Pat3m0pPrBc6tMyCYH7kFqiO7 IFrSqTK85qHB9E01UfbN/JA5JFpaM9lMVXCU7SPD41zDfSFi9BR8XCaEqb7CtdWkCvtp GVXMzfb69Kqjw89Kok6n1gZaxW1ey8z9R5YedHz0pEEUU1ZlBkncxU0mXc368W3b9n0g xFFGOw4XWXlGXqUesW8JDEvIfxxUUTxMKh22CPW0giptjZXGSlF3EijiR8D+qYqUOY8Z BsvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nAeGjCGQ; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ov7si154781ejb.409.2020.05.13.09.47.30; Wed, 13 May 2020 09:48:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@kernel.org header.s=default header.b=nAeGjCGQ; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730831AbgEMQrK (ORCPT + 99 others); Wed, 13 May 2020 12:47:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:52836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729328AbgEMQrK (ORCPT ); Wed, 13 May 2020 12:47:10 -0400 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACEC32054F; Wed, 13 May 2020 16:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589388430; bh=/v2IdDrymQyOQwGKwD3DYskW13FfX9JBpATBQnCGEcA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nAeGjCGQQCEXECiiVUZ7LQP3/1bJtcWmeYZLTYbvUSHQs9C+sg1PGBkyCDUte1c9B UYBEHmYQLrO4Ycv+IwUgQAYx+Ig+4XaEH8IHLafNSLlVrXNOtJ6gnpBTOZ0UREEf2n x/hhC5VoAEYTb5c9q+su5I0gJUEo4ndlnhA7bCQY= Date: Wed, 13 May 2020 09:47:07 -0700 From: Eric Biggers To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, Barani Muthukumaran , Kuohong Wang , Kim Boojin Subject: Re: [PATCH v12 01/12] Documentation: Document the blk-crypto framework Message-ID: <20200513164707.GA1243@sol.localdomain> References: <20200430115959.238073-1-satyat@google.com> <20200430115959.238073-2-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430115959.238073-2-satyat@google.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Apr 30, 2020 at 11:59:48AM +0000, Satya Tangirala wrote: > The blk-crypto framework adds support for inline encryption. There > are numerous changes throughout the storage stack. This patch documents > the main design choices in the block layer, the API presented to users > of the block layer (like fscrypt or layered devices) and the API presented > to drivers for adding support for inline encryption. > > Signed-off-by: Satya Tangirala Looks good, you can add: Reviewed-by: Eric Biggers But a few comments for when you resend: > +When a bio is added to a request, the request takes over ownership of the > +``bi_crypt_context`` of the bio - in particular, the request keeps the > +``bi_crypt_context`` of the first bio in its bio-list, and frees the rest > +(blk-mq needs to be careful to maintain this invariant during bio and request > +merges). Is this part up-to-date? There was discussion about not freeing the bios' crypt contexts. > +``blk_crypto_evict_key`` should be called by upper layers when they want > +to ensure that a key is removed from memory and from any keyslots in inline > +encryption hardware that the key might have been programmed into (or the > +blk-crypto-fallback). This should be reworded to emphasize that blk_crypto_evict_key() *must* be called (as now the keyslot manager has a pointer to the key). > +API presented to device drivers > +=============================== > + > +A :c:type:``struct keyslot_manager`` should be set up by device drivers in the "keyslot_manager" => "blk_keyslot_manager". Likewise below. > +``request_queue`` of the device. The device driver needs to call > +``blk_ksm_init`` on the ``keyslot_manager``, which specfying the number of > +keyslots supported by the hardware. "which specfying" => "while specifying" > +The device driver also needs to tell the KSM how to actually manipulate the > +IE hardware in the device to do things like programming the crypto key into > +the IE hardware into a particular keyslot. All this is achieved through the > +:c:type:`struct keyslot_mgmt_ll_ops` field in the KSM that the device driver > +must fill up after initing the ``keyslot_manager``. "keyslot_mgmt_ll_ops" => "blk_ksm_ll_ops" - Eric