From patchwork Mon Sep 4 12:44:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDB9EC83F2C for ; Mon, 4 Sep 2023 12:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234846AbjIDMpv (ORCPT ); Mon, 4 Sep 2023 08:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233431AbjIDMpv (ORCPT ); Mon, 4 Sep 2023 08:45:51 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE92ECD7; Mon, 4 Sep 2023 05:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831531; x=1725367531; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+h9NKb/dDqcVeQhkPiBsyE57V5ftPJHDQ5ZLYh4Jqdc=; b=KKmXT9jUFcvUjbr/+0aPsEEvT1Xk8gfoJMzSyTAYSPLGvptZbwNp4Rnz Di2hkMVFIJ/Fos+AnHZhcThPh09FwZr9qiHXow+6OqDf84Jeq+M9SWtKJ bRVJqOZdZ2bnFIhoigHpa6PRKC7NuBf3OrK0r8kvVuqZd6PMaVmm7Kc5g 1XcFSxr8Kzbszdlf+glx12h8TP6ejrV7Idd0A6V5e1IzuYmY2fLB0rFuq bmSmD0umtrTcyDTWot4e7CFolH6EIc8CQrxdjBJxxX0vAufBQ/keqvpue KeL6M8L+eqgTFGdxhTB6n9NMPApwEPRnTH8yXgeoFw9Uk4XnUfTMYbjfx Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555376" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555376" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497761" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497761" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:22 -0700 From: Wieczor-Retman Maciej To: Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/8] selftests: Add printf attribute to ksefltest prints Date: Mon, 4 Sep 2023 14:44:24 +0200 Message-ID: <4a5bf486de7420019ea946bf814579909460ebbb.1693829810.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Kselftest header defines multiple variadic functions that use printf along with other logic. There is no format checking for the variadic functions that use printing inside kselftest.h. Because of this the compiler won't be able to catch instances of mismatched printf formats and debugging tests might be more difficult. Add the common __printf attribute macro to kselftest.h. Add __printf attribute to every function using formatted printing with variadic arguments. Reviewed-by: Ilpo Järvinen Signed-off-by: Wieczor-Retman Maciej --- tools/testing/selftests/kselftest.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 829be379545a..ff47ed711879 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -77,6 +77,8 @@ #define KSFT_XPASS 3 #define KSFT_SKIP 4 +#define __printf(a, b) __attribute__((format(printf, a, b))) + /* counters */ struct ksft_count { unsigned int ksft_pass; @@ -134,7 +136,7 @@ static inline void ksft_print_cnts(void) ksft_cnt.ksft_xskip, ksft_cnt.ksft_error); } -static inline void ksft_print_msg(const char *msg, ...) +static inline __printf(1, 2) void ksft_print_msg(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -146,7 +148,7 @@ static inline void ksft_print_msg(const char *msg, ...) va_end(args); } -static inline void ksft_test_result_pass(const char *msg, ...) +static inline __printf(1, 2) void ksft_test_result_pass(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -160,7 +162,7 @@ static inline void ksft_test_result_pass(const char *msg, ...) va_end(args); } -static inline void ksft_test_result_fail(const char *msg, ...) +static inline __printf(1, 2) void ksft_test_result_fail(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -186,7 +188,7 @@ static inline void ksft_test_result_fail(const char *msg, ...) ksft_test_result_fail(fmt, ##__VA_ARGS__);\ } while (0) -static inline void ksft_test_result_xfail(const char *msg, ...) +static inline __printf(1, 2) void ksft_test_result_xfail(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -200,7 +202,7 @@ static inline void ksft_test_result_xfail(const char *msg, ...) va_end(args); } -static inline void ksft_test_result_skip(const char *msg, ...) +static inline __printf(1, 2) void ksft_test_result_skip(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -215,7 +217,7 @@ static inline void ksft_test_result_skip(const char *msg, ...) } /* TODO: how does "error" differ from "fail" or "skip"? */ -static inline void ksft_test_result_error(const char *msg, ...) +static inline __printf(1, 2) void ksft_test_result_error(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -262,7 +264,7 @@ static inline int ksft_exit_fail(void) ksft_cnt.ksft_xfail + \ ksft_cnt.ksft_xskip) -static inline int ksft_exit_fail_msg(const char *msg, ...) +static inline __printf(1, 2) int ksft_exit_fail_msg(const char *msg, ...) { int saved_errno = errno; va_list args; @@ -289,7 +291,7 @@ static inline int ksft_exit_xpass(void) exit(KSFT_XPASS); } -static inline int ksft_exit_skip(const char *msg, ...) +static inline __printf(1, 2) int ksft_exit_skip(const char *msg, ...) { int saved_errno = errno; va_list args; From patchwork Mon Sep 4 12:44:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD55BC71153 for ; Mon, 4 Sep 2023 12:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352927AbjIDMpw (ORCPT ); Mon, 4 Sep 2023 08:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240763AbjIDMpv (ORCPT ); Mon, 4 Sep 2023 08:45:51 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1054CDB; Mon, 4 Sep 2023 05:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831533; x=1725367533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tVZ45VVk9jiOwslIlVhrQyeA3gThQGKo4Ac1RQA0Wo4=; b=gc0j+d2Ghbn2EgBhZHI9mvQ+3iN5RKyxd2WCtyISp0zyn///bNNWiVJg zGOKjxRfYX5fZN2ABjB+SBV60qx6pfAnESWPsrLmQyzZgJwmZzbEt4rtd ZVvXtXdEeJtLLlP2XZsO/lg2pi6iScS2uKFTtGPPrrzNclfwr59uBYXKh 25cjctNaEGm/Dhn8EOBh6vnuWlIjdpwuwElkhM1lJdQCyBw8bJ3h9QXcs ypSqOHEYiQZQ7hGcCbKZtkb9I0nlsDEdLnCUKJXD8H4S1BNrf7TVFHAQD IPzMyMNgZMgdg5hfanqO/GbRvG4ml9Us+YqvBO/jQc77RojEOCLoJDCj8 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555386" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555386" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497771" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497771" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:23 -0700 From: Wieczor-Retman Maciej To: Nhat Pham , Johannes Weiner , Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] selftests/cachestat: Fix print_cachestat format Date: Mon, 4 Sep 2023 14:44:25 +0200 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The format specifier in printf() call expects long int variables and received long long int. Change format specifiers to long long int so they match passed variables. Acked-by: Nhat Pham Signed-off-by: Wieczor-Retman Maciej --- Changelog v2: - Added Acked-by tag (Nhat) tools/testing/selftests/cachestat/test_cachestat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/cachestat/test_cachestat.c b/tools/testing/selftests/cachestat/test_cachestat.c index a5a4ac8dcb76..7f3871eef409 100644 --- a/tools/testing/selftests/cachestat/test_cachestat.c +++ b/tools/testing/selftests/cachestat/test_cachestat.c @@ -23,7 +23,7 @@ static const char * const dev_files[] = { void print_cachestat(struct cachestat *cs) { ksft_print_msg( - "Using cachestat: Cached: %lu, Dirty: %lu, Writeback: %lu, Evicted: %lu, Recently Evicted: %lu\n", + "Using cachestat: Cached: %llu, Dirty: %llu, Writeback: %llu, Evicted: %llu, Recently Evicted: %llu\n", cs->nr_cache, cs->nr_dirty, cs->nr_writeback, cs->nr_evicted, cs->nr_recently_evicted); } From patchwork Mon Sep 4 12:44:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAAE1CA0FE9 for ; Mon, 4 Sep 2023 12:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352957AbjIDMpz (ORCPT ); Mon, 4 Sep 2023 08:45:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352939AbjIDMpx (ORCPT ); Mon, 4 Sep 2023 08:45:53 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADEF100; Mon, 4 Sep 2023 05:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831541; x=1725367541; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oK2oMG0iXA0jLGcy05yT1KHeEFd9CnCki26bJnytwqQ=; b=XTedPjpaIvXID4QVEEMNYZHn+iARRIRNgJ/jfMHubTMN7ROxif8pHpAx 9co9v2654a2gbwKEaCVBNNBEe+BlFNAl7XLE8dt/Om6/ZPug2c+jrgdXo wsP64a01ENsPC61b7ieETAxRsJg0ZES7e1xfOSpUYCtQZgIzVxcAPBuii elV9gfTgIYZnayCvZ+wKCKTYr4S3nlfUI2ySxbhcyaBLS2fLuq11M4ft2 3WBizbXrb4PEMqDH68+SlIGcAMOk5a/2Mt+Q+M+78YMrH8AwpqsDmtZn4 hteSZ0egb5L9H642hwUfFHa/Jd4PGx/v9z/MLhIcNnVqFwoJU9QsxMx6o Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555397" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555397" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497813" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497813" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:26 -0700 From: Wieczor-Retman Maciej To: Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/8] selftests/openat2: Fix wrong format specifier Date: Mon, 4 Sep 2023 14:44:26 +0200 Message-ID: <88c3f59b8fad5296e9e0235946fe48dab154f378.1693829810.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Ksft_print_msg() inside test_openat2_flags() uses the wrong format specifier for printing test.how->flags variable. Change the format specifier to %llX so it matches the printed variable. Reviewed-by: Ilpo Järvinen Signed-off-by: Wieczor-Retman Maciej --- Changelog v2: - Added Reviewed-by tag (Ilpo) tools/testing/selftests/openat2/openat2_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c index 7fb902099de4..9024754530b2 100644 --- a/tools/testing/selftests/openat2/openat2_test.c +++ b/tools/testing/selftests/openat2/openat2_test.c @@ -300,7 +300,7 @@ void test_openat2_flags(void) ksft_print_msg("openat2 unexpectedly returned "); if (fdpath) - ksft_print_msg("%d['%s'] with %X (!= %X)\n", + ksft_print_msg("%d['%s'] with %X (!= %llX)\n", fd, fdpath, fdflags, test->how.flags); else From patchwork Mon Sep 4 12:44:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 471AFC83F3F for ; Mon, 4 Sep 2023 12:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352976AbjIDMp5 (ORCPT ); Mon, 4 Sep 2023 08:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240763AbjIDMpz (ORCPT ); Mon, 4 Sep 2023 08:45:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8208CCE; Mon, 4 Sep 2023 05:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831547; x=1725367547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ur7uZoww6FS6EfbpNkxHkTWp9s13PDMr1Npv7yNc/3U=; b=QPRTv9OeGPvpJjbv5xgTMYsSIQZ4aGidcoINN2KENtCi/Ok0trOVr7P1 S9CbQSd+6VVm32TYdFSMMldMM1DYyKcVIRD07w3yfNNB9tvviUvfVyIcn kqYrLIdPGnH9H0UfC9++DDdyOrfQeSj9TLB0wTk/7UiJ7St4uFL+FPqLy lfnhzQp2UTaQ3XKD3CpzRcfFtrgu2muwD/yeAA8rQ8ATdpcCdCibEYdQp h/vCDpcNgUFbj0YVJY0Wqal2INiDsGG5tI8NFe8LR0chIXa9hIN9g/K9g dHntr9AzCunrCUSYJzFJ17TonR9Euwx8ADscrfSodTyDV/0YMWgeaEuAD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555404" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555404" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497823" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497823" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:28 -0700 From: Wieczor-Retman Maciej To: Christian Brauner , Shuah Khan , Christian Kellner Cc: ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 4/8] selftests/pidfd: Fix ksft print formats Date: Mon, 4 Sep 2023 14:44:27 +0200 Message-ID: <0ac871f5a15392dac7f308b8759cb17707faf789.1693829810.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Many calls to ksft print functions have format strings that don't match with other passed arguments. One call expects a string but doesn't provide any argument after the format string. Fix format specifiers so they match the passed variables. Add a missing variable to ksft_test_result_pass() inside pidfd_fdinfo_test() so it matches other cases in the switch statement. Fixes: 2def297ec7fb ("pidfd: add tests for NSpid info in fdinfo") Signed-off-by: Wieczor-Retman Maciej --- Changelog v2: - Add fixes tag to patch message. tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 2 +- tools/testing/selftests/pidfd/pidfd_test.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c index 4e86f927880c..01cc37bf611c 100644 --- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c +++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c @@ -62,7 +62,7 @@ static void error_report(struct error *err, const char *test_name) break; case PIDFD_PASS: - ksft_test_result_pass("%s test: Passed\n"); + ksft_test_result_pass("%s test: Passed\n", test_name); break; default: diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index 00a07e7c571c..c081ae91313a 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -381,13 +381,13 @@ static int test_pidfd_send_signal_syscall_support(void) static void *test_pidfd_poll_exec_thread(void *priv) { - ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n", + ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n", getpid(), syscall(SYS_gettid)); ksft_print_msg("Child Thread: doing exec of sleep\n"); execl("/bin/sleep", "sleep", str(CHILD_THREAD_MIN_WAIT), (char *)NULL); - ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", + ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); return NULL; } @@ -427,7 +427,7 @@ static int child_poll_exec_test(void *args) { pthread_t t1; - ksft_print_msg("Child (pidfd): starting. pid %d tid %d\n", getpid(), + ksft_print_msg("Child (pidfd): starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); pthread_create(&t1, NULL, test_pidfd_poll_exec_thread, NULL); /* @@ -480,10 +480,10 @@ static void test_pidfd_poll_exec(int use_waitpid) static void *test_pidfd_poll_leader_exit_thread(void *priv) { - ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n", + ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n", getpid(), syscall(SYS_gettid)); sleep(CHILD_THREAD_MIN_WAIT); - ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", getpid(), syscall(SYS_gettid)); + ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); return NULL; } @@ -492,7 +492,7 @@ static int child_poll_leader_exit_test(void *args) { pthread_t t1, t2; - ksft_print_msg("Child: starting. pid %d tid %d\n", getpid(), syscall(SYS_gettid)); + ksft_print_msg("Child: starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); pthread_create(&t1, NULL, test_pidfd_poll_leader_exit_thread, NULL); pthread_create(&t2, NULL, test_pidfd_poll_leader_exit_thread, NULL); From patchwork Mon Sep 4 12:44:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373820 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDF76C83F3E for ; Mon, 4 Sep 2023 12:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352955AbjIDMp5 (ORCPT ); Mon, 4 Sep 2023 08:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352949AbjIDMpz (ORCPT ); Mon, 4 Sep 2023 08:45:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B275ECCC; Mon, 4 Sep 2023 05:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831548; x=1725367548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+AE54msbYDBee4Ou/ku1JT1wVLqEztYVwWvJ71+SQaQ=; b=XpiuUGPiyTupA4z071TME188pcizvL+XWpxggxDA1IQrp43XkgQQJV+4 kZCMbW+UXetg2kx0OJEqRtZYamroOtHXzy4FKsEWppXHMZ5sDGezC5S6f YEk9VrW1ijFgYaRr6N/0SDSfCQafCouuznIgtRu+pNCQ7qyiT8qsRk0Tx 7EaZsUTgZ3DZIyVdAzKVbG552UmLOHgHwmM8120xql5fTtiZQDIcXpz5Y wv6jqq+8q16aairiMipubRb7NiQNyORio1Rni8/DMSUpi0Y00XfWUVNCf enPsVtIbsVfd9WEf7V5S8pxCEqWmefAyknah8+lACGKQqaktPRpPOpOeA w==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555410" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555410" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497828" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497828" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:31 -0700 From: Wieczor-Retman Maciej To: Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] selftests/sigaltstack: Fix wrong format specifier Date: Mon, 4 Sep 2023 14:44:28 +0200 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The format specifier inside ksft printing function expects a long unsigned int but the passed variable is of unsigned int type. Fix the format specifier so it matches the passed variable. Reviewed-by: Ilpo Järvinen Signed-off-by: Wieczor-Retman Maciej --- Changelog v2: - Added Reviewed-by tag. (Ilpo) tools/testing/selftests/sigaltstack/sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/sigaltstack/sas.c b/tools/testing/selftests/sigaltstack/sas.c index 98d37cb744fb..07227fab1cc9 100644 --- a/tools/testing/selftests/sigaltstack/sas.c +++ b/tools/testing/selftests/sigaltstack/sas.c @@ -111,7 +111,7 @@ int main(void) /* Make sure more than the required minimum. */ stack_size = getauxval(AT_MINSIGSTKSZ) + SIGSTKSZ; - ksft_print_msg("[NOTE]\tthe stack size is %lu\n", stack_size); + ksft_print_msg("[NOTE]\tthe stack size is %u\n", stack_size); ksft_print_header(); ksft_set_plan(3); From patchwork Mon Sep 4 12:44:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F23CCA0FF6 for ; Mon, 4 Sep 2023 12:45:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352986AbjIDMp6 (ORCPT ); Mon, 4 Sep 2023 08:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352965AbjIDMp4 (ORCPT ); Mon, 4 Sep 2023 08:45:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C063CD0; Mon, 4 Sep 2023 05:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831549; x=1725367549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cqMx3146mlcRdEqzrqlSle1X9Tx5A2MHZVrqT4ocrfo=; b=ZHvu/mMs5eQMT0GXRR+c3W2Ag5L8A0zf1OPglr0ixnOPmfKATdusEGON MCD4KBKAIoQjLnEhTryWFQrIp9ZpjhTjx4/4duNNkyiwc1PUrLCqnWGVW f1EFEA5Q6Tb4toOsmCTmmkzdPo290b1Ss7NB2h9K0QWJRtnC2KdgCwNI3 1Pi61ZT2uCRaMUZyKgjHElKYC/RqmtG7eNT9VlLNwKgpH64VS/lTfoi9K KcJIzdKoC7R1k17Y2SRg+Mb1uGnu/pIj8ElZl2kbRHQlXbG6QqmSWHbWP POPHZClt6ZY8fQdk55IQ4WQH6n2UPQCH97igeWkBK4qm3IUCx2ng2NjvA A==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555421" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555421" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497832" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497832" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:33 -0700 From: Wieczor-Retman Maciej To: Paolo Bonzini , Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] selftests/kvm: Replace attribute with macro Date: Mon, 4 Sep 2023 14:44:29 +0200 Message-ID: <876277d8e5c6a1defadc3758b543217947615cff.1693829810.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The __printf() macro is used in many tools in the linux kernel to validate the format specifiers in functions that use printf. The kvm selftest uses it without putting it in a macro definition while it also imports the kselftests.h header. Use __printf() from kselftests.h instead of the full attribute. Signed-off-by: Wieczor-Retman Maciej --- Changelog v2: - Reword patch message. - Use __printf() on test_assert(). tools/testing/selftests/kvm/include/test_util.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/include/test_util.h b/tools/testing/selftests/kvm/include/test_util.h index a6e9f215ce70..357fb7d8f6b4 100644 --- a/tools/testing/selftests/kvm/include/test_util.h +++ b/tools/testing/selftests/kvm/include/test_util.h @@ -33,7 +33,7 @@ static inline int _no_printf(const char *format, ...) { return 0; } #define pr_info(...) _no_printf(__VA_ARGS__) #endif -void print_skip(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +void __printf(1, 2) print_skip(const char *fmt, ...); #define __TEST_REQUIRE(f, fmt, ...) \ do { \ if (!(f)) \ @@ -46,9 +46,9 @@ ssize_t test_write(int fd, const void *buf, size_t count); ssize_t test_read(int fd, void *buf, size_t count); int test_seq_read(const char *path, char **bufp, size_t *sizep); -void test_assert(bool exp, const char *exp_str, - const char *file, unsigned int line, const char *fmt, ...) - __attribute__((format(printf, 5, 6))); +void __printf(5, 6) test_assert(bool exp, const char *exp_str, + const char *file, unsigned int line, + const char *fmt, ...); #define TEST_ASSERT(e, fmt, ...) \ test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__) From patchwork Mon Sep 4 12:44:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB752CA0FF7 for ; Mon, 4 Sep 2023 12:45:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352997AbjIDMp6 (ORCPT ); Mon, 4 Sep 2023 08:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352971AbjIDMp4 (ORCPT ); Mon, 4 Sep 2023 08:45:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77494CDB; Mon, 4 Sep 2023 05:45:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831551; x=1725367551; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HI4lVmI1BviZYccM5IrIZHGszBCHZkniFynHIcYP17g=; b=XmKvkhp3ofRk3f9OdPjvhoKCosAi8RszwFRSH6JxqOEdLGLjSowPBdPZ T8wBUsXAVN21dzi3/BxcqYawalkhpWih3xaxkh3AMiU+vO4IVOLns+TLU paoEdNtlkhTOLU2VpTjub/zBAjxuQ2XvNQsee+/IO4aC4+K8GAegg9jQw jG7NpbMkd9NTrs/O1mDqdjeLUoj0my3HQEamn4XrvpY+G7BbG20HN9sjc S5bEYWfj+D1rFUo0cK4+y91Iyt//XFk9vQrmxcNbbNHa+XEktdr2mxR0O 36fE2zgZOgMs+Tp3zDMlXHWE0OGcrEZYv9t5AuhXG6TLcFy1gxP7g+SUl A==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555430" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555430" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497849" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497849" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:35 -0700 From: Wieczor-Retman Maciej To: Andrew Morton , Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/8] selftests/mm: Substitute attribute with a macro Date: Mon, 4 Sep 2023 14:44:30 +0200 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The mm selftest uses the printf attribute in its full form. Since the header file that uses it also includes kselftests.h it can use the macro defined there. Use __printf() included with kselftests.h instead of the full attribute. Fix a wrong format specifier in ksft_print_msg(). Signed-off-by: Wieczor-Retman Maciej --- Changelog v2: - Added this patch to the series. tools/testing/selftests/mm/mremap_test.c | 2 +- tools/testing/selftests/mm/pkey-helpers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selftests/mm/mremap_test.c index 5c3773de9f0f..1dbfcf6df255 100644 --- a/tools/testing/selftests/mm/mremap_test.c +++ b/tools/testing/selftests/mm/mremap_test.c @@ -338,7 +338,7 @@ static long long remap_region(struct config c, unsigned int threshold_mb, char c = (char) rand(); if (((char *) dest_addr)[i] != c) { - ksft_print_msg("Data after remap doesn't match at offset %d\n", + ksft_print_msg("Data after remap doesn't match at offset %llu\n", i); ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff, ((char *) dest_addr)[i] & 0xff); diff --git a/tools/testing/selftests/mm/pkey-helpers.h b/tools/testing/selftests/mm/pkey-helpers.h index 92f3be3dd8e5..1af3156a9db8 100644 --- a/tools/testing/selftests/mm/pkey-helpers.h +++ b/tools/testing/selftests/mm/pkey-helpers.h @@ -34,7 +34,7 @@ extern int test_nr; extern int iteration_nr; #ifdef __GNUC__ -__attribute__((format(printf, 1, 2))) +__printf(1, 2) #endif static inline void sigsafe_printf(const char *format, ...) { From patchwork Mon Sep 4 12:44:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 13373823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EE22C83F2C for ; Mon, 4 Sep 2023 12:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352939AbjIDMqE (ORCPT ); Mon, 4 Sep 2023 08:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345281AbjIDMp4 (ORCPT ); Mon, 4 Sep 2023 08:45:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53725CE2; Mon, 4 Sep 2023 05:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693831552; x=1725367552; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MHP/tyZYUAXuReqVf8J+AcZrD7lYWnZcCDK9Q2cSu4Y=; b=FcsRw9aWgZ04rnL52sIAkNR5XMhgVqYWyIYbCaWwDCz9hgZ0M/misGUq kqQXCq/bvWXUjqVyilhEkQttyQ9ezyzJTXxyHKHdZrOcqpy6S92xfINx4 2OtzbKCm50dLw+B2Qe0TVZKcu5ubJlTAp7xtXcpwtB1q43kH2ssCoaebr WgYnqBu0enhnK7mR+lNQY8QmT1NLKAx6zGRFjhFlPmzBWe9STfFoEHk6g 7opkr5blF9LrJHsdD+fiWFliNX2TqKv8HgNZ9Rpry3JuCIUPhWMgxT5wW 8IXcwCM+QwjxoeWKNSS7LaO6cOaKIjizK8/Gf1YMecJRy6SNbVcybq5KS w==; X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="440555438" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="440555438" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10823"; a="914497878" X-IronPort-AV: E=Sophos;i="6.02,226,1688454000"; d="scan'208";a="914497878" Received: from mfederki-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.15.69]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2023 05:45:37 -0700 From: Wieczor-Retman Maciej To: Fenghua Yu , Reinette Chatre , Shuah Khan Cc: ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 8/8] selftests/resctrl: Fix wrong format specifier Date: Mon, 4 Sep 2023 14:44:31 +0200 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org A long unsigned int variable is passed to the ksft_print_msg() and the format specifier used expects a variable of type int. Change the format specifier to match the passed variable. Signed-off-by: Wieczor-Retman Maciej Reviewed-by: Ilpo Järvinen --- Changelog v2: - Added this patch to the series. tools/testing/selftests/resctrl/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index d3cbb829ff6a..a5d082cd2d53 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -294,7 +294,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits, ret = platform && abs((int)diff_percent) > max_diff_percent && (cmt ? (abs(avg_diff) > max_diff) : true); - ksft_print_msg("%s Check cache miss rate within %d%%\n", + ksft_print_msg("%s Check cache miss rate within %lu%%\n", ret ? "Fail:" : "Pass:", max_diff_percent); ksft_print_msg("Percent diff=%d\n", abs((int)diff_percent));