All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Mikko Perttunen <cyndis-/1wQRMveznE@public.gmane.org>,
	Mikko Perttunen
	<mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] gpu: host1x: Refactor/fix channel allocation code
Date: Thu, 18 May 2017 15:07:04 +0300	[thread overview]
Message-ID: <bd0cb68c-6e74-401c-f091-c98e7349137a@gmail.com> (raw)
In-Reply-To: <47f76f18-9940-ec07-0a71-1e53dd8dd08e-/1wQRMveznE@public.gmane.org>

On 18.05.2017 14:55, Mikko Perttunen wrote:
> On 18.05.2017 14:42, Dmitry Osipenko wrote:
>> On 20.03.2017 21:44, Mikko Perttunen wrote:
>>> ...
>>>  struct host1x_channel *host1x_channel_request(struct device *dev)
>>>  {
>>>      struct host1x *host = dev_get_drvdata(dev->parent);
>>> +    struct host1x_channel_list *chlist = &host->channel_list;
>>>      unsigned int max_channels = host->info->nb_channels;
>>>      struct host1x_channel *channel = NULL;
>>> -    unsigned long index;
>>> +    unsigned int index;
>>>      int err;
>>>
>>> -    mutex_lock(&host->chlist_mutex);
>>> +    down(&chlist->alloc_sema);
>>> +
>>
>> It's a bit hard to follow lockings in the code, could you please explain why
>> you've added this semaphore? What problem it solves?
> 
> Sure. The role of the semaphore is to allow the caller to sleep waiting for a
> free channel, and also to be sure that a channel is available once the down()
> call finishes. Currently the channel allocation model is such that each unit
> allocates a single channel for itself, in which case this is not useful, but
> with later chips with more available channels we can move to a model where a
> channel is allocated for each userspace client. In this case we can allow the
> application to sleep if there are no available channels.
> 
> Of course, there is also the possibility of just returning -EBUSY if there are
> no channels - that's probably fine too..
> 

Currently, the host1x_channel_request() is only invoked during the drivers probe
routine, it has nothing to do with userspace. I'd suggest to drop that semaphore
from the patch since it's unrelated to the current channel allocation model.

-- 
Dmitry

      parent reply	other threads:[~2017-05-18 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 18:44 [PATCH] gpu: host1x: Refactor/fix channel allocation code Mikko Perttunen
     [not found] ` <20170320184402.32723-1-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-05-18 11:42   ` Dmitry Osipenko
     [not found]     ` <71538e6d-f8f5-06e0-ca4e-42c7f33acacc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-05-18 11:55       ` Mikko Perttunen
     [not found]         ` <47f76f18-9940-ec07-0a71-1e53dd8dd08e-/1wQRMveznE@public.gmane.org>
2017-05-18 12:07           ` Dmitry Osipenko [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=bd0cb68c-6e74-401c-f091-c98e7349137a@gmail.com \
    --to=digetx-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=cyndis-/1wQRMveznE@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.