[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56DFEC78.9050704@linux.vnet.ibm.com>
Date: Wed, 9 Mar 2016 10:27:20 +0100
From: Frederic Barrat <fbarrat@...ux.vnet.ibm.com>
To: Ian Munsie <imunsie@....ibm.com>,
Michael Ellerman <michaele@....ibm.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Matt Ochs <mrochs@...ibm.com>, Manoj Kumar <kumarmn@...ibm.com>
Cc: linuxppc-dev <linuxppc-dev@...abs.org>,
Michael Neuling <mikey@...ling.org>
Subject: Re: [PATCH v3 1/2] cxl: Add mechanism for delivering AFU driver
specific events
Hi Ian,
Le 08/03/2016 02:48, Ian Munsie a écrit :
> diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
...
> +static inline bool ctx_event_pending(struct cxl_context *ctx)
> +{
> + if (ctx->pending_irq || ctx->pending_fault || ctx->pending_afu_err)
> + return true;
> +
> + if (ctx->afu_driver_ops)
> + return ctx->afu_driver_ops->event_pending(ctx);
> +
> + return false;
> +}
> +
...
> +
> + if (ctx->afu_driver_ops && ctx->afu_driver_ops->event_pending(ctx)) {
> + pr_devel("afu_read delivering AFU driver specific event\n");
> + event.header.type = CXL_EVENT_AFU_DRIVER;
> + ctx->afu_driver_ops->deliver_event(ctx, &event, sizeof(event));
> + WARN_ON(event.header.size > sizeof(event));
> +
> + } else if (ctx->pending_irq) {
So on afu_read(), we may call afu_driver_ops->event_pending() twice
before calling afu_driver_ops->deliver_event(). Actually, in the
(likely) scenario where there's only an afu_driver event pending, we
*will* call afu_driver_ops->event_pending() twice. Wouldn't it make
sense to cache it then?
It would also avoid entering
WARN(1, "afu_read must be buggy\n");
if the driver changes its mind between the 2 calls :-)
Fred
Powered by blists - more mailing lists