From owner-svn-src-all@freebsd.org Mon May 13 22:10:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11335159C120; Mon, 13 May 2019 22:10:19 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yw1-f68.google.com (mail-yw1-f68.google.com [209.85.161.68]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8703A7070B; Mon, 13 May 2019 22:10:18 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yw1-f68.google.com with SMTP id q185so12318579ywe.3; Mon, 13 May 2019 15:10:18 -0700 (PDT) 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=qkKLrEaY9WbdrD28Mq3TG+CqxIXQHRdW62x4Zm5IjgY=; b=VvCWDt2WOlryOAMWe/qYxibEKkqLjeY1YJh0xewL8y81ETPjQ5G8X86v1SPD9RyA6U 8kQwioorRaZKirglMj871BYMivplJsg9o6XiQ7/1SJMfLwF4javdZy0Vwg4gkl8YSVaS IAXpdDCZzTwn9lIH1M/tQR4zT0uTi3jgBjT5nBNTMCXe6NEpNw8YA4lkLDH8QOuvqzA4 H/jiZBsX0wPBKgkM+HsItvVsEpt03Za6E7UEZxC8NtqiOZX9xLCeRPuSJo8e03qy3FAU 5fuzZvK5GHW+HjHyxjjWtN+rBrzW3hPduMK771BV1xzyNk0GB905+GDJLVFqeQ3YVrAZ VLug== X-Gm-Message-State: APjAAAUS/5gRMQ+WR3ZKZAlHL1ECez4vmPglSauXI5sBEIdboIlcJ0kp nASoeaBdZqtAPcN3tWrrVzUEEsRRC3cDLTDg9Ur2AnOLRtU= X-Google-Smtp-Source: APXvYqw0RHsct/N3piuNLJaYSO/FlXSuGJ0Hh73/Zo+Tvy8lbzDEFpMEMSqq0AaSwIEb4R0IsdwwNSIzD+Ib4xB4mbA= X-Received: by 2002:a81:a34a:: with SMTP id a71mr5002222ywh.318.1557785411817; Mon, 13 May 2019 15:10:11 -0700 (PDT) MIME-Version: 1.0 References: <201905131345.x4DDjTRn092669@repo.freebsd.org> <20190513193754.GA37655@raichu> In-Reply-To: <20190513193754.GA37655@raichu> From: Li-Wen Hsu Date: Mon, 13 May 2019 18:09:59 -0400 Message-ID: Subject: Re: svn commit: r347526 - head/sys/net To: Mark Johnston Cc: "Andrey V. Elsukov" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, melifaro@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 8703A7070B X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; TAGGED_FROM(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2019 22:10:19 -0000 On Mon, May 13, 2019 at 3:38 PM Mark Johnston wrote: > > On Mon, May 13, 2019 at 01:45:29PM +0000, Andrey V. Elsukov wrote: > > Author: ae > > Date: Mon May 13 13:45:28 2019 > > New Revision: 347526 > > URL: https://svnweb.freebsd.org/changeset/base/347526 > > > > Log: > > Rework locking in BPF code to remove rwlock from fast path. > > > > On high packets rate the contention on rwlock in bpf_*tap*() functions > > can lead to packets dropping. To avoid this, migrate this code to use > > epoch(9) KPI and ConcurrencyKit's lists. > > > > * all lists changed to use CK_LIST; > > * reference counting added to bpf_if and bpf_d; > > * now bpf_if references ifnet and releases this reference on destroy; > > * each bpf_d descriptor references bpf_if when it is attached; > > * new struct bpf_program_buffer introduced to keep BPF filter programs; > > * bpf_program_buffer, bpf_d and bpf_if structures are freed by > > epoch_call(); > > * bpf_freelist and ifnet_departure event are no longer needed, thus > > both are removed; > > > > Reviewed by: melifaro > > Sponsored by: Yandex LLC > > Differential Revision: https://reviews.freebsd.org/D20224 > > This seems to introduce a possible recursion on the bpf cdev mutex. Now > bpfwrite() holds the mutex over the if_output call, which may enter > bpf_mtap() via bridge_transmit(), and bpf_mtap() may attempt to > reacquire the mutex. It does, the sys.netinet.fibs_test.arpresolve_checks_interface_fib case can trigger a panic: root@:/usr/tests/sys/netinet # kyua test fibs_test:arpresolve_checks_interface_fib fibs_test:arpresolve_checks_interface_fib -> panic: _mtx_lock_sleep: recursed on non-recursive mutex bpf @ /usr/src/sys/net/bpf.c:2325