From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0057.outbound.protection.outlook.com [157.56.110.57]) by dpdk.org (Postfix) with ESMTP id CFBA758D4 for ; Wed, 9 Dec 2015 14:28:26 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@caviumnetworks.com; Received: from localhost.localdomain (80.82.22.190) by DM2PR07MB1451.namprd07.prod.outlook.com (10.161.139.145) with Microsoft SMTP Server (TLS) id 15.1.355.16; Wed, 9 Dec 2015 13:28:23 +0000 To: Panu Matilainen , Kamil Rytarowski , References: <1449513365-22282-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <1449588833-485-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <1449588833-485-2-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <5667D879.9020006@redhat.com> From: Kamil Rytarowski Message-ID: <56682C6A.8030806@caviumnetworks.com> Date: Wed, 9 Dec 2015 14:28:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5667D879.9020006@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [80.82.22.190] X-ClientProxiedBy: VI1PR02CA0026.eurprd02.prod.outlook.com (25.162.7.164) To DM2PR07MB1451.namprd07.prod.outlook.com (25.161.139.145) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1451; 2:Wjns82rZt++vVwdId6UKq2xJTgW/A0N4Zexa2aWdt/eKAWn/meYpy2vRxXrpJXlWB9Mun+yFSnnpYYXnt4/xsENsyDzGIqpu1h37hw72lx7vXq2H4TdUZx4CUnB8sPosrTUjd89lmWGKnlcsiEXk3Q==; 3:cQ/zwXmXYTw1jDDw3PodEkDQnvIXWxH2/zFbIHJt5SXTl4hIlcttMmT+F0Botz4is4Z+BRAnPPrn2dA9UDEb6+ELOBr/8Z3wRZ1DVRL9+SBH47ZXu068BGDMNlZleqr4; 25:8BlgbfqSBkZBIpObU7cX7ozZRae8CwKXRMQSL0TmO3HB7WD16DxLCVECHDrr4c3Bf+YjoGj1LsGmEasBbJJwIBWsb1vjl6n11WwSqyQz0GxQ8YoHQN6ro2D3HE1aBiIcSkmYsSpEJjwq0Ym0ty7CXh6q27PliNVN1Iep23IzTdujykFAQLrF9F96EmjOvpW4uUX877RUJJr0C483Fskc+flB4lYB/rGLRRbKbULl8l6IMe6jJ4BZydoXpUALep6Z+qvdnN4XhYs25m+IC1f36Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB1451; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1451; 20:ZAMusrZkr83ulMf7HA/QaMHmJUWqGFLO2mORed3OLG8gsW/FxaUc58SgbOIAYNBHQDrfpFRp97WbOx3+dMX//xke2zkicZ37eg1o54iQCcaQiOzt3lLoD1rnMEc1MZhjDEtV5Wa6KP9/C1O8PdBDQ5F3hyBGQR+uebuf5x1sWJpXIu3MSUQ6yo3YJ2n9I3C1XNZcXS2I0ovBEHR9CZzfKiMMiu57O926lczpjNkA78lR8OxEB9FsxzzzOxV1S3ude4J7AmAx5IEKJKdqW5pRVG55fEkRYJVNbh+RX+J9xt3jt5U1vDYjjZn1Hkf7Je/7bgwiQWlB90B7IZw81FEACAeRfdDxP1vSTqVzml+zWgJcH8NuECVG7Lz7WsrIs6/yQaPmhpDtVdCDnmhqm9t+3LjE65A3wlS+pTopQA8/bN0eEVA3ptCjszlCC53OjsQlumTmKCRVO5dGcOJ0sWt0VkK6GeExaHAgtFqqusy1/EvaZbQdMm6/zRpQ7deXflvYjoog3kin6diBoijL+LghW0SsV5mkxg/mPUiSzzpcJIstP+FXdQ8c3EVzl6pHov79tlnaydx6PbCpD1eH95ZfgOMk9cMIMrrptuqHjja1ohQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:DM2PR07MB1451; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB1451; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1451; 4:7PquOIOwvKRcCngyx4TL+MjPfX2Whm39oKqWh6BvgWfRhuki2aCy6CQxoOsYP839g/KdKdGSp62v+6BwQli4nVkfSV6bO1p4y4umd0WSFNgO0HPQEpyqqX5vW8xK5J49MgljCsmn1AsmkbU7WH3V98GiHtR/waoitNpR8+jCK8oPSyCwwC0kv27yunOJcOa/+FlXBaqqb1p/NMNv0/Jg7uwOyKF7tC9R3IgtH+06Joyw4qI7lw69kka0p5pDiuCiyW6WaE594JG7qSHzdUogSpcZ4A5Qjf3ppyOJ0PS8+drLMZng8VhmflVbX8SfNHzcZxkTz38u1fxLyqX6/cRkWPvo5rEYTJNjprKqC4P94IYpjEfCgsCsomYs9yvVxlGvb1H0ukx6QBhP3jucpHHXtTPsS88yjq0JwvXketgF5xuylpRtqRr1SNc34HDk3YPa X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(479174004)(199003)(377454003)(24454002)(189002)(122386002)(23676002)(42186005)(40100003)(36756003)(59896002)(5004730100002)(65806001)(105586002)(65956001)(47776003)(93886004)(106356001)(64126003)(66066001)(5001770100001)(92566002)(3846002)(5008740100001)(107886002)(5001960100002)(77096005)(101416001)(586003)(97736004)(81156007)(189998001)(76176999)(4001350100001)(65816999)(83506001)(87266999)(1096002)(50986999)(33656002)(2950100001)(50466002)(54356999)(87976001)(99136001)(6116002)(80316001)(19580405001)(230700001)(19580395003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB1451; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjA3TUIxNDUxOzIzOldORldVL2N4Y0RybFFEdGxNZVRieW9DSW9D?= =?utf-8?B?dk5lUlRpNEtNU3VvbDJHeWQ0WVBBRmhYYThHMDRDZUQ0ZmkyMy9JUm1mZFo5?= =?utf-8?B?b0V4L2IzU3N4cnhHenFNMno5N2cxMFBDU2NENjd6VS8zaFdhQzZDZ3ZnQkxl?= =?utf-8?B?NURQNE14clhLeEgrODdDYWQrb1Bza2t4b0piL2thQzZsZlRBTmN5MWNERk9l?= =?utf-8?B?WnMrZmpSU3dETUhWMHRzNVlkbUlBTjJ1UFFRY2JjUlYwc1NjcHpTdG5pWC82?= =?utf-8?B?Y1U3c05LcFMwYm0wSy9nTTlWdko2UzAzMGJlNEtxVS9PN3ZELzh3alFXcStt?= =?utf-8?B?VVVmd0h1NjhuWFJnSjEwQzZ2c1VhdktrVGhzSkVKb0EwblhwWWhCNXBORm5P?= =?utf-8?B?S1dIVk4wNlhtOHJFVEk3Tll6aTlCMkNxVE1xWmVNTGNZSFkxTkdNZDFXVlFl?= =?utf-8?B?bVZIdy9qcCtrVEFzS1UwN2xWV29mSENCbHV5ZThhTHRibk1yZWY5amc0ZXFS?= =?utf-8?B?Y2l6SXNHaCtPTllGZXVNWkNQRThLeVJscS8rS0QxNEZVVk9JeFdSWHhwNWF0?= =?utf-8?B?UG5Ib3U3aWJNWDJOVjBJZGUxNDUzLy9VcEFVcGZkQ2FnUmFXUnZrZ2xGV2Yx?= =?utf-8?B?bEkybGpQd0FESlE4ZmpDY29WN1lseis3c01xT0R6TzN2TElvOVZxOWlQVUdj?= =?utf-8?B?Yi9JYkp0aExQeGxSZHlYakFKaVE3N21DdkwyZ0dJb3AxVDlQQ0xjTDJGOWxN?= =?utf-8?B?S0xLbDFTc1ArTzBieXdVUWFJMEk2cmZUOHZXTXgyM21NbWMzNkZ0MnRobjhu?= =?utf-8?B?blhUa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= =?utf-8?B?Tmg4VXk0Tk1QblVWLyt0QWRwSGJzVDc2TzE1aTF1Z3hmU0VIV3V5cGJJUC9z?= =?utf-8?B?eUhsT29uSHcwckNZNzNoTlAyUmxUZmFBN1Y0RHhoL3dnSVE9PQ==?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1451; 5:3CK43cxzX9pSJ2/8FdcYgFDjxQmoRt6LzqUIyjaY6DE26Oyj05BtTndITJP61UWJGPHikOV/K2/0JqADvOjzVPmtU90ic13yYtcGEd0TTVxk/6lLC/27k57GKbylCC2ocbZf4wS5W20eTSzxYBEuPA==; 24:GKC3xasbubW+tA3DnP9nHU07jzvtzsEdUKgJbFUZ6COgXt2OKlACifPhlSpZoPevJGglyL7dEXjH9qOrQnIh9k3+Wng/h/vezHaCCUBsIIw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2015 13:28:23.8120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB1451 Subject: Re: [dpdk-dev] [PATCH v4 2/2] eal/linux: Add support for handling built-in kernel modules X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 13:28:27 -0000 W dniu 09.12.2015 o 08:30, Panu Matilainen pisze: > On 12/08/2015 05:33 PM, Kamil Rytarowski wrote: >> Currently rte_eal_check_module() detects Linux kernel modules via >> reading >> /proc/modules. Built-in ones aren't listed there and therefore they >> are not >> being found by the script. >> >> Add support for checking built-in modules with parsing the sysfs files >> >> This commit obsoletes the /proc/modules parsing approach. >> >> Signed-off-by: Kamil Rytarowski >> Signed-off-by: David Marchand >> --- >> lib/librte_eal/linuxapp/eal/eal.c | 34 >> ++++++++++++++++++++-------------- >> 1 file changed, 20 insertions(+), 14 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal.c >> b/lib/librte_eal/linuxapp/eal/eal.c >> index 635ec36..92482a0 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal.c >> +++ b/lib/librte_eal/linuxapp/eal/eal.c >> @@ -901,27 +901,33 @@ int rte_eal_has_hugepages(void) >> int >> rte_eal_check_module(const char *module_name) >> { >> - char mod_name[30]; /* Any module names can be longer than 30 >> bytes? */ >> - int ret = 0; >> + char sysfs_mod_name[PATH_MAX]; >> + struct stat st; >> int n; >> >> if (NULL == module_name) >> return -1; >> >> - FILE *fd = fopen("/proc/modules", "r"); >> - if (NULL == fd) { >> - RTE_LOG(ERR, EAL, "Open /proc/modules failed!" >> - " error %i (%s)\n", errno, strerror(errno)); >> + /* Check if there is sysfs mounted */ >> + if (stat("/sys/module", &st) != 0) { >> + RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n", >> + errno, strerror(errno)); >> return -1; >> } >> - while (!feof(fd)) { >> - n = fscanf(fd, "%29s %*[^\n]", mod_name); >> - if ((n == 1) && !strcmp(mod_name, module_name)) { >> - ret = 1; >> - break; >> - } >> + >> + /* A module might be built-in, therefore try sysfs */ >> + n = snprintf(sysfs_mod_name, PATH_MAX, "/sys/module/%s", >> module_name); >> + if (n < 0 || n > PATH_MAX) { >> + RTE_LOG(DEBUG, EAL, "Could not format module path\n"); >> + return -1; >> } >> - fclose(fd); >> >> - return ret; >> + if (stat(sysfs_mod_name, &st) != 0) { >> + RTE_LOG(DEBUG, EAL, "Open %s failed! error %i (%s)\n", >> + sysfs_mod_name, errno, strerror(errno)); >> + return 0; >> + } > > Like with /sys/module, its not trying to *open* sysfs_mod_name > directory either so it shouldn't claim to do so. > > I did use plural on purpose when I said "the debug messages are > incorrect/misleading. It's certainly not trying to *open* these > directories so it should not claim to do so" in my previous mail :) > > - Panu - > Should be good now! Thank you.