From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD343BC681 for ; Fri, 27 Mar 2026 14:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774620392; cv=none; b=lJkLDh/iO7hDhPqXwNTmCJxmbfCvfmkwt2nEr7DwGojXTYZ7nlf5ADyCvGX/zMPrhvfVQIE54jTajQ9/3u0LkLSjwKASH6h/0fp6+UzY1WH3Qb3xQ5nybTYuC3/iYCNvQeo1fDJr39METSiKigYNaQtoBUP2me7SYRbx6OgRnhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774620392; c=relaxed/simple; bh=YG4r2XuxApAYu6LKzoe/5SwvEPoyF1OnlWcoZM1u4mI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PWvcDTBbDXzZnmS7STK8xfCMkVS4e9EdhQZgTD9f3kPXflMre5XAKPta23DQJJWUUCpSYdE2uz+rHTd/9BPdSMRJXxrmxdRVXoECtQq9AubbuO3orNzow3dOOWRfBtF00qKBV50WnycLUTwGbmQS80Km4ibZF7q3a1xgMS3XCTU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XJUcqaIg; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XJUcqaIg" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-43b40fb7f95so1876628f8f.3 for ; Fri, 27 Mar 2026 07:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774620388; x=1775225188; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QSUpIlblw1Y8p0Flz+2ps8AGucj2y3pRw8IP0aJ+OJI=; b=XJUcqaIgL71hXD8t8lZL96lttY7Xmh42IwKc368lwUvYfz9XpYn8Jd5XpIJeKwnEFm e8eEcTukPFBgYursd0S1J82POhJmnJ07m/jPGknii0EALdeJQlpPYMXIfLBUfdubcFIj v4nhPm+AeCgHb3KWllGs2ESKnlm4tp179tr921TTeSCc5Hr9eH1DjvukiwNCzf51SLoW 2MfPnhVEMpxMeVzt6APJbDIJZWCEvVK+wwNgO/1cEVZqpYH+ywjowG4JYq2Z2bxFnG7Z 6+zTinJphliFafoczfxB7EX2oh7tPuziJouOa+myu0yHg/jtkwyYv4++V98M6PyOO+TI ywGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774620388; x=1775225188; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QSUpIlblw1Y8p0Flz+2ps8AGucj2y3pRw8IP0aJ+OJI=; b=CM8XK2E6/uiiXRykb97oKGNMSiK95ci1MsfMjavyswh/Mwscyr3zOjHjUWpttoczN1 lhsUusdkOIIKUAkFUundumtz0sw412ASer5ppZifqGyfC9NT6E/bWvRijB7v9HCWobIE JcvKHWs5GyxQuL1B68huvig84HCTzG4pZjZE/ludiOnSEEn7WcfTm6LqZi28pt3H/M9v 0xZsL1PKqxgwAt9M+IXEarBn2WT84Xs44nMqcgVRrurjEGxJfvBy8e1fvwPj94rYaMEn CTm9DW+RwGpViCsYHcJhSiJEKIqjPS/NXKmfdaY+zsUw5Id4MX/vMaZf7MpZbiespMSY LICQ== X-Forwarded-Encrypted: i=1; AJvYcCX9FByacqtIsG9a/VPPmg1nCW7w/VqCrKCdT103uO8bEDMXs/6EW4owVoLo45wWhO8p0ACdujnUgKOD39I=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1WlxY/YqeYCWXGvIyva3ODc4wtvqt3aP6DLREc9QvMfrFJQcd s/aRwX/XYKKTuF+MhoGIsC98BfX9DgOj57P7r2ALf2rISlYvLGvTU02s X-Gm-Gg: ATEYQzw9S+urCC9PxN9GPxNl5ItzTahN7ZtgeFpXuNzqD0Z7j3zK6K7ifBD08LQMmFT matRUqtSUNu3iouEZmUAkN4BV7lmKX4z7mpjclZVQJI4KXzRH44GLWv4VOE3czN/yDy/8FzLaOt AK4ZCrHWCYctk5mIw9EP3dEAVH6dHRS261+LnGUTyXa/gEkAvVdtZ1jnkCK67VUeH3IU40qus38 fP1dRjY8X2t0ZoUq9HnIiLgCVV9/s2LPe/zlL4cnlLjy28tjn1yc4mKyJyode+Bhew4sWmNkwQH BDHYYfIXP7u+BlUycWptnS8YdAlL/JxAKb/rencANaLeaWi5Xpjrnxll62lmZ5OEJpHAYDbcoDD +IyBJE+Y4cJLhwqsGfolQH0YIZFdRQwkyuEizbkdcjn9HFVqHe68RlgzrEvqwjjp3d/DUn1UPok eBcO73+j7/36eRU/YxCwDtc2UPhgE7IP5xu+eLVw6TAGg5qdonDnZnUAFuNRdfjEBeTEDVObiAA VPgyBJLSRhIAw== X-Received: by 2002:a05:6000:4212:b0:43b:95e9:413c with SMTP id ffacd0b85a97d-43b9ea6390fmr4110385f8f.44.1774620388098; Fri, 27 Mar 2026 07:06:28 -0700 (PDT) Received: from orome (p200300e41f249a00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f24:9a00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b9192e305sm16052576f8f.8.2026.03.27.07.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2026 07:06:26 -0700 (PDT) Date: Fri, 27 Mar 2026 15:06:23 +0100 From: Thierry Reding To: Diogo Ivo Cc: Thierry Reding , Mathias Nyman , Greg Kroah-Hartman , Jonathan Hunter , JC Kuo , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 2/6] usb: xhci: tegra: Remove redundant mutex when setting phy mode Message-ID: References: <20260127-diogo-tegra_phy-v2-0-787b9eed3ed5@tecnico.ulisboa.pt> <20260127-diogo-tegra_phy-v2-2-787b9eed3ed5@tecnico.ulisboa.pt> <00aeda7a-e5e5-4779-b212-6e56c2c5ec31@tecnico.ulisboa.pt> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ktw4w3vv6m4wgb3m" Content-Disposition: inline In-Reply-To: <00aeda7a-e5e5-4779-b212-6e56c2c5ec31@tecnico.ulisboa.pt> --ktw4w3vv6m4wgb3m Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2 2/6] usb: xhci: tegra: Remove redundant mutex when setting phy mode MIME-Version: 1.0 On Thu, Mar 26, 2026 at 02:17:33PM +0000, Diogo Ivo wrote: > Hello, >=20 > On 3/24/26 11:48, Thierry Reding wrote: > > On Tue, Jan 27, 2026 at 03:11:48PM +0000, Diogo Ivo wrote: > > > As the PHY subsystem already synchronizes concurrent accesses to a PHY > > > instance with a core-internal mutex remove the driver specific mutex > > > synchronization. > > >=20 > > > Signed-off-by: Diogo Ivo > > > --- > > > v1->v2: > > > - New patch > > > --- > > > drivers/usb/host/xhci-tegra.c | 4 ---- > > > 1 file changed, 4 deletions(-) > > >=20 > > > diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-te= gra.c > > > index 8b492871d21d..927861ca14f2 100644 > > > --- a/drivers/usb/host/xhci-tegra.c > > > +++ b/drivers/usb/host/xhci-tegra.c > > > @@ -1357,15 +1357,11 @@ static void tegra_xhci_id_work(struct work_st= ruct *work) > > > dev_dbg(tegra->dev, "host mode %s\n", str_on_off(tegra->host_mode)= ); > > > - mutex_lock(&tegra->lock); > > > - > > > if (tegra->host_mode) > > > phy_set_mode_ext(phy, PHY_MODE_USB_OTG, USB_ROLE_HOST); > > > else > > > phy_set_mode_ext(phy, PHY_MODE_USB_OTG, USB_ROLE_NONE); > > > - mutex_unlock(&tegra->lock); > > > - > >=20 > > It looks to me like the mutex here is trying to protect against > > tegra->host_mode changing while we're setting a different mode. That > > doesn't seem to be taken care of by the PHY internal mutex. >=20 > After taking another look at it I think I understand your point for the > mutex, but in that case wouldn't it also need to be held in the writer > of host_mode, tegra_xhci_id_notify()? Yes, I think it probably would need to. I don't know how likely it is, but I think the purpose of this is to protect against the ID notifier firing quickly in succession. Although, given that this runs on a work queue and work queue instances are non-reentrant to my knowledge, I don't think we need the mutex here after all. > This patch has been picked up as-is into usb-next so it would be nice to > figure this out before it gets merged in the next merge window. Given the above, I think it's fine. Maybe the commit message doesn't give a correct reason for why we don't need the mutex, but the resulting code looks like it should be fine regardless. Thierry --ktw4w3vv6m4wgb3m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmnGjtwACgkQ3SOs138+ s6Goig//SnPG7Rf8K0gKeOP5TZWyD90YKXfxg4roWTYyRNVHdUU2H14n31xJS1Oo pMQvSFpK/kjChe09fFOUecq5vW68Rrfm2+Vi5rqfW+GHUlGo+5S70gJ8lbpV4wOh Ee7fuEilJgSjIMVxxwQY6rupnrXIPufzsSHGwbtaSYy04ibP9vhDn2REJ0bkIuZc AWzBBUQXf+aDMyKkliS5Ll15t54oQRdjZp/c02Zd1ffBX/6vx2/lx7hbSTBEm8mF eTyQV9XU3so3X9+mmff5uYEOLkHOxEJgOOVdMW8XDrTTLqR+PgTJ44zoGcOnCrNk 2sOuA8ThjZBqgmjmVvi1zTasc0jHB7McIwHD8XLHmBS1SM1k8y7Lwjzm3VXXqYOl aXaMCIEwzp+WeYuxLPDQp5Qj8HEbNmAqZMztnucMn0h6riFsFX1SICiQ7o8DXe3/ qTPjRWL7qvtiJSBCN068/hZF6l0m2hIfJqflvmF9CqDd4wzAfUqgSZiavmwpJpYt refzB/wklao+yrD+cp895hPidxJVmG6omcleeczxJmVVKWm6pOYJP3LCLGezArVn phgVYhRDOUvKWQk6sgtCqJbf6h0T1Nf1YvN/Cu1y6MAB1tgGiMUV6JEVuhaPN+kd PnN3cFTF/8ATfGpMSArmO8l4VYoGHx5FxgE/LFRPED4LZgaGlZU= =g7fB -----END PGP SIGNATURE----- --ktw4w3vv6m4wgb3m--