From owner-svn-src-head@freebsd.org Wed Nov 22 16:19:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8538FDEF161 for ; Wed, 22 Nov 2017 16:19:56 +0000 (UTC) (envelope-from mk@semihalf.com) Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 505B67F9D2 for ; Wed, 22 Nov 2017 16:19:56 +0000 (UTC) (envelope-from mk@semihalf.com) Received: by mail-qk0-x231.google.com with SMTP id c123so7053438qkf.7 for ; Wed, 22 Nov 2017 08:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Un3uXIqlMm7dF+jSqcZaceTC9U5HgMXJL4PQVoRdopU=; b=q3LWGu93/bAGOK8evBEfQv3VHxCZD1e95ejJmMXuf0QmiRkrkLLNePGynWycWHHPS7 GlG+fPkMz3bTqOVYw6KMeo1odGQkQRK2VbfwBC4WVQ1sD4mwNSKfKtcSYowDMgTDNz3H jL/eTkgI6+aV8hTFDQHTneXZ8qnEGjuZtG5O7R7HfYgcEoioJY95T4jnzA2+mqKNzGOg elrWxiQSPN1sM64P/8EUzS/SxFQ6Vciyglygt6sMX5v04mAcWbo6zsc3z9yV58xmg9gJ /fr6aG+y0OgNEeYB5NPYc8QN5FgS1bxuSeDOnQtir0B8/94lsPZ4lYWj7Ex5EhtylK6/ Kkog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Un3uXIqlMm7dF+jSqcZaceTC9U5HgMXJL4PQVoRdopU=; b=md71GBtvdtUZxAv4iX9J7peDH87kd45Cx///RA5bmbO6O4EkiFsvHOhP1uKUAFIr3E FgOCqgkV4nkepM0xI8Wr3AOcxZ1WmF/YTrK3qdaA28e506Ol3M2YsOjOEdvNrIzQkZyG vDj4ElmPvmnW4lMCvBScX9HZ4K+HvAdVNC4MMHC8JfWxguS8W6S8qRjlCJyJlF+nJRl+ DhE+V9V7Cr1jQmJydcsjDScha6XKp21hMtN+780G9iHq9F9H6jpeqbSYE7QBtFI4YRt+ pMB4d58FCxSUTLnqm1ihsmJs4v+t5FhEJE7IAQVXAHMoToFbNkCQPl8vASt5wA87bIlq ki1A== X-Gm-Message-State: AJaThX586zFJK3j7mfDPqSm1piOgNZPEQIsQJI+qCBB6AbzDeyGLE2a3 2FjzvHaWKyJ0fxcob2EvBkf42SglEFNApWBjoDbAEw== X-Google-Smtp-Source: AGs4zMYgQHA9S0aDG6zhAGtlHYr7Pab2UzkA2nYhWyFkAz1RoNwE87VI6VFen+8bV4Qoz0x0x/aVeoRWFkB+OyTJhFI= X-Received: by 10.55.22.7 with SMTP id g7mr33429277qkh.82.1511367594959; Wed, 22 Nov 2017 08:19:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.144.203 with HTTP; Wed, 22 Nov 2017 08:19:54 -0800 (PST) In-Reply-To: <20171122000816.GH1063@FreeBSD.org> References: <201710311631.v9VGVNOs058255@repo.freebsd.org> <20171122000816.GH1063@FreeBSD.org> From: =?UTF-8?Q?Micha=C5=82_Krawczyk?= Date: Wed, 22 Nov 2017 17:19:54 +0100 Message-ID: Subject: Re: svn commit: r325239 - head/sys/dev/ena To: Gleb Smirnoff Cc: Marcin Wojtas , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Nov 2017 16:19:56 -0000 Hi Gleb, We are counting the statistics in the software because of the alignment with the newest ena-com API (HAL) which is delivered to us from NIC's vendor. Regarding fetching them periodically - there are 2 issues with that. First of all, there may be problem with the counter overflow. Secondly, reading statistics on demand requires sending admin message to the NIC and then the cv_timedwait function is called to wait for the response. However there are a lot of witness warnings when the cv_timedwait is called from the if_get_counter() context, because of the non sleepable lock which is hold there (I don't remember exactly which lock was causing this issue). Best regards, Michal 2017-11-22 1:08 GMT+01:00 Gleb Smirnoff : > Hi Martin and Michal, > > On Tue, Oct 31, 2017 at 04:31:23PM +0000, Marcin Wojtas wrote: > M> Author: mw > M> Date: Tue Oct 31 16:31:23 2017 > M> New Revision: 325239 > M> URL: https://svnweb.freebsd.org/changeset/base/325239 > M> > M> Log: > M> Rework counting of hardware statistics in ENA driver > M> > M> Do not read all statistics from the device, instead count them in the > M> driver except from RX drops - they are received directly from the NIC > M> in the AENQ descriptor. > M> > M> Submitted by: Michal Krawczyk > M> Reviewed by: imp > M> Obtained from: Semihalf > M> Sponsored by: Amazon.com, Inc. > M> Differential Revision: https://reviews.freebsd.org/D12852 > > Is it possible not to count them in software, as well as not fetch > them from hardware periodically, but instead just fetch them on > demand, when either if_get_counter() or a sysctl is called? > > That would be more efficient. > > -- > Gleb Smirnoff >