Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp842605ybi; Fri, 7 Jun 2019 19:20:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0ASUDFsvkSDRMqKdxQz568FV240rvaDuV595LIm/n1ir8rlLTAUlmoM+UaDNvNu3FvkpC X-Received: by 2002:a62:3145:: with SMTP id x66mr63334101pfx.223.1559960444968; Fri, 07 Jun 2019 19:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559960444; cv=none; d=google.com; s=arc-20160816; b=FYZBNtEMUCubrkzTxjERPrIFS7mI26U2INbUagh600+uMqN8g3Il0yg2ufORuh0aDA CLxxdBeSVkkdaLwKZRfYbyA8QMTULtd6XFR3YFJvtCyIYv972UK2IiL+MG9pVRfvsTCk H9jFe9GW6zb8XFSM9lxTyKAz9yx9ogYadcf3Ojhwz9264QNvfcWLKq6LCKFwphg4c3kP ayptsO12Oh/oKPwJzJ3iNlag6hXSrpgyw5UOgHY9T8EzP5vQIYZhj55jeCQTBh1xcV1n jmTFM9CwIDhfPSxGtWEPRDn05ItHTGnVkmjR5C5KR4XWOB0Ch8pc1w7pEiVfjsmUcQ00 hT2g== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=VTzWwngxPn7YyI3XNpgYPusalulagXtL7uonX4g/D38=; b=0+V5FzCaHXLOXd2AjQ5pVfIDReRWwqvhZQMKlSFqMlO/gXq8rJh0AJKCF/0vlJ194s VkeQv1QmzS0lk99WW9oB5lkjOaxqQFv9CXVBVkswtrYWknbSN7kvUDv6P5Wr0vSeql4o Gr81XzskcnBA3M5WuizxJFCggPUTdRIx7M4cYVWOokepxQFrMOBg11fUsfRyORs6zJhE BpqVbcDTtvQlRau47rC1G2RxwbHtAdPJtmVLSIpTzLI+Oe+6+ATHtnHsMx1Aeit+LCZy vXXmdnuafQ1DfvgiFSvbwt74zV8FUrlVhPHMtTFePF8aM2iZfWErk36oTQ5kT9OegPCw Ub4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="bOOMgC/P"; 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 m127si3419746pgm.231.2019.06.07.19.20.28; Fri, 07 Jun 2019 19:20:44 -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=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="bOOMgC/P"; 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 S1730529AbfFGXcB (ORCPT + 99 others); Fri, 7 Jun 2019 19:32:01 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40786 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbfFGXcB (ORCPT ); Fri, 7 Jun 2019 19:32:01 -0400 Received: by mail-pg1-f194.google.com with SMTP id d30so1914880pgm.7 for ; Fri, 07 Jun 2019 16:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=VTzWwngxPn7YyI3XNpgYPusalulagXtL7uonX4g/D38=; b=bOOMgC/P21zWjKT9xBiJT6w4SUTILrqWFCEkD+HiuqJZ4/AXnT6ykjTCAUiKGhS27g qPbHk8Nji1CYrI0iD5hMRCu+XP2nY6Q68AbBWKS+cD/jRrgzuQs8ib2OlPnBUrLguL6c 1sTyyKsaBeik3WfK14pxVI7jzu6xzonbkvnQmnjXxfyIs1oQtGSmL5uNqUvF9EaIKSPu 6mtCjYXzfbdEk/2fhBieW8HKJ2U/TbOwt7i+PqgyBmq5dJahD5iDnGVc1PaER9+9rsVe 6gOT2FiFoeCywuoXzOBM8LGiLFxD4wzCDOoRWgL1ffcN31Mqh0L3g/ZEm8g47Rog+QYW y2Zg== 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=VTzWwngxPn7YyI3XNpgYPusalulagXtL7uonX4g/D38=; b=UlRUvvmTrMueIP+BFHMhbQGVLiLPldpcY9fbWbNt/LKVsQUVLvr1MKaI/lm5WZ//4Y DAqn0nBCpXFQKchHgozKSr0yQSx03BwfQgvRuq4Jgp4P5UVQZG8PSvL4KWBJFrGug44X X+8/dTT3Q6XglD5/GT31gcV5eqEz0k1lcMiZF8q0ak19hWBIALHLQtrm509QGbO2/1gL qqczi+7BoY7HPxZ44Krw22NLzv1VP7B4MWQ5xY+2XcZw8bs157qhD/pQBH3E8OV6S3jz 2iHtyH2Yekfk9Jc5RUI7+LOENzMEmbDPzB3dsE7aicNz0Mjfk9Z7k+gS+aKfBCmuda1H SJSw== X-Gm-Message-State: APjAAAWWH9t0iMK6BeR2GQF/PfLJQwj27E4oAab/oUrlA2hDqE6LprX+ sevja+4bZei8PNDJrf7ddkJK7w== X-Received: by 2002:a63:5024:: with SMTP id e36mr5430701pgb.220.1559950320726; Fri, 07 Jun 2019 16:32:00 -0700 (PDT) Received: from cakuba.netronome.com (wsip-98-171-133-120.sd.sd.cox.net. [98.171.133.120]) by smtp.gmail.com with ESMTPSA id 85sm6135458pgb.52.2019.06.07.16.31.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 16:32:00 -0700 (PDT) Date: Fri, 7 Jun 2019 16:31:56 -0700 From: Jakub Kicinski To: Ilya Maximets Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, "David S. Miller" , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon Subject: Re: [PATCH bpf v2] xdp: fix hang while unregistering device bound to xdp socket Message-ID: <20190607163156.12cd3418@cakuba.netronome.com> In-Reply-To: <20190607173143.4919-1-i.maximets@samsung.com> References: <20190607173143.4919-1-i.maximets@samsung.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 7 Jun 2019 20:31:43 +0300, Ilya Maximets wrote: > +static int xsk_notifier(struct notifier_block *this, > + unsigned long msg, void *ptr) > +{ > + struct sock *sk; > + struct net_device *dev = netdev_notifier_info_to_dev(ptr); > + struct net *net = dev_net(dev); > + int i, unregister_count = 0; Please order the var declaration lines longest to shortest. (reverse christmas tree) > + mutex_lock(&net->xdp.lock); > + sk_for_each(sk, &net->xdp.list) { > + struct xdp_sock *xs = xdp_sk(sk); > + > + mutex_lock(&xs->mutex); > + switch (msg) { > + case NETDEV_UNREGISTER: You should probably check the msg type earlier and not take all the locks and iterate for other types..