Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3526198yba; Mon, 29 Apr 2019 04:06:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDm26goIke7Ne281W82+5xwR0OiHq+pqHC0oGPRbWEctDgg42/4Y2abFVNQHnpAZ5rnCe8 X-Received: by 2002:a65:6554:: with SMTP id a20mr59057173pgw.284.1556535984160; Mon, 29 Apr 2019 04:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556535984; cv=none; d=google.com; s=arc-20160816; b=S94HrwccNmA1dWUz/xVz3Vb0XYKCblk9W75ZKt6CjiMQN9RjCzjffYXA9GGhhp1lwb FQ3PRCx5tn7vMCNFEREIl7P1zyrwlHHxeiHGSNE/jnrZ8Pfj1vKkI8Bez102UGbLXO/k 5bgY3QQWotUih/YxpkEuNr2NfUF33oRPLKJsbcni/lD+hJck+SLw7oO/8TmvZA3AyTFz DzfnfnBRKOMjryKyQphXylHR2hvzFp7YVEA1d5U6J4rhT7ax/MnZGzh7wrRlc2rhaEzt tGT9tyf7auocwkZehUaj2Me86WVZtiHzX3JLCUd5+xwVhr7b6B6z7ndjgHlrvlrxdlVR wrew== 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:dkim-signature; bh=JyCdc5gZkR3Qq1DjvPmdztMb+4DbBLd30vsC8ayEy68=; b=WT/nkrcd2MHOopTVQ8h0jbxA0ThKT5o6+EoBpmvaeRZiYGc/ChlkJBY7hKcU1IzBsW KDSA2KMpC77wIP83OxiuG700JMZnokVNuVm16fYHc1Xg8nArO58cgO+Ntux0BsdeW9mD SfyLVdQDnoSjnomq6x28ICqzYRJMuh0Yq3P0qsUx9/IWZ//LKQ8EWu79CNA3k/BkrH2w YwXTCHgMabX6fFiCCRd0f16rYY4rV99Z63K8dbtkz3FRxLvf7SvsNcUpoTUAdOgm9INA +5lAzlsHMlEIlwuG9ajrKMAqFYf6ZbCqfAbROegTyx/hSCuuucG6kuHjI92B1uimhA7w sd7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=JwqPiMml; 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 v2si31728397plp.191.2019.04.29.04.06.08; Mon, 29 Apr 2019 04:06:24 -0700 (PDT) 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; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=JwqPiMml; 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 S1727896AbfD2LFP (ORCPT + 99 others); Mon, 29 Apr 2019 07:05:15 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38089 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727710AbfD2LFP (ORCPT ); Mon, 29 Apr 2019 07:05:15 -0400 Received: by mail-wm1-f65.google.com with SMTP id w15so15091962wmc.3 for ; Mon, 29 Apr 2019 04:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JyCdc5gZkR3Qq1DjvPmdztMb+4DbBLd30vsC8ayEy68=; b=JwqPiMmlkBbRl+8STUVjxV7mu9j7I9gu+7xnz+6/MRSZPfd0eELUIPE13g2nyX1BcP UJ3Rfh2muIiKCN+2iUciSFXr9sgT3tYCivqYlZB5CWJBd9DXFdvJAiA8ZkzLlAEgbG7m 3LIWHCLCnZa+bQNv0EB1Xga3wL+CF+uEDr+8kYERbI2zFYf947r5Z/2Xo8zUpg1RoZEX tRhQVLMuF/TO/OHURICfhahTD61AnI6q92mzExtbtl7Un0WSPReAuC7MZCt9seOwI6Vm TJlf2YCzkw8qBGfmLQ/dRZ//eEd8pBGPKFDljgyRL+/dYfRMksu3/NDmFevCwp2B41IF WGeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JyCdc5gZkR3Qq1DjvPmdztMb+4DbBLd30vsC8ayEy68=; b=YrVNRBSTYkcYI9+K43Rwsa3qPMuDn22H3ZNRJuOWgJCcBoVCUwZz/3lmFtle47he33 tktdIvwNyn1zgnTlOYiB1K6JnJyMp3Ly9RCA5VkQyG+Ps0C/Toe4RKm0M4erFAfV5Nir iNDfJXSJlM8gq+7K4XWULl6C3KxVUSC6hr7q5varOFRn8SbmsH3ZWNtYFasgVqR7BZjZ LyMBV3Tkh8fTyPiuekqtMPUzpFMmYErWD0oAr82AseiyiRVG/V+dquBdYEm4LRYUw4Wd 8BKKexQcTZt6xhiX5I8hofP5FiBUwQbo9i0vGUZ36oe3hx0pWix0QgPbG/ulal2ip7Bg eP7Q== X-Gm-Message-State: APjAAAWPXYxR4aBevfPbYTXmq9hduG4aqKUBmBeT1Hkj6p5M3LaGDwpP 9IX64T6oU5/J1QNAvn2dyYg8Jw== X-Received: by 2002:a1c:c181:: with SMTP id r123mr16610408wmf.13.1556535913172; Mon, 29 Apr 2019 04:05:13 -0700 (PDT) Received: from localhost (mail.chocen-mesto.cz. [85.163.43.2]) by smtp.gmail.com with ESMTPSA id z4sm10799474wrq.75.2019.04.29.04.05.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 04:05:12 -0700 (PDT) Date: Mon, 29 Apr 2019 13:05:11 +0200 From: Jiri Pirko To: Moshe Shemesh Cc: "David S. Miller" , Jiri Pirko , Jakub Kicinski , Saeed Mahameed , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] devlink: Change devlink health locking mechanism Message-ID: <20190429110511.GD2121@nanopsycho> References: <1556530905-9908-1-git-send-email-moshe@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556530905-9908-1-git-send-email-moshe@mellanox.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mon, Apr 29, 2019 at 11:41:45AM CEST, moshe@mellanox.com wrote: >The devlink health reporters create/destroy and user commands currently >use the devlink->lock as a locking mechanism. Different reporters have >different rules in the driver and are being created/destroyed during >different stages of driver load/unload/running. So during execution of a >reporter recover the flow can go through another reporter's destroy and >create. Such flow leads to deadlock trying to lock a mutex already >held. > >With the new locking mechanism the different reporters share mutex lock >only to protect access to shared reporters list. >Added refcount per reporter, to protect the reporters from destroy while >being used. > >Signed-off-by: Moshe Shemesh Signed-off-by: Jiri Pirko