From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 448DE2877ED for ; Tue, 3 Feb 2026 11:32:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770118375; cv=none; b=boscEdPImgQpy6YmCL8vOTygN6zRCt2ofMHX1aZDlTAvx7apcWXHjlkKXuxiLsoZW11QyqR0LRJMJlIRQuq7JUmzI4YBIlUtLcRzJhOZE2HnbKT4f2z72K7PsmPObvrQgYBdT21mdroCuYVFC6n9savOFF2g7gXTtx30m1P7i0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770118375; c=relaxed/simple; bh=fvyV02ZW3kLZ2e5V7ZC1CiXFpmVv76IxX1uzkp0TxLo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iJ4JaMFnSaitcdgW1wfqgGaGFyRAyQDQH73KTuPUUwWwpt9abgzei5vyhp7+TArcur7DFVKy49/O1MiVNlv5LNJRwzmmqUcsuaEl0VkNu/cNNp6fNoSyrwzWdmusQMcEonIbnFWOuvQZg0C3PeDzprD4hH2pd8s9zCMyGh2wjVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F6B0+8qW; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=tynBgFKy; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F6B0+8qW"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="tynBgFKy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770118373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WCFzyXHFlPrMBFKkr2XvCqwF53SaNdsFKd3C1yICKWI=; b=F6B0+8qW9t5XaGMLWv62g/c9CWO3ds5hTK+T/uXuMtmcwFoBYdfO651dFIAhFDodgmiRgl vRBptYhUslzm5nX59PWOn8I20by0exhGUofN+BnafJSNeAN6rF8KoM8LMrDAa6U3KVd+IP 0ouXlCVqbuVr9wR/zlTZBVxu9weUV5s= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-395-vyqt-WtkNjeu6utJ8bdTGw-1; Tue, 03 Feb 2026 06:32:52 -0500 X-MC-Unique: vyqt-WtkNjeu6utJ8bdTGw-1 X-Mimecast-MFC-AGG-ID: vyqt-WtkNjeu6utJ8bdTGw_1770118371 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4802bb29400so69182905e9.0 for ; Tue, 03 Feb 2026 03:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770118371; x=1770723171; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=WCFzyXHFlPrMBFKkr2XvCqwF53SaNdsFKd3C1yICKWI=; b=tynBgFKy0qAyy7GwXSMkQk0Pv2earhvBOmalSCGZxSY5K1OObbRWoj4VKewai5NYHM gN/6VnDZM9M062r+l8uwmNOBOvcNJFu57agARIWf4fzZbQ4BZLfLWhD/qNS/Bz/bq7rU Q4tNgU7iuIzw/kFtERsKWcoPe6MygtoAwR7Rb6yQYsxWytcZGj200fz2nSKsr+6F2dBr 0H48yWHlIMP182Na8VwEK1r00bn22aJCiCJLumTLOAijZOPlzWGuJpcQBNIPOsYFWDWi Mn7Pa1Wy3Q68/DDG62t45WzbpTMTpt8uUD1GawiB40+3WPy7jwzSkT7Sxy0DG2+R48XB ZxIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770118371; x=1770723171; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WCFzyXHFlPrMBFKkr2XvCqwF53SaNdsFKd3C1yICKWI=; b=GgXi/vWaR5evgIFYLLpbZ5y2O2GmR7hlXpufBV55bRzmtQ8rthatTbsnfaKAqmCM7c YS0hwFIqg4f+SXE5j8d9t1DAxD7gpYevT5nC/l5J5HGinS+S7h5BYMuzCCR2MBGzbl9V IR3LVxI16W5qY3/Pjm0Kz3HUfzz7sIzG6fyzPfr3zmiQ66JIW41yfbVmLvA/tatgZbf0 2DJdPYc0xR0oY1/QkH8pBcUhK7lnia2qvjH8TeNDB2sgwqCtrKV1t9qzCHG4tbYBlhyM NFnnNbxQK9b5O84bVZFuNvaCdR7b1pnr6nOWXHakEKXlqCEc34xE2ye9l5F6ZPZsl8hX 0lrw== X-Forwarded-Encrypted: i=1; AJvYcCXKXxTohuX9QqGQTDy5uTvg61aJVyr2SkwbJhVcYFDcz8pfibpQ6v8IdamDCfLR2B+blvbhxisqcpO4upw=@vger.kernel.org X-Gm-Message-State: AOJu0YwlPNlncCtYJ4UGmyB2u3FXtL33TKr+Kuv0QUfiCCuhHE6X3bqV zjF46hlAWcR/IBurOaxT+0nNbul700MJnwbdnP7gCxmZddBfJpWInqcdwyeSeQ4va1PZcZbi1WO I22cjnsFgjcjJ61tUkVgFPvduegt2kVmB+EwX8FNK+AyA78r/TmsfXt/y4VhX2J1thw== X-Gm-Gg: AZuq6aJpQgXV6G/K6DbLAMcfd0O6mgnNTF29QPuZRi7DiBRjLI/YcJgtEtJtZFp1+JL 3QRf952QxqXjhPatUGxfeZaFP3WK/gJhPJMtBZNKCzzjFrwauLA6nML1t26B6I7XeX3qc7yRLQs akQm2fgUy2on7gSkrNTKnGlJQON6Db2wP7fUbCeCbWy51Q6AkLWoQtRwovgYjAY+sXtv1jc581L 68g9TQ6+3ZWN+MWryrH3wy+ek8xpHwoz6LP+pgkYsXq1RxRFEGIn5gvlNqJ4GJZWHyRa6MFbVok 64PouD2NZdyVQFwQgiSkLYRJv9DdfNG55i/eUkDWMYZZGcnsrqRe2n0PKmap693nlIy+OMXFnqi 9YoryReUn X-Received: by 2002:a05:600c:474d:b0:46f:c55a:5a8d with SMTP id 5b1f17b1804b1-482db44d141mr233861645e9.4.1770118370846; Tue, 03 Feb 2026 03:32:50 -0800 (PST) X-Received: by 2002:a05:600c:474d:b0:46f:c55a:5a8d with SMTP id 5b1f17b1804b1-482db44d141mr233861205e9.4.1770118370338; Tue, 03 Feb 2026 03:32:50 -0800 (PST) Received: from [192.168.2.83] ([46.175.183.46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4360ef9e804sm9385010f8f.41.2026.02.03.03.32.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Feb 2026 03:32:49 -0800 (PST) Message-ID: Date: Tue, 3 Feb 2026 12:32:47 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Intel-wired-lan] [PATCH net] iavf: fix deadlock in reset handling To: Przemek Kitszel , Jacob Keller , Jakub Kicinski Cc: ivecera@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Eric Dumazet , Stanislav Fomichev , Tony Nguyen , intel-wired-lan@lists.osuosl.org, Paolo Abeni , "David S. Miller" References: <20260202084820.260033-1-poros@redhat.com> <20260202155813.3f8fbc27@kernel.org> <14cb0b22-ec39-43e4-a35b-22ad558b2e34@redhat.com> <7907d42e-4805-48bc-aaf6-16cbe46eb1d2@intel.com> Content-Language: en-US From: Petr Oros In-Reply-To: <7907d42e-4805-48bc-aaf6-16cbe46eb1d2@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/3/26 11:19, Przemek Kitszel wrote: > On 2/3/26 09:44, Petr Oros wrote: >> >> On 2/3/26 02:00, Jacob Keller wrote: >>> >>> >>> On 2/2/2026 3:58 PM, Jakub Kicinski wrote: >>>> On Mon,  2 Feb 2026 09:48:20 +0100 Petr Oros wrote: >>>>> +    netdev_unlock(netdev); >>>>> +    ret = wait_event_interruptible_timeout(adapter->reset_waitqueue, >>>>> + !iavf_is_reset_in_progress(adapter), >>>>> +                           msecs_to_jiffies(5000)); >>>>> +    netdev_lock(netdev); >>>> >>>> Dropping locks taken by the core around the driver callback >>>> is obviously unacceptable. SMH. >>> >>> Right. It seems like the correct fix is to either a) have reset take >>> and hold the netdev lock (now that its distinct from the global RTNL >>> lock) or b) refactor reset so that it can defer any of the netdev >>> related stuff somehow. >>> >> I modeled this after the existing pattern in iavf_close() (ndo_stop), >> which also temporarily releases the netdev instance lock taken by the >> core to wait for an async operation to complete: > > First of all, thank you for working on that, I was hit by the very same > problem (no series yet), but my local fix is the same as of now. > > I don't see an easy fix (w/o substantial driver refactor). > >> >> static int iavf_close(struct net_device *netdev) >> { >>          netdev_assert_locked(netdev); >>          ... >>          iavf_down(adapter); >>          iavf_change_state(adapter, __IAVF_DOWN_PENDING); >>          iavf_free_traffic_irqs(adapter); >> >>          netdev_unlock(netdev); >> >>          status = wait_event_timeout(adapter->down_waitqueue, >>                                      adapter->state == __IAVF_DOWN, >>                                      msecs_to_jiffies(500)); >>          if (!status) >>                  netdev_warn(netdev, "Device resources not yet >> released\n"); >>          netdev_lock(netdev); >>          ... >> } >> >> This was introduced by commit 120f28a6f314fe ("iavf: get rid of the >> crit lock"), and ndo_stop is called with netdev instance lock held by >> the core just like ndo_change_mtu is. > > technically it was introduced by commmit afc664987ab3 ("eth: iavf: > extend the netdev_lock usage") > >> Could you clarify why the unlock-wait- lock pattern is acceptable in >> ndo_stop but not here? >> > > perhaps just closing netdev is a special kind of operation > > Other thing is that the lock was added to allow further NAPI > development, and one silly driver should not stop that effort. > Sadly, we have not managed to re-design the driver yet. I would like to > do so personally, but have much work accumulated/pending to free my time > I agree, the unlock-wait-lock pattern is fundamentally flawed (I now understand why it is unacceptable) and should be avoided. What can we do now? * Eliminating the wait is not an option: As noted in the description of commit c2ed2403f12c, this wait was originally added to fix a race condition where adding an interface to bonding failed because the device remained in __RESETTING state after the callback returned. * Passing the lock into reset is impractical: The reset path is triggered from numerous contexts, many of which are not under the netdev_lock, making this even more complex than a full refactor. If dropping the lock is a no-go, the only viable path forward is to split the reset_task so that the waiting portion is decoupled from the netdev_lock critical section. The fact remains that MTU configuration and ring parameter changes are currently broken in iavf. Changing the MTU on a Virtual Function is a fundamental configuration not an obscure edge case that can remain non-functional. I would appreciate any further guidance on how you would prefer...