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: <20181005072645.GW31561@phenom.ffwll.local>
Date:   Fri, 5 Oct 2018 09:26:45 +0200
From:   Daniel Vetter <daniel@...ll.ch>
To:     Lyude Paul <lyude@...hat.com>
Cc:     nouveau@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        intel-gfx@...ts.freedesktop.org,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        stable@...r.kernel.org,
        Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        David Airlie <airlied@...ux.ie>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/5] drm/i915: Skip vcpi allocation for MSTB ports
 that are gone

On Thu, Oct 04, 2018 at 08:29:53PM -0400, Lyude Paul wrote:
> Since we need to be able to allow DPMS on->off prop changes after an MST
> port has disappeared from the system, we need to be able to make sure we
> can compute a config for the resulting atomic commit. Currently this is
> impossible when the port has disappeared, since the VCPI slot searching
> we try to do in intel_dp_mst_compute_config() will fail with -EINVAL.
> 
> Since the only commits we want to allow on no-longer-present MST ports
> are ones that shut off display hardware, we already know that no VCPI
> allocations are needed. So, hardcode the VCPI slot count to 0 when
> intel_dp_mst_compute_config() is called on an MST port that's gone.
> 
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> Cc: stable@...r.kernel.org
> ---
>  drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index fcb9b87b9339..a366f32b048a 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -42,7 +42,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		to_intel_connector(conn_state->connector);
>  	struct drm_atomic_state *state = pipe_config->base.state;
>  	int bpp;
> -	int lane_count, slots;
> +	int lane_count, slots = 0;
>  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	int mst_pbn;
>  	bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc,
> @@ -76,11 +76,16 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  	mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
>  	pipe_config->pbn = mst_pbn;
>  
> -	slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr,
> -					      connector->port, mst_pbn);
> -	if (slots < 0) {
> -		DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots);
> -		return false;
> +	if (!connector->mst_port_gone) {

Wondered why you don't need this for nouveau/amdgpu, but a bit of grepping
later says they don't even bother to check that in their atomic_check
functions. So if a multi-stream cable runs out of vcpi slots, they just
toss up their hands, atomic be damned :-(

With the s/mst_port_gone/READ_ONCE(!conn->registered)/ bikeshed:

Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>

I wondered a bit whether ths fuction shouldn't just return 0 if the
connector is gone, but we'd need to audit/fix other drivers first.
-Daniel

> +		slots = drm_dp_atomic_find_vcpi_slots(state,
> +						      &intel_dp->mst_mgr,
> +						      connector->port,
> +						      mst_pbn);
> +		if (slots < 0) {
> +			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
> +				      slots);
> +			return false;
> +		}
>  	}
>  
>  	intel_link_compute_m_n(bpp, lane_count,
> -- 
> 2.17.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ