lkml.org 
[lkml]   [2016]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 1/2] cxl: Add mechanism for delivering AFU driver specific events
From
Date
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

\
 
 \ /
  Last update: 2016-03-09 11:01    [W:0.061 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site