Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp805922pxb; Fri, 22 Apr 2022 11:31:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHlMJMdVaEzny0mWuEUungyZZJI+yEyFZCpzYd/9zqEP1CY0OtZwNButfb0fQvIoLepobL X-Received: by 2002:a17:903:228a:b0:159:28f:6462 with SMTP id b10-20020a170903228a00b00159028f6462mr5586386plh.168.1650652307391; Fri, 22 Apr 2022 11:31:47 -0700 (PDT) Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k12-20020aa788cc000000b004fa3a8dff83si9494547pff.58.2022.04.22.11.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:31:47 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=V72Wipbf; arc=fail (signature failed); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B20111054F; Fri, 22 Apr 2022 11:00:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358231AbiDSWhI (ORCPT + 99 others); Tue, 19 Apr 2022 18:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358226AbiDSWhF (ORCPT ); Tue, 19 Apr 2022 18:37:05 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C6B72C669; Tue, 19 Apr 2022 15:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650407661; x=1681943661; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=Rt05lD41NQLJulCNR5DK2Rwct+9l7hvRmvTmNt8S9HI=; b=V72WipbfQsOrfxv7zCp1i+pmjKojwGzJNW1Z3I95mUl+yB882NkYWLkX evP/k1t9zhTivZGrJLDxVSj3q7m6+k00qEXcKieHeM2lFsDvD3Ci7bM7w AtnrXN4VxjJfCMpYJtQofe8GcO0k2qOJ346dx863JwF1ny/AMQhgNBzX3 FV0yI4QXmNyqAjoAMrmYnkZpFUJy1uFU+4eCEslNN6oLvTCBee8ozqsxe Z9NK+odVPPf51CkUQMTKd/OvB0GQnISqnt92sRg1iOuRGLlRmKRG9s1h9 D0AKIZSh9vVoNxNdItX3ZzCOqfey89rgZXul4E4gBCKjwl5F2Qzgr/6uK A==; X-IronPort-AV: E=McAfee;i="6400,9594,10322"; a="261490506" X-IronPort-AV: E=Sophos;i="5.90,273,1643702400"; d="scan'208";a="261490506" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 15:34:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,273,1643702400"; d="scan'208";a="510307284" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga003.jf.intel.com with ESMTP; 19 Apr 2022 15:34:20 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 19 Apr 2022 15:34:20 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 19 Apr 2022 15:34:19 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Tue, 19 Apr 2022 15:34:19 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.109) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Tue, 19 Apr 2022 15:34:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gQfYT4TrjVKw0nlUBtzl8Rr+IdA/Iqlk3rRfdUnD0vDi3AO2Ap9qEV1RP0AWzHNm4+u9e8L1hutyUQ9n6MPkYwrFweP3JXezBTiDv4aTI0jnRsh2vFbZVpQZvBC6jMDW0R+4IWEfJdPU8qOpQnVLcnH0IBcy1hTeydi3zvBqV5YTYa2mfxNJgfYam3hnXTCm5qC0U7KyKzCF1j3Pj9zYnf92DcdBsX6ItUzZo13fBaJ8R/96mhhcDUL71t/6kE3VwMwj8zj4kI1zJl3+B4X7zXjDdN0azJ9bOITMsgpvp/1x+tDMATzDb0sI2sZUmQfsgGOe+tMsEqZ0yNjJGWMGFg== 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=a85sBTgzU/A2i86PPjss25r0cGqrE/Usc52EahfBiGo=; b=bKtKY3CMXemsSp1hD2sNf2laN6ExIsOsjKocx+qR0FYf3o8bEdPGf8KvDCwOmKTJrABRbvhqNcfGmUle11KXqkeIgbUXF36e5Gkz2/3LzkRH9538H2hpKVH0aDhiA3v1NLRj7WYMN+12AHPzWlCMjzvoL1eOhIW4jylkErIr6ST3f9uXk0csfHeTvU4mzbyWkIkXAOirR1GqsPbDxvyI/whUS4G+aqj4VmL0LQ5kpNCOb/mI1VocDoYOQafm7IBHo/klUPqmsi2O/cklc/ysGtN/+YANZPbFuIZh8THoA3Hr+iDAj+4A6Tv9UMcgVezuSt56UsrZc+wGmmZ99ndnTA== 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 BN0PR11MB5744.namprd11.prod.outlook.com (2603:10b6:408:166::16) by MWHPR11MB1423.namprd11.prod.outlook.com (2603:10b6:300:22::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Tue, 19 Apr 2022 22:34:16 +0000 Received: from BN0PR11MB5744.namprd11.prod.outlook.com ([fe80::5459:7151:e684:6525]) by BN0PR11MB5744.namprd11.prod.outlook.com ([fe80::5459:7151:e684:6525%2]) with mapi id 15.20.5186.013; Tue, 19 Apr 2022 22:34:16 +0000 Message-ID: Date: Tue, 19 Apr 2022 15:34:11 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.8.0 Subject: Re: [PATCH V2 1/4] selftests: Provide local define of __cpuid_count() Content-Language: en-US To: Pengfei Xu CC: , , , , , , , , , , , , , , , , , , References: <7c49dbfe5bab04389ed84c516fcbfe31d66df880.1647360971.git.reinette.chatre@intel.com> <50067c2d-5563-7d8c-f992-5fef787d4d38@intel.com> From: Reinette Chatre In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BY5PR03CA0028.namprd03.prod.outlook.com (2603:10b6:a03:1e0::38) To BN0PR11MB5744.namprd11.prod.outlook.com (2603:10b6:408:166::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8220f024-89e4-4aed-2bbd-08da2254bc5c X-MS-TrafficTypeDiagnostic: MWHPR11MB1423:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BpRcekzO0j/AIxoBXyNd2A1BcsZCnx5StrzbX2mmUkw8Dj5F7ogTv9NOiU8qyOCms2eABHOJFnynrLMJXvNjclpDjcHyfuFdCg95lu5BtYD5mMxyAsvpPZbGqpg44BvX41oeV0MO3CQGOC/fBEoX1oYpltXA4dNZh44hWcIv/pRDbY1RhYdPAOZYm/eI1gbZEwEZ4VzeBkAxj4WIHGs0GPrVbHxAJLn9U6MeqFxOUedKOhlJi6rP4lqG8egpTxUDnu1KBUH6fySLfgH08jiKrzxMJ/I8N64ZkcaQG5V+Syt0vpR00ZFQaeWqyONwIMiHjs1wuCX2B58CdR5MoVj21hFeGv+LAtPQRWzzF1OMwaE0vFmCzy/8E8m0g38PeTUTa80E+EkN7xg8yIMalgATAI9Uvr1Czn8NVkVPhVVgguoP9LyO6/wwFPX5Y5rLB6rO9Fl9GBJ9632Fz8QnmDIUjCSYmQQcq2GpRQO56Nbwl+3WrFWJamoEnuU9KCojdv4AEFbDWHNIP6PQBhiMMQlZAyvZUTleR5uk43YpCPQSDLnlv07lZlmTdpdHlc9fY4r6NJM2ocmgct9digvnA8iSvQr6pzC5oa3+HZ4ey5nQSNSSfKjOz/emVuP2Yis1K2O5bE2N48B0lBwRN+ulvkBexF9l2dQtQbr+Zz0741Yt9u04RGkHecM1Kqai3NFayoKl/LOerXIgue5GmNEsxD/vv+U9ObNOCIzJXWT7Wg9Rjo7OvDmcyqD0qewPyVdoXAy2uX9+3VbpUR0FSYgO+e1GD3QjhXQjlgPN8wTBtWj6GrSh3dVxZQ+3t5KNccaGePj1Zq7JE0Z0KvNEMbUQql1+5ZX+ffcx0/3Mpk32e5UH+bc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN0PR11MB5744.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(66946007)(38100700002)(66556008)(966005)(6486002)(316002)(66476007)(8936002)(31696002)(44832011)(6636002)(8676002)(7416002)(4326008)(2616005)(26005)(53546011)(37006003)(2906002)(5660300002)(6862004)(83380400001)(508600001)(186003)(36756003)(82960400001)(31686004)(6506007)(6512007)(86362001)(6666004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V2VsZEE0TUJjYUtWd1BWbHlMUmR5b1UvTUYrUitNWGxnZ1Jza1ErZDFReXZZ?= =?utf-8?B?bzYvbDRPVkwzN2FrTVdGSEh6aU94alpwYjVxbExwTDdkQjgwQkJiMkVYTXFM?= =?utf-8?B?aW1GMVdDMzkwcDdGYzRtbjVNbEo0VlJseVdVSHcxbDU1c0V4UmtjV2NJT0R6?= =?utf-8?B?RWEyV05oNHNYUDlsOCtnRTMvVEpibUR2VUlIdS9tQVFOVmdtYy9uNDFJNFln?= =?utf-8?B?NFFGWWowUmVRZ0dlby9OWTdWczR4dXA0cEd4c2pFbEJkMUR4dmdzdEUxRzkz?= =?utf-8?B?ZjRhN3hBUlc1Wm9VQWhOOXdlVy9zM1kzeGVrd2ZKMjdTciswQVRVdklzNkt2?= =?utf-8?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3QxemtFQTV6bnNaOWIyL0xpR2l6dTRQbUFmYkVDSk9za09RbUFj?= =?utf-8?B?ai9rVGs0WUFJYXVzWWJwTUlNYVJlOXNyQlpoN0tBRVJmR3FWUUZWUlJZZ0pR?= =?utf-8?B?RUlsT1pTR2lDaUc0YnhWemRYTHhyWU9ReGl2WWl3Um5CNFRvYktreC9ZRHdt?= =?utf-8?B?MkxKSVVjY1dSK0U1dXh4U0t4S3o1djA3eVc2NW5sd2ZEMUZSSUVvQmxLQjg5?= =?utf-8?Q?NeBowhofsZ1FtjL0=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 8220f024-89e4-4aed-2bbd-08da2254bc5c X-MS-Exchange-CrossTenant-AuthSource: BN0PR11MB5744.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2022 22:34:16.2863 (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: AyRRMq5iq5B1BppqyNhzeFKkmV0sPnLlvu8uHwIg8PGmG7dveIeDRwboRUIYfrRyA9pO/vY3Pk44spU2uwZ1tbMfKHa36ypqFHvYfWvtNRk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1423 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pengfei, On 4/18/2022 9:31 PM, Pengfei Xu wrote: > On 2022-04-18 at 09:04:33 -0700, Reinette Chatre wrote: >> Hi Pengfei, >> >> On 4/16/2022 12:52 AM, Pengfei Xu wrote: >>> On 2022-03-15 at 09:44:25 -0700, Reinette Chatre wrote: >>>> Some selftests depend on information provided by the CPUID instruction. >>>> To support this dependency the selftests implement private wrappers for >>>> CPUID. >>>> >>>> Duplication of the CPUID wrappers should be avoided. >>>> >>>> Both gcc and clang/LLVM provide __cpuid_count() macros but neither >>>> the macro nor its header file are available in all the compiler >>>> versions that need to be supported by the selftests. __cpuid_count() >>>> as provided by gcc is available starting with gcc v4.4, so it is >>>> not available if the latest tests need to be run in all the >>>> environments required to support kernels v4.9 and v4.14 that >>>> have the minimal required gcc v3.2. >>>> >>>> Provide a centrally defined macro for __cpuid_count() to help >>>> eliminate the duplicate CPUID wrappers while continuing to >>>> compile in older environments. >>>> >>>> Suggested-by: Shuah Khan >>>> Signed-off-by: Reinette Chatre >>>> --- >>>> Note to maintainers: >>>> - Macro is identical to the one provided by gcc, but not liked by >>>> checkpatch.pl with message "Macros with complex values should >>>> be enclosed in parentheses". Similar style is used in kernel, >>>> for example in arch/x86/kernel/fpu/xstate.h. >>>> >>>> tools/testing/selftests/kselftest.h | 15 +++++++++++++++ >>>> 1 file changed, 15 insertions(+) >>>> >>>> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h >>>> index f1180987492c..898d7b2fac6c 100644 >>>> --- a/tools/testing/selftests/kselftest.h >>>> +++ b/tools/testing/selftests/kselftest.h >>>> @@ -52,6 +52,21 @@ >>>> + * have __cpuid_count(). >>>> + */ >>>> +#ifndef __cpuid_count >>>> +#define __cpuid_count(level, count, a, b, c, d) \ >>>> + __asm__ __volatile__ ("cpuid\n\t" \ >>>> + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ >>>> + : "0" (level), "2" (count)) >>>> +#endif >>> Linux C check tool "scripts/checkpatch.pl" shows an error: >>> " >>> ERROR: Macros with complex values should be enclosed in parentheses >> >> I encountered this also and that is why this patch contains the "Note to >> maintainers" above. It is not clear to me whether you considered the note >> since your response does not acknowledge it. >> > Sorry, I just made a suggestion to fix this problem mentioned by the script. > I didn't notice and reply for the note. > >>> ... >>> +#define __cpuid_count(level, count, a, b, c, d) \ >>> + __asm__ __volatile__ ("cpuid\n\t" \ >>> + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ >>> + : "0" (level), "2" (count)) >>> " >>> Googling: >>> https://www.google.com/search?q=Macros+with+complex+values+should+be+enclosed+in+parentheses&rlz=1C1GCEB_enUS884US884&oq=Macros+with+complex+values+should+be+enclosed+in+parentheses&aqs=chrome.0.69i59j0i5i30l2.313j0j7&sourceid=chrome&ie=UTF-8 >>> -> https://stackoverflow.com/questions/8142280/why-do-we-need-parentheses-around-block-macro >> >> More information available in >> https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html#Statement-Exprs >> but from what I understand it does not apply to this macro. Even so, I do >> not know what checkpatch.pl uses to determine that this is a "Macro with >> complex values". >> > Checked checkpatch.pl and it seems to suggest using ({ }) for any asm macro > definition. > >>> >>> Could we fix it as follow, shall we? >>> " >>> #ifndef __cpuid_count >>> #define __cpuid_count(level, count, a, b, c, d) ({ \ >>> __asm__ __volatile__ ("cpuid\n\t" \ >>> : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ >>> : "0" (level), "2" (count)) \ >>> }) >>> #endif >>> " >> >> Sure, I can do so. >> > I just made a suggestion to fix the problem reported by the checkpatch.pl. > But I didn't think deeply enough before: I'm not sure is there any real > improvment or help after the fix. In this case I would prefer to not implicitly follow the checkpatch.pl without understanding what the concern is. The goal of this change is to make the __cpuid_count() macro available within kselftest and it does so by duplicating gcc's __cpuid_count() macro. The macro style is not unique and you would, for example, encounter the same checkpatch.pl complaint if you run: ./scripts/checkpatch.pl -f arch/x86/kernel/fpu/xstate.h Reinette