Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp133830pxu; Tue, 1 Dec 2020 07:46:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJywMPo8TdmXSAwfd4vPTTebhx4+yWUpvsc89nVgba28COytvR6le9j8qdqdGUa01Q8vXAYz X-Received: by 2002:a05:6402:22ea:: with SMTP id dn10mr3548538edb.67.1606837570638; Tue, 01 Dec 2020 07:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606837570; cv=none; d=google.com; s=arc-20160816; b=wxVDRBx5XQVf/KkA8SoNQLqxhVp9P4fg9PWbaQLEJYSVRNntt/7/ckEUWQ2VXsoaez LOMA1Cun148d2w0biUMAUjlpTg0Dr/OCdCOK3uVw42/kBtavE20I6UrKH+1jExEIM21Q NPBc8rD0Qk3y0V9o3pcujUobQoBJTSSldPbVeae+vOe36/ZHtmtZG95xmRpHUf42JuYb MD5Psdo7PWe9Bjo/ix2W98dqxwrcRGMZuaeyy7GOE3x0Jj8P28SB4AitN/f4geLdQKkw cEcvb0BzLUld0eBw7EhBuSK61Zongfz0LDa/bYZ4Y8C6A/GjVM3n7bIospjPALQQ/mv5 rNCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bmnnSVAPM4/WJHnSbNc1plp45hvTpBpINKVfc8FGKWM=; b=yno+OlPbVTFYgtv8cZNchkELM+hK/UJfyldESF0X9Bgcq1+f8LufclGSTG+GtobTR+ e8x+6FECn2oBXa9fkhsPkcqW6qIMyWTjFGA+h9MSahE8e8Zmr/LMn0P0YgVDDdcXrB7m aLdMtL5xl4SYA1qF9FzguHazAZCvQaIAa24IlYqoSIw1Ei/fq0cKUSa3C861YTZwbWH/ VOPxNCyERPoAtHWobVODC1UHMmOQbETgRz/kwG0gK5/YGjw0gcnm8fEnOc+HH61iGmC8 RBc2LTdmqkHQ8q8XpSdi7ww+vWjodWfR99TASbiFjhBtl7PLi2Lf1ET8b6zkO87P6Tdl SmmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 89si97269edc.413.2020.12.01.07.45.42; Tue, 01 Dec 2020 07:46:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390192AbgLAPoO (ORCPT + 99 others); Tue, 1 Dec 2020 10:44:14 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:55890 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388395AbgLAPoO (ORCPT ); Tue, 1 Dec 2020 10:44:14 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id E838D1C0B87; Tue, 1 Dec 2020 16:43:32 +0100 (CET) Date: Tue, 1 Dec 2020 16:43:32 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Daniel Vetter , Rodrigo Vivi , David Airlie , Lyude Paul , Joonas Lahtinen , Christoph Niedermaier Subject: Re: [PATCH 4.19 11/57] drm/atomic_helper: Stop modesets on unregistered connectors harder Message-ID: <20201201154332.GB23661@amd> References: <20201201084647.751612010@linuxfoundation.org> <20201201084648.982712007@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QTprm0S8XgL7H0Dt" Content-Disposition: inline In-Reply-To: <20201201084648.982712007@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --QTprm0S8XgL7H0Dt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Lyude Paul >=20 > commit de9f8eea5a44b0b756d3d6345af7f8e630a3c8c0 upstream. So this says protected by mutex: > /** > - * @registered: Is this connector exposed (registered) with userspace? > + * @registration_state: Is this connector initializing, exposed > + * (registered) with userspace, or unregistered? > + * > * Protected by @mutex. > */ > - bool registered; > + enum drm_connector_registration_state registration_state; > =20 > /** > * @modes: > @@ -1165,6 +1214,24 @@ static inline void drm_connector_unrefer > drm_connector_put(connector); > } > =20 > +/** > + * drm_connector_is_unregistered - has the connector been unregistered f= rom > + * userspace? > + * @connector: DRM connector > + * > + * Checks whether or not @connector has been unregistered from userspace. > + * > + * Returns: > + * True if the connector was unregistered, false if the connector is > + * registered or has not yet been registered with userspace. > + */ > +static inline bool > +drm_connector_is_unregistered(struct drm_connector *connector) > +{ > + return READ_ONCE(connector->registration_state) =3D=3D > + DRM_CONNECTOR_UNREGISTERED; > +} But this uses READ_ONCE() for protection, and corresponding WRITE_ONCE() is nowhere to be seen. Should this take the mutex, too? Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --QTprm0S8XgL7H0Dt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl/GZKQACgkQMOfwapXb+vLdtwCgt/kT41bYBloUZ7+bCf5esRBA CfIAn0nOmDFWfMTilErvK1DEZXP+URYh =jIjo -----END PGP SIGNATURE----- --QTprm0S8XgL7H0Dt--