From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50E60A0C48; Mon, 14 Jun 2021 22:42:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF4C24067E; Mon, 14 Jun 2021 22:42:11 +0200 (CEST) Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) by mails.dpdk.org (Postfix) with ESMTP id B6FF54067A for ; Mon, 14 Jun 2021 22:42:10 +0200 (CEST) Received: by mail-oi1-f182.google.com with SMTP id w127so15772257oig.12 for ; Mon, 14 Jun 2021 13:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sxBGH+MTozdt2nJuIhttnoEHAFBLmGgi+HKxCqup+Ag=; b=W44oLPGNwzsCBFFAoch2dfdVVGt/EzwF3pyCRDbLnxvPhC7JsKYn7RTvjHa+muc+3P NumhSx/lYzvhoT08VsbMfS3TT7ACkjbIAJamp3kFmS3DT/ccCSggJ0bVAjegjVLdCmKB D00uD51MpJwVura0ICsQsP8A1LqJtA8X6yGpc= 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=sxBGH+MTozdt2nJuIhttnoEHAFBLmGgi+HKxCqup+Ag=; b=CXmxpVYJZqywlcNwn6P/Oo6s9mhuGo8uGdV1OdsozKWbJvcIo49/6MiV0bDHHJbV79 7fK3NkKOnP7+iczP8CCAFr5gNVUfM+CuGqy2rV9l1XsqUWblCBdEF6KehS+5DAgp6QFt fdl7Sfq2t2lUguNGGf0C6GDrQeppT044w2YH01E3nwwwCEt79Rn5MG9AAVh5DSDuj4ND 94Y9BeZPm2tWybVZ9xfU2T0Dm0FJBGYMT5gNO2MWI4gp0GpiI0tuZPzPdOM0faf/QW21 5uaCIJBcwfJ8bIQMbb13jt7QixV5os+Z/MfL0XwRCM/gMuTNF8F/fV++QSvzIxzTDdG0 X7Rw== X-Gm-Message-State: AOAM533yfse1THEOjYUInePgGRze/EvhbYgwSBRDZM2hXAzZfTDbce6K QClcl8s420GQXtq93Scm8Zz7yqO5hIUoo1WeLMBrGQ== X-Google-Smtp-Source: ABdhPJxqjT5/vhXDGGTSro91C4yxmbtoZxheUT8KF1b7ba9yC/Q7SmohduzRos+gdsAnWGS48tO3EIn3Fa82V1pfyGI= X-Received: by 2002:aca:53ca:: with SMTP id h193mr619485oib.69.1623703330056; Mon, 14 Jun 2021 13:42:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Owen Hilyard Date: Mon, 14 Jun 2021 16:41:34 -0400 Message-ID: To: David Marchand Cc: dev , dpdklab , Gaetan Rivet , Jerin Jacob Kollanukkaran Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] Memory leak in rte_pci_scan X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >From what I've seen so far, that fixes the PCI leak. That just leaves a few other places. I'll try to get the complete list to you tomorrow, since running the full set of unit tests takes quite a few hours when ASAN is involved. On Mon, Jun 14, 2021 at 6:30 AM David Marchand wrote: > On Mon, Jun 14, 2021 at 11:11 AM David Marchand > wrote: > > > > On Tue, Jun 8, 2021 at 8:48 PM Owen Hilyard > wrote: > > > > > > Hello All, > > > > > > As part of the community lab's work to deploy static analysis tools, > we've > > > been doing test runs of the various tools. One of the problems we > found is > > > that rte_pci_scan leaks 214368 Bytes every time it is run. There are > also > > > > I suspect the "leak" is on pci device objects that are not released > > unless hot(un)plugging. > > Cc: Gaetan. > > I think I found a leak at: > https://git.dpdk.org/dpdk/tree/drivers/bus/pci/linux/pci.c#n333 > > For devices with no kernel driver, 'dev' will be leaked, since there > is no reference to it in the pci device list. > > There will be more things to fix (there is a proposed patch on > annotating the dpdk memory allocator for ASAN) but can you try this > diff below with the mp patch [1] I sent to see if the situation gets > better? > > diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c > index 0dc99e9cb2..5ea76bc867 100644 > --- a/drivers/bus/pci/linux/pci.c > +++ b/drivers/bus/pci/linux/pci.c > @@ -331,7 +331,7 @@ pci_scan_one(const char *dirname, const struct > rte_pci_addr *addr) > else > dev->kdrv = RTE_PCI_KDRV_UNKNOWN; > } else { > - dev->kdrv = RTE_PCI_KDRV_NONE; > + free(dev); > return 0; > } > /* device is valid, add in list (sorted) */ > > > 1: > http://patchwork.dpdk.org/project/dpdk/patch/20210614091213.3953-1-david.marchand@redhat.com/ > > -- > David Marchand > >