From: Michael Ellerman <mpe@ellerman.id.au>
To: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: mikey@neuling.org, imunsie@au1.ibm.com,
Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Subject: Re: cxl: Fix possible idr warning when contexts are released
Date: Thu, 26 Nov 2015 23:15:54 +1100 (AEDT) [thread overview]
Message-ID: <20151126121554.28FE3140319@ozlabs.org> (raw)
In-Reply-To: <1447646625-28854-1-git-send-email-vaibhav@linux.vnet.ibm.com>
On Mon, 2015-16-11 at 04:03:45 UTC, Vaibhav Jain wrote:
> An idr warning is reported when a context is release after the capi card
> is unbound from the cxl driver via sysfs. Below are the steps to
> reproduce:
>
> 1. Create multiple afu contexts in an user-space application using libcxl.
> 2. Unbind capi card from cxl using command of form
> echo <capi-card-pci-addr> > /sys/bus/pci/drivers/cxl-pci/unbind
> 3. Exit/kill the application owning afu contexts.
>
> After above steps a warning message is usually seen in the kernel logs
> of the form "idr_remove called for id=<context-id> which is not
> allocated."
>
> This is caused by the function cxl_release_afu which destroys the
> contexts_idr table. So when a context is release no entry for context pe
> is found in the contexts_idr table and idr code prints this warning.
>
> This patch fixes this issue by increasing & decreasing the ref-count on
> the afu device when a context is initialized or when its freed
> respectively. This prevents the afu from being released until all the
> afu contexts have been released. The patch introduces two new functions
> namely cxl_afu_get/put that manage the ref-count on the afu device.
>
> Also the patch removes code inside cxl_dev_context_init that increases ref
> on the afu device as its guaranteed to be alive during this function.
>
> Reported-by: Ian Munsie <imunsie@au1.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/1b5df59e50874b9034c0fa38
cheers
prev parent reply other threads:[~2015-11-26 12:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 4:03 [PATCH] cxl: Fix possible idr warning when contexts are released Vaibhav Jain
2015-11-16 5:20 ` Ian Munsie
2015-11-26 12:15 ` Michael Ellerman [this message]
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=20151126121554.28FE3140319@ozlabs.org \
--to=mpe@ellerman.id.au \
--cc=imunsie@au1.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=vaibhav@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;
as well as URLs for NNTP newsgroup(s).