On Mon, Feb 03, 2020 at 07:39:15PM -0800, Satya Tangirala wrote: > Wouldn't that mean that all the other requests in the queue, even ones that > don't even need any inline encryption, also don't get processed until the > queue is woken up again? For the basic implementation yes. > And if so, are we really ok with that? That depends on the use cases. With the fscrypt setup are we still going to see unencrypted I/O to the device as well? If so we'll need to refine the setup and only queue up unencrypted requests. But I'd still try to dumb version first and then refine it. > As you said, we'd need the queue to wake up once a keyslot is available. > It's possible that only some hardware queues and not others get blocked > because of keyslot programming, so ideally, we could somehow make the > correct hardware queue(s) wake up once a keyslot is freed. But the keyslot > manager can't assume that it's actually blk-mq that's being used > underneath, Why? The legacy requet code is long gone. > Also I forgot to mention this in my previous mail, but there may be some > drivers/devices whose keyslots cannot be programmed from an atomic context, > so this approach which might make things difficult in those situations (the > UFS v2.1 spec, which I followed while implementing support for inline > crypto for UFS, does not care whether we're in an atomic context or not, > but there might be specifications for other drivers, or even some > particular UFS inline encryption hardware that do). We have an option to never call ->queue_rq from atomic context (BLK_MQ_F_BLOCKING). But do you know of existing hardware that behaves like this or is it just hypothetical? > So unless you have strong objections, I'd want to continue programming > keyslots per-bio for the above reasons. I'm pretty sure from looking at the code that doing inline encryption at the bio level is the wrong approach. That isn't supposed to end the discussion, but especially things like waking up after a keyslot becomes available fits much better into the request layer resource model that is built around queuing limitations, and not the make_request model that assumes the driver can always queue.