From owner-svn-src-all@freebsd.org Mon May 13 19:38:02 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 CECA21599635; Mon, 13 May 2019 19:38:01 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it1-x12a.google.com (mail-it1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 6BD2E6A711; Mon, 13 May 2019 19:38:01 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it1-x12a.google.com with SMTP id q65so1057780itg.2; Mon, 13 May 2019 12:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Nk/8sfq4Tok6/qoaRcuxwjKDdJ7+AcJxrUL1JPkWuSo=; b=eOlG81UDgtTjgXQM4Swf2wWDXzheb/s83nRSVDE+unXPHmiPL6BI+AlTBB+lUir0e7 1MHnhbnDbcv1Pf/VdvroChX89cm1q//GgCDVzIYJUC536ME3kAWdkFp1SNIRNGplA2g3 q1CytoJ+QNOako3dUoQdwwK4VoXK3iFwEh5/systb8RlPLO2cbA2Hk+wufOH3QbvvAV9 tB7BjOPIAMEtRw9aK8XO2A6m9/0TV+jwYNfUUPJUn4wEHBlxCjOi9i7p4Xtj+r23ie8o dnOZA7DsABbbNZuC7EAiyO/Dm0mmoCSjIhEOxdYvp4+1+VUZ42E/2DohGeKdecI0Wo0I soDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Nk/8sfq4Tok6/qoaRcuxwjKDdJ7+AcJxrUL1JPkWuSo=; b=KCzPbFPidDhTuwVRop+X/BGaKtLt61LeK/RM/LtMdQ8iZfXqSOeagwYC6kYPnRBD+c /c8I3NbkHMq4KWadQ68BccDCdBuGRj0KeY3p4GB8u65vsBMoNnyOS/vsnXys6AR9MNS/ F2UsHX2QeJ2I0DB/VZIKPHZHE3+VPW6ewcuj5jcTgWtFhllOLnTVv9cve+OONpHrm5fs vbqS0URxxQrml519Y93eJFd1DPQTECWP5Ok5L9YeMshBqyp++UMA2BQyz5dcHiQnMb1g hp9W12lds1gt7YHkc3EQDfGjTSGf3EtAO6X1fy4BabPBzv9yzqcuFCy8qY7OeqDJzryJ vKag== X-Gm-Message-State: APjAAAU+SlItGJUnv/SspTtGXoY+8l9scowwQ/3kwzam0y8MdFpbKHpa UnESKLHBI+XxKieHpBb2IqaTktgu X-Google-Smtp-Source: APXvYqz25Uxd/oIkhBQr5gmjkhGRHhDlLZQ2FCbb0sagf5muWdtjfC1n6Tp+SEw/yc5riGl7eY80kg== X-Received: by 2002:a24:9412:: with SMTP id j18mr661915ite.124.1557776279730; Mon, 13 May 2019 12:37:59 -0700 (PDT) Received: from raichu (toroon0560w-lp140-01-69-159-36-31.dsl.bell.ca. [69.159.36.31]) by smtp.gmail.com with ESMTPSA id b1sm206699itd.12.2019.05.13.12.37.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2019 12:37:58 -0700 (PDT) Sender: Mark Johnston Date: Mon, 13 May 2019 15:37:54 -0400 From: Mark Johnston To: "Andrey V. Elsukov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, melifaro@freebsd.org Subject: Re: svn commit: r347526 - head/sys/net Message-ID: <20190513193754.GA37655@raichu> References: <201905131345.x4DDjTRn092669@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201905131345.x4DDjTRn092669@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 6BD2E6A711 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.990,0]; REPLY(-4.00)[]; 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 19:38:02 -0000 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.