Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18892742ybl; Fri, 3 Jan 2020 11:08:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzGS74bNFIVRzpHrU1WvbbHsx0ksyu7RH/GDtp3wxcEE+jniSOLpp/R5lKQhb/NN5pUEGZx X-Received: by 2002:a05:6830:1292:: with SMTP id z18mr65060277otp.148.1578078505733; Fri, 03 Jan 2020 11:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578078505; cv=none; d=google.com; s=arc-20160816; b=qljhEnU655unZzXasbVAqBsv+zeMPqiaQorz93wZrXP8dhoRmBUGHlKkpsML0mICjF lK+5NkNl8rHMt3cowH5Bhhbb3NXrmtncm5p+b6Hn21nw8/DLtvn8PCvihPwWA/ql83Ty lxfNQDyOiKzK06c1iIKB9ThhYKOPW8SYf5//u3vxm1C4DH3Pc5p7i4yA0/WrvVgOW6/1 FGiS9r1G5+IGdJCLh4pIrqhvN0zjSpMZT/eiFzuidF0sFvoRxXLf6UFlB8LJSNZk6JCM N+/WlNTzMupyBiZV44VU+s57Dyep9QVHp8YgA4GDnDjVCPdJotnbonEsYwXmPT4Jq+8V MwYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NB7ngFp4wXih49+ukzc97MVWiH6u5OkNuhnGFRgpeRk=; b=FJ/zPe7cEtNWCK3r21rqxOwIuX4aTWu994VgqPOJmRT/yCrlYvShH3AifK2eHTY9mW UfMEsCPyVikoLz5ApOAIzOhNObH3mQJcmoyz2ATEzq8CYISxsaD7fFdWgqjUvV+Cj+qs tvwB7GcV3TI4OFO9nTH17p3dUpIwUwcpfT6q1YKvRCBPHxz5Jxqm4OxTr3UXLzcmQEnK 875otLopsKzQEsEU6005BB2BkwvnZzbE6gTvYOv8HeOV8WBeh5FIbvKH/nAcU3B4t7Gv myjpzmGg3Cry15n/ak4DPyOOIW+Shvexns1YZ/xjJuLcve4C/JiArNmyrRaA+3iq4AsB omSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si31638790otn.100.2020.01.03.11.08.13; Fri, 03 Jan 2020 11:08:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728465AbgACTHO (ORCPT + 99 others); Fri, 3 Jan 2020 14:07:14 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:45188 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbgACTHO (ORCPT ); Fri, 3 Jan 2020 14:07:14 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 25F3B1C2228; Fri, 3 Jan 2020 20:07:12 +0100 (CET) Date: Fri, 3 Jan 2020 20:07:11 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot , Eric Dumazet , Thomas Gleixner Subject: Re: [PATCH 4.19 089/114] hrtimer: Annotate lockless access to timer->state Message-ID: <20200103190711.GF14328@amd> References: <20200102220029.183913184@linuxfoundation.org> <20200102220038.167049649@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FoLtEtfbNGMjfgrs" Content-Disposition: inline In-Reply-To: <20200102220038.167049649@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --FoLtEtfbNGMjfgrs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Eric Dumazet >=20 > commit 56144737e67329c9aaed15f942d46a6302e2e3d8 upstream. >=20 > syzbot reported various data-race caused by hrtimer_is_queued() reading > timer->state. A READ_ONCE() is required there to silence the warning. >=20 > Also add the corresponding WRITE_ONCE() when timer->state is set. >=20 > In remove_hrtimer() the hrtimer_is_queued() helper is open coded to avoid > loading timer->state twice. Is there a reason why READ_ONCE is not neccessary in remove_hrtimer? Should there be comment there explaining it? Best regards, Pavel > @@ -1002,8 +1004,9 @@ static void __remove_hrtimer(struct hrti > static inline int > remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, b= ool restart) > { > - if (hrtimer_is_queued(timer)) { > - u8 state =3D timer->state; > + u8 state =3D timer->state; > + > + if (state & HRTIMER_STATE_ENQUEUED) { > int reprogram; > =20 > /* >=20 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --FoLtEtfbNGMjfgrs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl4PkN8ACgkQMOfwapXb+vIXSgCeLWRt9/Au7H2W6ury0qy8+LDc 5WEAn140rt5mS/Pw4LJL/cm+8edXvfPz =8tqD -----END PGP SIGNATURE----- --FoLtEtfbNGMjfgrs--