All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Bauer <scott.bauer@intel.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Keith Busch <keith.busch@intel.com>,
	linux-nvme@lists.infradead.org, Rafael.Antognolli@intel.com,
	axboe@fb.com, jonathan.derrick@intel.com,
	viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
	sagi@grimberg.me
Subject: Re: [PATCH v3 4/5] nvme: Implement resume_from_suspend and SED Allocation code.
Date: Tue, 20 Dec 2016 10:52:41 -0700	[thread overview]
Message-ID: <20161220175239.GA2426@sbauer-Z170X-UD5> (raw)
In-Reply-To: <20161220154639.GA16393@infradead.org>

On Tue, Dec 20, 2016 at 07:46:39AM -0800, Christoph Hellwig wrote:
> On Tue, Dec 20, 2016 at 10:49:16AM -0500, Keith Busch wrote:
> > On Mon, Dec 19, 2016 at 10:17:44PM -0800, Christoph Hellwig wrote:
> > > As far as I can tell Security Send / Receive has always been intended to
> > > apply to the whole controller, even if that's something I would not
> > > personally think is a good idea.
> > 
> > NVMe security commands required the namespace ID since the very
> > beginning. It's currently documented in figure 42 of section 5,
> > "Namespace Identifier Used" column.
> 
> Oh, for some reason I read a no there when looking it up.
> Good to know, although TCG spec still seem to ignore it.

Before I submit another version I want to address a few design issues we seem
to be walking around a bit:

The other reviews you gave for the series are fine and will be implemented,
thank you for that.

The main development issue seems to be how the drivers/block layer interact
with the core sed.

1) We will move the core from lib/ back to block/ and add CONFIGS in kconfig.

2) Do we want to continue passing around a sed_context to the core? Instead of
   a block_device struct like we did in previous versions.

 2a) If we do wish to do wish to continue passng sed_contexts to the core I
 have to add a new variable to the block_device structure for our sed_context.
 Will this be acceptable? It wasn't acceptable for the file struct. The reason
 I need a new variable in the struct is:
 On the ioctl path, if we intercept the SED call in the block layer ioctl and
 have the call chain be:
 uland -> blk_ioctl -> sed_ioctl() -> sedcore -> sec_send/recv -> nvme
 then I need to be able to pass a sed_ctx struct in blk_ioctl to sed-ioctl and
 the only  way is to have it sitting in our block_device structure.

 The other way which was sorta nack'd last time is the following call chain:
 uland -> blk_ioctl -> nvme_ioctl -> sed_ioctl -> sedcore -> send/rcv -> nvme

 In this call chain in nvme_ioctl we have access to our block device struct
 and from there we can do blkdev->bd_disk->private_data to get our ns and then
 eventually our sed_ctx to pass to sed_ioctl. I could add the ns to the sec_data
 pointer in sed_context. This would give us access to ns without having to pass
 around a block device or store it anywhere.

 In the first scenario I can't work at all with opaque pointers like we can in
 the drivers itself (private_data). I don't know what they are, the drivers have
 the domain knowledge of what type they actually stored in private_data. That's
 why I need an explicit member in the block_device for the first scenario.

3) For NVMe we need access to our ns ID. It's in the block_device behind a few
pointers. What I can do is if we want to continue with the first ioctl path
described above is something like:

sed_ioctl(struct block_device *bdev, ...)
{
  sed_context *ctx = bdev->sed_ctx;
  ctx->sed_data = bdev->bd_disk->private_data;
  switch(cmd) {
  ...
  ...
  return some_opal_cmd(ctx);
  }
}

While this works for NVMe I don't know if this is acceptible for *all* users.
Since this is in a generic ioctl that is supposed to work with all drivers, who
knows what the hell they're putting in private_data and whether its useful for
their implementation of sec_send/recv.

I think that's all I have for now. If I think of anything throughout the day I'll
reply to to this email.

WARNING: multiple messages have this Message-ID (diff)
From: scott.bauer@intel.com (Scott Bauer)
Subject: [PATCH v3 4/5] nvme: Implement resume_from_suspend and SED Allocation code.
Date: Tue, 20 Dec 2016 10:52:41 -0700	[thread overview]
Message-ID: <20161220175239.GA2426@sbauer-Z170X-UD5> (raw)
In-Reply-To: <20161220154639.GA16393@infradead.org>

On Tue, Dec 20, 2016@07:46:39AM -0800, Christoph Hellwig wrote:
> On Tue, Dec 20, 2016@10:49:16AM -0500, Keith Busch wrote:
> > On Mon, Dec 19, 2016@10:17:44PM -0800, Christoph Hellwig wrote:
> > > As far as I can tell Security Send / Receive has always been intended to
> > > apply to the whole controller, even if that's something I would not
> > > personally think is a good idea.
> > 
> > NVMe security commands required the namespace ID since the very
> > beginning. It's currently documented in figure 42 of section 5,
> > "Namespace Identifier Used" column.
> 
> Oh, for some reason I read a no there when looking it up.
> Good to know, although TCG spec still seem to ignore it.

Before I submit another version I want to address a few design issues we seem
to be walking around a bit:

The other reviews you gave for the series are fine and will be implemented,
thank you for that.

The main development issue seems to be how the drivers/block layer interact
with the core sed.

1) We will move the core from lib/ back to block/ and add CONFIGS in kconfig.

2) Do we want to continue passing around a sed_context to the core? Instead of
   a block_device struct like we did in previous versions.

 2a) If we do wish to do wish to continue passng sed_contexts to the core I
 have to add a new variable to the block_device structure for our sed_context.
 Will this be acceptable? It wasn't acceptable for the file struct. The reason
 I need a new variable in the struct is:
 On the ioctl path, if we intercept the SED call in the block layer ioctl and
 have the call chain be:
 uland -> blk_ioctl -> sed_ioctl() -> sedcore -> sec_send/recv -> nvme
 then I need to be able to pass a sed_ctx struct in blk_ioctl to sed-ioctl and
 the only  way is to have it sitting in our block_device structure.

 The other way which was sorta nack'd last time is the following call chain:
 uland -> blk_ioctl -> nvme_ioctl -> sed_ioctl -> sedcore -> send/rcv -> nvme

 In this call chain in nvme_ioctl we have access to our block device struct
 and from there we can do blkdev->bd_disk->private_data to get our ns and then
 eventually our sed_ctx to pass to sed_ioctl. I could add the ns to the sec_data
 pointer in sed_context. This would give us access to ns without having to pass
 around a block device or store it anywhere.

 In the first scenario I can't work at all with opaque pointers like we can in
 the drivers itself (private_data). I don't know what they are, the drivers have
 the domain knowledge of what type they actually stored in private_data. That's
 why I need an explicit member in the block_device for the first scenario.

3) For NVMe we need access to our ns ID. It's in the block_device behind a few
pointers. What I can do is if we want to continue with the first ioctl path
described above is something like:

sed_ioctl(struct block_device *bdev, ...)
{
  sed_context *ctx = bdev->sed_ctx;
  ctx->sed_data = bdev->bd_disk->private_data;
  switch(cmd) {
  ...
  ...
  return some_opal_cmd(ctx);
  }
}

While this works for NVMe I don't know if this is acceptible for *all* users.
Since this is in a generic ioctl that is supposed to work with all drivers, who
knows what the hell they're putting in private_data and whether its useful for
their implementation of sec_send/recv.

I think that's all I have for now. If I think of anything throughout the day I'll
reply to to this email.

  parent reply	other threads:[~2016-12-20 18:00 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 19:35 [PATCH v3 0/5] SED OPAL Library Scott Bauer
2016-12-19 19:35 ` Scott Bauer
2016-12-19 19:35 ` [PATCH v3 1/5] include: Add definitions for sed Scott Bauer
2016-12-19 19:35   ` Scott Bauer
2016-12-20  6:46   ` Christoph Hellwig
2016-12-20  6:46     ` Christoph Hellwig
2016-12-25 14:15   ` Jethro Beekman
2016-12-25 14:15     ` Jethro Beekman
2016-12-27 22:14     ` Scott Bauer
2016-12-27 22:14       ` Scott Bauer
2016-12-19 19:35 ` [PATCH v3 2/5] lib: Add Sed-opal library Scott Bauer
2016-12-19 19:35   ` Scott Bauer
2016-12-19 21:34   ` Keith Busch
2016-12-19 21:34     ` Keith Busch
2016-12-20  6:07     ` Christoph Hellwig
2016-12-20  6:07       ` Christoph Hellwig
2016-12-20  3:21   ` kbuild test robot
2016-12-20  3:21     ` kbuild test robot
2016-12-20  3:48   ` kbuild test robot
2016-12-20  3:48     ` kbuild test robot
2016-12-20  6:50   ` Al Viro
2016-12-20  6:50     ` Al Viro
2016-12-20  7:28   ` Christoph Hellwig
2016-12-20  7:28     ` Christoph Hellwig
2016-12-20 21:55     ` Scott Bauer
2016-12-20 21:55       ` Scott Bauer
2016-12-21  9:42       ` Christoph Hellwig
2016-12-21  9:42         ` Christoph Hellwig
2016-12-20 22:07     ` Jon Derrick
2016-12-20 22:07       ` Jon Derrick
2016-12-21  9:47       ` Christoph Hellwig
2016-12-21  9:47         ` Christoph Hellwig
2016-12-19 19:35 ` [PATCH v3 3/5] fs: Wire up SED/Opal to ioctl Scott Bauer
2016-12-19 19:35   ` Scott Bauer
2016-12-20  6:21   ` Christoph Hellwig
2016-12-20  6:21     ` Christoph Hellwig
2016-12-19 19:35 ` [PATCH v3 4/5] nvme: Implement resume_from_suspend and SED Allocation code Scott Bauer
2016-12-19 19:35   ` Scott Bauer
2016-12-19 21:59   ` Keith Busch
2016-12-19 21:59     ` Keith Busch
2016-12-19 22:23     ` Scott Bauer
2016-12-19 22:23       ` Scott Bauer
2016-12-20  6:17       ` Christoph Hellwig
2016-12-20  6:17         ` Christoph Hellwig
2016-12-20 15:49         ` Keith Busch
2016-12-20 15:49           ` Keith Busch
2016-12-20 15:46           ` Christoph Hellwig
2016-12-20 15:46             ` Christoph Hellwig
2016-12-20 16:05             ` Scott Bauer
2016-12-20 16:05               ` Scott Bauer
2016-12-21  9:01               ` Christoph Hellwig
2016-12-21  9:01                 ` Christoph Hellwig
2016-12-20 17:52             ` Scott Bauer [this message]
2016-12-20 17:52               ` Scott Bauer
2016-12-21  9:37               ` Christoph Hellwig
2016-12-21  9:37                 ` Christoph Hellwig
2016-12-20  4:11   ` kbuild test robot
2016-12-20  4:11     ` kbuild test robot
2016-12-20  6:21   ` Christoph Hellwig
2016-12-20  6:21     ` Christoph Hellwig
2016-12-20  6:49   ` Christoph Hellwig
2016-12-20  6:49     ` Christoph Hellwig
2016-12-25 14:15   ` Jethro Beekman
2016-12-25 14:15     ` Jethro Beekman
2016-12-27 22:12     ` Scott Bauer
2016-12-27 22:12       ` Scott Bauer
2016-12-28  8:39       ` Christoph Hellwig
2016-12-28  8:39         ` Christoph Hellwig
2016-12-19 19:35 ` [PATCH v3 5/5] Maintainers: Add Information for SED Opal library Scott Bauer
2016-12-19 19:35   ` Scott Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161220175239.GA2426@sbauer-Z170X-UD5 \
    --to=scott.bauer@intel.com \
    --cc=Rafael.Antognolli@intel.com \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=jonathan.derrick@intel.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.