LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] gpu: host1x: Ignore clients initialization failure
@ 2018-08-09 23:12 Dmitry Osipenko
  2018-08-13 17:48 ` Dmitry Osipenko
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Osipenko @ 2018-08-09 23:12 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel, linux-kernel

From time to time new bugs are popping up, causing some host1x client to
fail its initialization. Currently a single clients initialization failure
causes whole host1x device registration to fail, as a result a single DRM
sub-device initialization failure makes whole DRM initialization to fail.
Let's ignore clients initialization failure, as a result display panel
lights up even if some DRM clients (say GR2D or VIC) fail to initialize.
Actually VIC fails if initramfs misses the firmware file, so with this
change a serial console isn't needed anymore to figure out why display
isn't working.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---

Changelog:

v2: Added WARN_ON() that should get more attention than just a error message.
    Made clients_lock to lock around the lists modification, that is in line
    with the rest of the code.

 drivers/gpu/host1x/bus.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 815bdb42e3f0..07bb6b6c1260 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -199,19 +199,23 @@ static void host1x_subdev_unregister(struct host1x_device *device,
  */
 int host1x_device_init(struct host1x_device *device)
 {
-	struct host1x_client *client;
+	struct host1x_client *client, *cl;
 	int err;
 
 	mutex_lock(&device->clients_lock);
 
-	list_for_each_entry(client, &device->clients, list) {
+	list_for_each_entry_safe(client, cl, &device->clients, list) {
 		if (client->ops && client->ops->init) {
 			err = client->ops->init(client);
-			if (err < 0) {
+			if (WARN_ON(err < 0)) {
 				dev_err(&device->dev,
 					"failed to initialize %s: %d\n",
 					dev_name(client->dev), err);
-				goto teardown;
+
+				/* add the client to the list of idle clients */
+				mutex_lock(&clients_lock);
+				list_add_tail(&client->list, &clients);
+				mutex_unlock(&clients_lock);
 			}
 		}
 	}
@@ -219,14 +223,6 @@ int host1x_device_init(struct host1x_device *device)
 	mutex_unlock(&device->clients_lock);
 
 	return 0;
-
-teardown:
-	list_for_each_entry_continue_reverse(client, &device->clients, list)
-		if (client->ops->exit)
-			client->ops->exit(client);
-
-	mutex_unlock(&device->clients_lock);
-	return err;
 }
 EXPORT_SYMBOL(host1x_device_init);
 
-- 
2.18.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gpu: host1x: Ignore clients initialization failure
  2018-08-09 23:12 [PATCH v2] gpu: host1x: Ignore clients initialization failure Dmitry Osipenko
@ 2018-08-13 17:48 ` Dmitry Osipenko
  2018-08-16 17:20   ` Dmitry Osipenko
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Osipenko @ 2018-08-13 17:48 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Mikko Perttunen, linux-tegra, dri-devel, linux-kernel

On Friday, 10 August 2018 02:12:11 MSK Dmitry Osipenko wrote:
> From time to time new bugs are popping up, causing some host1x client to
> fail its initialization. Currently a single clients initialization failure
> causes whole host1x device registration to fail, as a result a single DRM
> sub-device initialization failure makes whole DRM initialization to fail.
> Let's ignore clients initialization failure, as a result display panel
> lights up even if some DRM clients (say GR2D or VIC) fail to initialize.
> Actually VIC fails if initramfs misses the firmware file, so with this
> change a serial console isn't needed anymore to figure out why display
> isn't working.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> 
> Changelog:
> 
> v2: Added WARN_ON() that should get more attention than just a error
> message. Made clients_lock to lock around the lists modification, that is
> in line with the rest of the code.
> 
>  drivers/gpu/host1x/bus.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> index 815bdb42e3f0..07bb6b6c1260 100644
> --- a/drivers/gpu/host1x/bus.c
> +++ b/drivers/gpu/host1x/bus.c
> @@ -199,19 +199,23 @@ static void host1x_subdev_unregister(struct
> host1x_device *device, */
>  int host1x_device_init(struct host1x_device *device)
>  {
> -	struct host1x_client *client;
> +	struct host1x_client *client, *cl;
>  	int err;
> 
>  	mutex_lock(&device->clients_lock);
> 
> -	list_for_each_entry(client, &device->clients, list) {
> +	list_for_each_entry_safe(client, cl, &device->clients, list) {
>  		if (client->ops && client->ops->init) {
>  			err = client->ops->init(client);
> -			if (err < 0) {
> +			if (WARN_ON(err < 0)) {
>  				dev_err(&device->dev,
>  					"failed to initialize %s: %d\n",
>  					dev_name(client->dev), err);
> -				goto teardown;
> +
> +				/* add the client to the list of idle clients */
> +				mutex_lock(&clients_lock);
> +				list_add_tail(&client->list, &clients);

This shall be list_move_tail(), v3 is coming.

> +				mutex_unlock(&clients_lock);





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gpu: host1x: Ignore clients initialization failure
  2018-08-13 17:48 ` Dmitry Osipenko
@ 2018-08-16 17:20   ` Dmitry Osipenko
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Osipenko @ 2018-08-16 17:20 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Mikko Perttunen, linux-tegra, dri-devel, linux-kernel

On Monday, 13 August 2018 20:48:25 MSK Dmitry Osipenko wrote:
> On Friday, 10 August 2018 02:12:11 MSK Dmitry Osipenko wrote:
> > From time to time new bugs are popping up, causing some host1x client to
> > fail its initialization. Currently a single clients initialization failure
> > causes whole host1x device registration to fail, as a result a single DRM
> > sub-device initialization failure makes whole DRM initialization to fail.
> > Let's ignore clients initialization failure, as a result display panel
> > lights up even if some DRM clients (say GR2D or VIC) fail to initialize.
> > Actually VIC fails if initramfs misses the firmware file, so with this
> > change a serial console isn't needed anymore to figure out why display
> > isn't working.
> > 
> > Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> > ---
> > 
> > Changelog:
> > 
> > v2: Added WARN_ON() that should get more attention than just a error
> > message. Made clients_lock to lock around the lists modification, that is
> > in line with the rest of the code.
> > 
> >  drivers/gpu/host1x/bus.c | 20 ++++++++------------
> >  1 file changed, 8 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> > index 815bdb42e3f0..07bb6b6c1260 100644
> > --- a/drivers/gpu/host1x/bus.c
> > +++ b/drivers/gpu/host1x/bus.c
> > @@ -199,19 +199,23 @@ static void host1x_subdev_unregister(struct
> > host1x_device *device, */
> > 
> >  int host1x_device_init(struct host1x_device *device)
> >  {
> > 
> > -	struct host1x_client *client;
> > +	struct host1x_client *client, *cl;
> > 
> >  	int err;
> >  	
> >  	mutex_lock(&device->clients_lock);
> > 
> > -	list_for_each_entry(client, &device->clients, list) {
> > +	list_for_each_entry_safe(client, cl, &device->clients, list) {
> > 
> >  		if (client->ops && client->ops->init) {
> >  		
> >  			err = client->ops->init(client);
> > 
> > -			if (err < 0) {
> > +			if (WARN_ON(err < 0)) {
> > 
> >  				dev_err(&device->dev,
> >  				
> >  					"failed to initialize %s: %d\n",
> >  					dev_name(client->dev), err);
> > 
> > -				goto teardown;
> > +
> > +				/* add the client to the list of idle clients */
> > +				mutex_lock(&clients_lock);
> > +				list_add_tail(&client->list, &clients);
> 
> This shall be list_move_tail(), v3 is coming.
> 
> > +				mutex_unlock(&clients_lock);

I just realized that DRM won't load if any of host1x drivers fail to probe. I 
think the behaviour should be consistent in a case of driver-probe and client-
init failures. It looks like changing drivers probe error handling will be a 
much bigger change, hence let's keep the old behaviour at least for now.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 23:12 [PATCH v2] gpu: host1x: Ignore clients initialization failure Dmitry Osipenko
2018-08-13 17:48 ` Dmitry Osipenko
2018-08-16 17:20   ` Dmitry Osipenko

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox