Received: by 10.192.165.148 with SMTP id m20csp394678imm; Fri, 20 Apr 2018 00:40:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/c0rhqQ0vx5O5Ni1RUr0xhpEJyAUVWjzDRrCydaNKCzYJypZtQH62+cOJ3MYhRPTdBzcS X-Received: by 10.101.98.194 with SMTP id m2mr2433596pgv.164.1524210044941; Fri, 20 Apr 2018 00:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524210044; cv=none; d=google.com; s=arc-20160816; b=YFlZ1o7Ny3C9l8yxbGdG8otVoH7Pv2GqStn7nBhUoqhnj5+pi84bd07v4HdXWuHoXN wmZ4VvOjEqxo2wGLg3FtyK38MTbo6pBdPe7PYtN7bYpkvfPo3KRgxKIVn89WhWz+lKW5 6xwVBlMmuAG5Cibs7fCy4trK4nCs/oP74Hjoa2rttc3O81XESw5AD7zQkn1EC6azO0QB s8NPVhrTR5onIwL6Iwiz41Y/ES1uzzXfrETrvC9VUi29TPUvkxh0bvH3TIqkbXP5ESd/ VdRvmtIAK1yINTZf5uF5rqeSWZ+YjzTdnPntSFSvaNx4O8xLnQZG39NLFhIsNGiBPsFi OMVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=jJqOOsI49uQdQ5UEciMsM80mzhkJR7IkipIPluScB7k=; b=ixdXF9Sjm+rFVPibGGtYI1ceWu2FfdbTY3Kv3hLISETezIXMyS1+y7SPtSvVpji69c 0gRspKn1iyWH0LjLxUpfkXsrw/icIAL+pkr0G08jCsKeYXBdc3b6iqoobEuwhEXt4ANz 7hh7giNSNSlaA8IRw3obIJF4BFLxmDK09wEp3NSiBz8T8Rj3WyF9CgQ4gv3SZLOxH5N/ Fn03pS/4TjvsftNAUrvvZFsDvDkjhHsTSI3gWQYDvq62tCpx7p8fHiu7q0DITN+vQhSE t4VYsGXMwaUepg8fN2hKBmHHAPIgJtRIzOSls1VQzYwc3iOzzLp/IuRhoWxkgnQXuxjv 0lSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FGnhNI3w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si3691939pfn.292.2018.04.20.00.40.30; Fri, 20 Apr 2018 00:40:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FGnhNI3w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754001AbeDTHjM (ORCPT + 99 others); Fri, 20 Apr 2018 03:39:12 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:35902 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753956AbeDTHjK (ORCPT ); Fri, 20 Apr 2018 03:39:10 -0400 Received: by mail-io0-f194.google.com with SMTP id c26-v6so9553364iob.3 for ; Fri, 20 Apr 2018 00:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jJqOOsI49uQdQ5UEciMsM80mzhkJR7IkipIPluScB7k=; b=FGnhNI3wZyTYh3KM6LLbacpc6Zpbwb9QLNPlpn0q+s0JAbXuojgXffz4jcSl3Zk7BE /i5A68muQUjDliZ1gg2ZSDZCm0REWsSyNzeAOEWB2pTUDGQpeDmSQijylsHb7yVn7Ldg VYyCiiwHv2a+JlO5tYDm9BDpWdMeHgs/UDsXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jJqOOsI49uQdQ5UEciMsM80mzhkJR7IkipIPluScB7k=; b=KXpOFcgBOMqvjciLIUUQusEicY+esSopMml4ADUO6h66SbkD79JHPWv0VHQorCrYHr Q0Pmus5hu36GstWydSWXmqXgOfcW81n9ALVSI1gWmauegLH3z43FC/JgMXL+DbyZ35ro UlJD0hhiGJTVYty/N8hlO3YAiU1TQh0ilsvHgyTTEBqLxPXS/M4qS+18Xq6CMhEE5tDM 5MKUuynMit9LM0yBLQOiCc0Wh9TXZbDIGbBTR29QulbPvm6hF6wmm6icqYb2+IR0NRyA 6ylW8NEYXfjpBqBWD1IZHynnYegB9jID7ug1c+DYPtCw2XXiH7ZNVycLn2b/54dXhSsQ TQcg== X-Gm-Message-State: ALQs6tBnl4DsbzLdIXTL5ySFc98i2cFgDEXIfoubRwvtxFS7SuKGsUQF cpTIjx4so5Lk+4VLj351Za6EExdEfxs= X-Received: by 2002:a6b:d818:: with SMTP id y24-v6mr9027679iob.184.1524209949751; Fri, 20 Apr 2018 00:39:09 -0700 (PDT) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id l195-v6sm563887itl.37.2018.04.20.00.39.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 00:39:09 -0700 (PDT) Received: by mail-io0-f174.google.com with SMTP id f3-v6so9532010iob.13 for ; Fri, 20 Apr 2018 00:39:08 -0700 (PDT) X-Received: by 2002:a6b:d406:: with SMTP id l6-v6mr8995563iog.86.1524209948279; Fri, 20 Apr 2018 00:39:08 -0700 (PDT) MIME-Version: 1.0 References: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> <20180419154124.17512-3-paul.kocialkowski@bootlin.com> In-Reply-To: <20180419154124.17512-3-paul.kocialkowski@bootlin.com> From: Alexandre Courbot Date: Fri, 20 Apr 2018 07:38:57 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 02/10] media-request: Add a request complete operation to allow m2m scheduling To: Paul Kocialkowski Cc: Linux Media Mailing List , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, LKML , linux-sunxi@googlegroups.com, Mauro Carvalho Chehab , robh+dt@kernel.org, mark.rutland@arm.com, Maxime Ripard , wens@csie.org, Pawel Osciak , Marek Szyprowski , kyungmin.park@samsung.com, Hans Verkuil , Sakari Ailus , p.zabel@pengutronix.de, arnd@arndb.de, Tomasz Figa Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 20, 2018 at 12:43 AM Paul Kocialkowski < paul.kocialkowski@bootlin.com> wrote: > When using the request API in the context of a m2m driver, the > operations that come with a m2m run scheduling call in their > (m2m-specific) ioctl handler are delayed until the request is queued > (for instance, this includes queuing buffers and streamon). > Thus, the m2m run scheduling calls are not called in due time since the > request AP's internal plumbing will (rightfully) use the relevant core > functions directly instead of the ioctl handler. > This ends up in a situation where nothing happens if there is no > run-scheduling ioctl called after queuing the request. > In order to circumvent the issue, a new media operation is introduced, > called at the time of handling the media request queue ioctl. It gives > m2m drivers a chance to schedule a m2m device run at that time. > The existing req_queue operation cannot be used for this purpose, since > it is called with the request queue mutex held, that is eventually needed > in the device_run call to apply relevant controls. > Signed-off-by: Paul Kocialkowski > --- > drivers/media/media-request.c | 3 +++ > include/media/media-device.h | 2 ++ > 2 files changed, 5 insertions(+) > diff --git a/drivers/media/media-request.c b/drivers/media/media-request.c > index 415f7e31019d..28ac5ccfe6a2 100644 > --- a/drivers/media/media-request.c > +++ b/drivers/media/media-request.c > @@ -157,6 +157,9 @@ static long media_request_ioctl_queue(struct media_request *req) > media_request_get(req); > } > + if (mdev->ops->req_complete) > + mdev->ops->req_complete(req); > + > return ret; > } > diff --git a/include/media/media-device.h b/include/media/media-device.h > index 07e323c57202..c7dcf2079cc9 100644 > --- a/include/media/media-device.h > +++ b/include/media/media-device.h > @@ -55,6 +55,7 @@ struct media_entity_notify { > * @req_alloc: Allocate a request > * @req_free: Free a request > * @req_queue: Queue a request > + * @req_complete: Complete a request > */ > struct media_device_ops { > int (*link_notify)(struct media_link *link, u32 flags, > @@ -62,6 +63,7 @@ struct media_device_ops { > struct media_request *(*req_alloc)(struct media_device *mdev); > void (*req_free)(struct media_request *req); > int (*req_queue)(struct media_request *req); > + void (*req_complete)(struct media_request *req); This is called *before* the request is actually run, isn't it? In that case, wouldn't something like "req_schedule" be less confusing? req_complete implies that the request is already completed.