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 D0202A0543; Thu, 22 Sep 2022 12:39:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B092740156; Thu, 22 Sep 2022 12:39:29 +0200 (CEST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mails.dpdk.org (Postfix) with ESMTP id 9B292400D7 for ; Thu, 22 Sep 2022 12:39:27 +0200 (CEST) Received: by mail-lf1-f50.google.com with SMTP id w8so13902768lft.12 for ; Thu, 22 Sep 2022 03:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=LAf9gtbvjgf6soYgh3ERLCh8xeOsgX/L17TRFl+MIBA=; b=RZMu1MbbOhKixwfvOu5zxw51flDtG2Y+6mHQqMb1GliDXTpnRiK7/ElW48NeKAs90P uZIU0q/YAFsGJonGx9cw6Q38ZfVRHMbJM3z8Lp22Ri8Bpv+iCNIWUZH5kCCZuBpepCNP s11FoWqg9t9X1+UEjcWxHLnRXldPeecnrOeuiP9tE+y9SxfmmksZHeWBmzKGcolPo8Dx 3/3CBDoP7K5PSM3gWrIHjbL7N/3UqnFCCe8oeeITF/juw/Py6lTvkozs5vNtVy0g6pgX dr63Y+4R9SkQCVRaX9zmfszbLt1W/0O3fWtJBwuKxW13orsaJe5zwxeD67cOO5zhydAn A/PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=LAf9gtbvjgf6soYgh3ERLCh8xeOsgX/L17TRFl+MIBA=; b=Qdw/ecQQgDD7y0I3T5VN+R8npWLx5zLi67shdxE5CGMxZJzTOMRXOwWT7TfeaRWCjQ r8CGRdyBnGCJA9qMYzTcLLzgCIXQ2qUeSwicfer4ooyM/8LTJdCy2Ay/2ASwazJ0wXKy my4/G93KrRfPpc6pdNvUwmpOtgCFf2vkzTh4ShaOhBAqrM+PTzdDbOwtnjFGLg/LNeX2 PPS0TmE9DeWUhoPsEVXXC6V3p/Tb/5oGFzvJby4ladgZ/rCR/ky8MifX2KxRLBsbKpZp lLk32ajRQwInKqTNpI+weUvmOotFdNQAwRskrvXSj3QuITknbnOpD1KldMeH51qO1tVJ cxWQ== X-Gm-Message-State: ACrzQf2jIVykvBariUwCSuHU49MaMJlWxiAiyJeGJLt8cLN81BKgbj7S r5bCYWF+Y4/kOolHa/NPw2oob0hJkWPW4SF3jvFPww== X-Google-Smtp-Source: AMsMyM603M5C/jzSsZoBC6l0eHk3DBb7A1Z+f7y+D/ZyywaaToMY90DgwbsrH0bnv1Pr28vxVis1BkXPlFTOVpYwFww= X-Received: by 2002:a19:380e:0:b0:497:7968:e789 with SMTP id f14-20020a19380e000000b004977968e789mr937123lfa.242.1663843167126; Thu, 22 Sep 2022 03:39:27 -0700 (PDT) MIME-Version: 1.0 References: <20220818123014.2515261-1-huzaifa.rahman@emumba.com> <0430b449-d730-a13e-edb9-bb20fd7ef925@cesnet.cz> In-Reply-To: <0430b449-d730-a13e-edb9-bb20fd7ef925@cesnet.cz> From: Huzaifa Rahman Date: Thu, 22 Sep 2022 15:39:16 +0500 Message-ID: Subject: Re: [PATCH] mlx5: initially reading xstats does not cause seg fault To: Kamil Vojanec Cc: matan@nvidia.com, dev@dpdk.org, viacheslavo@nvidia.com, viktorin@cesnet.cz Content-Type: multipart/alternative; boundary="000000000000f069e305e941ac70" 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 --000000000000f069e305e941ac70 Content-Type: text/plain; charset="UTF-8" The bugzilla ID of this bug is 701: https://bugs.dpdk.org/show_bug.cgi?id=701 On Tue, Aug 23, 2022 at 12:33 PM Kamil Vojanec wrote: > On 8/18/22 14:30, huzaifa.rahman wrote: > > Bugzilla ID: 296 > > the size of counters array in mlx5_xstats_get() was smaller > than the memory we are setting for this array in > mlx5_os_read_dev_counters(). due to which the extra memory is > corrupted and thus corrupting the seemingly unrelated variables. > this happens at the first run only because the n function arg > of mlx5_xstats_get() which is used to init counters array is > initialized by adding the preceding statistics which in our case > (i.e first run) is zero. after the initialization in > mlx5_os_stats_init() the mlx5_stats_n is populated and thus from > then onward the counters array size is correct > > my changes will only affect the flow of the first run when we > need to initialize stats in mlx5_os_stats_init(). the size of the > counters array is set according the mlx5_stats_n variable. by doing > this we will avoid the memset corrupting other variables` memory > > Signed-off-by: huzaifa.rahman > > Tested-by: Kamil Vojanec > > --000000000000f069e305e941ac70 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The bugzilla ID of this bug is 701:=C2=A0 =C2=A0 https://bugs.dpdk.org/show= _bug.cgi?id=3D701

On Tue, Aug 23, 2022 at 12:33 PM Kamil Vojanec <vojanec@cesnet.cz> wrote:
=20 =20 =20

    
On 8/18/22 14:30, huzaifa.rahman wrote:
Bugzilla ID: 296

the size of counters array in mlx5_xstats_get() was smaller
than the memory we are setting for this array in
mlx5_os_read_dev_counters(). due to which the extra memory is
corrupted and thus corrupting the seemingly unrelated variables.
this happens at the first run only because the n function arg
of mlx5_xstats_get() which is used to init counters array is
initialized by adding the preceding statistics which in our case
(i.e first run) is zero. after the initialization in
mlx5_os_stats_init() the mlx5_stats_n is populated and thus from
then onward the counters array size is correct

my changes will only affect the flow of the first run when we
need to initialize stats in mlx5_os_stats_init(). the size of the
counters array is set according the mlx5_stats_n variable. by doing
this we will avoid the memset corrupting other variables` memory

Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com>
Tested-by: Kamil Vojanec <vojanec@cesnet.cz>
--000000000000f069e305e941ac70--