Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3583005ybi; Mon, 10 Jun 2019 12:47:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQqe5BAgt+hRRKIOeFh12HL51JFWWMKZDGGDh9I4ffAbiXITwvWuW3vu27kggD8wV0niTt X-Received: by 2002:a63:f817:: with SMTP id n23mr9491185pgh.35.1560196071000; Mon, 10 Jun 2019 12:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560196070; cv=none; d=google.com; s=arc-20160816; b=ozTx/Oiv86wGLQElvVqLJDsgS11H7MEkH8gXWFLIp7QBFGtXrjT8937X5u5nZyl0Mn YzWyio5xH+6UvMSs4OsG1v2bHzReVinaViBKpi8J4vXpFKKFp2HEVzyXb/jL7UIYEdxH pqscYTtyH5UGGijvPc3FUoOs6ViZgdEU2VQKcO6OmRrIuyQffjksALaw+CJTbj4qWhWr M3OlrqSMxKH1DdEpVS117bJH/VhCgVk3kxCGqCZC2xPL1J2VsQsWVOqVf5WhUaGvR2FV 3jwp4xBqEtxxL1hRT3HEHHT/KLOplPeTjhpawU6YDQ3b3sKCujNz+ObI0Edgi+0/Igzi bF3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=q6FJgYJZH5Fw8octjl9prEaDtOkXxZ/TH6CJsMI4oLA=; b=HS38O7CEB1KX2UQ2zyV5GloIQVl7xsF0I4IZKHoxrhiPt3S8AoaDpBJB6i2ay+OuJo LeH3Tl6ZzUWUVqeOrIqEGF3t5V5Lz+Zz7b2DDIUGWg79OKAF7HJCEyHOt78VpbrlKWcy ubbxKdRWvY7uS8ZmPyEsUa8T9oVro7TadNPz63pcYaTXATfmUeDi7/2xAjZ1/TjZKm4f tZQmk9/nID/97xB7b4oDxLMyB8m/DrCA7F/wgiZ39qxMCXP9AWr1FLqRBZNmS044MXS8 F/kGt9Y0Pgp/puhMnYklhvX1jUMfvNGk7IEwBwt1tlAYL4qXYFBGM7/BSS3uhqAp/WDJ hYHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Wi6BTnNL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si2343910plq.376.2019.06.10.12.47.35; Mon, 10 Jun 2019 12:47:50 -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=@gmail.com header.s=20161025 header.b=Wi6BTnNL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389282AbfFJTq3 (ORCPT + 99 others); Mon, 10 Jun 2019 15:46:29 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:37157 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388901AbfFJTq3 (ORCPT ); Mon, 10 Jun 2019 15:46:29 -0400 Received: by mail-qk1-f194.google.com with SMTP id d15so6197293qkl.4; Mon, 10 Jun 2019 12:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q6FJgYJZH5Fw8octjl9prEaDtOkXxZ/TH6CJsMI4oLA=; b=Wi6BTnNLSs132AE1rb41JulCjO93FXVZwTbIUwzkMlTmiFFfk9W8vewl42PtGGGjQ/ yDzRuyvCz9k5M6K8dpbxiVSEmBiM+peWbjI78FhZaeNlkpihe2/ldTs/rWfBbZAiS5gk 2KU+BjPlxgmDp7rWjngSG5h13+mY2G6+pwB657aM+JtovrcVBupvy2dMv3+jE/AcSGuF LY817fumUBN3D1Mi9mo/j/qYGNuIProVHiBXOqB7bLIEAIazDj0y1ZgzeX/Vdj0ls/3s zDDM4enyhJhFx56xR0QtiR/5+cA7odTSkI2+U9zvFKZcV7cqLUTkfy+XSfvaAkoBMB1/ PZng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q6FJgYJZH5Fw8octjl9prEaDtOkXxZ/TH6CJsMI4oLA=; b=g/IcVkOYzbKQQ0cNqPjjCrX2ve3KNvgffS2OcpeKpHloY03oon+96jbA6HHzDub0mE TEbcMS96eindZaWLTtMB+8NmTJKgtJ2boXBomS8HRypVQPKpmcahtUib8DBV3wvLMO5F t1p6PIYfbwmK5MocKNyo75jICTkEkdtJsQwJzHBPWzBEVkPkwgAbBssyX2NmMNbshAe6 aH37gxrV0C7E/bBUD1/yZui3AUPqfUiS8REQf6p/d/z/kjxutC5qA0XljSvFuvWGoGBA ZwmanDCri91tquNtCnmI80HWV2IynzMZAZePanPwOKHXcAWQx4sR2XMiCTdJN9werQYM n7ow== X-Gm-Message-State: APjAAAVDIIYsPKM79biY/0dUgvRiOIjPc/iBrbN8mMGzl3/sffMPKhhk dBRvyzoGXkNJlZZMRiSVbeJBxQBqotKnNbSqcvE= X-Received: by 2002:a05:620a:5b0:: with SMTP id q16mr55641369qkq.212.1560195987928; Mon, 10 Jun 2019 12:46:27 -0700 (PDT) MIME-Version: 1.0 References: <20190610161546.30569-1-i.maximets@samsung.com> In-Reply-To: <20190610161546.30569-1-i.maximets@samsung.com> From: William Tu Date: Mon, 10 Jun 2019 12:45:50 -0700 Message-ID: Subject: Re: [PATCH bpf v3] xdp: fix hang while unregistering device bound to xdp socket To: Ilya Maximets Cc: Linux Kernel Network Developers , LKML , bpf , Xdp , "David S. Miller" , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 10, 2019 at 9:39 AM Ilya Maximets wrote: > > Device that bound to XDP socket will not have zero refcount until the > userspace application will not close it. This leads to hang inside > 'netdev_wait_allrefs()' if device unregistering requested: > > # ip link del p1 > < hang on recvmsg on netlink socket > > > # ps -x | grep ip > 5126 pts/0 D+ 0:00 ip link del p1 > > # journalctl -b > > Jun 05 07:19:16 kernel: > unregister_netdevice: waiting for p1 to become free. Usage count = 1 > > Jun 05 07:19:27 kernel: > unregister_netdevice: waiting for p1 to become free. Usage count = 1 > ... Thanks. I hit the same issue quite often when using veth driver to test AF_XDP. > > Fix that by implementing NETDEV_UNREGISTER event notification handler > to properly clean up all the resources and unref device. > > This should also allow socket killing via ss(8) utility. > > Fixes: 965a99098443 ("xsk: add support for bind for Rx") > Signed-off-by: Ilya Maximets > --- Tested-by: William Tu