lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190613132436.GN4173@e110455-lin.cambridge.arm.com>
Date:   Thu, 13 Jun 2019 14:24:37 +0100
From:   Liviu Dudau <Liviu.Dudau@....com>
To:     "james qian wang (Arm Technology China)" <james.qian.wang@....com>,
        "Lowry Li (Arm Technology China)" <Lowry.Li@....com>,
        "maarten.lankhorst@...ux.intel.com" 
        <maarten.lankhorst@...ux.intel.com>,
        "seanpaul@...omium.org" <seanpaul@...omium.org>,
        "airlied@...ux.ie" <airlied@...ux.ie>,
        Brian Starkey <Brian.Starkey@....com>,
        Ayan Halder <Ayan.Halder@....com>,
        "Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
        nd <nd@....com>
Subject: Re: [PATCH v2 2/2] drm/komeda: Adds komeda_kms_drop_master

On Thu, Jun 13, 2019 at 11:08:14AM +0200, Daniel Vetter wrote:
> On Thu, Jun 13, 2019 at 09:28:13AM +0100, Liviu Dudau wrote:
> > On Thu, Jun 13, 2019 at 10:17:27AM +0200, Daniel Vetter wrote:
> > > On Wed, Jun 12, 2019 at 02:26:24AM +0000, james qian wang (Arm Technology China) wrote:
> > > > On Tue, Jun 11, 2019 at 02:30:38PM +0200, Daniel Vetter wrote:
> > > > > On Tue, Jun 11, 2019 at 11:13:45AM +0000, Lowry Li (Arm Technology China) wrote:
> > > > > > From: "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
> > > > > >
> > > > > > The komeda internal resources (pipelines) are shared between crtcs,
> > > > > > and resources release by disable_crtc. This commit is working for once
> > > > > > user forgot disabling crtc like app quit abnomally, and then the
> > > > > > resources can not be used by another crtc. Adds drop_master to
> > > > > > shutdown the device and make sure all the komeda resources have been
> > > > > > released and can be used for the next usage.
> > > > > >
> > > > > > Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@....com>
> > > > > > ---
> > > > > >  drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 13 +++++++++++++
> > > > > >  1 file changed, 13 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > > > > > index 8543860..647bce5 100644
> > > > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > > > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > > > > > @@ -54,11 +54,24 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
> > > > > >  return status;
> > > > > >  }
> > > > > >
> > > > > > +/* Komeda internal resources (pipelines) are shared between crtcs, and resources
> > > > > > + * are released by disable_crtc. But if user forget disabling crtc like app quit
> > > > > > + * abnormally, the resources can not be used by another crtc.
> > > > > > + * Use drop_master to shutdown the device and make sure all the komeda resources
> > > > > > + * have been released, and can be used for the next usage.
> > > > > > + */
> > > > >
> > > > > No. If we want this, we need to implement this across drivers, not with
> > > > > per-vendor hacks.
> > > > >
> > > > > The kerneldoc should have been a solid hint: "Only used by vmwgfx."
> > > > > -Daniel
> > > > 
> > > > Hi Daniel:
> > > > This drop_master is really what we want, can we update the doc and
> > > > add komeda as a user of this hacks like "used by vmwfgx and komeda",
> > > > or maybe directly promote this per-vendor hacks as an optional chip
> > > > function ?
> > > 
> > > Still no, because it would mean different behaviour for arm/komeda
> > > compared to everyone else. And we really don't want this, because this
> > > would completely break flicker-less vt-switching.
> > > 
> > > Currently the only fallback for this case is the lastclose handler, which
> > > atm just restores fbcon/fbdev. If you want to change/extend that to work
> > > without fbdev, then that's the place to do the change. And across _all_
> > > drm kms drivers, so that we have consistent behaviour.
> > 
> > Slightly unrelated, just thinking of a solution and wanted confirmation/double
> > checking: can a CRTC be instantiated without any planes (or without a primary
> > plane)?
> 
> Without a primary plane maybe not so recommended, because it would break
> all the legacy userspace. Might even result in some oopses, not sure we
> check for crtc->primary != NULL.
> 
> I'm not sure what you mean about instantiating it without any plane at
> all. That would be rather useless.

Agree, and I think I have one way of solving the scenario Lowry and James are
trying to cover. Basically, komeda has 2 pipelines that are exposed as 2 crtcs.
However, layers (planes in DRM) can be associated with any of the pipelines and
it is possible to have a DRM master open up crtc0 and enable all possible planes,
which would leave crtc1 with no available layer to use (but technically still visible to
userspace, as it has been drm_crtc_init-ed. James and Lowry are trying to give
another master a chance of enabling crtc1 if previous master drops the
ownership of crtc0 without disabling it. So one solution I'm thinking of is to
tie one of the layers/planes to crtc1 regardless if that pipeline is enabled or
not.

Alternatively, we need a more generic solution for re-allocating resources
between CRTCs that might be enabled at different times. Ideas on how userspace
should handle it first are welcome as well.

Best regards,
Liviu

> -Daniel
> 
> > 
> > Best regards,
> > Liviu
> > 
> > > 
> > > kms is a cross-vendor api, vendor hacks are very, very much not cool.
> > > -Daniel
> > > 
> > > > 
> > > > James
> > > > 
> > > > > > +static void komeda_kms_drop_master(struct drm_device *dev,
> > > > > > +   struct drm_file *file_priv)
> > > > > > +{
> > > > > > +drm_atomic_helper_shutdown(dev);
> > > > > > +}
> > > > > > +
> > > > > >  static struct drm_driver komeda_kms_driver = {
> > > > > >  .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
> > > > > >     DRIVER_PRIME | DRIVER_HAVE_IRQ,
> > > > > >  .lastclose= drm_fb_helper_lastclose,
> > > > > >  .irq_handler= komeda_kms_irq_handler,
> > > > > > +.master_drop= komeda_kms_drop_master,
> > > > > >  .gem_free_object_unlocked= drm_gem_cma_free_object,
> > > > > >  .gem_vm_ops= &drm_gem_cma_vm_ops,
> > > > > >  .dumb_create= komeda_gem_cma_dumb_create,
> > > > > > --
> > > > > > 1.9.1
> > > > > >
> > > > > > _______________________________________________
> > > > > > dri-devel mailing list
> > > > > > dri-devel@...ts.freedesktop.org
> > > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > > > >
> > > > > --
> > > > > Daniel Vetter
> > > > > Software Engineer, Intel Corporation
> > > > > http://blog.ffwll.ch
> > > > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
> > > > _______________________________________________
> > > > dri-devel mailing list
> > > > dri-devel@...ts.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > > 
> > > -- 
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > 
> > -- 
> > ====================
> > | I would like to |
> > | fix the world,  |
> > | but they're not |
> > | giving me the   |
> >  \ source code!  /
> >   ---------------
> >     ¯\_(ツ)_/¯
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@...ts.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ