From owner-freebsd-hackers@freebsd.org Wed Jun 27 14:11:15 2018 Return-Path: Delivered-To: freebsd-hackers@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 F28811026373 for ; Wed, 27 Jun 2018 14:11:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (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 80EA07FA32 for ; Wed, 27 Jun 2018 14:11:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id 128-v6so7749412itf.1 for ; Wed, 27 Jun 2018 07:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=w+0Dnm4e4H5rmeNxrtYatQt5hAWmhCOWNFUWxRoQHPY=; b=qyILUuNphlhanOyiZIzHUgpOyUDF/q/hoWfgGg5M1xpKGmvkKk6W0LQLyzS1UI6wVc M8Ti9RVcVJewqs+5xohN8QZTX02aJbNZYGn0kYJYDVBEggoyl82Z2xQYRPHrmBrmVtoT knUtOCzrX9pSvz1t+JYaPEC5c+nGn7Oo/LjSn6QDx4qmXr9nis5q32MEMqH8vJSOEA2l TVKlq1/Zx3cAdMPatO+pDdRD9k3jMUuT6zTBYdTA2A0/0+TyOX8cJUBbU9UUTelfGlWA Hv7iiDS0jaanjb7a1CD1B57hkTF0RUQab3T3tYNpKPEkXdRIE0qV00kz72NqifXEBC5/ 5pEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=w+0Dnm4e4H5rmeNxrtYatQt5hAWmhCOWNFUWxRoQHPY=; b=SqOZRSKmqAds5F1Tn/Eip1skU/1/A6Wwli0yi6BCPEfepbuD8ChmdUxDnuaEu3gLcu ua35kJDfwBhYUBbUVQzwyaiv4ZcNkOsSUd6KIOa+xYfhycKag0Us7BpccNkSxzjCVpVe voKDdW5TNVIUeGK/thl7EoZzz71GFLtQgcUAToglsGzqhSzq+MsH8g4fmyLYOVE5LUTX s9J/Z0l2xHpg0yrLLG8lZsO0TpHfEed4cpa+D8+Lpw9rt8oGQiC0yLC7ArLhWWzMslpl bCrSczbautyUAJlnrDhyPRIWFypTC5ApWhhMWVcru3AHv80gKjttT2N2VPstykkhH14R MXvw== X-Gm-Message-State: APt69E3I/UG2E+e8tcupRgsxIcLIZSdWsUstA1GKuak4M98kL9Dz4ura D9UPqdAdLi5s5lXoVE3mv96PrL8LgDq13Gpq+rR6QA== X-Google-Smtp-Source: ADUXVKIf/FOyeKasvUF53ArG8aTx7qedqb1i8a8NRqYsisyDHhskO0+OKn4tkaJ3gFNM8aPq392QVS0xIz44aJYFmIQ= X-Received: by 2002:a24:7c8d:: with SMTP id a135-v6mr5015107itd.73.1530108673840; Wed, 27 Jun 2018 07:11:13 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:5945:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 07:11:13 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: From: Warner Losh Date: Wed, 27 Jun 2018 08:11:13 -0600 X-Google-Sender-Auth: SzktL4Xr6Mdc3ehxYfGylkIF5Ms Message-ID: Subject: Re: high CPU usage in FreeBSD for a PCIe card driver To: Steevan Rodrigues Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2018 14:11:15 -0000 No. It's not from mtx_lock. It's likely from lock contention. Since the list ate the attachment, I can't check for sure, but high CPU usage in locking primitives is a classic sign of poor lock design leading to contention. Warner On Wed, Jun 27, 2018 at 6:28 AM, Steevan Rodrigues wrote: > Hi > > I come from Linux background and new to FreeBSD. > > I am investigating a high CPU usage issue on FreeBSD for PCIe driver of a > card . The card can process data at a rate of 30 to 50 Gbps . However, I > see very high CPU usage even when I run a single threaded user side > application which uses this card . > > I ran hotkernel script from Dtrace toolkit. A portion of the output is > given in the attached file dtraceDiff.txt. Here I see that lock_delay > seems to be the reason for high CPU usage. Looks like it comes from mutex > locks > > This driver uses mutex locks ( mtx_lock). > > The CPU usage is very high on a multicore (Xeon CPU) server node than a > dual core (Intel i3) Desktop . > > It shows 30 to 40 % CPU usage on a Intel i3 ( 2 core 4 threads) and 60 to > 70% CPU usage on a Xeon CPU with 12 core (24 threads) for same output > data rate . > > I wonder whether usage of mtx_lock is the cause of high CPU usage ? Any > pointers or suggestions welcome. > > Using FreeBSD 11.1 Release > > Thanks > > Steev > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > >