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 8E45B42D24; Thu, 22 Jun 2023 17:56:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8387940DDA; Thu, 22 Jun 2023 17:56:04 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 541FF406BA for ; Thu, 22 Jun 2023 17:56:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687449362; x=1718985362; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=fXKr5eEIfMaXnnJ9mV+GI8rgVy7VNTN2j8n0FQ7/+jY=; b=Yc2ZNTp872eyig9VDXeJkWu3ekbgOu6sZDqBfs/Kkaxx0KWca8jqXcON JBPbCjkNbQKGLjJe2ui/hNr2fG/aESZocj5iZ5o6+CoTYT/skzkCNuqye Yt+mciEPOAZEfeR98bxOy9Y7AVZ19keLc8EapFH6vPGQkTyUXIYXkvFDs PB7LCnpTPbZjNLtu+P7skwgWva7dLCYYJ4O0afTv4NoK4oLVIsWC0JK6g L1mn5cjtVmsKU5wx0lTkRr3M5yNoo0GqgglYgp71OeHOV8PaLjH06CO+m w5/SvR8i9FyaPm8mAqPhBO0V7u4wlM0vUX5P4r1IpXaOw6u/INw5xL7+U A==; X-IronPort-AV: E=McAfee;i="6600,9927,10749"; a="363969816" X-IronPort-AV: E=Sophos;i="6.01,149,1684825200"; d="scan'208";a="363969816" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2023 08:55:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10749"; a="859503476" X-IronPort-AV: E=Sophos;i="6.01,149,1684825200"; d="scan'208";a="859503476" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 22 Jun 2023 08:55:59 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 08:55:58 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 08:55:58 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.46) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 22 Jun 2023 08:55:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KjFpckYlBQHgbYnfgSSjMtK/qdctbbepDfbTBE8Sz2j4C8qBE9pnw3avVB0aYW/SMgkZmPvy71nrPdOwmH79/L+NbBkKEV3aSzRwX5e1h0JYLaGYH7UySnEYxmM0deAP6QWKmQq8ZnRhZTM/09s1RbYbMpEpEbBn9BSonHuIkYt+sNyzQh4ejq4//1PhWag8ws81cwH4tOQZTaxSS7NrWZjvrWx4qyblRkQQdH0w0PzxzG0TFoxAKXfZ9PoJkcyhHqqZrY76X4Y+wvOM9wPgPU5j5EC1WfSTrNPZn2WyH+k30lznanDcRfUcCsSD8/h5n+h3Pw864hLhj3sIPnDH7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HZM2MhRYNsDyggMO8ziMOlc3TROSn1q9nwnscdegLUw=; b=F3REFl0R1yKk65DxvFAaEiiplxkA3lm1/31kpSlpdrcUSJq4qW3MNWarnGpOg6UnvTlA5pJdLflkjze/ywSFx69DizIpU0FzT9/+1t3pqC7HxVpFSlOL1r79F+RICqc/6c+qDdEZfNhve+ZOn+f4C+y5pgjD3oXxSwXB3rps1Vzle/HClfu75gs5u2zh9+krOqMxVKxHjWOQ2Q/aCj1/WetifzOU+O3FbM1Buu4wV6I36y6p9XdpgujshLv/shxu7kgkWYNXRQjlwcCvxE0rfc6/Ub0AGbTNj12Qp2TlGacufnZ9+T40xtvdPbhDJX6+Gsw76g+kkVv6By+ZF3nXHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) by CO1PR11MB4803.namprd11.prod.outlook.com (2603:10b6:303:95::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:55:54 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::49c0:aa4c:e5b4:e718]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::49c0:aa4c:e5b4:e718%7]) with mapi id 15.20.6521.023; Thu, 22 Jun 2023 15:55:54 +0000 Message-ID: <5cccddc4-7aef-d261-be78-536d3839dbc2@intel.com> Date: Thu, 22 Jun 2023 16:55:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.12.0 Subject: Re: [PATCH v14 5/6] memarea: support dump API Content-Language: en-US To: Chengwen Feng , , CC: , , , , , References: <20220721044648.6817-1-fengchengwen@huawei.com> <20230209063610.35501-1-fengchengwen@huawei.com> <20230209063610.35501-6-fengchengwen@huawei.com> From: "Burakov, Anatoly" In-Reply-To: <20230209063610.35501-6-fengchengwen@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DB8P191CA0028.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:130::38) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|CO1PR11MB4803:EE_ X-MS-Office365-Filtering-Correlation-Id: 355b5964-178f-4ea9-e205-08db7339292c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R7lUXA9/J40v6xmEozlQfEwjeD2OioshGQaEObun+QNdY2B434qZy3kwSuqwr5Lcksq9QnaWJJaeRDz96LHdfLajEwLuXNyHhTrpRJ3Hkn+R7Nt/njkP5+7EHTY7TgOSNu7i23SSp6Ur154ot7SjmR2DDztuN2kMIbEgQ754BSVJqHwrNNnKBKafeXqEIV/d7agsFsS6nfMpn7zJGiXP/JacHeA8kp2gqrOxS6BPvhSs1tI44i5ld59d1q9YyR/K22x1LzE7BlMHuQD7O5xS7A2Wj9nfmpdvFkhORCg4EEFyVKFVsKBFikD5+wm+hYBaIiJQjYffz6uFR/vFNhmcVioHsl2JBWV9jDSDJaucx8CKkJZr8metl2a1T0P8A98NTE2GwXppJ6QtwgCioKgzTofvCRB6RS5wgjN4Y8mGrJpzA493MWqvKEXsaZKqAbpbYW2nr44x8rcb0sErJ+rgjL10cYK791wy7BToATcCRsayEFKMW0ttjmnztriU+Ep+wgWwTGZXre7wgFmnsoaV8rhsf30TsaM+xLPXdg8Zd3wtPWi0o0TgEz53f6wE061KvXc7omOEyyxUv7s6375MijuXtkwBUkZBQQ/TRgw6bDHzU8+hZlh5OWxrfX8e/9IYcpOeJChxn3nH5U4u1ISP+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB6502.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(39860400002)(136003)(346002)(366004)(376002)(451199021)(6512007)(4326008)(6666004)(82960400001)(26005)(186003)(36756003)(2906002)(31686004)(31696002)(86362001)(2616005)(316002)(8936002)(66946007)(66476007)(66556008)(5660300002)(478600001)(6506007)(53546011)(6486002)(41300700001)(8676002)(38100700002)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N0h3di8vS2VYd2dXZWR5ck1Fb3pQZDU3c29UQnM5aDcyeFFZN1RvVTg0RDZp?= =?utf-8?B?bnBhb3FXYWhuK1lDUmx0WmVYd1J2d2dmUVJDcHljeGc0UkRPUExGMS9wUnhO?= =?utf-8?B?S0NtU1BuL0VSb2hBTTRnK2FoT3hYUlJiVVFiMGhnNW5LUnZ3SXVKZzlzMUF4?= =?utf-8?B?OGttL2U1aVc5WUlybWpnc1dhdjY1czJQWHlGd0cxdlV1MEgwRk0wY1JCUWYv?= =?utf-8?B?ZmVXZE5nbkduMGg3Yzc3d21yV0E1amlBOGZQTHl4SkJML2crbWFnMEJNbFdH?= =?utf-8?B?S2xQeVNtSkZnd1QreFo5cWFTcjFtUkhrbFhIdHplMFA2MEp4UEFHTnJsZGMv?= =?utf-8?B?bEt3VHVURGxmdXpsd1Bqai9UbFhQcjVhbjZmZ2s2YnNQQzlvUlZtM3BiTWpn?= =?utf-8?B?dmM1MjhiamhOZ2FWRFJsSXh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X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:55:54.5497 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uQjh07tYBL2DMCwPznu2V9T8+XRKQSCmZnCCnA1YCB4ZTsxhfrUC7Mha7ZsDqQTjxMgPbQ3lDeY4qESAbIku4LMsEYv1pbEznNswnNxHpZU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4803 X-OriginatorOrg: intel.com 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 On 2/9/2023 6:36 AM, Chengwen Feng wrote: > This patch supports rte_memarea_dump() API which could be used for > debug. > > Signed-off-by: Chengwen Feng > Reviewed-by: Dongdong Liu > Acked-by: Morten Brørup > --- Provisionally, Acked-by: Anatoly Burakov As long as below is addressed. > +static void > +memarea_dump_objects_detail(struct rte_memarea *ma, FILE *f) > +{ > + struct memarea_objhdr *hdr; > + size_t offset; > + void *ptr; > + > + fprintf(f, " objects:\n"); > + TAILQ_FOREACH(hdr, &ma->obj_list, obj_next) { > + if (hdr == ma->guard_hdr) > + break; > + memarea_check_cookie(ma, hdr, 2); > + ptr = RTE_PTR_ADD(hdr, sizeof(struct memarea_objhdr)); > + offset = RTE_PTR_DIFF(ptr, ma->area_base); > +#ifdef RTE_LIBRTE_MEMAREA_DEBUG > + fprintf(f, " %p off: 0x%zx size: 0x%zx %s\n", > + ptr, offset, MEMAREA_OBJECT_GET_SIZE(hdr), > + MEMAREA_OBJECT_IS_ALLOCATED(hdr) ? "allocated" : ""); > +#else > + fprintf(f, " off: 0x%zx size: 0x%zx %s\n", > + offset, MEMAREA_OBJECT_GET_SIZE(hdr), > + MEMAREA_OBJECT_IS_ALLOCATED(hdr) ? "allocated" : ""); > +#endif > + }. > +} > + > +int > +rte_memarea_dump(struct rte_memarea *ma, FILE *f, bool dump_all) > +{ > + if (ma == NULL || f == NULL) > + return -EINVAL; I feel like the API is inconsistent in this way. I would suggest picking a method of error reporting, and sticking with it. I would suggest returning 0/-1 or ptr/NULL with rte_errno set to indicate error, as that is how most libraries in DPDK behave. -- Thanks, Anatoly