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 0FF9DC38142 for ; Wed, 1 Feb 2023 19:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231252AbjBATW3 (ORCPT ); Wed, 1 Feb 2023 14:22:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjBATW1 (ORCPT ); Wed, 1 Feb 2023 14:22:27 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B17EC7FA3D; Wed, 1 Feb 2023 11:22:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675279346; x=1706815346; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wy1msrIPfznHGysWzTYnh4CoIsPDb+6Js1yj4Dk5Y4w=; b=VidhZcNQjPHNc8WHbfFhot7GGMyzlu7ixQDa5yadbBFxP86Som6t2OTN FlCN2C5wUQPBEqGPCJFww0tmYct+J9yuQi6FrIYTJX54YvDO2bPXqlg8f fF6mjmsCX40HbDEzFBVZjKV6yTkMYqHAqUGb8s112CrtL+UsDsQ1iFYlK qbIESl9+eYcPDAch3aV3WeV1awyWJP+zkJUl9E/Z8sblpKwsztW1b2/fx NvFt1qb5X/Zc2j8CQVf3qUv+4WjpIXC7VmSAR1IIUNSj9gV2PRHsmMuv0 z/bE/U5ibClmoBXmeBKSeTMykophZL6Fr4QDMHy+gYtqF+6auLyZNOb8y Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="328259717" X-IronPort-AV: E=Sophos;i="5.97,265,1669104000"; d="scan'208";a="328259717" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2023 11:22:26 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="642569336" X-IronPort-AV: E=Sophos;i="5.97,265,1669104000"; d="scan'208";a="642569336" Received: from agluck-desk3.sc.intel.com ([172.25.222.78]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2023 11:22:25 -0800 Date: Wed, 1 Feb 2023 11:22:24 -0800 From: Tony Luck To: Greg KH Cc: "Joseph, Jithu" , "hdegoede@redhat.com" , "markgross@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "rostedt@goodmis.org" , "Raj, Ashok" , "linux-kernel@vger.kernel.org" , "platform-driver-x86@vger.kernel.org" , "patches@lists.linux.dev" , "Shankar, Ravi V" , "Macieira, Thiago" , "Jimenez Gonzalez, Athenas" , "Mehta, Sohil" Subject: Re: [PATCH 4/5] platform/x86/intel/ifs: Implement Array BIST test Message-ID: References: <20230131234302.3997223-1-jithu.joseph@intel.com> <20230131234302.3997223-5-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 01, 2023 at 07:19:15PM +0100, Greg KH wrote: > It shouldn't be that hard, lots of people use them today. > > Try and see! Extract from the first of our in-field-scan tests: while (activate.start <= activate.stop) { ... trigger scan ... if (status.chunk_num == activate.start) { ... check for too many retries on same chunk ... } else { activate.start = status.chunk_num; } } using becomes: while (FIELD_GET(GENMASK(7, 0), activate) <= FIELD_GET(GENMASK(15, 8), activate) { if (FIELD_GET(GENMASK(7, 0), status) == FIELD_GET(GENMASK(7, 0), activate) { ... } else { activate &= ~GENMASK(7, 0); activate |= FIELD_PREP(GENMASK(7, 0), FIELD_GET(GENMASK(7, 0), status)); } } While I can make that more legible with some helper #defines for the fields, it becomes more difficult to write, and no easier to read (since I then have to chase down what the macros are doing). If this were in some performance critical path, I might worry about whether the generated code was good enough. But this code path isn't remotely critical to anyone. The test takes up to 200 usec, so saving a handful of cycles in the surrounding code will be in the noise. -Tony