lkml.org 
[lkml]   [2019]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH, RFC 26/62] keys/mktme: Move the MKTME payload into a cache aligned structure
On Fri, Jun 14, 2019 at 01:35:23PM +0200, Peter Zijlstra wrote:
> On Wed, May 08, 2019 at 05:43:46PM +0300, Kirill A. Shutemov wrote:
>
> > +/* Copy the payload to the HW programming structure and program this KeyID */
> > +static int mktme_program_keyid(int keyid, struct mktme_payload *payload)
> > +{
> > + struct mktme_key_program *kprog = NULL;
> > + int ret;
> > +
> > + kprog = kmem_cache_zalloc(mktme_prog_cache, GFP_ATOMIC);
>
> Why GFP_ATOMIC, afaict neither of the usage is with a spinlock held.

Got it. GFP_ATOMIC not needed.
That said, this is an artifact of reworking the locking, and that
locking may need to change again. If it does, will try to pre-allocate
rather than depend on GFP_ATOMIC here.

>
> > + if (!kprog)
> > + return -ENOMEM;
> > +
> > + /* Hardware programming requires cached aligned struct */
> > + kprog->keyid = keyid;
> > + kprog->keyid_ctrl = payload->keyid_ctrl;
> > + memcpy(kprog->key_field_1, payload->data_key, MKTME_AES_XTS_SIZE);
> > + memcpy(kprog->key_field_2, payload->tweak_key, MKTME_AES_XTS_SIZE);
> > +
> > + ret = MKTME_PROG_SUCCESS; /* Future programming call */
> > + kmem_cache_free(mktme_prog_cache, kprog);
> > + return ret;
> > +}

\
 
 \ /
  Last update: 2019-06-14 19:09    [W:0.134 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site