Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21909352ybl; Mon, 6 Jan 2020 13:55:51 -0800 (PST) X-Google-Smtp-Source: APXvYqxVkWH25etGMKE5YQG4vvH0J5YQ4qASvChu4AqP8sb2K9AUYr6zqBWz1ZAak3cA2php5xA4 X-Received: by 2002:a9d:70cb:: with SMTP id w11mr102573402otj.230.1578347751846; Mon, 06 Jan 2020 13:55:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578347751; cv=none; d=google.com; s=arc-20160816; b=K9EZE87fyUNNHUYeX0i2JlXsppb6oObK1a3IOghWN2kFHkXRj8LN9Tg7mgZUcsCnRO /MFpKsPZd/2SruCKwrYvyUJ1KcZHHtfTjlvAor2XIfSkvJ3RbG4VI9QXcj+B7GQfVPiu 9LqvIfnr0Rkl/0JOg8R0tt0zkdlV3+CCg5/sR2pRneTZhyXiTwzPy3dpJm5sL1Lt5v2R GtKvcIvGpz1yBl1DtGue2OMTVo8iy72SCX7A633a6StkqLIHSvRTN1zAM+FLYTFeo02G 934q7uUQRukjekrExnFne12W3WnY+bXvuQpwKr9dQsL06X8C+m9tm+2JoMe6SLkwejQr Fbow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :dkim-signature; bh=vmmECI1BArQVwUDJptXcPvRtU+ySdyFJRPuvbFtEwis=; b=MWFvLwa3M8ktraFueSCfzAazmM19AQaBT43IWfE2sxva+OJlnRTYgdTrtlJpGCECGV Kip69DFeuMc/ES8JaRffGMxECkx2JkR/TbiBVv61i2UzFUq7TL6dr3yBykPYXbRuvWlc 8N3cBT8tVnLB7d9N9rCZZx663xYcmkfffQppnNAoOx0uHKVj6XvMSJpj5giFaBMCLBJe YkDSt3Jb1B1/AF2q+W2KdKbkw4oaD/jIdmYfKRegx68tUcDibbNToDjF5W+Bi2rUTAxZ 9VkSqkfCk4fs9RfpxedUcAlAr2iCDNMXeHR2rk5Oglh6Eehlo7AZ+5L2MrRuVWQC1+Fw 8uZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LjCtEYgp; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i20si33579783otk.270.2020.01.06.13.55.31; Mon, 06 Jan 2020 13:55:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LjCtEYgp; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbgAFVz2 (ORCPT + 99 others); Mon, 6 Jan 2020 16:55:28 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58834 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726731AbgAFVz2 (ORCPT ); Mon, 6 Jan 2020 16:55:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578347727; 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=vmmECI1BArQVwUDJptXcPvRtU+ySdyFJRPuvbFtEwis=; b=LjCtEYgppRW2Uw0WHIadd4vNzmJNVA6glK9u4Jfge/eQFyEn9TzPdU5gAHOTbOVa67KolJ kDTULtjNdZ2Z7jDK0+WZoNxr+psMH7TVZ0DM49eDfd5R9Ylz9cRUK5kTuDnMV3RexfN3Ub ryPxEaBj/L/s4092rLUt07aLxHzWVv4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-RrKuuhBfPFKSJHwusUSmsQ-1; Mon, 06 Jan 2020 16:55:23 -0500 X-MC-Unique: RrKuuhBfPFKSJHwusUSmsQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DAF7800D48; Mon, 6 Jan 2020 21:55:21 +0000 (UTC) Received: from localhost (ovpn-112-4.rdu2.redhat.com [10.10.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28C537BA28; Mon, 6 Jan 2020 21:55:17 +0000 (UTC) Date: Mon, 06 Jan 2020 13:55:16 -0800 (PST) Message-Id: <20200106.135516.1925975914161500836.davem@redhat.com> To: mkubecek@suse.cz Cc: netdev@vger.kernel.org, merez@codeaurora.org, kvalo@codeaurora.org, linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, romieu@fr.zoreil.com, linux-kernel@vger.kernel.org, andrew@lunn.ch, f.fainelli@gmail.com Subject: Re: [PATCH net-next v2 0/3] ethtool: allow nesting of begin() and complete() callbacks From: David Miller In-Reply-To: References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Michal Kubecek Date: Mon, 6 Jan 2020 07:39:26 +0100 (CET) > The ethtool ioctl interface used to guarantee that ethtool_ops callbacks > were always called in a block between calls to ->begin() and ->complete() > (if these are defined) and that this whole block was executed with RTNL > lock held: > > rtnl_lock(); > ops->begin(); > /* other ethtool_ops calls */ > ops->complete(); > rtnl_unlock(); > > This prevented any nesting or crossing of the begin-complete blocks. > However, this is no longer guaranteed even for ioctl interface as at least > ethtool_phys_id() releases RTNL lock while waiting for a timer. With the > introduction of netlink ethtool interface, the begin-complete pairs are > naturally nested e.g. when a request triggers a netlink notification. > > Fortunately, only minority of networking drivers implements begin() and > complete() callbacks and most of those that do, fall into three groups: > > - wrappers for pm_runtime_get_sync() and pm_runtime_put() > - wrappers for clk_prepare_enable() and clk_disable_unprepare() > - begin() checks netif_running() (fails if false), no complete() > > First two have their own refcounting, third is safe w.r.t. nesting of the > blocks. > > Only three in-tree networking drivers need an update to deal with nesting > of begin() and complete() calls: via-velocity and epic100 perform resume > and suspend on their own and wil6210 completely serializes the calls using > its own mutex (which would lead to a deadlock if a request request > triggered a netlink notification). The series addresses these problems. > > changes between v1 and v2: > - fix inverted condition in epic100 ethtool_begin() (thanks to Andrew > Lunn) Series applied, thanks.