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 11B79C64EC4 for ; Wed, 15 Feb 2023 20:23:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229546AbjBOUXI (ORCPT ); Wed, 15 Feb 2023 15:23:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbjBOUXE (ORCPT ); Wed, 15 Feb 2023 15:23:04 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8674203; Wed, 15 Feb 2023 12:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676492583; x=1708028583; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=E502p1OLiZT97qOR/roIQYfmcpVUMhtYaeVAuWTcXec=; b=LZkEssnZ4SRcLmY81st6037nfRDXJYvn6JGxYuNT4i7PXyW99vSckziF HYXoR88LAZcsoL9u7tVGBtOmYj397aAkIKd6L8F748hvkUFUttki7kWAH 4HEpDLWAAKDERF9vg22eRLu9vHMW3U0XEk15eyOepfrOJEqXiRwvjKBKB rCInhqSi+WLt6eyNa6A2hrZltT+hvdsVLCvTOnRTP1JjWi42to3zdAgCJ xROqwJdG3oO/bLHlIROK7tDfApGkpI0gJXQlPAb/DXYKDarpmc27Iwdnm yP9f+MCqFZJpDjht1tMAYrCSJdlTGpz0YrRi9m/oTn59nRLC+SrnZYzum g==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="332852921" X-IronPort-AV: E=Sophos;i="5.97,300,1669104000"; d="scan'208";a="332852921" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 12:22:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="700157659" X-IronPort-AV: E=Sophos;i="5.97,300,1669104000"; d="scan'208";a="700157659" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga008.jf.intel.com with ESMTP; 15 Feb 2023 12:22:51 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 15 Feb 2023 12:22:50 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 15 Feb 2023 12:22:50 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.173) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 15 Feb 2023 12:22:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bKjD4RzSBWIvAiZkG4KH8Ij9h1RF+TTStkHlt7Wlw44g8yCPMngQkvLDIzc72SkJwjOPbShzsXtUtPwBQbtIL3IdLqoET6WKFSzZhLObJ8mDbvt+kdw322F0Xy+DctzlFYGBtDS7wTHTux5Qz09EV/Q9VnTRnFnCmwrBft/8tRvZDSgFHT5Gmgj5Xo00iSBMiP8R++VHa9l9x/YOUZhRQQqOXHlu6yLlk0YkpA8wZsUaV8TNWlsdIprygG40qIEKKJlhNt40T+IpymM/qA7LP4VAldIpTkmuO8g9lVkUH0QaQissRXUh8SUKsYqEPzG8voPxx/sIfkc80E7CPybB/w== 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=TNdobDUFimfNaMX4vpcDxr7oYQIToZ4o8icM+sK3RzM=; b=Kgt1DouxGAl2Nys5Dugr2bGO7di9Jl4rkgNX28wgIDfQ+2lRa/zuE7B/6gVUKDKK6FiUkGrhWc2DAadRPCD1f8yHX4H92lahDCb+lf+TvfQvvbLSJD9V7WA2iX3FiZLMxAX+T2KKu8oq1ad0IQFbYzXqAhMeLhKakfE728bVJSqpewtQAos7qcwlnf9gnRwTqTbWO5JgDH1q89ULvGXvE0A2pdfCKeBhNMgBcTaYP1dVY00mF6jTrrYeFfNkDqhc96DAq5F2oCKbElhBHCg7StsYfms5kT0ZXIjrDjrK02Mzwry+dOZa/x+ZIVGGTi+NMGlzgzH3/0kndQ4tpZGRJw== 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 BYAPR11MB3768.namprd11.prod.outlook.com (2603:10b6:a03:fa::20) by PH0PR11MB5205.namprd11.prod.outlook.com (2603:10b6:510:3d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 20:22:46 +0000 Received: from BYAPR11MB3768.namprd11.prod.outlook.com ([fe80::b387:57c:7240:8b72]) by BYAPR11MB3768.namprd11.prod.outlook.com ([fe80::b387:57c:7240:8b72%5]) with mapi id 15.20.6086.026; Wed, 15 Feb 2023 20:22:46 +0000 Message-ID: Date: Wed, 15 Feb 2023 12:22:43 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH v2 4/7] platform/x86/intel/ifs: Implement Array BIST test Content-Language: en-US To: Dave Hansen , , CC: , , , , , , , , , , , , , , , , References: <20230131234302.3997223-1-jithu.joseph@intel.com> <20230214234426.344960-1-jithu.joseph@intel.com> <20230214234426.344960-5-jithu.joseph@intel.com> From: "Joseph, Jithu" In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SJ0PR05CA0098.namprd05.prod.outlook.com (2603:10b6:a03:334::13) To BYAPR11MB3768.namprd11.prod.outlook.com (2603:10b6:a03:fa::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR11MB3768:EE_|PH0PR11MB5205:EE_ X-MS-Office365-Filtering-Correlation-Id: b020ad31-7f40-4011-5ca0-08db0f926670 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xenWhkgLmACEzQIgpFf4XjLZ17dFEp1kmYijJRVI7mde4g/JEx3hnSpih8+WHWtYR/5bwq3NNhKRgBYc3kozrzJwfKOAPfAsjVioUPpPTRYg2QnephShaetz90EUotGHpcKaAzqzDhirHga4Le715qj7cRz1qQoFCRdpMWF/e6EYJsnpVse7QkmdKwdOXH9Tr2GMu89Vv5Ejpbaz2LFPGVyePkRDeBgNrLS6ySQx/rwOrLiecMWe0j9EZB8yf8y55zSUoQPVrF0iFZwlM6k79XU+9vmdNmZ/doKZDenUsXCphybHn0N2CO9aZWuRlGlP/sIe2jX5lzRvX8xZ2ca7xfG59sC/1H9zTx3WdEawjlZxg9d5q6FXmH3cPXvayoob/i293sgccjhFPceR1+Ewtykasw2j06QVs3vrnVf0Ya3kufMiWcRDMf2TTIqp4ocQGrFE2+6YL0XvKY2rH52NRxEMoS3Q7a0IiwKnX9jgyUIl7KTm/AdCuvm90XW+GAxxRAbw+34MT3kbwWmmtMQ15MhZxoVjy+RsWZ91Hx33Si9xwxrMltMTNledM4m0fSVnl2iPV/V2lskFJxHS87LNIn936z4586YCmeODQ63fluL7bS/LK8LLHy86zxAhLTMPWR1wkIA/qT7Qy8ok8tF9g2WYMC81sidMSZAX+50kEinXVgbQm5SEXUNWhhG0fjuJuB+gbQHSUDXAwAEhqg3BclW5+Ol2JAMBh4J+ytqE9C0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB3768.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(136003)(346002)(396003)(366004)(39860400002)(376002)(451199018)(5660300002)(7416002)(8936002)(66476007)(66556008)(41300700001)(4326008)(8676002)(66946007)(2906002)(316002)(31686004)(6666004)(6486002)(36756003)(478600001)(6512007)(6506007)(53546011)(26005)(186003)(2616005)(82960400001)(83380400001)(38100700002)(86362001)(31696002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SElERGhiS2lyWkQrK1FYaE1yRUkvMzlPbEo0UmhzNTZFNXlVTHlCeU1INTlm?= =?utf-8?B?VGZNT2tJWmJoZTZDSnVpcWpWalFKTHlPcW84K0lvdDNmMDJWR1hPWno0VHNT?= =?utf-8?B?eWdnakMxRENSR29lWjhZZ1B1dVYveUVBYUNEa1hRT3Q1Y3J0RHRJdnB3VGtm?= =?utf-8?B?NzJmL0p2R002S0hXQ0VqVmt1dzBVRVlTazBDTFArZGN0WksxKzlqMytScnRR?= =?utf-8?B?S0pYUkQ3QmZjQ3NpUHdU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FsTXU3NldBdHJ1?= =?utf-8?B?TmU4NEtqQi80RW40UDBFWUg1ZDhZdit5K0kycVY3dDgrUjljWGxLT1l4cmxy?= =?utf-8?B?amYxaGR5eTJCQUNrbkNiZk5xa2JzcG40bHlRV3A1T2JzNGt1Rm85YVo1T1Fa?= =?utf-8?B?TGc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: b020ad31-7f40-4011-5ca0-08db0f926670 X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3768.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 20:22:46.4151 (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: 7GDU2I9F14/frZ6WS0yt1xUFAz5nbEjvHwKvIS8Y6iYjaRERyx1wXiq9/WQ7NVVqbfJCykJwYZtjqpdb2Mec+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5205 X-OriginatorOrg: intel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/15/2023 9:11 AM, Dave Hansen wrote: > On 2/15/23 08:58, Dave Hansen wrote: >> On 2/14/23 15:44, Jithu Joseph wrote: >> I'd probably do something like the attached patch. It gets rid of >> 'data' and uses sane types for the bitfield. It does away with separate >> variables and munging into/out of the msr[] array and just passes a >> single command struct to the work function. It doesn't have any >> uninitialized structure/bitfield fields. > > Real patch attached now. I did try out Dave's suggested patch. With few additional type castings, I could get it to work. We can go with this. I will incorporate this while posting v3. (Will await a few day for additional comments before posting v3) Jithu For context, the functions under discussion incorporating Dave's changes would look as below: static int do_array_test(void *data) { struct ifs_array *command = data; int cpu = smp_processor_id(); int first; /* * Only one logical CPU on a core needs to trigger the Array test via MSR write. */ first = cpumask_first(cpu_smt_mask(cpu)); if (cpu == first) { wrmsrl(MSR_ARRAY_BIST, *((u64 *)command)); /* Pass back the result of the test */ rdmsrl(MSR_ARRAY_BIST, *((u64 *)command)); } /* Tests complete faster if the sibling is spinning here */ wait_for_sibling_cpu(&array_cpus_out, NSEC_PER_SEC); return 0; } static void ifs_array_test_core(int cpu, struct device *dev) { struct ifs_array command = {}; bool timed_out = false; struct ifs_data *ifsd; unsigned long timeout; ifsd = ifs_get_data(dev); command.array_bitmask = ~0U; timeout = jiffies + HZ / 2; do { struct ifs_array before = command; if (time_after(jiffies, timeout)) { timed_out = true; break; } atomic_set(&array_cpus_out, 0); stop_core_cpuslocked(cpu, do_array_test, &command); trace_ifs_array(cpu, *((u64 *)&before), *((u64 *)&command)); if (command.ctrl_result) break; } while (command.array_bitmask); ifsd->scan_details = *((u64 *)&command); if (command.ctrl_result) ifsd->status = SCAN_TEST_FAIL; else if (timed_out || command.array_bitmask) ifsd->status = SCAN_NOT_TESTED; else ifsd->status = SCAN_TEST_PASS; }