From nobody Fri Apr  8 16:58:43 2022
X-Original-To: net@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6304C18414D5
	for <net@mlmmj.nyi.freebsd.org>; Fri,  8 Apr 2022 16:58:43 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4KZkwg0kngz3GwG
	for <net@FreeBSD.org>; Fri,  8 Apr 2022 16:58:43 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDC009B3
	for <net@FreeBSD.org>; Fri,  8 Apr 2022 16:58:42 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org ([127.0.1.5])
	by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 238GwgD0041064
	for <net@FreeBSD.org>; Fri, 8 Apr 2022 16:58:42 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
	by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 238GwglS041063
	for net@FreeBSD.org; Fri, 8 Apr 2022 16:58:42 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
From: bugzilla-noreply@freebsd.org
To: net@FreeBSD.org
Subject: [Bug 252165] usb network and mii bus media status race condition
Date: Fri, 08 Apr 2022 16:58:43 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: kern
X-Bugzilla-Version: CURRENT
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: Affects Many People
X-Bugzilla-Who: ali.abdallah@suse.com
X-Bugzilla-Status: New
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: net@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: 
Message-ID: <bug-252165-7501-3sS65Zs3In@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-252165-7501@https.bugs.freebsd.org/bugzilla/>
References: <bug-252165-7501@https.bugs.freebsd.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/
Auto-Submitted: auto-generated
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-net
List-Help: <mailto:freebsd-net+help@freebsd.org>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Subscribe: <mailto:freebsd-net+subscribe@freebsd.org>
List-Unsubscribe: <mailto:freebsd-net+unsubscribe@freebsd.org>
Sender: owner-freebsd-net@freebsd.org
MIME-Version: 1.0
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1649437123;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=QbBbucePmSHYLPhqQZgZjNh6yepi9Bl80RyJ0PSDe1g=;
	b=m4QamsKsnQGeaSEZXESGLfE5N9rxtU8dkuIao4naGQlb7H1fVXHRU7nZVQBdXgE6dQ61CM
	lYGNwlc4F55xg8ib9ChEEvtNt72bG+n4bt9ncuk7wAco9qkSsmP0E57xC8o3Y5YJEqPsFJ
	mhHM6tQG3q4c7vqi4hPP3A+39CMv72Dy8JrqxLABBkjNyKacvRgAaD06OzRfaMO237+vVn
	lsePUPtnwgSBlLYYCIueaNqRxHbioH7MOAcQBJsMN7WZLEUd5UmcoluI7sJJx/5guLff8Q
	bMAHZBcYUZ8stgbb5DS0asfL9up0Z9GrcaGGeI4HTmau2w0uIsLlaqOT3iZGbw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649437123; a=rsa-sha256; cv=none;
	b=K3e4LquyPzp4Q4VUQ2TVQ7TqxayVLYru5DGEFI3Mv+878nb2LUm2/gUZqHRKGaKOLql6uJ
	4fjLTp7RaCZq2CV6NozHFge2sV+p24zcN31SIww+j+vJfROhEls+P7dQTgyK7HV3FyOJPO
	E9NcQMxr6H4esDra/dqwvW9bOpUn3IUIYbKMsmh+aTS4a5dVq9PJFtwlt8TI6hqcm0Boz3
	8eqKjrVvhUFpujYBnqXjobw973MwEUJNRWytzIQ++JqbHkfcVm3rdLM8Ht1zH71LtHXcbc
	Unm1uiQ760hslN7UyCLH3yOaxgEcNW2xkWczJCLU8sDGzwuU8xgQXgzjImuqlg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
X-ThisMailContainsUnwantedMimeParts: N

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D252165

--- Comment #19 from Ali Abdallah <ali.abdallah@suse.com> ---
(In reply to Hans Petter Selasky from comment #18)
Compiling the kernel with COPTFLAGS=3D-O0 and CFLAGS=3D-O0 resulted in non-=
working
dtrace... (dtrace: invalid probe specifier... "/usr/lib/dtrace/mbuf.d", lin=
e 1:
failed to copy type of 'm_data': Type information is in parent and
unavailable.) But anyway the problem occurs, with no particular dmesg from
witness or debug_lock.

On the other hand, on the standard generic kernel, when the issue is not
occurring, the following dtrace is shown

# dtrace -n
"fbt:kernel:mii_pollstat:*,fbt:uether:ue_tick_task:*,fbt:if_ure:ure_tick:*,=
fbt:if_ure:ure_ifmedia_sts:*,fbt:kernel:mii_tick:*"

  0  92491            ure_ifmedia_sts:entry=20
  0  35254               mii_pollstat:entry=20
  2  35255              mii_pollstat:return=20
  2  92492           ure_ifmedia_sts:return=20

  3  92425               ue_tick_task:entry=20
  3  92489                   ure_tick:entry=20
  3  35276                   mii_tick:entry=20
  3  35277                  mii_tick:return=20
  3  92490                  ure_tick:return=20

Which are the two "code-path" checking for link status. Now with the same
dtrace probes, when the link up/down problem occurs, I see=20

  3  92425               ue_tick_task:entry=20
  3  92489                   ure_tick:entry=20
  3  35276                   mii_tick:entry=20
  0  92491            ure_ifmedia_sts:entry  <----
  0  35254               mii_pollstat:entry  <----
  3  35277                  mii_tick:return=20
  3  92490                  ure_tick:return

How that is possible? ure_ifmedia_sts should acquire the same mutex lock as
ue_tick_task before calling mii_pollstat. And this is not happening apparen=
tly.

--=20
You are receiving this mail because:
You are the assignee for the bug.=