From: Michael Neuling <mikey@neuling.org>
To: "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org,
James.Bottomley@HansenPartnership.com, nab@linux-iscsi.org,
brking@linux.vnet.ibm.com, wenxiong@linux.vnet.ibm.com,
dja@ozlabs.au.ibm.com, benh@kernel.crashing.org,
hch@infradead.org, imunsie@au1.ibm.com,
"Manoj N. Kumar" <manoj@linux.vnet.ibm.com>
Subject: Re: [PATCH v5 2/3] cxlflash: Superpipe support
Date: Thu, 13 Aug 2015 20:53:07 +1000 [thread overview]
Message-ID: <1439463187.21643.49.camel@neuling.org> (raw)
In-Reply-To: <1439423471-15648-1-git-send-email-mrochs@linux.vnet.ibm.com>
> Add superpipe supporting infrastructure to device driver for the IBM CXL
> Flash adapter. This patch allows userspace applications to take advantage
> of the accelerated I/O features that this adapter provides and bypass the
> traditional filesystem stack.
>
> Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
> Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Thanks for incorporating my suggestions. One minor issue below but if
you fix that and add the ioctl version advertising as we talked about
offline, I'm happy if you add my reviewed by.
Reviewed-by: Michael Neuling <mikey@neuling.org>
> +static struct ctx_info *create_context(struct cxlflash_cfg *cfg,
> + struct cxl_context *ctx, int ctxid,
> + int adap_fd, struct file *file,
> + u32 perms)
> +{
> + struct device *dev = &cfg->dev->dev;
> + struct afu *afu = cfg->afu;
> + struct ctx_info *ctxi = NULL;
> + struct llun_info **lli = NULL;
> + struct sisl_rht_entry *rhte;
> +
> + ctxi = kzalloc(sizeof(*ctxi), GFP_KERNEL);
> + lli = kzalloc((MAX_RHT_PER_CONTEXT * sizeof(*lli)), GFP_KERNEL);
> + if (unlikely(!ctxi || !lli)) {
> + dev_err(dev, "%s: Unable to allocate context!\n", __func__);
> + goto out;
If only one of these allocations fails you'll leak some memory. I
suggest making this "goto err", remove the "out" label and make err
look like this:
err:
if lli
kfree(lli);
if ctxi
kfree(ctxi);
return NULL;
> + }
> +
> + rhte = (struct sisl_rht_entry *)get_zeroed_page(GFP_KERNEL);
> + if (unlikely(!rhte)) {
> + dev_err(dev, "%s: Unable to allocate RHT!\n", __func__);
> + goto err;
> + }
> +
> + ctxi->rht_lun = lli;
> + ctxi->rht_start = rhte;
> + ctxi->rht_perms = perms;
> +
> + ctxi->ctrl_map = &afu->afu_map->ctrls[ctxid].ctrl;
> + ctxi->ctxid = ENCODE_CTXID(ctxi, ctxid);
> + ctxi->lfd = adap_fd;
> + ctxi->pid = current->tgid; /* tgid = pid */
> + ctxi->ctx = ctx;
> + ctxi->file = file;
> + mutex_init(&ctxi->mutex);
> + INIT_LIST_HEAD(&ctxi->luns);
> + INIT_LIST_HEAD(&ctxi->list); /* initialize for list_empty() */
> +
> + atomic_inc(&cfg->num_user_contexts);
> + mutex_lock(&ctxi->mutex);
> +out:
> + return ctxi;
> +
> +err:
> + kfree(lli);
> + kfree(ctxi);
> + ctxi = NULL;
> + goto out;
> +}
next prev parent reply other threads:[~2015-08-13 10:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 23:51 [PATCH v5 2/3] cxlflash: Superpipe support Matthew R. Ochs
2015-08-13 10:53 ` Michael Neuling [this message]
2015-08-13 23:38 ` Manoj Kumar
2015-08-13 13:26 ` wenxiong
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=1439463187.21643.49.camel@neuling.org \
--to=mikey@neuling.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=benh@kernel.crashing.org \
--cc=brking@linux.vnet.ibm.com \
--cc=dja@ozlabs.au.ibm.com \
--cc=hch@infradead.org \
--cc=imunsie@au1.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=manoj@linux.vnet.ibm.com \
--cc=mrochs@linux.vnet.ibm.com \
--cc=nab@linux-iscsi.org \
--cc=wenxiong@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox